:root {
  --academy-green: #075c45;
  --academy-green-2: #0a7a58;
  --academy-mint: #dff5eb;
  --academy-red: #df4d3f;
  --academy-gold: #e4a51f;
  --academy-blue: #2d64a5;
  --academy-ink: #15241f;
  --academy-muted: #68756f;
  --academy-border: #d8e2dd;
  --academy-bg: #eef3f0;
  --academy-panel: #ffffff;
}

body {
  overflow: hidden;
  background: var(--academy-bg);
}

button:focus-visible {
  outline: 3px solid rgba(45, 100, 165, .35);
  outline-offset: 2px;
}

.academy-view,
.theory-view {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: auto;
  color: var(--academy-ink);
  background: var(--academy-bg);
}

.academy-header,
.theory-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 10px max(22px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(7, 92, 69, .14);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(19, 43, 34, .07);
}

.academy-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.academy-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--academy-green);
  font-size: 15px;
  font-weight: 900;
}

.academy-brand strong,
.academy-brand span,
.theory-header strong,
.theory-header span {
  display: block;
}

.academy-brand strong,
.theory-header strong {
  color: var(--academy-green);
  font-size: 17px;
}

.academy-brand div span,
.theory-header div span {
  margin-top: 2px;
  color: var(--academy-muted);
  font-size: 12px;
}

.academy-header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--academy-muted);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--academy-green-2);
  box-shadow: 0 0 0 5px rgba(10, 122, 88, .11);
}

.academy-dashboard,
.theory-dashboard {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 max(36px, env(safe-area-inset-bottom));
}

.welcome-band,
.theory-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 168px;
  padding: 28px 32px;
  border-left: 6px solid var(--academy-red);
  border-radius: 8px;
  color: #fff;
  background: var(--academy-green);
  box-shadow: 0 16px 35px rgba(7, 58, 44, .17);
}

.welcome-band h1,
.theory-hero h1 {
  max-width: 720px;
  margin: 7px 0 8px;
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 1.18;
  letter-spacing: 0;
}

.welcome-band p,
.theory-hero p {
  margin: 0;
  color: rgba(255, 255, 255, .75);
  font-size: 14px;
}

.section-kicker {
  color: var(--academy-gold);
  font-size: 12px;
  font-weight: 900;
}

.overall-progress {
  display: grid;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  place-content: center;
  border: 7px solid rgba(255, 255, 255, .18);
  border-top-color: var(--academy-gold);
  border-radius: 50%;
  text-align: center;
}

.overall-progress strong {
  font-size: 27px;
}

.overall-progress span {
  margin-top: 2px;
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
}

.subject-section {
  padding-top: 30px;
}

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

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.bank-status,
.section-heading > span,
.section-heading div > span {
  color: var(--academy-muted);
  font-size: 12px;
}

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

.subject-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  min-height: 176px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--academy-border);
  border-top: 5px solid var(--academy-green-2);
  border-radius: 8px;
  text-align: left;
  background: var(--academy-panel);
  box-shadow: 0 10px 28px rgba(20, 47, 37, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}

.subject-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 32px rgba(20, 47, 37, .13);
}

.subject-two {
  border-top-color: var(--academy-blue);
}

.subject-three {
  border-top-color: #9aa8a1;
  color: #66736d;
  background: #f4f6f5;
}

.subject-index {
  grid-row: 1 / 3;
  margin-right: 15px;
  color: #b7c3bd;
  font-size: 28px;
  font-weight: 900;
}

.subject-copy strong,
.subject-copy small {
  display: block;
}

.subject-copy strong {
  margin-top: 3px;
  color: var(--academy-ink);
  font-size: 22px;
}

.subject-copy small {
  margin-top: 7px;
  color: var(--academy-muted);
  line-height: 1.5;
}

.subject-meta {
  grid-column: 2;
  align-self: end;
  margin-top: 18px;
  color: var(--academy-green-2);
  font-size: 12px;
  font-weight: 800;
}

.subject-meta.soon {
  color: #7c8983;
}

.subject-arrow,
.subject-lock {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--academy-green-2);
  font-size: 24px;
  font-weight: 900;
}

.subject-lock {
  max-width: 52px;
  color: #8d9993;
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.academy-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 18px;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  background: #fff;
}

.academy-summary > div {
  min-width: 0;
  padding: 17px 20px;
  border-right: 1px solid var(--academy-border);
}

.academy-summary > div:last-child {
  border-right: 0;
}

.academy-summary span,
.academy-summary small,
.academy-summary strong {
  display: block;
}

.academy-summary span,
.academy-summary small {
  color: var(--academy-muted);
  font-size: 11px;
}

.academy-summary strong {
  margin: 6px 0 1px;
  color: var(--academy-green);
  font-size: 24px;
}

.theory-header {
  justify-content: flex-start;
  gap: 12px;
}

.theory-header .text-action {
  margin-left: auto;
}

.icon-back,
.icon-close,
.game-home-btn {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  color: var(--academy-green);
  background: #fff;
  font-size: 22px;
  font-weight: 800;
}

.text-action,
.favorite-btn {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--academy-border);
  border-radius: 7px;
  color: var(--academy-green);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.theory-dashboard {
  max-width: 950px;
}

.theory-hero {
  min-height: 150px;
}

.theory-hero .primary-action {
  min-width: 140px;
  margin-left: 28px;
}

.primary-action {
  min-height: 46px;
  padding: 11px 20px;
  border-radius: 8px;
  color: #173021;
  background: var(--academy-gold);
  font-weight: 900;
}

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

.mode-grid button {
  display: grid;
  min-height: 132px;
  padding: 17px;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  text-align: left;
  background: #fff;
  box-shadow: 0 8px 20px rgba(20, 47, 37, .06);
}

.mode-grid button > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--academy-green-2);
  font-size: 14px;
  font-weight: 900;
}

.mode-grid button:nth-child(2) > span { background: var(--academy-blue); }
.mode-grid button:nth-child(3) > span { background: var(--academy-red); }
.mode-grid button:nth-child(4) > span { color: #332400; background: var(--academy-gold); }

.mode-grid strong {
  align-self: end;
  margin-top: 16px;
  font-size: 16px;
}

.mode-grid small {
  margin-top: 4px;
  color: var(--academy-muted);
  line-height: 1.4;
}

.mode-grid .exam-mode {
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  min-height: 88px;
  border-color: rgba(7, 92, 69, .28);
  background: #f4fbf7;
}

.exam-mode > span {
  grid-row: 1 / 3;
  align-self: center;
  margin-right: 14px;
}

.exam-mode strong {
  align-self: end;
  margin-top: 0;
}

.learning-stats {
  margin-top: 22px;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 10px;
}

.section-heading.compact h2 {
  margin: 0;
  font-size: 18px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  background: #fff;
}

.stat-strip div {
  padding: 18px;
  border-right: 1px solid var(--academy-border);
  text-align: center;
}

.stat-strip div:last-child { border-right: 0; }
.stat-strip strong, .stat-strip span { display: block; }
.stat-strip strong { color: var(--academy-green); font-size: 23px; }
.stat-strip span { margin-top: 3px; color: var(--academy-muted); font-size: 11px; }

.practice-view {
  display: grid;
  grid-template-rows: auto 4px minmax(0, 1fr) auto;
  width: min(900px, 100%);
  height: calc(100dvh - 69px);
  margin: 0 auto;
  overflow: hidden;
}

.practice-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--academy-bg);
}

.practice-title {
  min-width: 0;
  flex: 1;
}

.practice-title strong,
.practice-title span {
  display: block;
}

.practice-title strong { font-size: 16px; }
.practice-title span { margin-top: 2px; color: var(--academy-muted); font-size: 11px; }

.practice-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.favorite-btn.is-active {
  color: #332400;
  border-color: var(--academy-gold);
  background: #fff6da;
}

.exam-timer {
  min-width: 62px;
  color: var(--academy-red);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.question-progress {
  overflow: hidden;
  background: #dce5e0;
}

.question-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--academy-green-2);
  transition: width .2s ease;
}

.question-scroll {
  min-height: 0;
  overflow: auto;
  padding: 10px 16px 24px;
}

.question-card {
  max-width: 820px;
  min-height: 100%;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(19, 43, 34, .07);
}

.question-type-row,
.feedback-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-type-row span {
  padding: 5px 9px;
  border-radius: 6px;
  color: #fff;
  background: var(--academy-green-2);
  font-size: 12px;
  font-weight: 800;
}

.question-type-row small { color: var(--academy-muted); }

.question-card h2 {
  margin: 18px 0 20px;
  font-size: clamp(19px, 2.7vw, 27px);
  line-height: 1.55;
  letter-spacing: 0;
}

.question-image {
  display: block;
  width: min(100%, 680px);
  max-height: 340px;
  margin: 0 auto 20px;
  border: 1px solid var(--academy-border);
  border-radius: 6px;
  object-fit: contain;
  background: #f6f8f7;
}

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

.option-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  text-align: left;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}

.option-button:hover { border-color: #8bbbaa; background: #f6fbf8; }
.option-letter {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #bcc9c3;
  border-radius: 50%;
  color: #475650;
  font-weight: 900;
}

.option-button.is-selected { border-color: var(--academy-blue); background: #f1f6fc; }
.option-button.is-selected .option-letter { color: #fff; border-color: var(--academy-blue); background: var(--academy-blue); }
.option-button.is-correct { border-color: var(--academy-green-2); background: #ecf8f2; }
.option-button.is-correct .option-letter { color: #fff; border-color: var(--academy-green-2); background: var(--academy-green-2); }
.option-button.is-wrong { border-color: var(--academy-red); background: #fff2f0; }
.option-button.is-wrong .option-letter { color: #fff; border-color: var(--academy-red); background: var(--academy-red); }

.answer-feedback {
  margin-top: 18px;
  padding: 16px;
  border-left: 4px solid var(--academy-green-2);
  border-radius: 6px;
  background: #f0f8f4;
}

.answer-feedback.is-wrong { border-left-color: var(--academy-red); background: #fff4f2; }
.feedback-result strong { color: var(--academy-green); }
.answer-feedback.is-wrong .feedback-result strong { color: var(--academy-red); }
.feedback-result span { color: var(--academy-muted); font-size: 12px; }
.answer-feedback p { margin: 10px 0 0; color: #46544e; line-height: 1.65; }

.practice-footer {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--academy-border);
  background: #fff;
}

.practice-footer button {
  min-height: 48px;
  border: 1px solid var(--academy-border);
  border-radius: 8px;
  background: #f6f8f7;
  font-weight: 900;
}

.practice-footer .primary-action { border-color: var(--academy-green); color: #fff; background: var(--academy-green); }

.sheet-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 27, 20, .56);
}

.sheet-panel,
.exam-result-panel {
  width: min(620px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(5, 25, 18, .3);
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin: 18px 0;
}

.sheet-grid button {
  aspect-ratio: 1;
  border: 1px solid var(--academy-border);
  border-radius: 5px;
  color: var(--academy-muted);
  background: #f7f9f8;
  font-size: 11px;
}

.sheet-grid button.is-answered { color: #fff; border-color: var(--academy-green-2); background: var(--academy-green-2); }
.primary-action.full { width: 100%; color: #fff; background: var(--academy-green); }
.icon-close { font-size: 20px; }

.exam-result-panel {
  text-align: center;
}

.exam-result-panel > span {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  color: #fff;
  background: var(--academy-green);
  font-size: 12px;
  font-weight: 800;
}

.exam-result-panel > strong {
  display: block;
  margin: 18px 0 0;
  color: var(--academy-green);
  font-size: 74px;
  line-height: 1;
}

.exam-result-panel h2 { margin: 10px 0 6px; }
.exam-result-panel p { color: var(--academy-muted); }
.exam-result-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 20px; }
.exam-result-actions button { min-height: 46px; border: 1px solid var(--academy-border); border-radius: 8px; font-weight: 900; }

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  transform: translateX(-50%);
  border-radius: 7px;
  color: #fff;
  background: #1a3028;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .24);
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  justify-content: flex-start;
}

.topbar .stats {
  margin-left: auto;
}

.game-home-btn {
  margin-right: 10px;
}

@media (max-width: 760px) {
  .academy-header,
  .theory-header {
    min-height: 60px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .academy-header-status span:first-child { display: none; }
  .academy-dashboard,
  .theory-dashboard { width: calc(100% - 20px); padding-top: 12px; }
  .welcome-band,
  .theory-hero { min-height: 150px; padding: 22px 18px; }
  .welcome-band h1,
  .theory-hero h1 { font-size: 24px; }
  .welcome-band p { max-width: 230px; }
  .overall-progress { width: 88px; height: 88px; border-width: 6px; }
  .overall-progress strong { font-size: 22px; }
  .subject-section { padding-top: 22px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 19px; }
  .bank-status { max-width: 120px; text-align: right; }
  .subject-grid { grid-template-columns: 1fr; gap: 10px; }
  .subject-card { min-height: 132px; padding: 17px; }
  .subject-copy strong { font-size: 19px; }
  .academy-summary { grid-template-columns: 1fr 1fr; }
  .academy-summary > div:nth-child(2) { border-right: 0; }
  .academy-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--academy-border); }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-grid button { min-height: 120px; }
  .theory-hero { display: block; }
  .theory-hero .primary-action { width: 100%; margin: 20px 0 0; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip div:nth-child(2) { border-right: 0; }
  .stat-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--academy-border); }
  .practice-view { height: calc(100dvh - 61px); }
  .practice-toolbar { gap: 8px; padding: 9px 10px; }
  .practice-tools { gap: 5px; }
  .practice-tools .text-action,
  .favorite-btn { padding: 7px 9px; }
  .question-scroll { padding: 7px 9px 18px; }
  .question-card { padding: 18px 15px; }
  .question-card h2 { margin: 15px 0 17px; font-size: 20px; }
  .option-button { min-height: 56px; padding: 9px 10px; }
  .sheet-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 420px) {
  .welcome-band p { display: none; }
  .overall-progress { width: 78px; height: 78px; margin-left: 10px; }
  .subject-index { font-size: 23px; }
  .practice-title strong { font-size: 14px; }
  .practice-tools .text-action { display: none; }
  .exam-timer { min-width: 50px; font-size: 13px; }
}

.hidden {
  display: none !important;
}
