/* Wheel of the Fates — styles (see docs/DESIGN.md) */

:root {
  color-scheme: dark;
  --sea-950: #0B1026;
  --sea-900: #16203F;
  --sea-800: #1E2A52;
  --sea-700: #253366;
  --input-bg: #0E1530;
  --wine-950: #2A0E1F;
  --marble-50: #F4EFE6;
  --marble-300: #C9BFAE;
  --marble-400: #9A95A8;
  --placeholder: #A8A090;
  --ink-900: #1A1206;
  --gold-300: #F0CD72;
  --gold-400: #E0B651;
  --gold-600: #B8892B;
  --bronze-500: #A86B32;
  --bronze-700: #6E4320;
  --error-300: #FF9C8A;
  --success-300: #B5CF8F;

  --font-display: "Cinzel", "Trajan Pro", "Times New Roman", Georgia, serif;
  --font-title: "Cinzel Decorative", "Cinzel", "Trajan Pro", "Times New Roman", Georgia, serif;
  --font-body: "EB Garamond", Garamond, "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --fs-sm: 0.9375rem;
  --fs-base: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-title: clamp(2rem, 1.1rem + 3.6vw, 4rem);
  --lh-tight: 1.15;
  --lh-body: 1.5;
  --tracking-caps: 0.08em;

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;    --sp-8: 4rem;

  --r-sm: 4px; --r-md: 8px; --r-lg: 16px; --r-pill: 999px;

  --shadow-card: 0 8px 24px rgb(0 0 0 / 0.45), inset 0 0 0 1px rgb(184 137 43 / 0.35);
  --shadow-wheel: 0 20px 60px rgb(0 0 0 / 0.6), 0 0 0 2px var(--gold-600);
  --glow-gold: 0 0 0 2px var(--gold-400), 0 0 24px rgb(224 182 81 / 0.45);
  --focus-ring: 0 0 0 3px var(--sea-950), 0 0 0 5px var(--gold-300);

  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;
  --dur-reveal: 600ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* 280px floor keeps segment labels legible on short viewports / 400% zoom (WCAG 1.4.10); page scrolls vertically instead */
  --wheel-size: min(88vw, max(58svh, 280px), 360px);
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M0 18H16V2H4V14H12V6H8V10M16 18H20' fill='none' stroke='%23B8892B' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E");
}
@media (min-width: 1600px) { html { font-size: 112.5%; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--marble-50);
  background: radial-gradient(120% 60% at 50% 110%, var(--wine-950) 0%, transparent 60%) fixed, var(--sea-950);
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: var(--tracking-caps); line-height: var(--lh-tight); }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sky {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
  /* Fade the sky behind the header so stars and lines don't cross the title, tagline or button. */
  -webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0.1) 0, rgb(0 0 0 / 0.1) 200px, #000 320px);
  mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0.1) 0, rgb(0 0 0 / 0.1) 200px, #000 320px);
}
.sky .twinkle { animation: twinkle 4s ease-in-out 1; } /* finite: auto-playing motion must stop within 5s (WCAG 2.2.2) */
.sky .t2 { animation-delay: -1.3s; }
.sky .t3 { animation-delay: -2.6s; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.skip-link {
  position: absolute; left: var(--sp-3); top: var(--sp-3);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--gold-400); color: var(--ink-900);
  font-family: var(--font-display); font-weight: 700;
  border-radius: var(--r-md);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ box-shadow: var(--focus-ring); }

.container {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

/* ---------- Header ---------- */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.site-header { position: relative; padding-block: var(--sp-3) var(--sp-4); }
/* Phones: a top row with the jump link (left) and the Oracle button (right), then the titles. */
.header-inner {
  text-align: center;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  grid-template-areas: "jump oracle" "titles titles";
  align-items: center;
  row-gap: var(--sp-3);
  column-gap: var(--sp-2);
}
@media (max-width: 359px) { .jump-send { display: none; } } /* very narrow phones: "Answers ↓" */
.titles { grid-area: titles; min-width: 0; }
.jump-link { grid-area: jump; justify-self: start; padding-inline: var(--sp-3); white-space: nowrap; letter-spacing: 0.03em; }
#submit-card { scroll-margin-top: var(--sp-4); }
#result-card { scroll-margin-block: var(--sp-4); }
h1 {
  /* Plain Cinzel, not Cinzel Decorative: the Decorative H has a long swash bar that made the
     title read "WĦEEL OF TĦE FATES" (it's the default glyph, not a ligature). */
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--gold-400);
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "dlig" 0, "calt" 0, "hlig" 0;
}
.tagline {
  margin-top: var(--sp-2);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--marble-300);
}
.oracle-btn { grid-area: oracle; justify-self: end; padding-inline: var(--sp-3); }
.oracle-text { display: none; }
.oracle-short { display: inline; }
.oracle-btn .icon-laurel { display: none; } /* phones: the laurel alone read as a smile; show "Oracle" text instead */

.boot-fail {
  margin: var(--sp-5) auto 0;
  max-width: 40rem;
  padding: var(--sp-4) var(--sp-5);
  background: var(--sea-800);
  border-left: 3px solid var(--error-300);
  border-radius: var(--r-md);
  color: var(--marble-50);
}
.boot-fail code { font-size: 0.95em; color: var(--gold-300); }

.meander {
  height: 12px;
  background-image: var(--meander);
  background-size: 12px 12px;
  background-repeat: repeat-x;
  opacity: 0.9;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--sp-2) var(--sp-5);
  border: 0;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  transition: background-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:focus { outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ }
.btn:focus-visible { box-shadow: var(--focus-ring); }

.btn-primary {
  background: var(--gold-400);
  color: var(--ink-900);
  box-shadow: inset 0 -3px 0 var(--gold-600);
}
.btn-primary:hover:not(:disabled) { background: var(--gold-300); transform: translateY(-1px); box-shadow: var(--glow-gold); }
.btn-primary:active:not(:disabled) { background: var(--gold-600); transform: translateY(1px); box-shadow: none; }
.btn-primary:focus-visible { box-shadow: var(--focus-ring); }
.btn-primary:disabled { background: var(--sea-800); color: var(--marble-400); box-shadow: none; cursor: not-allowed; }

.btn-secondary {
  border: 2px solid var(--gold-600);
  color: var(--gold-400);
}
.btn-secondary:hover:not(:disabled) { background: var(--sea-700); border-color: var(--gold-400); }
.btn-secondary:active:not(:disabled) { background: var(--sea-800); }
.btn-secondary:disabled { border-color: rgb(154 149 168 / 0.5); color: var(--marble-400); cursor: not-allowed; }

.btn-ghost { color: var(--gold-400); padding: var(--sp-2); }
.btn-ghost:hover:not(:disabled) { background: var(--sea-700); }
.btn-ghost:active:not(:disabled) { background: var(--sea-800); }
.btn-ghost:disabled { color: var(--marble-400); opacity: 0.5; cursor: not-allowed; }

.btn-danger { color: var(--error-300); border: 1px solid var(--error-300); }
.btn-danger:hover { background: rgb(255 156 138 / 0.12); }
.btn-danger:active { background: rgb(255 156 138 / 0.2); }

.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--r-pill); }

/* ---------- Layout ---------- */
main { flex: 1; }
.main-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding-block: var(--sp-5) var(--sp-6);
}
.stage { display: flex; flex-direction: column; align-items: center; }
.side { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }

/* ---------- Wheel ---------- */
.wheel-wrap {
  position: relative;
  width: var(--wheel-size);
  aspect-ratio: 1;
  margin-top: var(--sp-5);
}
.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: var(--shadow-wheel);
  cursor: pointer;
}
.wheel:focus { outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ }
.wheel:focus-visible { box-shadow: var(--shadow-wheel), var(--focus-ring); }
.wheel canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
.pointer {
  position: absolute;
  left: 50%;
  top: 0;
  height: max(44px, calc(var(--wheel-size) * 0.07));
  width: auto;
  aspect-ratio: 48 / 64;
  /* tip overlaps the rim by 0.06R = 0.03 × diameter */
  transform: translate(-50%, calc(-100% + var(--wheel-size) * 0.03));
  transform-origin: 50% 0;
  filter: drop-shadow(0 3px 4px rgb(0 0 0 / 0.6));
  pointer-events: none;
  z-index: 2;
}

.spin-btn {
  margin-top: var(--sp-5);
  width: 100%;
  max-width: 320px;
  min-height: 56px;
  font-size: var(--fs-lg);
}
.spin-glyph { flex: none; }
/* Busy state uses aria-disabled (not `disabled`) so focus stays on the button. */
.spin-btn.is-spinning,
.spin-btn.is-spinning:hover,
.spin-btn.is-spinning:active,
.spin-btn.is-spinning:disabled {
  transform: none;
  background: linear-gradient(100deg, rgb(224 182 81 / 0.7) 30%, rgb(240 205 114 / 0.95) 50%, rgb(224 182 81 / 0.7) 70%);
  background-size: 200% 100%;
  color: var(--ink-900);
  box-shadow: none;
  cursor: progress;
  animation: sheen 1.6s linear infinite;
}
.spin-btn.is-spinning:focus-visible { box-shadow: var(--focus-ring); }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.spin-help { margin-top: var(--sp-3); color: var(--marble-300); font-size: var(--fs-sm); text-align: center; max-width: 32ch; }
.inline-restore { margin-top: var(--sp-3); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: rgb(22 32 63 / 0.92);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
  transition: box-shadow 1s var(--ease-out);
}
.card h2 { font-size: var(--fs-xl); font-weight: 700; color: var(--gold-400); }

.result-card { text-align: center; min-height: 9.5rem; display: flex; flex-direction: column; justify-content: center; }
.result-card.glow { box-shadow: var(--glow-gold); transition: none; }
.result-content { transition: opacity var(--dur-fast); }
.result-content.fade-out { opacity: 0; }
.result-content.reveal { animation: reveal var(--dur-slow) var(--ease-out) both; }
@keyframes reveal { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.result-idle { font-family: var(--font-display); font-weight: 600; letter-spacing: var(--tracking-caps); font-size: var(--fs-lg); color: var(--marble-300); }
.result-spinning { font-style: italic; font-size: var(--fs-lg); color: var(--marble-300); }
.result-laurel { color: var(--gold-400); display: block; margin: 0 auto var(--sp-2); }
.result-kicker {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm);
  color: var(--gold-400); text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.result-name {
  margin-top: var(--sp-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl);
  letter-spacing: 0.04em; line-height: var(--lh-tight);
  color: var(--marble-50);
  text-wrap: balance;
  overflow-wrap: break-word;
}
.result-note { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--marble-300); font-style: italic; }

.submit-card { text-align: center; }
.card-laurel { display: block; margin: 0 auto var(--sp-2); color: var(--gold-400); }
.submit-body { display: grid; gap: var(--sp-5); margin-top: var(--sp-4); }
.submit-instr { white-space: pre-line; overflow-wrap: break-word; }
.submit-cta { margin-top: var(--sp-4); width: 100%; min-height: 52px; }
.qr-block { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); min-width: 0; }
.qr-plate {
  width: calc(160px + 24px);
  padding: 12px;
  background: var(--marble-50);
  border-radius: var(--r-md);
  line-height: 0;
}
.qr-plate svg { width: 100%; height: auto; display: block; }
.qr-caption { font-size: var(--fs-sm); color: var(--marble-300); }
.short-link { font-size: var(--fs-sm); color: var(--marble-300); word-break: break-all; }
.copy-input {
  width: 100%; height: 40px; padding: 0 var(--sp-2);
  background: var(--input-bg); color: var(--marble-50);
  border: 1px solid var(--gold-600); border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.copy-input:focus-visible { outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ box-shadow: var(--focus-ring); }
.copy-status { min-height: 1.5em; font-size: var(--fs-sm); color: var(--success-300); }

.submit-card.unset { box-shadow: none; border: 2px dashed var(--gold-600); }
.submit-card.unset .card-laurel { opacity: 0.4; }

.site-footer { padding: var(--sp-4) var(--sp-4) var(--sp-5); text-align: center; color: var(--marble-300); font-size: var(--fs-sm); }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(440px, 100vw);
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  border-left: 2px solid var(--gold-600);
  background: var(--sea-900);
  color: var(--marble-50);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.drawer[open] { display: flex; animation: drawer-in var(--dur-slow) var(--ease-out); }
.drawer::backdrop { background: rgb(5 8 20 / 0.7); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-6);
  border-bottom: 1px solid rgb(184 137 43 / 0.4);
  background: var(--sea-900);
}
.drawer-head h2 { font-size: var(--fs-xl); color: var(--gold-400); font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.drawer-intro { padding: var(--sp-5) var(--sp-6) 0; color: var(--marble-300); font-size: var(--fs-sm); }
.d-section { padding: var(--sp-6); border-bottom: 1px solid rgb(184 137 43 / 0.4); display: flex; flex-direction: column; gap: var(--sp-3); align-items: stretch; }
.d-section:last-child { border-bottom: 0; }
.d-section h3 { font-size: var(--fs-lg); color: var(--gold-400); font-weight: 700; }
.d-section > .btn { align-self: flex-start; }
.drawer-status { min-height: 2.5rem; padding: var(--sp-2) var(--sp-6); color: var(--success-300); font-size: var(--fs-sm); border-top: 1px solid rgb(184 137 43 / 0.4); }

.notice {
  margin: var(--sp-5) var(--sp-6) 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--sea-800);
  border-left: 3px solid var(--error-300);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.d-section .notice { margin: 0; }
.notice-info { border-left-color: var(--gold-400); }

.field { display: flex; flex-direction: column; gap: var(--sp-1); }
label, .field label {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm);
  letter-spacing: var(--tracking-caps); color: var(--marble-50);
}
input[type="text"], input[type="url"], textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-3);
  background: var(--input-bg);
  border: 1px solid var(--gold-600);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--marble-50);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
textarea { padding: var(--sp-2) var(--sp-3); resize: vertical; min-height: 6rem; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:hover:not(:disabled), textarea:hover { border-color: var(--gold-400); }
input:focus, textarea:focus { outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ }
input:focus-visible, textarea:focus-visible, input[type="text"]:focus, input[type="url"]:focus, textarea:focus { border-color: var(--gold-300); box-shadow: var(--focus-ring); }
input[aria-invalid="true"] { border: 2px solid var(--error-300); }
input:disabled { opacity: 0.6; cursor: not-allowed; }
.helper { font-size: var(--fs-sm); color: var(--marble-300); }
.helper.ok { color: var(--success-300); }
.helper.err, .field-error { font-size: var(--fs-sm); color: var(--error-300); }
.field-error:empty { display: none; }

.games-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.game-row {
  display: flex; align-items: center; gap: var(--sp-1);
  min-height: 52px;
  padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-2);
  background: var(--sea-800);
  border-radius: var(--r-md);
}
.game-row.aside .badge { opacity: 0.55; }
.badge { flex: none; width: 1.75rem; text-align: center; font-family: var(--font-display); font-weight: 700; color: var(--gold-400); }
.game-row input { flex: 1; min-width: 0; min-height: 44px; }
.game-row .icon-btn { flex: none; font-size: 1rem; }
.add-row { display: flex; gap: var(--sp-2); }
.add-row input { flex: 1; min-width: 0; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  min-height: 44px; cursor: pointer;
  font-family: var(--font-body); font-weight: 400; font-size: var(--fs-base); letter-spacing: 0;
}
.switch {
  appearance: none; -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 48px; height: 28px; margin: 0;
  border-radius: var(--r-pill);
  background: var(--sea-800);
  border: 1px solid var(--marble-400);
  cursor: pointer;
  transition: background-color var(--dur-base);
}
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--marble-50);
  transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-base);
}
.switch:checked { background: var(--gold-400); border-color: var(--gold-400); }
.switch:checked::after { transform: translateX(20px); background: var(--ink-900); }
.switch:focus { outline: 2px solid transparent; outline-offset: 2px; /* transparent outline shows in forced colors */ }
.switch:focus-visible { box-shadow: var(--focus-ring); }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  :root { --wheel-size: min(70vw, max(60svh, 280px), 520px); }
  .main-grid { max-width: 720px; }
  .site-header { padding-block: var(--sp-6) var(--sp-4); }
  .header-inner { display: block; padding-top: 56px; }
  .jump-link { display: none; }
  .oracle-btn { position: absolute; top: var(--sp-4); right: var(--sp-4); padding-inline: var(--sp-4); }
  .oracle-text { display: inline; }
  .oracle-short { display: none; }
  .oracle-btn .icon-laurel { display: inline; }
  .submit-body { grid-template-columns: 1fr 180px; align-items: start; text-align: left; }
  .qr-plate { width: calc(180px); padding: 10px; }
}

/* ---------- Desktop / projector ---------- */
@media (min-width: 1024px) {
  :root { --wheel-size: min(max(62svh, 320px), 820px); }
  .container { padding-inline: var(--sp-6); }
  .site-header { padding-block: var(--sp-4) var(--sp-2); }
  .copy-status { min-height: 0; }
  .copy-status:empty { display: none; }
  .header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); text-align: left; padding-top: 0; }
  .oracle-btn { position: static; flex: none; }
  .main-grid {
    max-width: 1600px;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr);
    gap: var(--sp-7);
    align-items: center;
    padding-block: var(--sp-4);
  }
  .wheel-wrap { width: min(var(--wheel-size), 100%); margin-top: var(--sp-5); }
  .spin-btn { min-height: 64px; font-size: var(--fs-xl); max-width: 460px; white-space: nowrap; }
  .card { padding: var(--sp-6); }
  .submit-body { grid-template-columns: minmax(0, 1fr) auto; text-align: left; align-items: center; }
  .submit-card h2 { text-align: center; }
  .qr-plate { width: 180px; padding: 12px; }
  .site-footer { padding-block: var(--sp-2) var(--sp-3); }
}
@media (min-width: 1600px) {
  .qr-plate { width: 220px; }
  .result-name { font-size: 2.75rem; }
}
/* Shorter desktop screens */
@media (min-width: 1024px) and (max-height: 900px) {
  .qr-plate { width: 160px; }
  .card { padding: var(--sp-5); }
}

@media (max-width: 639px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding-left: var(--sp-4); }
  .d-section { padding: var(--sp-5) var(--sp-4); }
  .drawer-intro { padding-inline: var(--sp-4); }
  .notice { margin-inline: var(--sp-4); }
  .drawer-status { padding-inline: var(--sp-4); }
  .game-row { gap: 0; }
}

/* Very short viewports (landscape phones, 400% zoom): let the whole drawer scroll
   so the sticky head/status bars don't squeeze the form to a sliver (WCAG 1.4.10). */
@media (max-height: 420px) {
  .drawer[open] { overflow-y: auto; }
  .drawer-body { flex: none; overflow: visible; }
}

/* ---------- Forced colors / Windows High Contrast ---------- */
@media (forced-colors: active) {
  .btn { border: 2px solid ButtonText; }
  .btn:disabled { border-color: GrayText; color: GrayText; }
  .btn-primary:disabled { border-color: GrayText; }
  .wheel:focus-visible, .btn:focus-visible, .switch:focus-visible,
  input:focus-visible, textarea:focus-visible, .skip-link:focus { outline: 3px solid Highlight; outline-offset: 3px; }
  .switch { border: 2px solid ButtonText; }
  .switch::after { background: ButtonText; }
  .switch:checked { background: Highlight; border-color: Highlight; }
  .switch:checked::after { background: HighlightText; }
  .qr-plate, .qr-plate svg { forced-color-adjust: none; } /* keep QR scannable: dark modules on light plate */
  .card { border: 1px solid CanvasText; }
  .submit-card.unset { border: 2px dashed CanvasText; }
  .result-card.glow { outline: 2px solid Highlight; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 1ms; --dur-base: 1ms; --dur-slow: 1ms; --dur-reveal: 1ms; }
  .sky .twinkle { animation: none; }
  .btn-primary:hover:not(:disabled), .btn-primary:active:not(:disabled) { transform: none; }
  .spin-btn.is-spinning { animation: none; }
  .drawer[open] { animation: drawer-fade 150ms linear; }
  .result-content.reveal { animation: drawer-fade 150ms linear both; }
  .card { transition: none; }
}
@keyframes drawer-fade { from { opacity: 0; } to { opacity: 1; } }
