:root {
  --red: #7d161a;
  --red-deep: #580d11;
  --red-bright: #a52a2a;
  --gold: #c49336;
  --gold-soft: #ead3a2;
  --cream: #f6efe3;
  --paper: #fffdf9;
  --paper-2: #fbf6ec;
  --ink: #2e241d;
  --muted: #7a6a5c;
  --line: #e8dcc8;
  --green: #1f7a4d;
  --green-soft: #e8f6ed;
  --wrong: #b3261e;
  --wrong-soft: #fdeceb;
  --shadow: 0 18px 45px rgba(78, 44, 24, 0.1);
  --shadow-soft: 0 8px 24px rgba(78, 44, 24, 0.08);
  --radius: 18px;
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --font-display: "STZhongsong", "Songti SC", "SimSun", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 8% 4%, rgba(196, 147, 54, 0.12), transparent 30%),
    radial-gradient(circle at 95% 18%, rgba(125, 22, 26, 0.08), transparent 34%),
    linear-gradient(180deg, #f8f2e7 0%, #f4ecdf 48%, #f8f3ea 100%);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(125, 22, 26, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 22, 26, 0.032) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  z-index: -1;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid rgba(196, 147, 54, 0.6);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.seal {
  display: inline-grid;
  place-content: center;
  width: 52px;
  height: 52px;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  position: relative;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.65;
}

.seal-large {
  width: 78px;
  height: 78px;
  font-size: 24px;
  color: var(--red);
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--red);
  text-decoration: none;
}

.brand .seal {
  color: var(--red);
  width: 46px;
  height: 46px;
  font-size: 14px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.head-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.68);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 122, 77, 0.1);
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 42px 46px 36px;
  color: #fff9ee;
  background:
    radial-gradient(circle at 86% 18%, rgba(234, 211, 162, 0.2), transparent 30%),
    radial-gradient(circle at 84% 84%, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(130deg, #5a0e12 0%, #7d161a 52%, #9b2422 100%);
  box-shadow: 0 26px 60px rgba(91, 15, 19, 0.24);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(234, 211, 162, 0.22);
  border-radius: 50%;
}

.hero::before {
  width: 360px;
  height: 360px;
  right: -110px;
  top: -170px;
}

.hero::after {
  width: 250px;
  height: 250px;
  right: 20px;
  bottom: -170px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.hero h1 {
  margin: 14px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.12;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.hero-lead {
  max-width: 590px;
  margin: 0;
  color: rgba(255, 249, 238, 0.8);
  font-size: 15px;
  line-height: 1.9;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-stat {
  min-width: 116px;
  padding: 12px 16px 11px;
  border: 1px solid rgba(234, 211, 162, 0.26);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
}

.hero-stat b {
  display: block;
  color: #fff8e9;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.2;
}

.hero-stat span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 249, 238, 0.62);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.hero-mark {
  position: absolute;
  right: 36px;
  bottom: 26px;
  z-index: 1;
  color: rgba(234, 211, 162, 0.6);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.32em;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(232, 220, 200, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.88);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-pad {
  padding: 24px;
}

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

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.04em;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.count-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.seat-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--ink);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.seat-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 18px rgba(125, 22, 26, 0.09);
}

.seat-btn b {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.seat-btn small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-btn.free::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9bca9;
}

.seat-btn.in_progress {
  background: #fdf6e9;
  border-color: #e5c98f;
}

.seat-btn.in_progress b {
  color: #9b6c18;
}

.seat-btn.submitted {
  background: #edf7f0;
  border-color: #bfdcc9;
}

.seat-btn.submitted b {
  color: var(--green);
}

.seat-btn.selected {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 10px 24px rgba(125, 22, 26, 0.28);
  transform: translateY(-2px);
}

.seat-btn.selected b,
.seat-btn.selected small {
  color: #fff8eb;
}

.seat-btn.selected::after {
  background: var(--gold-soft);
}

.seat-btn:disabled,
.seat-btn[aria-disabled="true"] {
  cursor: not-allowed;
}

.seat-btn[aria-disabled="true"]:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

.seat-btn.in_progress[aria-disabled="true"]:hover,
.seat-btn.submitted[aria-disabled="true"]:hover {
  border-color: #e5c98f;
}

.seat-btn.submitted[aria-disabled="true"]:hover {
  border-color: #bfdcc9;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9bca9;
}

.legend i.gold {
  background: #d9ad57;
}

.legend i.green {
  background: #5ea77b;
}

.join-panel {
  position: sticky;
  top: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(251, 246, 236, 0.96));
}

.selected-seat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border: 1px dashed #dcc9a5;
  border-radius: 13px;
  background: rgba(255, 250, 240, 0.8);
  color: var(--muted);
  font-size: 13px;
}

.selected-seat b {
  color: var(--red);
  font-family: var(--font-display);
  font-size: 27px;
  letter-spacing: 0.06em;
}

.selected-seat b.empty {
  color: #b8a894;
  font-size: 18px;
}

.field {
  display: block;
  margin-top: 18px;
}

.field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #4e3f33;
  font-size: 13px;
  font-weight: 700;
}

.field em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefb;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
  color: #b7a997;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(196, 147, 54, 0.13);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

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

.btn-primary {
  color: #fff8ea;
  background: linear-gradient(135deg, var(--red) 0%, #9a2422 100%);
  box-shadow: 0 12px 24px rgba(125, 22, 26, 0.22);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 15px 30px rgba(125, 22, 26, 0.3);
}

.btn-gold {
  color: #4a2e08;
  background: linear-gradient(135deg, #e5c584 0%, #c99a3d 100%);
  box-shadow: 0 10px 22px rgba(150, 104, 24, 0.18);
}

.btn-ghost {
  border-color: var(--line);
  background: #fffdf9;
  color: #5d4a3b;
}

.btn-ghost:hover:not(:disabled) {
  border-color: #d5c3a6;
  background: #fffaf1;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 54px;
  font-size: 16px;
  border-radius: 14px;
}

.btn:disabled {
  opacity: 0.5;
  box-shadow: none;
}

.join-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.link-btn {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 2px;
  border: 0;
  background: transparent;
  color: #997633;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.recover-select {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefb;
  color: var(--ink);
  font-size: 14px;
}

.recover-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(196, 147, 54, 0.13);
}

.rules-panel {
  margin-top: 20px;
}

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

.rules-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  color: #5a4a3c;
  font-size: 12px;
  line-height: 1.75;
}

.rule-num {
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #d9bf8c;
  border-radius: 50%;
  color: #9b6c18;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
}

.home-foot {
  margin-top: 26px;
  color: #9b8b7c;
  font-size: 11px;
  line-height: 1.8;
  text-align: center;
  letter-spacing: 0.03em;
}

/* Exam */
.exam-body {
  padding-bottom: 92px;
}

.exam-top {
  position: sticky;
  top: 0;
  z-index: 40;
  color: #fff9ee;
  background:
    linear-gradient(90deg, rgba(88, 13, 17, 0.98), rgba(125, 22, 26, 0.98));
  border-bottom: 1px solid rgba(234, 211, 162, 0.2);
  box-shadow: 0 6px 18px rgba(70, 15, 18, 0.18);
}

.exam-top-inner {
  width: min(1100px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 0;
}

.exam-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.exam-brand .seal {
  width: 38px;
  height: 38px;
  font-size: 11px;
  color: var(--gold-soft);
  flex: 0 0 auto;
}

.exam-brand div {
  min-width: 0;
}

.exam-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.exam-brand span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 249, 238, 0.55);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.exam-who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: rgba(255, 249, 238, 0.76);
  font-size: 12px;
}

.exam-who b {
  color: #fff9ee;
  font-size: 13px;
}

.exam-who .tag {
  padding: 4px 8px;
  border: 1px solid rgba(234, 211, 162, 0.28);
  border-radius: 999px;
  color: var(--gold-soft);
  font-size: 10px;
  white-space: nowrap;
}

.save-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: rgba(255, 249, 238, 0.62);
  font-family: inherit;
  font-size: 11px;
  white-space: nowrap;
}

.save-line .save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fd3a8;
}

.save-line.saving .save-dot {
  background: var(--gold-soft);
  animation: pulse 1s infinite;
}

.save-line.error {
  color: #ffd0cb;
}

.save-line.error .save-dot {
  background: #ff8d80;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff9ee;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.timer::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
}

.exam-top-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 15px;
  border: 1px solid rgba(234, 211, 162, 0.5);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff4dd;
  font-size: 12px;
  font-weight: 700;
}

.exam-wrap {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.exam-overview {
  position: sticky;
  top: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.overview-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.overview-label strong {
  color: var(--red);
  font-family: var(--font-display);
  font-size: 17px;
}

.progress-track {
  height: 7px;
  margin-top: 10px;
  border-radius: 999px;
  background: #ede4d6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b37b2d, var(--gold));
  transition: width 0.25s ease;
}

.overview-count {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.page-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-top: 16px;
}

.page-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: #6c5a4a;
  font-size: 10px;
  line-height: 1.2;
  text-align: left;
}

.page-chip b {
  display: inline-grid;
  place-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--paper-2);
  color: #8b7763;
  font-size: 9px;
}

.page-chip.active {
  border-color: var(--red);
  background: #fdf1ee;
  color: var(--red);
  font-weight: 700;
}

.page-chip.active b {
  background: var(--red);
  color: #fff;
}

.page-chip.done b {
  background: #e6f3ea;
  color: var(--green);
}

.overview-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.overview-actions .btn {
  min-height: 42px;
  font-size: 12px;
}

.exam-paper {
  min-width: 0;
}

.paper-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 16px;
}

.paper-head .eyebrow {
  color: #9a6b20;
  font-size: 10px;
}

.paper-head h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 27px;
  letter-spacing: 0.03em;
}

.paper-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-count {
  flex: 0 0 auto;
  color: #a39281;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
}

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

.q-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.97);
  box-shadow: 0 4px 14px rgba(78, 44, 24, 0.045);
  padding: 20px 22px 16px;
  scroll-margin-top: 92px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.q-card:focus-within {
  border-color: #dac49a;
  box-shadow: 0 8px 24px rgba(125, 22, 26, 0.08);
}

.q-card.answered {
  border-left: 3px solid #c9a15b;
}

.q-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.q-index {
  color: #b08b55;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.q-type {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.type-single {
  color: #8c5d11;
  background: #fbf1dc;
}

.type-multi {
  color: #7d161a;
  background: #f9e7e5;
}

.type-judge {
  color: #27664a;
  background: #e7f3eb;
}

.q-score {
  margin-left: auto;
  color: #ab9a88;
  font-size: 10px;
  white-space: nowrap;
}

.q-stem {
  margin: 0 0 14px;
  color: #32271f;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

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

.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #e9dfcf;
  border-radius: 11px;
  background: #fffefb;
  color: #4c3e33;
  font-size: 13px;
  line-height: 1.6;
  cursor: pointer;
  transition:
    border-color 0.14s ease,
    background 0.14s ease,
    box-shadow 0.14s ease;
}

.option:hover {
  border-color: #d7bd8d;
  background: #fffbf3;
}

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option-key {
  flex: 0 0 auto;
  display: inline-grid;
  place-content: center;
  width: 25px;
  height: 25px;
  margin-top: 0;
  border: 1px solid #d8c8b2;
  border-radius: 50%;
  background: #fffdf8;
  color: #806b56;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.14s ease;
}

.option-key.multi-key {
  border-radius: 7px;
}

.option-text {
  padding-top: 2px;
  word-break: break-word;
}

.option.selected {
  border-color: var(--red);
  background: #fdf2ef;
  box-shadow: inset 0 0 0 1px rgba(125, 22, 26, 0.08);
}

.option.selected .option-key {
  border-color: var(--red);
  background: var(--red);
  color: #fff8eb;
}

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

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

.option.wrong {
  border-color: #e0a49f;
  background: var(--wrong-soft);
}

.option.wrong .option-key {
  border-color: var(--wrong);
  background: var(--wrong);
  color: #fff;
}

.option-mark {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.option.correct .option-mark {
  color: var(--green);
}

.option.wrong .option-mark {
  color: var(--wrong);
}

.multi-tip {
  margin: 10px 0 0;
  color: #a18f7d;
  font-size: 10px;
}

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

.pager .btn {
  min-width: 108px;
}

.pager-mid {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.exam-dock {
  display: none;
}

/* Result */
.result-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.result-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 30px 34px;
  border-radius: 24px;
  color: #fff9ee;
  background:
    radial-gradient(circle at 88% 14%, rgba(234, 211, 162, 0.18), transparent 32%),
    linear-gradient(125deg, #5a0e12 0%, #7d161a 55%, #9b2422 100%);
  box-shadow: 0 22px 48px rgba(91, 15, 19, 0.22);
}

.result-hero::after {
  content: "答 卷";
  position: absolute;
  right: 30px;
  bottom: -8px;
  color: rgba(234, 211, 162, 0.09);
  font-family: var(--font-display);
  font-size: 104px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.score-orb {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(234, 211, 162, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.035);
  text-align: center;
}

.score-orb strong {
  font-family: var(--font-display);
  font-size: 55px;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.score-orb span {
  margin-top: 5px;
  color: var(--gold-soft);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.result-heading {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.result-heading .eyebrow {
  color: var(--gold-soft);
  font-size: 10px;
}

.result-heading h1 {
  margin: 9px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: 0.05em;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  color: rgba(255, 249, 238, 0.72);
  font-size: 12px;
}

.result-meta b {
  color: #fff6e4;
  font-size: 14px;
}

.result-hero .btn {
  position: relative;
  z-index: 1;
  margin-left: auto;
  flex: 0 0 auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.stat-top b {
  color: #6f5a46;
  font-size: 12px;
}

.stat-value {
  margin-top: 8px;
  color: var(--red);
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.1;
}

.stat-value small {
  color: #a08f7d;
  font-family: var(--font-body);
  font-size: 11px;
}

.stat-note {
  margin-top: 6px;
  color: #a08f7d;
  font-size: 10px;
}

.retake-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 14px 18px;
  border: 1px dashed #dcc9a5;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffaf1, #fdf5e7);
}

.retake-copy {
  min-width: 0;
}

.retake-copy b {
  display: block;
  color: #6f4b16;
  font-size: 12px;
}

.retake-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.retake-bar .btn {
  flex: 0 0 auto;
  min-height: 38px;
  font-size: 12px;
}

.attempt-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border: 1px solid #e3cfaa;
  border-radius: 4px;
  color: #9b6c18;
  font-size: 8px;
  font-weight: 400;
  vertical-align: 1px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 22px 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 249, 0.7);
  width: fit-content;
  max-width: 100%;
}

.tab-btn {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tab-btn.active {
  color: #fff8eb;
  background: var(--red);
  box-shadow: 0 6px 14px rgba(125, 22, 26, 0.18);
}

.board-card,
.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
}

.board-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.04em;
}

.board-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.board-sum {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--paper-2);
  color: #8b6a31;
  border: 1px solid #e8d6b3;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 8px 8px;
  -webkit-overflow-scrolling: touch;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 620px;
}

.board-table th {
  padding: 10px 10px;
  color: #9a8876;
  font-size: 10px;
  font-weight: 400;
  text-align: left;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.board-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #f0e7da;
  color: #544438;
  vertical-align: middle;
  white-space: nowrap;
}

.board-table tr:last-child td {
  border-bottom: 0;
}

.board-table tr.self td {
  background: #fdf4e7;
}

.board-table tr.self td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}

.rank-badge {
  display: inline-grid;
  place-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f2eadc;
  color: #7f6b55;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.rank-badge.top1 {
  background: linear-gradient(135deg, #e4c276, #c08a2b);
  color: #fff;
  box-shadow: 0 4px 10px rgba(192, 138, 43, 0.25);
}

.rank-badge.top2 {
  background: linear-gradient(135deg, #d8d2c7, #a19a8e);
  color: #fff;
}

.rank-badge.top3 {
  background: linear-gradient(135deg, #d9ab84, #ab6e43);
  color: #fff;
}

.seat-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seat-mini b {
  color: #8a5d1b;
  font-family: var(--font-display);
  font-size: 12px;
}

.me-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  vertical-align: 1px;
}

.score-cell {
  color: var(--red);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.score-cell small {
  color: #aa9886;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 400;
}

.pending-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  color: #a08c77;
  background: #f3ede3;
  font-size: 9px;
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.review-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf9;
  color: #7d6b5b;
  font-size: 11px;
}

.filter-btn.active {
  border-color: var(--red);
  background: #fdf1ee;
  color: var(--red);
  font-weight: 700;
}

.review-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.review-item {
  border: 1px solid #ece1d1;
  border-radius: 13px;
  background: #fffefb;
  padding: 16px 17px;
}

.review-item.wrong {
  border-left: 3px solid #c9574e;
}

.review-item.right {
  border-left: 3px solid #6cae86;
}

.review-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review-item-head .q-index {
  font-size: 12px;
}

.result-pill {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}

.result-pill.right {
  color: var(--green);
  background: var(--green-soft);
}

.result-pill.wrong {
  color: var(--wrong);
  background: var(--wrong-soft);
}

.result-pill.empty {
  color: #9d8b78;
  background: #f2ece2;
}

.review-stem {
  margin: 0 0 11px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}

.review-options {
  display: grid;
  gap: 6px;
}

.review-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #eee4d4;
  border-radius: 8px;
  color: #5b4b3e;
  font-size: 11px;
  line-height: 1.6;
}

.review-option .option-key {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.review-option.correct {
  border-color: #b9dbc6;
  background: #f0f9f3;
}

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

.review-option.wrong {
  border-color: #e7b6b1;
  background: #fdf1f0;
}

.review-option.wrong .option-key {
  border-color: var(--wrong);
  background: var(--wrong);
  color: #fff;
}

.review-answer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #eee3d3;
  color: #8d7b68;
  font-size: 10px;
}

.review-answer-line b {
  color: #534335;
  font-size: 11px;
}

.review-answer-line .good {
  color: var(--green);
}

.review-answer-line .bad {
  color: var(--wrong);
}

.explanation {
  margin: 9px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #faf5ea;
  color: #756553;
  font-size: 10px;
  line-height: 1.7;
}

.empty-state {
  padding: 46px 18px;
  color: #9d8b78;
  font-size: 12px;
  text-align: center;
}

.result-foot {
  margin-top: 20px;
  color: #9d8c7a;
  font-size: 10px;
  line-height: 1.8;
  text-align: center;
}

/* Modals and toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(45, 28, 18, 0.52);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.16s ease;
}

.modal {
  width: min(560px, 100%);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(234, 211, 162, 0.4);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(40, 20, 10, 0.32);
  overflow: hidden;
  animation: modalIn 0.18s ease;
}

.modal.wide {
  width: min(720px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.03em;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.icon-btn {
  display: inline-grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf9;
  color: #8b7763;
  font-size: 18px;
  line-height: 1;
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: #fdf8ef;
}

.sheet-section {
  margin-bottom: 16px;
}

.sheet-section:last-child {
  margin-bottom: 0;
}

.sheet-section h4 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  color: #7f6b56;
  font-size: 11px;
  font-weight: 700;
}

.sheet-section h4 span {
  color: #ad9b88;
  font-weight: 400;
}

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

.sheet-num {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefb;
  color: #8b7763;
  font-size: 10px;
}

.sheet-num.answered {
  border-color: #d8b16a;
  background: #fbf1dc;
  color: #855b16;
  font-weight: 700;
}

.sheet-num.current {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 10px rgba(125, 22, 26, 0.2);
}

.confirm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 4px 0 16px;
}

.confirm-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  text-align: center;
}

.confirm-stat b {
  display: block;
  color: var(--red);
  font-family: var(--font-display);
  font-size: 24px;
}

.confirm-stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid #ead7b4;
  border-radius: 10px;
  background: #fdf7e9;
  color: #745b35;
  font-size: 11px;
  line-height: 1.7;
}

.notice.warn {
  border-color: #ecc5c0;
  background: #fdf2f0;
  color: #8a3a32;
}

.notice b {
  color: inherit;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 200;
  transform: translateX(-50%) translateY(8px);
  max-width: min(88vw, 480px);
  padding: 11px 18px;
  border: 1px solid rgba(234, 211, 162, 0.3);
  border-radius: 999px;
  background: rgba(54, 30, 20, 0.94);
  color: #fff9ec;
  box-shadow: 0 14px 30px rgba(30, 15, 8, 0.25);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: rgba(125, 22, 26, 0.96);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: #f6efe3;
  color: var(--red);
  font-size: 14px;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.q-card {
  animation: rise 0.28s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

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

  .join-panel {
    position: static;
  }

  .exam-wrap {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 14px;
  }

  .exam-overview {
    position: static;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 16px;
  }

  .overview-progress {
    min-width: 0;
  }

  .page-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 6px;
    margin-top: 2px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .page-nav::-webkit-scrollbar {
    display: none;
  }

  .page-chip {
    flex: 0 0 auto;
    min-width: 64px;
    padding: 6px 8px;
  }

  .overview-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    gap: 6px;
    margin-top: 0;
  }

  .overview-actions .btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 11px;
  }

  .overview-actions .btn-primary {
    display: none;
  }

  .hero {
    padding: 32px 28px 28px;
  }

  .result-hero {
    padding: 24px;
    gap: 20px;
  }

  .score-orb {
    width: 112px;
    height: 112px;
  }

  .score-orb strong {
    font-size: 46px;
  }

  .result-hero .btn {
    display: none;
  }

  .exam-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(232, 220, 200, 0.95);
    background: rgba(255, 252, 245, 0.96);
    box-shadow: 0 -8px 22px rgba(70, 40, 20, 0.08);
    backdrop-filter: blur(8px);
  }

  .dock-btn {
    min-width: 88px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf9;
    color: #5b4839;
    font-size: 12px;
    font-weight: 700;
  }

  .dock-btn.main {
    flex: 1;
    border-color: transparent;
    background: var(--red);
    color: #fff8eb;
  }

  .dock-btn:disabled {
    opacity: 0.42;
  }

  .dock-page {
    flex: 0 0 auto;
    color: #8b7763;
    font-size: 10px;
    text-align: center;
    line-height: 1.3;
  }

  .dock-page b {
    display: block;
    color: var(--red);
    font-family: var(--font-display);
    font-size: 14px;
  }

  .exam-body {
    padding-bottom: 82px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 28px);
    padding-top: 16px;
    padding-bottom: 42px;
  }

  .site-head {
    padding-bottom: 12px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-sub {
    font-size: 9px;
  }

  .head-note {
    display: none;
  }

  .hero {
    border-radius: 20px;
    padding: 26px 21px 24px;
  }

  .hero h1 {
    margin-top: 10px;
    font-size: 35px;
  }

  .hero-lead {
    font-size: 13px;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 20px;
  }

  .hero-stat {
    min-width: 0;
    padding: 9px 8px;
    text-align: center;
  }

  .hero-stat b {
    font-size: 19px;
  }

  .hero-stat span {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .hero-mark {
    display: none;
  }

  .home-grid {
    margin-top: 14px;
    gap: 14px;
  }

  .panel-pad {
    padding: 17px 14px;
  }

  .panel-head h2 {
    font-size: 19px;
  }

  .seat-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .seat-btn {
    min-height: 50px;
    border-radius: 9px;
    padding: 5px 2px;
  }

  .seat-btn b {
    font-size: 15px;
  }

  .seat-btn small {
    font-size: 8px;
  }

  .rules-panel {
    margin-top: 0;
  }

  .join-panel .panel-pad {
    padding-top: 15px;
  }

  .selected-seat {
    padding: 11px 13px;
  }

  .selected-seat b {
    font-size: 23px;
  }

  .field {
    margin-top: 14px;
  }

  .field input {
    height: 47px;
  }

  .exam-top-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand timer submit"
      "who save submit";
    align-items: center;
    width: calc(100% - 22px);
    gap: 1px 9px;
    padding: 6px 0;
    min-height: 0;
  }

  .exam-brand {
    grid-area: brand;
    align-self: end;
  }

  .exam-brand .seal {
    width: 31px;
    height: 31px;
    font-size: 10px;
  }

  .exam-brand strong {
    font-size: 14px;
  }

  .exam-brand span {
    display: none;
  }

  .exam-who {
    grid-area: who;
    align-self: start;
    gap: 4px;
    margin-left: 0;
    font-size: 9px;
    line-height: 1.2;
  }

  .exam-who b {
    font-size: 11px;
  }

  .exam-who .tag {
    display: none;
  }

  .save-line {
    grid-area: save;
    justify-self: end;
    align-self: start;
    padding: 0;
    font-size: 9px;
    line-height: 1.2;
  }

  .timer {
    grid-area: timer;
    align-self: end;
    font-size: 11px;
  }

  .exam-top-btn {
    grid-area: submit;
    align-self: center;
    height: 42px;
    padding: 0 12px;
    font-size: 11px;
  }

  .exam-wrap {
    width: calc(100% - 22px);
  }

  .exam-overview {
    grid-template-columns: 1fr auto;
    padding: 12px 13px;
    border-radius: 13px;
  }

  .overview-label strong {
    font-size: 15px;
  }

  .page-chip {
    min-width: 56px;
    font-size: 9px;
    padding: 5px 6px;
  }

  .page-chip b {
    width: 15px;
    height: 15px;
    font-size: 8px;
  }

  .overview-actions .btn {
    min-height: 33px;
    padding: 0 9px;
    font-size: 10px;
  }

  .paper-head {
    align-items: flex-end;
    padding-bottom: 12px;
  }

  .paper-head h2 {
    font-size: 23px;
  }

  .paper-head p {
    font-size: 10px;
  }

  .page-count {
    font-size: 10px;
  }

  .question-list {
    gap: 10px;
  }

  .q-card {
    border-radius: 13px;
    padding: 16px 14px 13px;
  }

  .q-stem {
    font-size: 14px;
    line-height: 1.7;
  }

  .option {
    padding: 9px 10px;
    font-size: 12px;
    min-height: 41px;
  }

  .option-key {
    width: 23px;
    height: 23px;
    font-size: 11px;
  }

  .pager {
    display: none;
  }

  .result-shell {
    width: calc(100% - 22px);
    padding-top: 14px;
  }

  .result-hero {
    display: block;
    border-radius: 18px;
    padding: 20px;
  }

  .score-orb {
    width: 92px;
    height: 92px;
    margin-bottom: 15px;
  }

  .score-orb strong {
    font-size: 38px;
  }

  .score-orb span {
    font-size: 9px;
  }

  .result-heading h1 {
    font-size: 26px;
    margin: 7px 0 8px;
  }

  .result-meta {
    font-size: 10px;
    gap: 6px 12px;
  }

  .result-meta b {
    font-size: 12px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 10px;
  }

  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
  }

  .stat-top {
    display: block;
  }

  .stat-top b {
    display: block;
    margin-top: 3px;
  }

  .stat-value {
    margin: 0;
    font-size: 23px;
  }

  .stat-note {
    display: none;
  }

  .retake-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 12px 13px;
  }

  .retake-bar .btn {
    width: 100%;
  }

  .tabs {
    width: 100%;
    margin: 14px 0 10px;
  }

  .tab-btn {
    flex: 1;
    padding: 0 10px;
    font-size: 11px;
  }

  .board-head {
    padding: 15px 14px 11px;
  }

  .board-head h2 {
    font-size: 18px;
  }

  .board-sum {
    font-size: 10px;
    padding: 5px 8px;
  }

  .board-table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
    font-size: 10px;
  }

  .board-table th,
  .board-table td {
    padding: 9px 5px;
  }

  .board-table th:nth-child(5),
  .board-table td:nth-child(5),
  .board-table th:nth-child(6),
  .board-table td:nth-child(6),
  .board-table th:nth-child(7),
  .board-table td:nth-child(7) {
    display: none;
  }

  .board-table th:nth-child(3),
  .board-table td:nth-child(3) {
    max-width: 96px;
    white-space: normal;
    word-break: break-all;
  }

  .rank-badge {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .score-cell {
    font-size: 14px;
  }

  .review-head {
    padding: 12px;
    gap: 8px;
  }

  .review-filters {
    width: 100%;
  }

  .filter-btn {
    flex: 1;
    padding: 0 7px;
    font-size: 10px;
  }

  .review-list {
    padding: 9px;
    gap: 9px;
  }

  .review-item {
    padding: 13px 12px;
  }

  .review-stem {
    font-size: 12px;
  }

  .modal-backdrop {
    padding: 11px;
    align-items: end;
  }

  .modal {
    max-height: 88vh;
    border-radius: 16px;
  }

  .modal-head {
    padding: 17px 16px 12px;
  }

  .modal-head h3 {
    font-size: 19px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-foot {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .modal-foot .btn {
    flex: 1;
    min-height: 44px;
    padding: 0 10px;
    font-size: 12px;
  }

  .sheet-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
  }

  .sheet-num {
    height: 31px;
  }

  .confirm-stats {
    gap: 6px;
  }

  .confirm-stat {
    padding: 10px 6px;
  }

  .confirm-stat b {
    font-size: 20px;
  }

  .toast {
    bottom: calc(18px + env(safe-area-inset-bottom));
    font-size: 11px;
    padding: 10px 15px;
  }

  .home-foot {
    margin-top: 18px;
    font-size: 10px;
  }
}

/* Simplified mobile edition */
.simple-home-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

.entry-card .panel-head {
  margin-bottom: 8px;
}

.entry-form {
  margin-top: 10px;
}

.entry-form .field {
  margin-top: 15px;
}

.entry-form .btn-block {
  margin-top: 18px;
}

.simple-rules {
  margin-top: 0;
}

.entry-note {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed #dcc9a5;
  border-radius: 11px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.entry-note b {
  color: #8a5d1b;
  font-size: 11px;
}

.who-class {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-board {
  min-width: 660px;
}

.class-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-actions {
  margin-top: 16px;
  text-align: center;
}

.result-actions .link-btn {
  display: inline-block;
  width: auto;
  margin: 0;
  color: #9b7a3b;
}

@media (max-width: 900px) {
  .simple-home-grid {
    grid-template-columns: 1fr;
  }

  .simple-rules {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .simple-board {
    min-width: 0;
  }

  .simple-board th:nth-child(5),
  .simple-board td:nth-child(5) {
    display: table-cell;
  }

  .simple-board th:nth-child(6),
  .simple-board td:nth-child(6) {
    display: none;
  }

  .simple-board .class-cell {
    max-width: 82px;
    white-space: normal;
    word-break: break-all;
  }

  .who-class {
    max-width: 74px;
  }
}

/* Network check */
.test-shell {
  width: min(720px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.test-card {
  padding: 34px 38px 30px;
  text-align: center;
}

.test-orb {
  display: grid;
  place-content: center;
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  border: 2px solid #e5c98f;
  border-radius: 50%;
  background: #fdf6e9;
  color: #a9791f;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
}

.test-orb.pending {
  animation: pulse 1.3s infinite;
}

.test-orb.success {
  border-color: #9bc9ad;
  background: var(--green-soft);
  color: var(--green);
}

.test-orb.fail {
  border-color: #e0a49f;
  background: var(--wrong-soft);
  color: var(--wrong);
}

.test-eyebrow {
  color: #9a6b20;
  font-size: 10px;
}

.test-card h1 {
  margin: 10px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(27px, 5vw, 38px);
  letter-spacing: 0.04em;
}

.test-message {
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.test-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffdf9;
  text-align: left;
}

.test-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f2eadc;
  font-size: 11px;
}

.test-row:last-child {
  border-bottom: 0;
}

.test-row span {
  flex: 0 0 auto;
  color: var(--muted);
}

.test-row b {
  max-width: 75%;
  color: #4b3b2e;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.test-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 22px;
}

.test-actions .btn {
  min-width: 132px;
}

.test-help {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed #e8dcc8;
  color: #6e5c4b;
  font-size: 11px;
  line-height: 1.8;
  text-align: left;
}

.test-help p {
  margin: 0 0 8px;
}

.test-help ol {
  margin: 0 0 10px;
  padding-left: 19px;
}

.test-help li {
  margin-bottom: 3px;
}

.test-help .test-note {
  margin-bottom: 0;
  color: #9b8a77;
  font-size: 10px;
}

.test-error {
  margin: 15px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--wrong-soft);
  color: var(--wrong);
  font-size: 10px;
  line-height: 1.7;
  text-align: left;
  word-break: break-all;
}

@media (max-width: 640px) {
  .test-shell {
    width: calc(100% - 22px);
    padding-top: 14px;
  }

  .test-card {
    padding: 24px 18px 22px;
  }

  .test-orb {
    width: 78px;
    height: 78px;
    font-size: 36px;
    margin-bottom: 14px;
  }

  .test-card h1 {
    font-size: 27px;
  }

  .test-message {
    font-size: 12px;
  }

  .test-details {
    margin-top: 16px;
    padding: 3px 12px;
  }

  .test-row {
    gap: 8px;
    font-size: 10px;
  }

  .test-actions {
    margin-top: 16px;
  }

  .test-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    font-size: 12px;
  }

  .test-help {
    margin-top: 18px;
    padding-top: 14px;
    font-size: 10px;
  }
}

/* Admin */
.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.admin-login {
  width: min(430px, 100%);
  margin: 12vh auto 0;
}

.admin-login .panel-pad {
  padding: 30px;
}

.admin-login h1 {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: 27px;
  letter-spacing: 0.04em;
}

.admin-login p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

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

.admin-top h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
}

.admin-top p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.admin-stat {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow-soft);
}

.admin-stat span {
  color: var(--muted);
  font-size: 10px;
}

.admin-stat b {
  display: block;
  margin-top: 5px;
  color: var(--red);
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
  font-size: 11px;
}

.admin-table th {
  padding: 10px 9px;
  color: #998674;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 9px;
  border-bottom: 1px solid #f0e7da;
  color: #554538;
  white-space: nowrap;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tr:hover td {
  background: #fffaf1;
}

.admin-status {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
}

.admin-status.submitted {
  color: var(--green);
  background: var(--green-soft);
}

.admin-status.in_progress {
  color: #91651c;
  background: #fbf1dc;
}

.admin-status.not_started {
  color: #9f8e7b;
  background: #f2ece2;
}

.text-btn {
  padding: 3px 7px;
  border: 1px solid #dfd2bf;
  border-radius: 6px;
  background: #fffdf9;
  color: #8d4f28;
  font-size: 9px;
}

.text-btn:hover {
  border-color: #c9a26e;
  background: #fff8ed;
}

.admin-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

@media (max-width: 720px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-toolbar {
    width: 100%;
  }

  .admin-toolbar .btn {
    flex: 1;
    min-width: 100px;
    padding: 0 10px;
    font-size: 11px;
  }
}
