:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #17201d;
  --muted: #68736f;
  --line: #dde3df;
  --teal: #176b5c;
  --teal-dark: #0e4e43;
  --amber: #c98520;
  --rose: #b85b62;
  --blue: #3f628c;
  --shadow: 0 18px 46px rgba(28, 41, 36, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(320px, 420px);
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 7vw, 92px);
  padding: 36px;
}

.brand-lockup,
.brand-mini {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup {
  align-items: flex-start;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--teal);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  flex: 0 0 auto;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 23px;
}

.company,
.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1.04;
  letter-spacing: 0;
}

.auth-panel,
.study-card,
.daily-plan,
.curve-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.example-support {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 107, 92, 0.22);
  color: var(--ink);
  text-align: left;
}

.example-label {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.example-sentence {
  line-height: 1.55;
}

.example-translation,
.example-collocation {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-panel {
  padding: 22px;
}

.auth-tabs,
.section-tabs {
  display: flex;
  background: #e9eeeb;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.auth-tab,
.section-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  font-weight: 700;
}

.auth-tab.active,
.section-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(25, 35, 31, 0.08);
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.top-actions select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

.field input:focus,
.top-actions select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 92, 0.13);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.mistake-button,
.choice-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  background: #fff7e9;
  color: #7a4d10;
  border-color: #efd6aa;
}

.ghost-button {
  background: #fff;
  color: var(--muted);
  border-color: var(--line);
}

.mistake-button {
  background: #fff1f2;
  color: var(--rose);
  border-color: rgba(184, 91, 98, 0.32);
}

.mistake-button:hover {
  border-color: var(--rose);
}

.wide {
  width: 100%;
}

.main-screen {
  min-height: 100vh;
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 48px);
  background: rgba(246, 247, 244, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.brand-mini strong {
  display: block;
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.camp-bank-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #c9ddd4;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #edf6f1;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sync-indicator::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #82908a;
  content: "";
}

.sync-indicator.syncing::before {
  background: var(--amber);
  animation: sync-pulse 1s ease-in-out infinite;
}

.sync-indicator.saved::before {
  background: var(--teal);
}

.sync-indicator.error {
  color: var(--rose);
}

.sync-indicator.error::before {
  background: var(--rose);
}

@keyframes sync-pulse {
  50% {
    opacity: 0.35;
  }
}

.top-actions select {
  min-width: 190px;
  padding: 10px 12px;
}

.workspace {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.section-tabs {
  width: fit-content;
  margin-bottom: 18px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.hero-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: clamp(20px, 4vw, 36px);
  background: #e8f0ec;
  border: 1px solid #d1ded8;
  border-radius: 8px;
}

.hero-band h2,
.daily-plan h3,
.curve-panel h3 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reward-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid #ded5bd;
  border-radius: 8px;
  background: #fff8e8;
}

.reward-banner.earned {
  border-color: #d9ac46;
  background: #fff3c8;
  box-shadow: 0 12px 32px rgba(201, 133, 32, 0.16);
}

.reward-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
}

.reward-kicker {
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
}

.reward-copy strong {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.1;
}

.reward-copy small {
  color: var(--muted);
  font-weight: 700;
}

.reward-coin {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f8d76f, #d89622);
  color: #fff7d7;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.26), 0 10px 22px rgba(201, 133, 32, 0.22);
  flex: 0 0 auto;
}

.reward-pop .reward-coin {
  animation: coin-pop 900ms ease both;
}

.reward-sparkles span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #efbd45;
  opacity: 0;
}

.reward-sparkles span:nth-child(1) {
  right: 92px;
  top: 20px;
}

.reward-sparkles span:nth-child(2) {
  right: 56px;
  top: 82px;
}

.reward-sparkles span:nth-child(3) {
  right: 136px;
  bottom: 22px;
}

.reward-pop .reward-sparkles span {
  animation: sparkle-pop 850ms ease both;
}

.reward-pop .reward-sparkles span:nth-child(2) {
  animation-delay: 100ms;
}

.reward-pop .reward-sparkles span:nth-child(3) {
  animation-delay: 180ms;
}

.camp-panel {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #c9ddd4;
  border-radius: 8px;
  background: #f0f7f3;
}

.camp-summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.camp-summary h3 {
  margin: 0 0 6px;
  font-size: 21px;
}

.camp-summary .muted {
  margin: 0;
  font-size: 14px;
}

.camp-streak {
  display: grid;
  min-width: 84px;
  place-items: center;
  padding: 8px 13px;
  border-radius: 8px;
  background: #fff7e9;
  color: #7a4d10;
}

.camp-streak strong {
  font-size: 28px;
  line-height: 1;
}

.camp-streak span,
.camp-ranking-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.camp-checkin-done {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border-radius: 8px;
  padding: 0 16px;
  background: #dceee4;
  color: var(--teal-dark);
  font-weight: 800;
}

.camp-rankings {
  padding: 15px 20px 18px;
  border-top: 1px solid #c9ddd4;
  background: rgba(255, 255, 255, 0.7);
}

.camp-ranking-heading,
.camp-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.camp-ranking-heading {
  justify-content: space-between;
}

.camp-rank-list {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.camp-rank-row {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #fff;
}

.camp-rank-row.me {
  background: #e4f2eb;
}

.camp-rank-row strong {
  flex: 1;
}

.camp-rank-row > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.camp-rank-number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #e8eeeb;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.camp-rank-empty,
.camp-loading {
  color: var(--muted);
  font-size: 14px;
}

.camp-loading {
  padding: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: left;
}

.metric-button {
  width: 100%;
  color: var(--ink);
  box-shadow: none;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.metric-button:hover,
.metric-button.active {
  border-color: var(--teal);
  box-shadow: 0 8px 22px rgba(23, 107, 92, 0.1);
}

.metric-button:active {
  transform: translateY(1px);
}

.metric-card strong {
  display: block;
  font-size: clamp(26px, 4vw, 38px);
  margin-bottom: 6px;
}

.metric-card span {
  color: var(--muted);
  font-size: 14px;
}

.metric-detail {
  margin-top: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-heading.compact {
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button {
  min-height: 36px;
  padding-inline: 12px;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.word-list-item {
  display: grid;
  grid-template-rows: auto 48px auto;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.word-list-item.high-wrong {
  border-color: rgba(184, 91, 98, 0.55);
  background: #fff4f5;
}

.word-list-item.high-wrong strong {
  color: #9d3843;
}

.word-list-item > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.word-list-item .word-list-footer {
  align-items: center;
}

.word-list-item strong {
  font-size: 18px;
}

.word-list-item span,
.word-list-item small {
  color: var(--muted);
}

.word-list-item .word-meaning {
  margin: 0;
  line-height: 1.55;
  min-height: 48px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.word-list-item .meaning-hidden {
  visibility: hidden;
}

.mini-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f4ee;
  color: var(--teal) !important;
  font-weight: 800;
}

.warning-badge {
  background: #ffe0e3;
  color: #9d3843 !important;
}

.tomorrow-badge {
  background: #eef2ff;
  color: #41559f !important;
}

.relearn-badge {
  background: #fff4d7;
  color: #8a5a00 !important;
}

.word-mini-action {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(26, 118, 96, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.word-mini-action:disabled {
  border-color: transparent;
  background: #eef2f0;
  color: var(--muted);
  cursor: default;
}

.detail-empty {
  margin: 0;
}

.daily-plan,
.curve-panel {
  margin-top: 14px;
  padding: 22px;
  box-shadow: none;
}

.progress-track {
  height: 12px;
  margin: 18px 0 10px;
  background: #e7ece8;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  border-radius: inherit;
  transition: width 240ms ease;
}

.muted {
  color: var(--muted);
}

.study-card {
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 150px 118px minmax(178px, auto) auto;
  align-content: stretch;
  padding: clamp(22px, 5vw, 52px);
  box-shadow: none;
}

.study-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.word-zone {
  display: grid;
  align-content: center;
  min-height: 150px;
}

.word-line {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.word {
  margin: 0;
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.speak-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f6f4;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.speak-button:hover {
  border-color: var(--green);
  background: #e8f1ed;
}

.speak-button:active {
  transform: translateY(1px);
}

.part {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

.prompt-zone {
  min-height: 118px;
  display: grid;
  align-content: start;
}

.prompt {
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.55;
}

.micro-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.blank-prompt {
  min-height: 44px;
}

.answer-zone {
  min-height: 178px;
}

.meaning-box,
.mnemonic-box {
  margin-top: 12px;
  padding: 18px;
  border-radius: 8px;
  background: #f3f6f4;
  border: 1px solid var(--line);
  line-height: 1.65;
}

.meaning-box strong {
  font-size: 24px;
}

.meaning-box.placeholder {
  min-height: 82px;
  visibility: hidden;
}

@keyframes coin-pop {
  0% {
    transform: scale(0.72) rotate(-8deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.12) rotate(5deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes sparkle-pop {
  0% {
    transform: scale(0) translateY(8px);
    opacity: 0;
  }
  45% {
    transform: scale(1.4) translateY(-6px);
    opacity: 1;
  }
  100% {
    transform: scale(0) translateY(-16px);
    opacity: 0;
  }
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  margin-top: 18px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
  margin-bottom: 12px;
}

.choice-button {
  min-height: 66px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  text-align: left;
  line-height: 1.4;
}

.choice-button:hover {
  border-color: var(--teal);
}

.choice-button:disabled {
  cursor: default;
}

.choice-button:disabled:hover {
  border-color: var(--line);
}

.choice-button.correct {
  background: #e7f4ee;
  border-color: var(--teal);
}

.choice-button.wrong {
  background: #fff0f1;
  border-color: var(--rose);
}

.answer-feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: var(--muted);
  line-height: 1.45;
}

.answer-feedback strong {
  color: var(--ink);
}

.answer-feedback.correct {
  border-color: rgba(23, 107, 92, 0.28);
  background: #eaf6f1;
}

.answer-feedback.correct strong {
  color: var(--teal);
}

.answer-feedback.wrong {
  border-color: rgba(184, 91, 98, 0.28);
  background: #fff1f2;
}

.answer-feedback.wrong strong {
  color: var(--rose);
}

.empty-state {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-size: 32px;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.final-test-result {
  display: grid;
  align-content: start;
  gap: 14px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.final-test-result h3 {
  margin: 8px 0 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.1;
}

.test-score {
  font-size: clamp(44px, 9vw, 78px);
  line-height: 1;
}

.test-pass {
  color: var(--teal);
}

.test-fail {
  color: var(--rose);
}

.test-wrong-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.test-wrong-panel h4 {
  margin: 0;
  font-size: 20px;
}

.test-wrong-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

.test-wrong-item {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 11px;
  border: 1px solid rgba(184, 91, 98, 0.28);
  border-radius: 8px;
  background: #fff8f8;
}

.test-wrong-item span {
  color: var(--muted);
  line-height: 1.45;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.curve-chart {
  display: grid;
  grid-template-columns: repeat(15, minmax(26px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 220px;
  padding-top: 22px;
}

.curve-bar {
  min-height: 54px;
  display: grid;
  align-items: end;
  gap: 7px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.curve-bar span {
  display: block;
  height: var(--height);
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
  background: var(--teal);
}

.curve-bar.today span {
  background: var(--amber);
}

@media (max-width: 780px) {
  .auth-screen {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 24px 16px;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions,
  .top-actions select {
    width: 100%;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .sync-indicator {
    width: 100%;
  }

  .workspace {
    width: min(100% - 24px, 1120px);
    margin-top: 16px;
  }

  .section-tabs {
    width: 100%;
  }

  .section-tab {
    flex: 1;
    padding-inline: 8px;
  }

  .hero-band,
  .study-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions,
  .hero-actions button {
    width: 100%;
  }

  .reward-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .camp-summary {
    grid-template-columns: 1fr auto;
  }

  .camp-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .camp-action .primary-button,
  .camp-action .camp-checkin-done {
    width: 100%;
    justify-content: center;
  }

  .reward-coin {
    width: 58px;
    height: 58px;
    font-size: 17px;
  }

  .metric-grid,
  .choice-grid,
  .word-list {
    grid-template-columns: 1fr 1fr;
  }

  .study-card {
    min-height: 520px;
    grid-template-rows: auto 132px 126px minmax(190px, auto) auto;
  }

  .curve-chart {
    overflow-x: auto;
    grid-template-columns: repeat(15, 42px);
    padding-bottom: 8px;
  }
}

@media (max-width: 480px) {
  .brand-lockup {
    flex-direction: column;
  }

  .metric-grid,
  .choice-grid,
  .word-list,
  .test-wrong-list {
    grid-template-columns: 1fr;
  }

  .brand-lockup h1 {
    font-size: 40px;
  }

  .word {
    font-size: 36px;
    overflow-wrap: anywhere;
  }
}
