:root {
  color-scheme: light;
  --ink: #15201b;
  --muted: #667169;
  --paper: #f7f5ef;
  --card: #ffffff;
  --line: #dfe5df;
  --green: #174b35;
  --green-2: #2a6a4d;
  --lime: #d9f36a;
  --orange: #ff8a3d;
  --danger: #b84436;
  --shadow: 0 18px 48px rgba(24, 49, 37, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(22px, 5vw, 72px);
  border-bottom: 1px solid rgba(21, 32, 27, 0.1);
  background: rgba(247, 245, 239, 0.94);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--lime);
  background: var(--green);
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.user-nav { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.7fr);
  gap: clamp(36px, 6vw, 100px);
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 77px);
  margin: 0 auto;
  padding: 64px 0;
}

.hero-panel { padding: clamp(20px, 4vw, 50px); }
.eyebrow {
  margin: 0 0 12px;
  color: var(--green-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.hero-panel h1, .dashboard-hero h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}
.hero-copy {
  max-width: 660px;
  margin: 28px 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.85;
}
.hero-stats { display: flex; gap: 42px; padding-top: 18px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 32px; color: var(--green); }
.hero-stats span { color: var(--muted); font-size: 13px; }

.auth-card, .admin-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: #eef1ec; }
.auth-tab { padding: 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; }
.auth-tab.active { color: white; background: var(--green); }
.auth-card h2 { margin: 28px 0 5px; font-size: 30px; }
.auth-card > p { color: var(--muted); }

label { display: grid; gap: 8px; margin: 16px 0; font-size: 14px; font-weight: 600; }
input, select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: white;
  outline: none;
}
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(42, 106, 77, 0.12); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
}
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-primary { color: white; background: var(--green); }
.button-primary:hover:not(:disabled) { background: var(--green-2); }
.button-secondary { color: var(--green); border-color: #b7c8bc; background: transparent; }
.button-ghost { color: var(--ink); border-color: var(--line); background: transparent; }
.button-full { width: 100%; }
.button-google { width: 100%; margin-top: 18px; color: var(--ink); border-color: var(--line); background: white; }
.google-g { font-weight: 800; color: #4285f4; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: #8a938d; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.text-button { padding: 8px 0; border: 0; color: var(--green-2); background: transparent; font-weight: 600; }
.message { min-height: 20px; margin: 10px 0 0; color: var(--danger) !important; font-size: 13px; }

.dashboard {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 100px;
}
.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  padding: 44px;
  border-radius: 30px;
  color: white;
  background: var(--green);
}
.dashboard-hero h1 { font-size: clamp(34px, 5vw, 58px); }
.dashboard-hero p:not(.eyebrow) { color: #d5e3da; }
.dashboard-hero .eyebrow { color: var(--lime); }
.streak-card { min-width: 150px; padding: 20px; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; background: rgba(255,255,255,.08); }
.streak-card span, .streak-card strong { display: block; }
.streak-card span { color: #d5e3da; font-size: 13px; }
.streak-card strong { margin-top: 6px; color: var(--lime); font-size: 26px; }

.section-block { margin-top: 54px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 36px); }
.section-heading .eyebrow { margin-bottom: 5px; }
.free-training-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 30px;
  border: 1px solid #cbd5c8;
  border-radius: 22px;
  background: linear-gradient(135deg, #eff7df, #fff);
}
.free-training-card h3 { margin: 0 0 8px; font-size: 22px; }
.free-training-card p { margin: 0; color: var(--muted); }
.training-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.coach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.coach-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  transition: transform .18s ease, box-shadow .18s ease;
}
.coach-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.coach-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 28px; border-radius: 15px; color: var(--lime); background: var(--green); font-weight: 800; }
.coach-card h3 { margin: 12px 0 8px; font-size: 20px; }
.coach-card p { flex: 1; margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.status-badge { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; color: #6e5f30; background: #f3e9bb; font-size: 11px; font-weight: 700; }
.status-active { color: #195a3b; background: #d9f0df; }
.status-locked { color: #6b6e6c; background: #e8ebe9; }
.status-paused { color: #8a4a24; background: #f8dfcf; }

.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { padding: 25px; border-radius: 20px; color: white; background: #22362c; }
.plan-card h3 { margin: 12px 0 8px; }
.plan-card p { color: #cedbd3; font-size: 14px; line-height: 1.7; }

.admin-panel { padding-top: 46px; border-top: 1px solid var(--line); }
.admin-grid { display: grid; grid-template-columns: minmax(300px, .75fr) 1.25fr; gap: 20px; }
.admin-card { border-radius: 20px; box-shadow: none; }
.admin-card h3 { margin-top: 0; }
.launch-control-list { display: grid; gap: 10px; max-height: 600px; overflow: auto; }
.launch-control { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.launch-control span { font-size: 14px; font-weight: 600; }

.practice-view { width: min(840px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 100px; }
.practice-shell { margin-top: 20px; padding: 32px; border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.practice-topbar { display: flex; align-items: center; justify-content: space-between; }
.practice-topbar h2 { margin: 0; }
.progress-track { height: 7px; margin: 22px 0 36px; overflow: hidden; border-radius: 999px; background: #e8ece8; }
.progress-track span { display: block; width: 10%; height: 100%; border-radius: inherit; background: var(--orange); transition: width .25s ease; }
.question-card { text-align: center; }
.question-card h3 { margin: 18px 0 28px; font-size: clamp(30px, 5vw, 48px); }
.question-meta { margin: -18px 0 24px; color: var(--muted); }
.recall-input, textarea {
  width: 100%;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  resize: vertical;
}
#recall-stage, #sentence-stage { max-width: 580px; margin: 0 auto; }
.model-sentence { margin: 18px 0; padding: 16px; border-radius: 12px; color: var(--green); background: #eef6f0; text-align: left; }
.answer-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-option { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: white; font-weight: 600; }
.answer-option:hover:not(:disabled) { border-color: var(--green); }
.answer-option.correct { color: #145235; border-color: #5faa7b; background: #e2f5e8; }
.answer-option.wrong { color: #8b352e; border-color: #dc8a82; background: #fde9e7; }
.answer-feedback { min-height: 28px; margin: 20px 0; font-weight: 700; }
.practice-result { padding: 40px 0; text-align: center; }
.practice-result strong { display: block; margin: 16px 0; color: var(--green); font-size: 64px; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .hero-panel { padding: 10px; }
  .coach-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-grid, .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header { padding: 12px 16px; }
  .brand small, #user-email { display: none; }
  .auth-layout, .dashboard, .practice-view { width: min(100% - 24px, 1180px); }
  .auth-layout { padding: 28px 0; }
  .hero-panel h1 { font-size: 42px; }
  .hero-stats { gap: 20px; }
  .auth-card { padding: 24px; }
  .dashboard-hero, .free-training-card { align-items: flex-start; flex-direction: column; padding: 26px; }
  .coach-grid, .plan-grid, .answer-options { grid-template-columns: 1fr; }
  .practice-shell { padding: 22px; }
}
