:root {
  --ink: #1a1a1a;
  --ink-soft: #5a5a5a;
  --paper: #f5f5f2;
  --paper-2: #ebebe6;
  --surface: #ffffff;
  --brand: #b8cc00;
  --brand-deep: #8fa000;
  --brand-ink: #1a1a1a;
  --gray: #5a5a5a;
  --line: rgba(26, 26, 26, 0.12);
  --danger: #c62828;
  --ok: #2e7d32;
  --shadow: 0 10px 28px rgba(26, 26, 26, 0.08);
  --radius: 16px;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  position: relative;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(184, 204, 0, 0.18), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(90, 90, 90, 0.08), transparent 50%),
    linear-gradient(180deg, #fafaf7 0%, #f2f2ee 50%, #ecece6 100%);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  pointer-events: none;
}

a {
  color: var(--brand-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  text-transform: uppercase;
}

.brand span {
  color: var(--brand-deep);
}

.brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.top-link,
.top-actions {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.top-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}

.top-link:hover {
  color: var(--brand-deep);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  color: var(--ink);
}

h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
  color: var(--ink);
}

.lead {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-soft);
}

.page-home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page-home .topbar {
  flex-shrink: 0;
}

.hero {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: flex-start;
}

.hero-copy {
  animation: rise 0.5s ease both;
}

.hero-copy .lead {
  max-width: none;
}

.start-form,
.login-wrap .start-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease 0.08s both;
  width: 100%;
}

.form-hint {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.7rem 0 0.3rem;
  color: var(--ink);
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
  color: #9a9a9a;
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(184, 204, 0, 0.28);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s, box-shadow 0.2s, color 0.2s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  margin-top: 1rem;
  width: 100%;
  box-shadow: 0 8px 20px rgba(184, 204, 0, 0.3);
}

.btn-primary:hover {
  background: #c5db00;
  color: var(--brand-ink);
}

.btn-ghost {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: rgba(26, 26, 26, 0.25);
  color: var(--ink);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.alert {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  padding: 0.75rem 1rem calc(0.9rem + var(--safe-bottom));
  color: var(--gray);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.site-footer p {
  margin: 0;
}

.page-test {
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar-test {
  max-width: 960px;
  width: 100%;
  padding: 0.65rem 1rem 0.5rem;
}

.test-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem 0.75rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.progress-label {
  font-weight: 600;
  color: var(--brand-deep);
}

.exam-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(184, 204, 0, 0.2);
  border: 1px solid var(--brand);
  color: var(--brand-deep);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.exam-timer.is-warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.exam-timer.is-critical {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  animation: exam-pulse 1s ease infinite;
}

@keyframes exam-pulse {
  50% { opacity: 0.7; }
}

.settings-form {
  max-width: 420px;
  margin-top: 1rem;
}

.alert-ok {
  background: #ecfdf3;
  color: #067647;
  border-color: #abefc6;
}

.timer-settings {
  max-width: 520px;
  margin-top: 0.5rem;
  padding: 1.35rem 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.timer-settings-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.timer-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.timer-title {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
}

.timer-status {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(184, 204, 0, 0.22);
  border: 1px solid var(--brand);
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.timer-status.is-off {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #6b7280;
}

.timer-stepper {
  display: grid;
  grid-template-columns: 3.25rem 1fr 3.25rem;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.timer-step {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.timer-step:hover {
  border-color: var(--brand);
  background: rgba(184, 204, 0, 0.12);
}

.timer-step:active {
  transform: scale(0.96);
}

.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.85rem 1rem 0.95rem;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(184, 204, 0, 0.16), rgba(255, 255, 255, 0.9)),
    #fff;
  border: 1px solid rgba(143, 160, 0, 0.35);
}

.timer-display input[type="number"] {
  width: 5.5rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.timer-display input[type="number"]:focus {
  outline: none;
  box-shadow: none;
}

.timer-display input[type="number"]::-webkit-outer-spin-button,
.timer-display input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.timer-unit {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.timer-preset {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.timer-preset:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}

.timer-preset.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
}

.timer-hint {
  margin: 0 0 0.35rem;
}

.timer-save {
  margin-top: 0.85rem;
}

.lang-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.lang-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.lang-hub-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.lang-hub-card strong {
  font-size: 1.15rem;
  color: var(--brand-deep);
}

.lang-hub-card span {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.lang-edit-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(184, 204, 0, 0.15);
  border: 1px solid var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.progress-track {
  width: calc(100% - 2rem);
  max-width: 928px;
  margin: 0 auto;
  height: 5px;
  background: rgba(26, 26, 26, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand));
  transition: width 0.3s ease;
}

.test-wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem calc(0.5rem + var(--safe-bottom));
}

#testForm {
  display: block;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem;
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.question-card.needs-answer {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.q-num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.q-type {
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--paper-2);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.q-text {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.2vw, 1.4rem);
  font-weight: 650;
  margin: 0 0 1rem;
  line-height: 1.35;
  color: var(--ink);
}

.q-image-wrap {
  margin: 0 0 1rem;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
}

.q-image {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: inline-block;
}

.passage {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--paper-2);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
}

.speak-passage {
  font-size: 1.05rem;
  line-height: 1.6;
}

.speak-box {
  display: grid;
  gap: 0.65rem;
}

.speak-help {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.speak-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.btn-record {
  background: #c62828;
  color: #fff;
  margin-top: 0;
  width: auto;
  min-width: 120px;
  box-shadow: 0 6px 16px rgba(198, 40, 40, 0.25);
}

.btn-record:hover {
  background: #b71c1c;
  color: #fff;
}

.btn-record:disabled {
  opacity: 0.5;
}

.speak-timer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-deep);
  margin-left: 0.25rem;
}

.speak-playback {
  width: 100%;
  margin-top: 0.25rem;
}

.speak-status {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.speak-status.is-ok {
  color: var(--ok);
  font-weight: 600;
}

.write-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  min-height: 140px;
  line-height: 1.45;
}

.write-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(184, 204, 0, 0.28);
}

.word-count {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.word-count.is-ok {
  color: var(--ok);
  font-weight: 600;
}

.question-card.needs-answer .write-input,
.question-card.needs-answer .speak-box {
  outline: 2px solid rgba(198, 40, 40, 0.35);
  border-radius: 12px;
}

.passage-label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.passage-text {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink);
}

.blank-label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.blank-input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.blank-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(184, 204, 0, 0.28);
}

.question-card.needs-answer .blank-input {
  border-color: var(--danger);
}

.options {
  display: grid;
  gap: 0.55rem;
}

.options-tf {
  grid-template-columns: 1fr 1fr;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin: 0;
  font-weight: 500;
  font-size: 1rem;
  min-height: 48px;
  color: var(--ink);
}

.option:active {
  background: rgba(184, 204, 0, 0.08);
}

.option.is-selected,
.option:has(input:checked) {
  border-color: var(--brand-deep);
  background: rgba(184, 204, 0, 0.12);
}

.option input {
  margin-top: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand-deep);
  flex-shrink: 0;
}

.test-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 0.15rem 0 0.35rem;
}

.test-nav .btn {
  width: auto;
  min-width: 0;
  margin-top: 0;
  flex: 1;
  max-width: 48%;
}

.test-nav .btn-ghost {
  order: 1;
}

.test-nav .btn-primary {
  order: 2;
  margin-left: 0;
}

.result-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  text-align: center;
  animation: rise 0.5s ease both;
}

.result-wrap .lead {
  margin: 0 auto 1.25rem;
}

.thanks-box {
  text-align: left;
  max-width: 34rem;
  margin: 0 auto 1.5rem;
  padding: 1.15rem 1.2rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.thanks-box p {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.thanks-box p:last-child {
  margin-bottom: 0;
}

.level-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.25rem 2rem;
  border-radius: 22px;
  background: var(--brand);
  color: var(--brand-ink);
  margin-bottom: 0.85rem;
  box-shadow: 0 12px 28px rgba(184, 204, 0, 0.28);
  animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.1s both;
}

.level-code {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
}

.level-name {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.85;
}

.level-desc {
  color: var(--ink-soft);
  max-width: 42ch;
  margin: 0 auto 1.15rem;
  font-size: 0.95rem;
}

.score-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.15rem;
}

.score-label {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.score-row strong {
  font-size: 1.2rem;
  color: var(--ink);
}

.note {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.result-wrap .btn {
  width: 100%;
  max-width: 280px;
}

.login-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: grid;
  gap: 1rem;
  justify-items: stretch;
}

.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
}

.admin-head {
  margin-bottom: 1rem;
}

.admin-head .lead {
  margin-top: 0.25rem;
}

.admin-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.admin-search-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.search-field {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.15rem;
  height: 1.15rem;
  color: var(--ink-soft);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 2.6rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(184, 204, 0, 0.28);
}

.filter-select {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  min-width: 140px;
}

.filter-select.full {
  width: 100%;
}

.filter-btn {
  width: auto;
  margin-top: 0;
  min-width: 100px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.question-form {
  max-width: 820px;
  margin-top: 1rem;
}

.btn-danger {
  background: #c62828 !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #b71c1c !important;
}

.level-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.summary-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.summary-chip:hover {
  border-color: var(--brand);
  color: var(--ink);
  text-decoration: none;
}

.summary-chip.is-active {
  background: rgba(184, 204, 0, 0.2);
  border-color: var(--brand);
  color: var(--ink);
}

.summary-chip strong {
  color: var(--brand-deep);
}

.row-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.btn-pdf {
  background: #fff !important;
  color: var(--brand-deep) !important;
  border: 1px solid var(--brand) !important;
  box-shadow: none !important;
}

.btn-pdf:hover {
  background: rgba(184, 204, 0, 0.18) !important;
  color: var(--brand-deep) !important;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th,
.results-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.results-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  background: rgba(184, 204, 0, 0.1);
}

.results-table tr:last-child td {
  border-bottom: none;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.level-pill {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(184, 204, 0, 0.18);
  color: var(--brand-deep);
  font-size: 0.82rem;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 2rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  color: var(--ink-soft);
}

.empty-state .btn {
  width: auto;
  margin-top: 0.85rem;
}

.name-link {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.name-link:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

.btn-small {
  display: inline-flex;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink) !important;
  text-decoration: none !important;
  width: auto;
  margin: 0;
  box-shadow: none;
}

.btn-small:hover {
  background: #c5db00;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}

.back-link:hover {
  color: var(--brand-deep);
}

.detail-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detail-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 0.25rem;
}

.detail-hero .lead {
  max-width: none;
  font-size: 0.95rem;
}

.detail-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.detail-score strong {
  font-size: 1.35rem;
  color: var(--ink);
}

.detail-section-title {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.answer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.answer-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.answer-item.is-correct {
  border-left: 4px solid var(--ok);
}

.answer-item.is-wrong {
  border-left: 4px solid var(--danger);
}

.answer-item.is-pending {
  border-left: 4px solid var(--accent);
}

.answer-item.is-pending .answer-status {
  color: #b45309;
}

.grade-select {
  width: 100%;
  max-width: 220px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  margin-bottom: 0.25rem;
}

.grade-save {
  width: auto;
  min-width: 200px;
  margin: 1.25rem 0 2rem;
}

.answer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.4rem;
}

.answer-num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.answer-status {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
}

.answer-item.is-correct .answer-status {
  color: var(--ok);
}

.answer-item.is-wrong .answer-status {
  color: var(--danger);
}

.answer-passage {
  margin: 0 0 0.55rem;
  padding: 0.65rem 0.75rem;
  background: var(--paper-2);
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.answer-question {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.answer-rows {
  display: grid;
  gap: 0.55rem;
}

.answer-rows strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-word;
  color: var(--ink);
}

.answer-writing {
  margin-top: 0.35rem;
  padding: 0.75rem 0.9rem;
  background: var(--paper-2);
  border-radius: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.95rem;
}

.admin-image {
  margin-bottom: 0.65rem;
}

.admin-image .q-image {
  max-height: 180px;
}

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

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 640px) {
  .answer-rows {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .topbar {
    padding: 0.9rem 1.25rem;
  }

  .brand {
    font-size: 1.25rem;
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 1.25rem 1.5rem;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 4vw, 2.6rem);
  }

  .start-form {
    padding: 1.35rem 1.35rem 1.4rem;
  }

  .test-wrap {
    padding: 0.9rem 1.25rem 0.75rem;
  }

  .question-card {
    padding: 1.35rem 1.35rem 1.4rem;
  }

  .test-nav .btn {
    flex: 0 1 auto;
    min-width: 140px;
    max-width: none;
  }

  .result-wrap .btn {
    width: auto;
  }
}
