:root {
  color-scheme: light dark;
  --page: light-dark(#f6effa, #1d0b21);
  --field: light-dark(#ffffff, #2b1430);
  --ink: light-dark(#2b1030, #f7eefa);
  --muted: light-dark(#6b5270, #bda6c3);
  --line: light-dark(#d9c8e0, #4b3052);
  --accent: light-dark(#c2184f, #ff7aa5);
  --on-accent: light-dark(#ffffff, #2b1030);
  --good: light-dark(#0f6b63, #62d2c6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 1rem/1.5 ui-rounded, "SF Pro Rounded", Quicksand, Nunito, "Segoe UI", system-ui, sans-serif;
}

h1, h2 { margin: 0; line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-underline-offset: .2em; text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); font-size: .9rem; }
.saved { color: var(--good); font-size: .9rem; font-weight: 700; }
.error { color: var(--accent); font-weight: 600; }
.error:empty { display: none; }
.plain { list-style: none; margin: 0; padding: 0; }

.bar { display: flex; justify-content: space-between; align-items: center; padding: .75rem clamp(1rem, 4vw, 3rem); }
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; }

/* Controls */
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: .4rem 1.1rem;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--ink); }
button:disabled { cursor: default; opacity: .6; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.quiet { background: none; border-color: transparent; }
.danger { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
nav { display: flex; align-items: center; }

label { font-weight: 700; }
input, textarea {
  width: 100%; padding: .65rem .85rem;
  border: 2px solid var(--line); border-radius: .75rem;
  background: var(--field); color: inherit; font: inherit;
}
textarea { resize: vertical; }
fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: .25rem; }
legend { padding: 0; font-weight: 700; margin-bottom: .25rem; }
.inline { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; }
.inline > div { flex: 1 1 12rem; }
#max-spins { width: 8rem; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 2rem; font-weight: 400; cursor: pointer; }
.check input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); }
.copy-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.copy-row input { min-width: 0; }
.copy-row button { flex: none; }
form { display: grid; gap: .6rem; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

/* Wheel next to a side column; stacked on narrow screens */
.split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  gap: 2rem clamp(1.5rem, 5vw, 5rem);
  max-width: 76rem; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 3rem) 3rem;
}
.stage { display: grid; gap: 1rem; justify-items: center; align-content: start; text-align: center; }
.side { display: grid; gap: 1rem; align-content: start; }
.side h2 { margin-top: .75rem; }
#people { display: grid; gap: .75rem; }

.wheel { position: relative; width: min(100%, 40rem, 62vh); }
.wheel svg { display: block; width: 100%; }
.rim { fill: var(--ink); }
.blank { fill: var(--line); }
.pointer { fill: var(--field); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.disc { transform-origin: 0 0; }
.disc text { font-weight: 700; }
.hub {
  /* The wheel's centre sits slightly below the middle: 108/212 of the height. */
  position: absolute; left: 50%; top: 50.94%; translate: -50% -50%;
  width: 24%; aspect-ratio: 1; min-height: 0; padding: 0;
  border: 4px solid #2b1030; background: #fff; color: #2b1030;
  font-size: clamp(.85rem, 2.6vw, 1.3rem); font-weight: 800;
}
.hub:hover:not(:disabled) { background: #ffcf33; border-color: #2b1030; }
.hub:disabled { opacity: 1; color: #6b5270; }

.result { min-height: 1.2em; font-size: clamp(1.8rem, 1.2rem + 2.5vw, 3rem); line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; }

.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.rows .outcome { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.rows .details { flex: none; display: grid; justify-items: end; font-size: .85rem; }
.rows .who { font-weight: 700; }
.rows time { color: var(--muted); font-variant-numeric: tabular-nums; }

.notice { display: grid; gap: 1rem; justify-items: start; max-width: 28rem; margin: 10vh auto; padding: 1rem; }
.notice form, .notice .label-row { width: 100%; }
.notice form + form { margin-top: 1.5rem; }

.admin { max-width: 60rem; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 3rem) 3rem; display: grid; gap: 1rem; }
.admin-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1.5rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.admin-list .info { flex: 1 1 18rem; min-width: 0; }
.admin-list .info a { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }

@media (max-width: 52rem) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
