:root {
  --ink: #17201f;
  --muted: #5d6865;
  --paper: #f8f4eb;
  --panel: #fffdf7;
  --line: #d8d0c0;
  --blue: #173f79;
  --green: #0f7a61;
  --gold: #c9982f;
  --red: #b33b32;
  --shadow: 0 24px 70px rgba(33, 35, 30, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(23, 63, 121, 0.08), transparent 34%),
    radial-gradient(circle at 80% 10%, rgba(201, 152, 47, 0.18), transparent 30%),
    var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  background: #102b55;
  color: #fffdf7;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: #fffdf7;
  color: #102b55;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 6px;
  color: currentColor;
  opacity: 0.68;
  font: 700 0.72rem/1.2 Verdana, Geneva, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.04;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  max-width: 850px;
  font-size: clamp(2rem, 4vw, 4.4rem);
}

h3 {
  font-size: clamp(1.55rem, 2vw, 2.2rem);
}

.nav-tabs {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}

.tab {
  min-height: 46px;
  padding: 0 14px;
  color: rgba(255, 253, 247, 0.84);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  text-align: left;
}

.tab.is-active {
  background: #fffdf7;
  color: #102b55;
}

.tab.is-locked,
.chapter-tab.is-locked,
.set-button.is-locked {
  opacity: 0.58;
}

.tab.is-locked::after {
  content: "Locked";
  float: right;
  font: 800 0.62rem/1 Verdana, Geneva, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exam-rule {
  margin-top: 32px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.exam-rule strong,
.exam-rule span {
  display: block;
}

.exam-rule strong {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.account-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 18px;
  background: rgba(255, 253, 247, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.account-panel strong,
.account-panel span {
  display: block;
}

.account-panel strong {
  font-size: 1.05rem;
}

.account-panel span,
.account-panel p {
  margin: 0;
  color: rgba(255, 253, 247, 0.76);
  line-height: 1.35;
}

.account-actions {
  display: grid;
  gap: 8px;
}

.account-actions .ghost {
  color: #fffdf7;
  border-color: rgba(255, 255, 255, 0.28);
}

.sidebar-code-field {
  display: grid;
  gap: 6px;
  color: rgba(255, 253, 247, 0.82);
  font: 800 0.74rem/1.2 Verdana, Geneva, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-code-field input {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  outline: none;
  text-transform: uppercase;
}

.account-message {
  min-height: 18px;
  color: #f5d176 !important;
  font-weight: 800;
}

.access-contact {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.access-contact a {
  color: #f5d176;
  font-weight: 800;
  word-break: break-word;
}

.access-contact img {
  display: block;
  width: min(100%, 190px);
  aspect-ratio: 1;
  object-fit: contain;
  padding: 8px;
  background: #fff;
  border-radius: 8px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: end;
  min-height: 340px;
  padding: clamp(28px, 5vw, 54px);
  background:
    linear-gradient(135deg, rgba(16, 43, 85, 0.92), rgba(22, 66, 71, 0.82)),
    url("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Flag_of_Australia.svg/1280px-Flag_of_Australia.svg.png");
  background-position: center;
  background-size: cover;
  border-radius: 8px;
  color: #fffdf7;
  box-shadow: var(--shadow);
}

.hero-meter {
  display: grid;
  gap: 10px;
}

.hero-meter span {
  padding: 14px 16px;
  background: rgba(255, 253, 247, 0.14);
  border: 1px solid rgba(255, 253, 247, 0.24);
  border-radius: 8px;
  font: 800 1rem/1 Verdana, Geneva, sans-serif;
}

.view {
  display: none;
  margin-top: 28px;
}

.view.is-visible {
  display: block;
}

.section-head {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.search {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font: 700 0.78rem/1.2 Verdana, Geneva, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search input {
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.study-note {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.chapter-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.chapter-tab {
  display: grid;
  gap: 5px;
  min-height: 136px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.chapter-tab.is-active {
  color: #fffdf7;
  background: var(--blue);
  border-color: var(--blue);
}

.chapter-tab span,
.chapter-tab small {
  font: 800 0.72rem/1.2 Verdana, Geneva, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.chapter-tab strong {
  font-size: 1rem;
  line-height: 1.15;
}

.chapter-tab em {
  color: inherit;
  font-style: normal;
  opacity: 0.78;
}

.chapter-tab .lock-note {
  color: var(--gold);
  opacity: 1;
}

.chapter-panel {
  display: grid;
  gap: 16px;
}

.chapter-lesson,
.teaching-step,
.chapter-quiz {
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(33, 35, 30, 0.08);
}

.chapter-lesson {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.05fr);
  overflow: hidden;
}

.chapter-visual {
  min-height: 320px;
  background: #e9dfcd;
}

.chapter-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: contain;
}

.chapter-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: clamp(22px, 4vw, 42px);
}

.chapter-copy h4,
.teaching-step h4 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 3rem);
  line-height: 1.04;
}

.zh-title,
.translation {
  margin: 0;
  color: var(--muted);
}

.zh-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.keyword-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.keyword-strip span {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: #f1eadb;
  border-radius: 8px;
}

.keyword-strip strong,
.keyword-strip em,
.option em {
  font-family: Verdana, Geneva, sans-serif;
}

.keyword-strip strong {
  color: var(--blue);
  font-size: 0.78rem;
}

.keyword-strip em,
.option em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.teaching-step,
.chapter-quiz {
  padding: 20px;
}

.step-meter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.step-meter button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--blue);
  background: #e8edf4;
  border-radius: 50%;
  font: 900 0.9rem/1 Verdana, Geneva, sans-serif;
}

.step-meter button.is-active {
  color: #fff;
  background: var(--blue);
}

.bilingual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.bilingual-grid > div {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.memory-box {
  padding: 12px;
  color: var(--blue);
  background: #e8edf4;
  border-radius: 8px;
  font-weight: 700;
}

.question .option span:last-child,
.bilingual-question .option span:last-child {
  display: grid;
  gap: 4px;
}

.question .option strong,
.bilingual-question .option strong {
  font-weight: 700;
}

.lang-toggle {
  min-height: 34px;
  padding: 0 12px;
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.study-card,
.quiz-panel,
.history-item {
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(33, 35, 30, 0.08);
}

.study-card {
  padding: 18px;
}

.study-card h4 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.study-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.primary,
.ghost {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font: 800 0.85rem/1 Verdana, Geneva, sans-serif;
}

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

.primary:disabled,
.ghost:disabled,
.option:disabled {
  cursor: not-allowed;
}

.ghost {
  color: var(--blue);
  background: transparent;
  border: 1px solid var(--line);
}

.timer {
  min-width: 126px;
  padding: 12px 16px;
  color: #fffdf7;
  background: var(--ink);
  border-radius: 8px;
  text-align: center;
  font: 900 1.45rem/1 Verdana, Geneva, sans-serif;
}

.test-picker {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.set-button {
  position: relative;
  aspect-ratio: 1;
  color: var(--blue);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.set-button.is-active {
  color: #fff;
  background: var(--blue);
}

.set-button .lock-dot {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--gold);
  border-radius: 50%;
}

.quiz-panel {
  padding: 20px;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.quiz-top {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 7px 10px;
  color: var(--muted);
  background: #f1eadb;
  border-radius: 8px;
  font: 800 0.72rem/1 Verdana, Geneva, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pill.value {
  color: #fff;
  background: var(--red);
}

.question {
  display: grid;
  gap: 14px;
}

.question h4 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

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

.option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.option span:first-child {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--blue);
  background: #e8edf4;
  border-radius: 8px;
  font: 900 0.9rem/1 Verdana, Geneva, sans-serif;
}

.option.correct {
  border-color: var(--green);
  background: #edf8f3;
}

.option.wrong {
  border-color: var(--red);
  background: #fff0ed;
}

.feedback {
  padding: 14px;
  background: #f4eddf;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  color: var(--muted);
}

.quiz-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 18px;
}

.result {
  display: grid;
  gap: 14px;
}

.result-title {
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.result.pass {
  color: var(--green);
}

.result.fail {
  color: var(--red);
}

.history-panel {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.paywall-card {
  display: grid;
  gap: 14px;
  min-height: 220px;
  padding: clamp(20px, 4vw, 34px);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 63, 121, 0.09), transparent 48%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(33, 35, 30, 0.08);
}

.paywall-card h4 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.04;
}

.paywall-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 17, 25, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.auth-modal {
  position: relative;
  width: min(920px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  color: #001a3a;
  background: #f6f7f9;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.auth-modal-inner {
  display: block;
  padding: clamp(34px, 6vw, 70px) clamp(28px, 9vw, 128px) clamp(30px, 6vw, 52px);
}

.auth-offer {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: clamp(24px, 4vw, 42px);
  color: #fffdf7;
  background:
    linear-gradient(135deg, rgba(16, 43, 85, 0.96), rgba(15, 122, 97, 0.9)),
    url("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Flag_of_Australia.svg/1280px-Flag_of_Australia.svg.png");
  background-position: center;
  background-size: cover;
}

.auth-offer h3 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.price-stack {
  display: grid;
  gap: 8px;
}

.price-stack strong {
  font-size: 2.3rem;
  line-height: 1;
}

.price-stack span {
  opacity: 0.82;
}

.auth-form {
  display: grid;
  gap: 20px;
  padding: 0;
}

.auth-form-wide h3 {
  margin: 0;
  color: #001a3a;
  font: 900 clamp(2.4rem, 5vw, 3.15rem)/1.04 Verdana, Geneva, sans-serif;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 rgba(46, 99, 230, 0.2);
}

.auth-subtitle {
  margin: 18px 0 0;
  color: #001a3a;
  font: 400 1.35rem/1.35 Verdana, Geneva, sans-serif;
}

.text-link {
  min-height: auto;
  padding: 0;
  color: #0054ff;
  background: transparent;
  font-weight: 800;
}

.modal-head {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--blue);
  background: #e8edf4;
  border-radius: 50%;
  font: 900 1.1rem/1 Verdana, Geneva, sans-serif;
}

.auth-close {
  position: absolute;
  right: 18px;
  top: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auth-tabs button {
  min-height: 40px;
  color: var(--blue);
  background: #e8edf4;
  border-radius: 8px;
  font: 800 0.78rem/1 Verdana, Geneva, sans-serif;
}

.auth-tabs button.is-active {
  color: #fff;
  background: var(--blue);
}

.form-grid {
  display: grid;
  gap: 30px;
}

.account-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label {
  display: grid;
  gap: 12px;
  color: #001a3a;
  font: 800 1.08rem/1.2 Verdana, Geneva, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.form-grid input {
  min-height: 62px;
  padding: 0 20px;
  color: #1d2b3e;
  background: #fff;
  border: 1px solid #c9d0da;
  border-radius: 12px;
  outline: none;
  font-size: 1.35rem;
}

.check-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: #001a3a;
  font: 400 1.02rem/1.45 Verdana, Geneva, sans-serif;
}

.check-row input {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
}

.sync-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.social-sync-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.social-button {
  min-height: 58px;
  padding: 10px 14px;
  color: #001a3a;
  background: #fff;
  border: 1px solid #c9d0da;
  border-radius: 12px;
  font: 900 0.9rem/1.2 Verdana, Geneva, sans-serif;
}

.social-button span {
  color: #56657a;
  font-weight: 700;
}

.google-button {
  border-color: #d7b247;
}

.facebook-button {
  color: #fff;
  background: #1877f2;
  border-color: #1877f2;
}

.facebook-button span {
  color: rgba(255, 255, 255, 0.84);
}

.divider-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  color: #637083;
  font: 800 0.78rem/1 Verdana, Geneva, sans-serif;
}

.divider-label::before,
.divider-label::after {
  content: "";
  height: 1px;
  background: #d8dde5;
}

.auth-main-button {
  min-height: 68px;
  margin-top: 4px;
  background: #2f66e8;
  border: 1px solid #0b52df;
  border-radius: 10px;
  color: #fff;
  font-size: 1.28rem;
}

.auth-message {
  min-height: 20px;
  color: var(--red);
  font-weight: 700;
}

.billing-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.subscription-strip {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  color: #001a3a;
  background: #eaf0ff;
  border: 1px solid #cdd9ff;
  border-radius: 12px;
}

.subscription-strip strong {
  font: 900 2rem/1 Verdana, Geneva, sans-serif;
  color: #2f66e8;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-tabs,
  .study-grid,
  .chapter-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .chapter-lesson,
  .account-form-grid,
  .social-sync-row,
  .sync-options,
  .auth-modal-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .section-head,
  .quiz-top,
  .quiz-actions,
  .history-item {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .study-note {
    text-align: left;
  }

  .nav-tabs,
  .study-grid,
  .chapter-nav,
  .bilingual-grid {
    grid-template-columns: 1fr;
  }

  .test-picker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
