:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #06b6d4;
  --line: #e2e8f0;
  --radius: 16px;
  --touch: 48px;
  --nav-height: 74px;
  --content-bottom-buffer: 132px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: "Helvetica Neue", "PingFang TC", "Noto Sans TC", "Arial", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--content-bottom-buffer) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  position: relative;
}

.content-area {
  width: 100%;
  padding: 16px 16px 10px;
  padding-bottom: calc(var(--content-bottom-buffer) + 10px + env(safe-area-inset-bottom));
}

.section-card,
.vocab-word,
.bubble,
.btn,
.input-group input,
.input-group textarea {
  overflow-wrap: anywhere;
}

.screen-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.04);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.title-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lesson-card .done-pill {
  align-self: flex-start;
}

.grammar-practice {
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin-top: 10px;
  padding: 10px;
  background: #f8fafc;
}

.grammar-practice label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  font-size: 0.95rem;
}

.hero-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.btn {
  width: 100%;
  min-height: var(--touch);
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
  font-weight: 700;
  padding: 12px;
  margin: 6px 0;
}

.audio-listen {
  width: fit-content;
  min-width: 110px;
  min-height: 42px;
  padding: 8px 14px;
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: #0e7490;
}

.btn.ghost {
  background: #e2e8f0;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.outline {
  background: transparent;
  border: 1px solid var(--text);
  color: var(--text);
}

.chip {
  display: inline-block;
  background: #ecfeff;
  color: #155e75;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.today-task-list {
  margin: 0 0 8px;
  padding: 0 0 0 18px;
  color: var(--text);
  line-height: 1.8;
}

.today-task-list li {
  margin: 0;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.task-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  margin-bottom: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-cell {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.big-number {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--primary);
}

.section-list {
  display: grid;
  gap: 10px;
}

.section-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-item h3 {
  margin: 0;
}

.section-status {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.82rem;
  color: #0f766e;
}

.vocab-grid {
  display: grid;
  gap: 10px;
}

.vocab-word {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.vocab-word p {
  margin: 2px 0;
}

.vocab-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.input-group {
  display: grid;
  gap: 8px;
}

.btn-row {
  display: grid;
  gap: 8px;
}

.bilingual span {
  margin-left: 3px;
  font-size: 0.86rem;
}

.feedback-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px;
  margin-top: 4px;
}

.feedback {
  margin: 8px 0;
}

.translation-toggle {
  margin: 6px 0;
}

.translation-toggle summary {
  cursor: pointer;
  color: #0369a1;
  font-size: 0.85rem;
}

.translation-toggle p {
  margin: 6px 0 0;
}

textarea,
input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 48px;
  width: 100%;
  padding: 10px;
  resize: vertical;
  font-size: 1rem;
}

textarea {
  min-height: 88px;
}

.chat {
  display: grid;
  gap: 10px;
}

.bubble {
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 86%;
  line-height: 1.45;
}

.bubble.employer {
  margin-right: auto;
  background: #ecfeff;
  border: 1px solid #bae6fd;
}

.bubble.you {
  margin-left: auto;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.bubble.meta {
  margin: 0 auto;
  background: #f8fafc;
  color: #475569;
  border: 1px dashed #94a3b8;
  font-size: 0.85rem;
}

.bottom-nav {
  position: fixed;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.nav-btn {
  min-height: var(--touch);
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.progress-track {
  background: #e2e8f0;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #06b6d4);
  width: 0;
}

.hint {
  margin: 0;
  color: #334155;
}

.small-title {
  margin: 0;
  font-size: 1.08rem;
}

.small-text {
  margin: 0 0 6px;
  color: #334155;
}

.two-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.prompt-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f8fafc;
  margin-bottom: 6px;
}

.done-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  font-size: 0.8rem;
}

.error-box {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 8px;
}

.footer-note {
  color: #64748b;
  font-size: 0.8rem;
  text-align: center;
  margin: 10px 0 0;
}

.reset-area {
  text-align: center;
  margin-top: 8px;
}

.btn.ghost.muted-soft {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  opacity: 0.82;
}

@media (max-width: 390px) {
  .vocab-actions {
    flex-direction: column;
  }

  .content-area {
    padding-left: 12px;
    padding-right: 12px;
  }

  .screen-title {
    font-size: 1.2rem;
  }

  .btn {
    font-size: 0.96rem;
  }
}
