/* Challenge wheel: setup (players and rounds), the wheel with the scores beside it, and the challenge card. */
.wh-main { position: relative; overflow: hidden; } /* the turning wheel's square box must not make the page scrollable */
.wh-main [hidden] { display: none !important; }
.wh-label { font-family: var(--serif); font-size: 1.5rem; color: var(--sea-deep); }
.wh-note { font-size: 0.95rem; color: #5d646a; }
kbd { display: inline-block; min-width: 1.7em; padding: 0 0.4em; border-radius: 6px; background: var(--sand); border: 1px solid var(--rule); font: inherit; text-align: center; line-height: 1.4; }

/* ---------- setup ---------- */
.wh-setup { width: min(1180px, 94vw); display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 22px); }
.wh-title { font-size: 2.6rem; color: var(--sea-deep); }
.wh-sub { margin: -6px 0 0; font-size: 1.05rem; color: #5d646a; text-align: center; }
.wh-players { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: 100%; }
.wh-chip { display: flex; min-width: 0; border-radius: 18px; background: var(--sand); }
.wh-chip.is-editing { background: #fff; box-shadow: inset 0 0 0 4px var(--chip), 0 6px 18px rgba(22,44,51,0.12); }
.wh-chip-name {
  flex: 1; min-width: 0; min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 18px;
  border: 0; border-radius: 18px; background: transparent; cursor: pointer; font-size: 1.3rem; font-weight: 400; text-align: left;
  touch-action: manipulation;
}
.wh-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.wh-chip-text.is-fresh { background: rgba(184,146,110,0.32); border-radius: 4px; }
.wh-chip-text.has-caret::after { content: ""; display: inline-block; width: 3px; height: 1.1em; margin-left: 2px; vertical-align: -0.18em; background: var(--ink); animation: wh-blink 1s steps(1) infinite; }
@keyframes wh-blink { 50% { opacity: 0; } }
.wh-chip-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--chip); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15); }
.wh-chip-remove { flex: none; width: 64px; border: 0; border-radius: 18px; background: transparent; cursor: pointer; color: #6b6f73; touch-action: manipulation; }
.wh-chip-remove svg, .wh-add svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.wh-add {
  min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 3px dashed var(--rule); border-radius: 18px; background: transparent; cursor: pointer; font-size: 1.15rem; color: var(--sea);
  touch-action: manipulation;
}
.wh-setup-slot { width: 100%; min-height: calc(3 * clamp(64px, 7.4vh, 76px) + 16px); display: grid; place-items: center; }
.wh-options { display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3vh, 28px); }
.wh-option { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.wh-option .choice button { min-width: 80px; font-size: 1.2rem; }
.wh-start { min-height: 84px; padding: 0 2.4em; border-radius: 24px; font-size: 1.6rem; box-shadow: 0 6px 0 #9a7655; }
.wh-start:active { transform: translateY(3px); box-shadow: 0 3px 0 #9a7655; }
.wh-keypad { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wh-keyrow { display: flex; gap: 8px; justify-content: center; }
.wh-key {
  width: clamp(64px, 6.6vw, 92px); height: clamp(64px, 7.4vh, 76px); padding: 0;
  border: 0; border-radius: 14px; background: #fff; cursor: pointer; font-size: 1.4rem; font-weight: 400;
  box-shadow: inset 0 0 0 2px var(--sand-deep), 0 3px 0 var(--sand-deep); touch-action: manipulation;
}
.wh-key-wide { width: clamp(112px, 11vw, 168px); font-size: 1.15rem; }
.wh-key-done { background: var(--coral); color: #fff; box-shadow: 0 3px 0 #9a7655; }
.wh-key.is-down, .wh-key:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--sand-deep); }

/* ---------- play ---------- */
.wh-play { width: 100%; height: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; gap: clamp(24px, 4.5vw, 84px); }
.wh-wheel-box { --size: min(calc(100vh - 170px), 56vw); position: relative; flex: none; margin-top: calc(var(--size) * 0.05); width: var(--size); height: var(--size); }
.wh-wheel-box::before { content: ""; position: absolute; inset: 1%; border-radius: 50%; box-shadow: 0 16px 36px rgba(22,44,51,0.3); }
.wh-rotor { position: absolute; inset: 0; border-radius: 50%; will-change: transform; touch-action: none; cursor: grab; }
.wh-rotor:active { cursor: grabbing; }
.wh-rotor svg { display: block; width: 100%; height: 100%; }
.wh-rim { fill: var(--sea-deep); }
.wh-seg { transition: opacity 0.3s; }
.wh-seg.is-dim { opacity: 0.38; }
.wh-divider { stroke: rgba(255,255,255,0.85); stroke-width: 0.8; }
.wh-light { fill: #fff6dc; }
.wh-light.is-mid { fill: #f2c14e; }
.wh-seg-text { font-family: var(--sans); font-weight: 600; font-size: 7.6px; letter-spacing: 0.15px; pointer-events: none; }
.wh-pointer {
  position: absolute; z-index: 3; left: 50%; top: calc(var(--size) * -0.045); width: calc(var(--size) * 0.085);
  transform: translateX(-50%); transform-origin: 50% 30%; pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3));
}
.wh-pointer svg { display: block; width: 100%; }
.wh-pointer path { fill: #fff; stroke: var(--sea-deep); stroke-width: 2.5; }
.wh-pointer circle { fill: var(--coral); }
.wh-pointer.is-tick { animation: wh-tick 0.14s ease-out; }
@keyframes wh-tick { 40% { transform: translateX(-50%) rotate(-16deg); } }
.wh-spin {
  position: absolute; z-index: 2; left: 50%; top: 50%; width: calc(var(--size) * 0.25); height: calc(var(--size) * 0.25);
  min-width: 80px; min-height: 80px; transform: translate(-50%, -50%);
  border: calc(var(--size) * 0.016) solid #fff; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, #d4ad88, var(--coral) 55%, #94704f);
  color: #fff; font-family: var(--sans); font-weight: 600; font-size: calc(var(--size) * 0.048); letter-spacing: 0.08em; text-transform: uppercase;
  box-shadow: 0 6px 14px rgba(0,0,0,0.3); touch-action: manipulation;
}
.wh-spin:active { transform: translate(-50%, -50%) scale(0.95); }
.wh-spin:disabled { cursor: default; filter: grayscale(0.6); opacity: 0.8; }
.wh-spin:focus-visible { outline: 5px solid var(--sea-deep); outline-offset: 4px; }

.wh-side { width: clamp(300px, 28vw, 500px); display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 16px); }
.wh-round { font-family: var(--serif); font-size: 1.45rem; color: var(--sea); }
.wh-turn { display: flex; align-items: center; gap: 14px; min-height: 2.4em; font-family: var(--serif); font-size: 2.3rem; font-weight: 500; line-height: 1.1; color: var(--sea-deep); }
.wh-turn-dot { flex: none; width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15); }
.wh-hint { margin: 0; font-size: 1rem; color: #5d646a; }
.wh-scores { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wh-scores li { display: flex; align-items: center; gap: 12px; padding: 8px 18px; border-radius: 14px; background: var(--sand); font-size: 1.25rem; }
.wh-scores li.is-current { background: #fff; box-shadow: inset 0 0 0 3px var(--chip); }
.wh-score-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-score-pts { font-weight: 600; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.wh-scores li.is-point .wh-score-pts { animation: wh-bump 0.5s ease-out; color: var(--good); }
@keyframes wh-bump { 40% { transform: scale(1.6); } }

/* ---------- challenge card ---------- */
.wh-card-layer { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 12px; background: rgba(22,44,51,0.45); }
.wh-card {
  --cat: var(--coral); --cat-ink: #fff;
  width: min(1000px, 92vw); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 28px; background: var(--cream); box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}
.wh-card.is-in { animation: wh-card-in 0.4s cubic-bezier(.2,.9,.3,1.25); }
@keyframes wh-card-in { from { transform: scale(0.8) rotate(-2deg); opacity: 0; } to { transform: none; opacity: 1; } }
.wh-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 30px; background: var(--cat); color: var(--cat-ink); font-family: var(--serif); font-size: 2.1rem; font-weight: 600; }
.wh-card-who { font-family: var(--sans); font-size: 1.15rem; font-weight: 400; opacity: 0.92; white-space: nowrap; }
.wh-card-body { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.8vh, 18px); padding: clamp(14px, 3vh, 30px) 44px clamp(8px, 1.5vh, 16px); text-align: center; }
.wh-card-how { margin: 0; font-size: 1.15rem; color: #5d646a; }
.wh-card-text { margin: 0; max-width: 24ch; font-family: var(--serif); font-size: 3.3rem; font-weight: 600; line-height: 1.1; color: var(--sea-deep); }
.wh-card-text.is-long { max-width: 30ch; font-size: 2.6rem; }
.wh-card-answer { min-height: 64px; display: grid; place-items: center; }
.wh-card-answer p { margin: 0; font-family: var(--serif); font-size: 2.1rem; font-weight: 600; color: var(--good); }
.wh-timer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.wh-timer .choice button { min-width: 84px; }
.wh-countdown { min-width: 4.6em; font-size: 2.2rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--sea); text-align: left; }
.wh-countdown.is-low { color: var(--bad); }
.wh-countdown.is-up { color: var(--bad); font-family: var(--serif); }
.wh-card-actions { display: flex; justify-content: center; gap: 16px; padding: 8px 44px clamp(16px, 3vh, 30px); }
.wh-skip, .wh-done { min-height: 80px; min-width: 200px; border-radius: 22px; font-size: 1.45rem; }
.wh-done { min-width: 300px; background: var(--good); box-shadow: 0 6px 0 #2b5a40; }
.wh-done:active { transform: translateY(3px); box-shadow: 0 3px 0 #2b5a40; }

@media (prefers-reduced-motion: reduce) {
  .wh-card.is-in, .wh-pointer.is-tick, .wh-scores li.is-point .wh-score-pts, .wh-chip-text.has-caret::after { animation: none; }
  .wh-seg { transition: none; }
}
/* Narrow or portrait screens: scores under the wheel. */
@media (max-aspect-ratio: 4/3) {
  .wh-play { flex-direction: column; gap: 12px; }
  .wh-wheel-box { --size: min(calc(100vh - 420px), 88vw); }
  .wh-side { width: min(600px, 92vw); }
  .wh-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
