/* Layout idea: the wheel is the poster, lit from behind. Everything else is a quiet glass tool rail beside it. */
/* Dark is the look for everyone. A link can ask for the light one with ?theme=light. */
:root {
  --paper: #080A1C;
  --panel: #15173A;
  --ink: #F3F1FF;
  --ink-soft: #B3B0D0;
  --line: #2D2F5C;
  --signal: #FFB627;
  --signal-ink: #1A1033;
  --focus: #B5A8FF;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-line: rgba(255, 255, 255, 0.13);
  --field: rgba(6, 8, 24, 0.55);
  --lift: 0 18px 50px -22px rgba(0, 0, 0, 0.8);
  --aurora: 0.55;
  --violet: #7B5CFF;
  --rose: #FF5C8A;
  --amber: #FFB627;
  --aqua: #2ED3C6;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", Verdana, sans-serif;
  --radius: 20px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --paper: #F4F2FF;
  --panel: #FFFFFF;
  --ink: #17152E;
  --ink-soft: #55527A;
  --line: #D9D5F0;
  --focus: #5B3DF5;
  --glass: rgba(255, 255, 255, 0.7);
  --glass-line: rgba(23, 21, 46, 0.1);
  --field: rgba(255, 255, 255, 0.82);
  --lift: 0 18px 44px -24px rgba(60, 40, 140, 0.45);
  --aurora: 0.38;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 56px; }

/* Header */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 18px 0 14px;
}
.brand {
  font-family: var(--font-display); font-weight: 400;
  font-size: 26px; line-height: 1; letter-spacing: 0.01em;
  margin: 0; display: flex; align-items: center; gap: 10px;
}
.brand-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(#2F6BFF 0 60deg, #FFC400 0 120deg, #FF5A4E 0 180deg, #19B38A 0 240deg, #8B5CF6 0 300deg, #FF8A1F 0);
  border: 3px solid var(--ink);
  flex: none;
}
.modes { display: flex; flex-wrap: wrap; gap: 6px; }
.modes a {
  text-decoration: none; color: var(--ink);
  padding: 7px 14px; border-radius: 999px;
  border: 2px solid transparent; font-weight: 700;
}
.modes a:hover { border-color: var(--line); }
.modes a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.top-tools { margin-inline-start: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.btn {
  border: 2px solid var(--ink); background: var(--panel); color: var(--ink);
  border-radius: 10px; padding: 7px 13px; font-weight: 700; cursor: pointer;
  line-height: 1.2;
}
.btn:hover { background: var(--paper); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.quiet { border-color: var(--line); font-weight: 400; }
.btn.mini { padding: 3px 10px; font-size: 13px; letter-spacing: 0; text-transform: none; border-radius: 999px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.push { margin-inline-start: auto; }
.btn.lang { font-weight: 400; max-width: 170px; }
[dir="rtl"] .erow input[type="number"], [dir="rtl"] #shareLink, [dir="rtl"] #loadLink { direction: ltr; }

/* Main grid */
.work {
  display: grid; gap: 28px;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 880px) { .work { grid-template-columns: minmax(0, 1fr); } }

.stage {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  background: var(--paper);
}
@media (min-width: 881px) { .stage { position: sticky; top: 12px; } }
.stage.has-bg { padding: 18px 14px 20px; border-radius: 22px; background-size: cover; background-position: center; }
.stage:fullscreen { justify-content: center; padding: 16px; border-radius: 0; }
.stage:fullscreen .wheel-btn { width: min(92vw, calc(100vh - 170px)); }
.wheel-head { text-align: center; max-width: 620px; }
.wheel-head h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.1; margin: 0; overflow-wrap: anywhere; text-wrap: balance; }
.wheel-head p { margin: 4px 0 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.stage.has-bg .wheel-head, .stage.has-bg .hint, .stage.has-bg .last {
  background: var(--panel); color: var(--ink); border-radius: 12px; padding: 6px 14px;
}
.wheel-btn {
  width: min(100%, 620px); aspect-ratio: 1 / 1;
  padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  display: block; position: relative;
}
.wheel-btn:disabled { cursor: default; }
.wheels { width: 100%; display: flex; justify-content: center; }
.wheels.multi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.wheels.multi .wheel-btn { width: 100%; }
.wheels.multi.n3 > :last-child { grid-column: 1 / -1; width: 50%; justify-self: center; }
.xwheel { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.xwheel figcaption { font-weight: 700; font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.stage.has-bg .xwheel figcaption:not(:empty) { background: var(--panel); border-radius: 8px; padding: 1px 10px; }
.stage:fullscreen .wheels { width: auto; }
.stage:fullscreen .wheels.multi { width: min(96vw, calc((100vh - 190px) * 2)); }
.stage:fullscreen .wheels.multi.n3, .stage:fullscreen .wheels.multi.n4 { width: min(96vw, calc(100vh - 190px)); }
.wheel-btn canvas { width: 100%; height: 100%; display: block; }
.last { margin: 0; font-weight: 700; font-size: 20px; text-align: center; overflow-wrap: anywhere; }
.spin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
.spin {
  font-family: var(--font-display); font-size: 26px; letter-spacing: 0.04em;
  background: var(--signal); color: var(--signal-ink);
  border: 3px solid #101828; border-radius: 14px;
  padding: 12px 40px 10px; cursor: pointer;
  box-shadow: 0 5px 0 #101828;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.spin:hover { transform: translateY(1px); box-shadow: 0 4px 0 #101828; }
.spin:active { transform: translateY(5px); box-shadow: 0 0 0 #101828; }
.spin:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 #101828; }
.hint { color: var(--ink-soft); font-size: 15px; margin: 0; }
kbd {
  font-family: var(--font-body); font-size: 13px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--panel);
}

/* Tool rail */
.rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card h2 {
  font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
  margin: 0; display: flex; align-items: center; gap: 10px;
}
.pill {
  font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 700;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 1px 10px;
  font-variant-numeric: tabular-nums;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
textarea {
  width: 100%; min-height: 230px; resize: vertical;
  background: var(--paper); border: 2px solid var(--line); border-radius: 10px;
  padding: 10px 12px; line-height: 1.45;
}
textarea:disabled { opacity: 0.6; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: var(--ink-soft); }
.field.wide { width: 100%; }
.field.wide > span { color: var(--ink); font-weight: 700; }
.field input, .field select, .text-in {
  background: var(--paper); border: 2px solid var(--line); border-radius: 8px;
  padding: 6px 9px; color: var(--ink);
}
.field input[type="number"] { width: 96px; }
.field input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--focus); min-width: 120px; }
.field input[type="color"] { padding: 2px; width: 54px; height: 34px; cursor: pointer; }
.text-in.short { width: 110px; }
.check { display: flex; gap: 9px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--focus); flex: none; }
.note { font-size: 14px; color: var(--ink-soft); margin: 0; }
.example-flag {
  font-size: 13px; color: var(--ink-soft); border: 1px dashed var(--line);
  border-radius: 8px; padding: 5px 9px; margin: 0;
}

.fold { border-top: 1px solid var(--line); padding-top: 10px; }
.fold > summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.fold[open] > summary { margin-bottom: 10px; }
.fold > * + * { margin-top: 10px; }

.xw { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.xw textarea { min-height: 110px; }

/* Advanced entry rows */
.rows { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; padding: 2px; }
.erow { display: grid; grid-template-columns: 20px minmax(0, 1fr) 62px 38px 34px 30px; gap: 6px; align-items: center; }
.erow input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--focus); }
.erow input[type="text"], .erow input[type="number"] {
  background: var(--paper); border: 2px solid var(--line); border-radius: 8px; padding: 5px 8px; min-width: 0; width: 100%;
}
.erow input[type="color"] { width: 38px; height: 32px; padding: 1px; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; }
.erow .icon {
  width: 34px; height: 32px; border-radius: 8px; border: 2px solid var(--line); background: var(--paper) center / cover no-repeat;
  cursor: pointer; padding: 0; font-size: 15px; line-height: 1;
}
.erow .icon.del { width: 30px; border-color: transparent; background: none; color: var(--ink-soft); font-size: 20px; }
.erow .icon.del:hover { color: var(--ink); }
.erow.off input[type="text"] { opacity: 0.5; text-decoration: line-through; }

.picked { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.picked li { display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.picked .n { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 14px; min-width: 2.2em; }
.empty { color: var(--ink-soft); font-size: 15px; margin: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 54px; height: 30px; border-radius: 8px; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.swatch.custom { width: auto; padding: 0 10px; font-size: 13px; font-weight: 700; background: var(--paper); }

.saved { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.saved li { display: flex; gap: 8px; align-items: center; }
.saved .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved .sub { color: var(--ink-soft); font-size: 13px; }

.share-out { display: flex; gap: 8px; }
.share-out .text-in { flex: 1; min-width: 0; font-size: 14px; }

/* Below the tool */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px 32px; margin-top: 34px; }
.about h3 { font-family: var(--font-display); font-weight: 400; font-size: 19px; margin: 0 0 6px; text-wrap: balance; }
.about p { margin: 0; color: var(--ink-soft); max-width: 46ch; }
.foot a, .doc a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a.brand { color: inherit; text-decoration: none; }
/* Privacy and terms pages */
.doc { max-width: 70ch; margin: 10px 0 0; }
.doc h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 10px 0 4px; }
.doc h2 { font-size: 20px; margin: 30px 0 6px; }
.doc p, .doc ul { margin: 0 0 12px; }
.doc ul { padding-inline-start: 22px; }
.doc li { margin-bottom: 6px; }
.foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; }

/* Winner dialog */
.veil {
  position: fixed; inset: 0; background: rgba(8, 12, 22, 0.62);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 20;
}
.veil.open { display: flex; }
.win {
  background: var(--panel); color: var(--ink); border: 4px solid #101828; border-radius: 20px;
  box-shadow: 0 10px 0 #101828; padding: 26px 28px 24px; width: min(640px, 100%);
  text-align: center; display: flex; flex-direction: column; gap: 14px;
}
.win .eyebrow { margin: 0; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); overflow-wrap: anywhere; }
.win .name {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(34px, 8vw, 76px); line-height: 1.05; overflow-wrap: anywhere; text-wrap: balance;
}
.win .band { height: 12px; border-radius: 6px; border: 2px solid #101828; }
.win .row { justify-content: center; margin-top: 4px; }
.pop { animation: pop 320ms cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 9px 16px;
  font-size: 15px; z-index: 40; max-width: calc(100% - 32px); opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.toast.show { opacity: 1; }

/* Spin-only links and embeds: the wheel alone */
body.view-only .rail, body.view-only .about, body.view-only .modes { display: none; }
body.view-only .work { grid-template-columns: minmax(0, 1fr); }
body.embed .top, body.embed .foot, body.embed .hint { display: none; }
body.embed .shell { padding: 8px; }
body.embed .stage { position: static; }
body.clear-bg, body.clear-bg .stage { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .pop { animation: none; }
  .spin { transition: none; }
}

/* Account card */
#accountCard .note, #accountCard .row, #accountCard .saved, #accountCard .share-out { margin: 10px 0 0; }
#accountCard .note:first-child { margin-top: 0; }
#acctWho { overflow-wrap: anywhere; }
#shortNote { margin-top: 6px; }

/* Readout, odds, giveaway lock, teams */
.now {
  margin: 0; min-height: calc(1.25em + 7px); max-width: 100%; padding: 0 6px 2px;
  font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 4.6vw, 42px); line-height: 1.25;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 5px solid transparent;
}
.odds { margin: 0; color: var(--ink-soft); font-size: 15px; text-align: center; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.lock {
  margin: 0; padding: 4px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--panel); color: var(--ink); font-weight: 700; font-size: 15px; text-align: center; overflow-wrap: anywhere;
}
.lock::before { content: "\1F512  "; }
.stage.has-bg .now, .stage.has-bg .odds { background: var(--panel); color: var(--ink); border-radius: 12px; padding: 2px 14px; }
body.locked #entries { background: var(--paper); opacity: 0.8; }
.odds-list li { justify-content: space-between; }
.odds-list .n, .log .n { min-width: 0; white-space: nowrap; flex: none; }
.log li { flex-direction: column; gap: 0; }
.log li + li { border-top: 1px solid var(--line); padding-top: 4px; }
.odds-list .more { color: var(--ink-soft); font-size: 14px; }
.log { max-height: 240px; font-size: 14px; }
#giveCard .row, #giveCard .log, #teamCard .row, #teamCard .fold, #teamOut { margin-top: 10px; }
textarea.small { min-height: 70px; height: 70px; }
#teamOut { display: flex; flex-direction: column; gap: 6px; }
.team { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; overflow-wrap: anywhere; }

/* Beside the tools, the wheel also answers to the window's height, so the name, the SPIN button
   and the odds stay on screen with it instead of sliding under the bottom edge. */
@media (min-width: 881px) {
  .stage { gap: 13px; }
  .wheels:not(.multi) .wheel-btn { width: min(100%, 620px, max(280px, calc(100vh - 285px))); }
  .stage:fullscreen .wheels:not(.multi) .wheel-btn { width: min(92vw, calc(100vh - 250px)); }
}

#chatCard .row, #chatCard .check, #chatCard .note { margin-top: 10px; }
#chatCard .note:first-of-type { margin-top: 0; }
#chatStatus { color: var(--ink); font-weight: 700; }

/* Ready-made wheels, the link home on shared wheels, and the use-case pages */
.chip { padding: 5px 12px; font-size: 14px; }
#tplCard .row, #pairBox .row, #pairBox .note { margin-top: 8px; }
#pairBox { margin-top: 12px; }
.made { color: var(--ink-soft); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.stage.has-bg .made { background: var(--panel); color: var(--ink); border-radius: 10px; padding: 1px 10px; }
.guide { margin-top: 34px; max-width: 820px; }
.guide h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 4vw, 38px); line-height: 1.1; margin: 0 0 10px; text-wrap: balance; }
.guide h2 { font-family: var(--font-display); font-weight: 400; font-size: 21px; margin: 26px 0 6px; }
.guide h3 { font-size: 17px; margin: 16px 0 4px; }
.guide p, .guide li { color: var(--ink-soft); max-width: 70ch; }
.guide p { margin: 0 0 10px; }
.guide ol, .guide ul { margin: 0 0 10px; padding-left: 22px; }
.jobs { margin-top: 30px; }
.jobs h3 { font-family: var(--font-display); font-weight: 400; font-size: 19px; margin: 0 0 6px; }
.jobs p { margin: 0; line-height: 1.9; }
.jobs a, .guide a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
body.view-only .guide, body.view-only .jobs { display: none; }
/* these parts are written in English only for now */
html:not([lang="en"]) #tplCard, html:not([lang="en"]) #pairBox, html:not([lang="en"]) .guide, html:not([lang="en"]) .jobs { display: none; }

/* Folding tool boxes */
.fold-head { cursor: pointer; user-select: none; }
.fold-head::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-135deg); transition: transform 120ms ease; flex: none; }
.card.shut .fold-head::after { transform: rotate(45deg); }
.card.shut > *:not(h2) { display: none !important; }
.card.shut { padding-top: 13px; padding-bottom: 13px; }
.fold-head:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
.win .from { margin: 0; color: var(--ink-soft); font-size: 15px; text-align: center; }
.win .from:empty { display: none; }
.guide .as-h1 { font-size: clamp(24px, 3.6vw, 34px); line-height: 1.12; margin: 0 0 10px; text-wrap: balance; }


/* ================= Look: light behind the wheel =================
   One bold thing: the wheel sits in a slow halo of colour that races when it spins.
   Everything around it is glass and stays quiet. */
@property --turn { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
body { background: var(--paper); min-height: 100vh; font-weight: 500; }
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 90vmax; height: 90vmax; border-radius: 50%; opacity: var(--aurora);
}
body::before {
  left: -30vmax; top: -38vmax;
  background: radial-gradient(closest-side, var(--violet), transparent 70%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
body::after {
  right: -34vmax; bottom: -44vmax;
  background: radial-gradient(closest-side, var(--rose), transparent 68%), radial-gradient(closest-side at 30% 30%, var(--amber), transparent 60%);
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-12vmax, -9vmax) scale(1.1); } }
body.clear-bg::before, body.clear-bg::after { display: none; }

.shell { max-width: 1220px; padding: 0 24px 64px; }
.top { padding: 22px 0 18px; }
.brand { font-weight: 800; font-size: 25px; letter-spacing: -0.02em; }
.brand-dot {
  width: 24px; height: 24px; border: 0;
  background: conic-gradient(var(--violet), var(--rose), var(--amber), var(--aqua), var(--violet));
  box-shadow: 0 0 18px -2px var(--rose);
}
.modes { gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); }
.modes a { border: 0; padding: 7px 16px; transition: background 160ms ease, color 160ms ease; }
.modes a:hover { background: var(--glass-line); }
.modes a[aria-current="page"] { background: linear-gradient(120deg, var(--violet), var(--rose)); color: #FFFFFF; }

.btn {
  border: 1px solid var(--glass-line); background: var(--glass); border-radius: 12px; padding: 8px 14px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
.btn:hover { background: var(--glass); border-color: var(--violet); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { transform: none; }
.btn.quiet { border-color: var(--glass-line); font-weight: 500; }
.btn[aria-pressed="true"] { background: color-mix(in srgb, var(--violet) 26%, transparent); color: var(--ink); border-color: var(--violet); }
select.btn option { background: var(--panel); color: var(--ink); }

/* The stage */
.stage { background: none; }
.stage:fullscreen { background: var(--paper) radial-gradient(60vmax 60vmax at 15% 0%, color-mix(in srgb, var(--violet) 45%, transparent), transparent 70%); }
.wheels { isolation: isolate; }
.wheel-btn::before {
  content: ""; position: absolute; inset: -15%; z-index: -1; border-radius: 50%; pointer-events: none; /* light only: a click beside the wheel must not spin it */
  background: conic-gradient(var(--violet), var(--rose), var(--amber), var(--aqua), var(--violet));
  /* softened with a mask, not a blur filter: a blurred layer halves the frame rate on machines with no graphics card */
  -webkit-mask: radial-gradient(closest-side, #000 58%, transparent 100%); mask: radial-gradient(closest-side, #000 58%, transparent 100%);
  opacity: 0.7; will-change: transform;
  animation: orbit 16s linear infinite; /* turned as a whole, so it is painted once and only moved */
  transition: opacity 500ms ease, inset 500ms ease;
}
@keyframes halo { to { --turn: 360deg; } }
@keyframes orbit { to { transform: rotate(360deg); } }
body.is-spinning::before, body.is-spinning::after { animation-play-state: paused; }
body.is-spinning .wheel-btn::before { opacity: 1; inset: -21%; animation-duration: 1.6s; }
.wheel-head h2 { font-weight: 800; letter-spacing: -0.02em; font-size: clamp(26px, 3.8vw, 40px); }
.now { font-weight: 800; letter-spacing: -0.02em; }
.spin {
  position: relative; overflow: hidden; font-weight: 800; font-size: 24px; letter-spacing: 0.14em;
  background: linear-gradient(120deg, var(--amber), var(--rose)); color: var(--signal-ink);
  border: 0; border-radius: 999px; padding: 15px 54px 14px;
  box-shadow: 0 14px 34px -12px var(--rose), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 160ms cubic-bezier(.2, .8, .2, 1), box-shadow 160ms ease;
}
.spin::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.6) 50%, transparent 62%);
  transform: translateX(-120%); animation: sheen 5s ease-in-out 1.2s infinite;
}
@keyframes sheen { 0%, 62% { transform: translateX(-120%); } 82%, 100% { transform: translateX(120%); } }
.spin:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 20px 40px -12px var(--rose), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.spin:active { transform: translateY(1px) scale(0.98); box-shadow: 0 6px 18px -8px var(--rose), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.spin:disabled { opacity: 0.55; transform: none; box-shadow: 0 14px 34px -12px var(--rose), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.spin:disabled::after { animation: none; }
kbd { background: var(--glass); border-color: var(--glass-line); }
.lock { border: 1px solid var(--glass-line); background: var(--glass); }

/* The glass rail */
.card {
  /* no backdrop blur: the light behind is already soft, and blurring it again every frame costs weak laptops dearly */
  background: var(--glass); border: 1px solid var(--glass-line); padding: 18px 20px;
  box-shadow: var(--lift);
}
.card h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; }
.pill { background: linear-gradient(120deg, var(--violet), var(--rose)); color: #FFFFFF; padding: 2px 11px; }
textarea, .field input, .field select, .text-in, .erow input[type="text"], .erow input[type="number"] {
  background: var(--field); border: 1px solid var(--glass-line); border-radius: 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea { padding: 12px 14px; border-radius: 14px; }
textarea:focus-visible, .field input:focus-visible, .text-in:focus-visible, .erow input[type="text"]:focus-visible {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 28%, transparent);
}
.field input[type="range"], .field input[type="color"] { border: 0; background: none; box-shadow: none; }
.erow input[type="color"], .erow .icon { border: 1px solid var(--glass-line); background-color: var(--field); border-radius: 10px; }
.swatch { border: 1px solid var(--glass-line); border-radius: 10px; }
.swatch.custom { background: var(--field); }
.fold, .xw, .log li + li { border-color: var(--glass-line); }
.team { border-color: var(--glass-line); background: var(--field); }
.chip { border-radius: 999px; padding: 6px 14px; }
.example-flag { border-color: var(--glass-line); }
.card.shut { cursor: default; }
.card:not(.shut) > *:not(h2) { animation: unfold 260ms cubic-bezier(.2, .8, .2, 1); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }

/* One entrance, once: the wheel arrives, then the rail settles beside it */
.stage { animation: arrive 800ms cubic-bezier(.2, .9, .2, 1) both; }
.rail > .card { animation: settle 600ms cubic-bezier(.2, .8, .2, 1) both; }
.rail > .card:nth-child(1) { animation-delay: 120ms; }
.rail > .card:nth-child(2) { animation-delay: 190ms; }
.rail > .card:nth-child(3) { animation-delay: 260ms; }
.rail > .card:nth-child(n+4) { animation-delay: 330ms; }
@keyframes arrive { from { opacity: 0; transform: scale(0.94) rotate(-6deg); } }
@keyframes settle { from { opacity: 0; transform: translateY(16px); } }

/* The winner */
.veil { background: rgba(6, 6, 20, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.win {
  position: relative; overflow: hidden;
  border: 2px solid transparent; border-radius: 28px; padding: 30px 30px 26px;
  background: linear-gradient(var(--panel), var(--panel)) padding-box,
    conic-gradient(from var(--turn), var(--violet), var(--rose), var(--amber), var(--aqua), var(--violet)) border-box;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.75), 0 0 70px -20px var(--rose);
}
.veil.open .win { animation: pop 520ms cubic-bezier(.2, 1.35, .35, 1), halo 5s linear infinite; }
.win::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, color-mix(in srgb, var(--amber) 30%, transparent) 50%, transparent 60%);
  transform: translateX(-130%);
}
.veil.open .win::after { animation: sweep 900ms ease-out 180ms both; }
@keyframes sweep { to { transform: translateX(130%); } }
@keyframes pop { from { transform: scale(.8) translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.win .eyebrow { font-size: 16px; letter-spacing: 0; text-transform: none; font-weight: 700; }
.win .name { font-weight: 800; letter-spacing: -0.03em; }
.veil.open .win .name { animation: name-in 620ms cubic-bezier(.2, 1.2, .3, 1) 120ms both; }
@keyframes name-in { from { opacity: 0; transform: translateY(14px) scale(0.92); } }
.win .band { height: 6px; border: 0; border-radius: 999px; width: 96px; align-self: center; }
.toast { border-radius: 999px; padding: 10px 20px; box-shadow: var(--lift); }

/* Text below the tool */
.about h3, .jobs h3, .guide h2 { font-weight: 700; letter-spacing: -0.01em; }
.doc h1, .guide h1, .guide .as-h1 { font-weight: 800; letter-spacing: -0.025em; }
.guide .as-h1 { font-family: var(--font-display); }
.foot { border-color: var(--glass-line); }
.stage.has-bg .wheel-btn::before { display: none; }

@media (max-width: 880px) {
  .shell { padding: 0 16px 48px; }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .wheel-btn::before, .spin::after, .stage, .rail > .card, .card:not(.shut) > *:not(h2),
  .veil.open .win, .veil.open .win::after, .veil.open .win .name { animation: none; }
  .btn, .spin { transition: none; }
}
@media (max-width: 600px) {
  .top-tools { width: 100%; flex-wrap: nowrap; }
  .top-tools .lang { flex: 1 1 0; max-width: none; min-width: 0; }
  .top-tools .btn { white-space: nowrap; }
}
/* the halo reaches past the wheel; on a phone that must not turn into a sideways scroll */
html, body { overflow-x: clip; }

/* The slot under the wheel: the name under the pointer while it turns, a nudge to spin before that */
.readout { display: grid; width: 100%; justify-items: center; align-items: center; }
.readout > * { grid-area: 1 / 1; }
.readout .now:not(:empty):not([hidden]) ~ .hint { visibility: hidden; }
.readout .hint { font-size: 16px; }
.hint.touch { display: none; }
@media (hover: none) { .hint.keys { display: none; } .hint.touch { display: block; } }

/* Phone: four tabs along the bottom instead of one long scroll of tool boxes */
.tabs { display: none; }
@media (max-width: 880px) {
  body:not(.view-only) { padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  body:not(.view-only) .tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border-top: 1px solid var(--glass-line); box-shadow: 0 -12px 30px -18px rgba(0, 0, 0, 0.7);
  }
  .tabs button {
    flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; border-radius: 14px; background: none; color: var(--ink-soft); font-size: 12.5px; font-weight: 700; cursor: pointer;
  }
  .tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs button[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, var(--violet) 24%, transparent); }
  .tabs button[aria-pressed="true"] svg { color: var(--rose); }
  html:not([lang="en"]) #tabExplore { display: none; }
  body:not(.view-only) .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }

  body:not(.view-only)[data-tab="wheel"] .rail > .card:not([data-group="wheel"]),
  body:not(.view-only)[data-tab="explore"] .rail > .card:not([data-group="explore"]),
  body:not(.view-only)[data-tab="tools"] .rail > .card:not([data-group="tools"]),
  body:not(.view-only)[data-tab="saved"] .rail > .card:not([data-group="saved"]) { display: none; }
  body:not(.view-only)[data-tab="wheel"] .jobs { display: none; }
  body:not(.view-only):not([data-tab="wheel"]) .stage,
  body:not(.view-only):not([data-tab="wheel"]) .guide,
  body:not(.view-only):not([data-tab="wheel"]) .about,
  body:not(.view-only):not([data-tab="wheel"]) #homeGuide { display: none; }
  body:not(.view-only)[data-tab="tools"] .jobs, body:not(.view-only)[data-tab="saved"] .jobs { display: none; }
  body:not(.view-only)[data-tab="explore"] .jobs { margin-top: 18px; }
}

/* Ads: two fixed spots, labelled, and invisible until Google fills them */
.ad { margin: 34px 0 0; text-align: center; min-width: 0; }
.ad-label { display: none; margin: 0 0 6px; font-size: 12px; color: var(--ink-soft); }
.ad:has(ins[data-ad-status="filled"]) .ad-label { display: block; }
.ad ins[data-ad-status="unfilled"] { display: none !important; }
body.view-only .ad { display: none; }

/* The site's name under every wheel, so a screenshot or a clip of a spin says where it came from */
.mark { margin: -6px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; color: var(--ink); opacity: 0.72; text-align: center; user-select: none; }
.stage.has-bg .mark, body.clear-bg .mark { opacity: 1; color: #FFFFFF; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.6); }
.win .win-mark { margin: 2px 0 0; font-size: 14px; opacity: 0.6; }

/* Magnifier */
.wheel-wrap { position: relative; width: 100%; display: flex; justify-content: center; }
.mag-btn {
  position: absolute; top: 0; inset-inline-end: 0; z-index: 3; width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-line); background: var(--panel); color: var(--ink);
  transition: transform 140ms ease, border-color 140ms ease;
}
.mag-btn:hover { border-color: var(--violet); transform: scale(1.06); }
.mag-btn[aria-pressed="true"] { background: linear-gradient(120deg, var(--violet), var(--rose)); color: #FFFFFF; border-color: transparent; }
body.clear-bg .mag-btn { display: none; }
@media (prefers-reduced-motion: reduce) { .mag-btn { transition: none; } }
@media (min-width: 881px) {
  .wheels:not(.multi) .wheel-btn { width: min(100%, 620px, max(280px, calc(100vh - 305px))); }
}
@media (min-width: 881px) { .stage:fullscreen .wheels:not(.multi) .wheel-btn { width: min(92vw, calc(100vh - 272px)); } }
@media (min-width: 881px) {
  /* a title above the wheel takes room too; keep the SPIN button on screen */
  .stage:has(#wheelHead:not([hidden])) .wheels:not(.multi) .wheel-btn { width: min(100%, 620px, max(280px, calc(100vh - 358px))); }
  .stage:fullscreen:has(#wheelHead:not([hidden])) .wheels:not(.multi) .wheel-btn { width: min(92vw, calc(100vh - 325px)); }
}

/* AI wheel maker */
.ai-form { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-form .text-in { flex: 1 1 200px; min-width: 0; padding: 9px 12px; }
#aiCard .btn { background: linear-gradient(120deg, var(--violet), var(--rose)); color: #FFFFFF; border-color: transparent; }
html:not([lang="en"]) #aiCard { display: none; }

/* Contact form */
.contact-form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 560px; margin: 0 0 14px; }
.contact-form .field input, .contact-form textarea { font-size: 16px; color: var(--ink); }
.contact-form .field input { padding: 9px 12px; }
.contact-form textarea { min-height: 170px; }
.contact-form .cf-turnstile { min-height: 65px; max-width: 100%; }
.contact-form .btn { background: linear-gradient(120deg, var(--violet), var(--rose)); color: #FFFFFF; border-color: transparent; padding: 10px 20px; }
.contact-form .note { margin: 0; }
.contact-form .note.bad { color: var(--rose); }

/* Full screen: an X in the top-left corner to go back */
.fs-exit { display: none; }
.stage:fullscreen .fs-exit {
  display: flex; align-items: center; justify-content: center; position: fixed; top: 16px; left: 16px; z-index: 6;
  width: 52px; height: 52px; padding: 0; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--glass-line); background: var(--panel); color: var(--ink);
}
.stage:fullscreen .fs-exit:hover { border-color: var(--rose); }
