@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #08080f;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1ff;
  --muted: #9aa3bd;
  --muted-dim: #6d7590;
  --primary: #8b93ff;
  --secondary: #63c9ff;
  --green: #4ade80;
  --red: #ff7a90;
  --grad: linear-gradient(115deg, #8b93ff 0%, #63c9ff 100%);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --paper: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.1;
}
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: rgba(139, 147, 255, 0.35); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ---------- background ---------- */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow { position: absolute; border-radius: 50%; filter: blur(90px); }
.glow-a {
  width: 640px; height: 640px;
  top: -260px; left: -180px;
  background: radial-gradient(circle, rgba(99, 201, 255, 0.16), transparent 65%);
}
.glow-b {
  width: 600px; height: 600px;
  bottom: -240px; right: -160px;
  background: radial-gradient(circle, rgba(139, 147, 255, 0.18), transparent 65%);
}
.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 75%);
}

/* ---------- shared ---------- */

.wrap {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

.dnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 8, 15, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.dnav-inner { height: 64px; display: flex; align-items: center; gap: 12px; }
.dbrand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
}
.dbrand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--grad);
  color: #0a0b14;
  font-size: 0.68rem;
  font-weight: 700;
}
.dbrand-name { font-size: 0.9rem; }
.dnav-sep { color: var(--muted-dim); }
.dnav-product { font-family: var(--font-display); font-size: 0.86rem; color: var(--muted); }
.dnav-back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.dnav-back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dnav-back:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

.app { flex: 1; padding: clamp(34px, 5vw, 60px) 0 56px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}
.spark { color: var(--secondary); }
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 30px;
  align-items: end;
  margin-bottom: clamp(30px, 4vw, 46px);
}
.page-head h1 {
  margin-top: 14px;
  font-size: clamp(2.3rem, 4.6vw, 3.7rem);
  line-height: 1.03;
}
.page-lede {
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.92rem;
  padding-bottom: 6px;
}

/* ---------- buttons ---------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--grad);
  color: #0a0b14;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(139, 147, 255, 0.24);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, filter 0.25s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 38px rgba(139, 147, 255, 0.34);
  filter: brightness(1.05);
}
.btn-ico {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.btn-ghost .btn-ico { width: 15px; height: 15px; }

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

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

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.setup { padding: 22px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}
.panel-head h2 { font-size: 1rem; }
.seed-chip {
  font-family: var(--font-display);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-dim);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.field { margin-bottom: 17px; }
.field label,
.field-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(8, 8, 15, 0.66);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.25s;
}
.select-wrap select:hover { border-color: rgba(139, 147, 255, 0.45); }
.select-wrap svg {
  position: absolute;
  right: 13px;
  top: 50%;
  width: 15px; height: 15px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.text-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(8, 8, 15, 0.66);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
}
.text-input:focus,
.select-wrap select:focus,
textarea:focus { outline: none; border-color: rgba(139, 147, 255, 0.55); }

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(8, 8, 15, 0.55);
}
.seg-btn {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.22s, background 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.seg-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.seg-btn.is-on {
  color: #fff;
  border-color: rgba(139, 147, 255, 0.42);
  background: rgba(139, 147, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.field-note {
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--muted-dim);
}

.setup-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.setup-actions .btn-primary { flex: 1; font-size: 0.82rem; padding: 0 12px; }
.setup-actions .btn-ghost { font-size: 0.78rem; padding: 0 12px; }
.backend-note {
  margin-top: 13px;
  font-size: 0.66rem;
  line-height: 1.5;
  color: var(--muted-dim);
}

/* ---------- admin ---------- */

.admin { overflow: hidden; }
.admin summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.admin summary::-webkit-details-marker { display: none; }
.admin summary::after {
  content: "";
  width: 7px; height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s;
}
.admin[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.admin-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 500;
}
.admin-title svg {
  width: 15px; height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
}
.admin-count {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--muted-dim);
}
.admin[open] summary { border-bottom: 1px solid var(--border); }
.admin-body { padding: 16px 20px 20px; }

.bank-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 264px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.bank-list::-webkit-scrollbar { width: 6px; }
.bank-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
.bank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.bank-q {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #c2c8db;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bank-tags {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.bank-badge {
  flex: none;
  font-family: var(--font-display);
  font-size: 0.57rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted-dim);
}
.bank-badge[data-d="easy"] { color: #8ce8b0; border-color: rgba(74, 222, 128, 0.28); }
.bank-badge[data-d="medium"] { color: #b9c2ff; border-color: rgba(139, 147, 255, 0.3); }
.bank-badge[data-d="hard"] { color: #ffc578; border-color: rgba(251, 191, 36, 0.26); }
.bank-del {
  flex: none;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 122, 144, 0.28);
  border-radius: 5px;
  background: rgba(255, 122, 144, 0.06);
  color: #ff9cad;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.bank-del:hover { background: rgba(255, 122, 144, 0.16); border-color: rgba(255, 122, 144, 0.55); }

.add-form {
  padding-top: 15px;
  border-top: 1px dashed var(--border);
}
.add-form h3 { font-size: 0.82rem; margin-bottom: 10px; }
.add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.add-row .select-wrap select { height: 38px; font-size: 0.74rem; }
.add-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: rgba(8, 8, 15, 0.66);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 58px;
}
.add-form textarea::placeholder { color: var(--muted-dim); }
.btn-add { width: 100%; height: 38px; margin-top: 7px; font-size: 0.78rem; border-radius: 9px; }
.admin-note { margin-top: 9px; font-size: 0.64rem; color: var(--muted-dim); line-height: 1.5; }

/* ---------- preview ---------- */

.preview-col { min-width: 0; }

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 9px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 12px;
}
.preview-id {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(8, 8, 15, 0.5);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.tool-btn svg {
  width: 13px; height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-btn:hover { background: rgba(139, 147, 255, 0.1); border-color: rgba(139, 147, 255, 0.45); }

.sheet {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding: clamp(26px, 4vw, 52px);
  border-radius: 12px;
  background: #fdfcf7;
  color: #172033;
  font-family: var(--paper);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
  animation: paper-in 0.55s var(--ease) both;
}
@keyframes paper-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sheet.is-building { animation: paper-in 0.55s var(--ease) both; }

.sheet-brand {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #6b7280;
  padding-bottom: 10px;
  border-bottom: 2px solid #1f2937;
}
.sheet h2 {
  margin-top: 16px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2.3vw, 1.62rem);
  letter-spacing: -0.01em;
  color: #111827;
}
.sheet-class {
  margin-top: 5px;
  text-align: center;
  font-size: 0.84rem;
  color: #4b5563;
}

.sheet-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 20px;
  margin-top: 16px;
  padding: 10px 2px;
  border-top: 1px solid #d7dae2;
  border-bottom: 1px solid #d7dae2;
  font-size: 0.8rem;
  color: #374151;
}
.sheet-meta b { font-weight: 600; color: #111827; }

.candidate {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 16px;
  font-size: 0.82rem;
  color: #374151;
}
.candidate span { display: inline-flex; align-items: baseline; gap: 7px; }
.candidate i {
  display: inline-block;
  width: 130px;
  border-bottom: 1px dotted #9ca3af;
  transform: translateY(-3px);
}

.instructions {
  margin-top: 18px;
  padding: 12px 16px;
  background: #f2f1e9;
  border-left: 3px solid #8b93ff;
  border-radius: 0 6px 6px 0;
}
.instructions h3 {
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4b5563;
  margin-bottom: 6px;
}
.instructions ol {
  margin: 0;
  padding-left: 18px;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #4b5563;
}
.instructions li::marker { color: #8b93ff; font-weight: 600; }

.sheet-section { margin-top: 26px; }
.sheet-section + .sheet-section { break-inside: avoid; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1f2937;
}
.section-head h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #111827;
}
.section-head span {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: #6b7280;
  white-space: nowrap;
}
.section-hint {
  margin-top: 5px;
  font-size: 0.7rem;
  font-style: italic;
  color: #6b7280;
}
.sheet-questions {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  counter-reset: none;
}
.sheet-questions li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 34px;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dotted #e2e4ea;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #1f2937;
  break-inside: avoid;
}
.sheet-questions li:last-child { border-bottom: 0; }
.q-num {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: #6b7280;
  padding-top: 2px;
}
.q-marks {
  text-align: right;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: #4b5563;
  padding-top: 2px;
}
.custom-flag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 4px;
  border: 1px solid #c7cbe0;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
  vertical-align: 1px;
}

.sheet-foot {
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px solid #d7dae2;
  text-align: center;
  font-size: 0.68rem;
  color: #6b7280;
}
.sheet-foot strong { display: block; font-family: var(--font-display); letter-spacing: 0.08em; color: #374151; }
.sheet-foot span { display: block; margin-top: 4px; font-size: 0.6rem; }

.preview-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  max-width: 820px;
  margin: 12px auto 0;
  padding: 0 4px;
  font-size: 0.66rem;
  color: var(--muted-dim);
}

/* ---------- footer ---------- */

.dfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 0 30px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--muted-dim);
}
.dfoot a { color: var(--muted); text-decoration: none; }
.dfoot a:hover { color: var(--text); }
.dfoot-links { display: flex; gap: 18px; }
.dfoot-links a { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.15); text-underline-offset: 3px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .setup { height: 100%; }
  .preview-col { max-width: 860px; width: 100%; margin-inline: auto; }
}

@media (max-width: 900px) {
  .page-head { grid-template-columns: 1fr; gap: 16px; }
  .page-lede { max-width: 62ch; }
  .controls { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .dbrand-name { display: none; }
  .dnav-sep { display: none; }
  .dnav-product { font-size: 0.8rem; }
  .dnav-inner { height: 58px; }
  .dnav-back { font-size: 0.74rem; padding: 7px 10px; }
  .app { padding-top: 28px; }
  .page-head h1 { font-size: clamp(2.05rem, 9.6vw, 2.8rem); }
  .sheet { padding: 24px 20px; }
  .sheet-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 14px; font-size: 0.74rem; }
  .sheet-questions li { font-size: 0.8rem; grid-template-columns: 22px minmax(0, 1fr) 26px; gap: 5px; }
  .candidate i { width: 90px; }
  .preview-toolbar { padding: 8px 10px 8px 13px; }
  .dfoot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .wrap { width: calc(100% - 28px); }
  .setup { padding: 18px 16px; }
  .setup-actions { flex-direction: column; }
  .setup-actions .btn-ghost { width: 100%; }
  .sheet { padding: 20px 15px; border-radius: 8px; }
  .candidate { flex-direction: column; }
  .sheet-questions li { font-size: 0.77rem; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* ---------- print ---------- */

@media print {
  @page { size: A4; margin: 13mm 14mm; }
  html, body { background: #fff !important; color: #000; display: block; }
  .page-bg, .dnav, .dfoot, .controls, .preview-toolbar, .preview-note, .page-head {
    display: none !important;
  }
  .wrap { width: 100%; }
  .app { padding: 0; }
  .workspace { display: block; }
  .preview-col { max-width: none; }
  .sheet {
    max-width: none;
    width: auto;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    background: #fff;
    color: #000;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .sheet-brand, .sheet-meta, .section-head, .sheet-foot { color: #000; }
  .sheet-brand { padding-bottom: 6px; }
  .sheet h2 { margin-top: 10px; font-size: 21px; }
  .sheet-class { margin-top: 3px; }
  .sheet-meta { margin-top: 9px; padding: 6px 0; font-size: 10pt; }
  .candidate { margin-top: 9px; font-size: 10pt; }
  .instructions { margin-top: 11px; padding: 7px 13px; background: #f4f4f4 !important; border-left-color: #555; }
  .instructions ol { font-size: 9pt; line-height: 1.4; }
  .sheet-section { margin-top: 16px; break-inside: avoid-page; }
  .sheet-questions { margin-top: 6px; }
  .sheet-questions li { color: #000; padding: 4px 0; font-size: 10pt; line-height: 1.45; }
  .section-hint { margin-top: 3px; }
  .sheet-foot { margin-top: 16px; padding-top: 8px; }
  .custom-flag { display: none; }
  a { text-decoration: none; color: #000; }
}

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