:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #1d2524;
  --muted: #66736f;
  --line: #d8ddd6;
  --panel: #fffefa;
  --deep: #13332f;
  --green: #2f6f4f;
  --coral: #c9573f;
  --gold: #d89d36;
  --blue: #3d6e91;
  --shadow: 0 18px 45px rgba(25, 35, 31, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(19, 51, 47, 0.08), transparent 260px),
    var(--bg);
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 750;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.compose-panel,
.result-panel,
.saved-panel {
  background: var(--panel);
  border: 1px solid rgba(19, 51, 47, 0.11);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compose-panel {
  padding: 14px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.voice-row {
  margin-bottom: 14px;
}

.select-wrap {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  line-height: 1.6;
  outline: none;
}

.access-code-input {
  width: 100%;
  min-height: 44px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 111, 79, 0.15);
}

.action-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--deep);
}

.secondary-button {
  color: var(--deep);
  background: #eaf0eb;
}

.icon-button {
  width: 44px;
  color: #fff;
  background: var(--deep);
  flex: 0 0 44px;
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--coral);
  background: transparent;
}

.small-button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--deep);
  background: #edf3ef;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

i[data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 2.3;
}

.status-line {
  min-height: 28px;
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.result-panel {
  min-height: 190px;
  padding: 14px;
}

.result-panel.is-empty {
  display: grid;
  place-items: center;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.empty-state i {
  width: 32px;
  height: 32px;
  color: var(--green);
}

.result-header,
.section-title,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.answer-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.answer-card.is-main {
  border-color: rgba(47, 111, 79, 0.45);
}

.answer-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.answer-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.english {
  font-size: 21px;
  font-weight: 850;
  line-height: 1.35;
}

.translation {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.note-list,
.chunk-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.note-item,
.chunk-item {
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  color: #39433f;
  background: #fff8e7;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.45;
}

.chunk-item {
  border-left-color: var(--blue);
  background: #eef5f8;
}

.saved-panel {
  margin-top: 14px;
  padding: 14px;
}

.saved-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.saved-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.saved-item p {
  line-height: 1.45;
}

.saved-cn {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.saved-empty {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 380px) {
  .mode-row,
  .action-row {
    grid-template-columns: 1fr;
  }

  .english {
    font-size: 19px;
  }
}
