/* Spin the Wheel */
.entry-count { color: var(--color-deep-warm); }
.warn-text { color: var(--color-coral-text); font-weight: 700; }
.chip-btn { cursor: pointer; padding: 4px 12px; min-height: 40px; color: var(--color-ink); font: inherit; font-weight: 700; font-size: .9rem; }
.chip-btn:hover { background: var(--color-yolk-soft); }
.wheel-actions { margin-top: var(--space-sm); }

/* Phone: the wheel comes first, the list below it. */
@media (max-width: 899px) {
    .wheel-grid > .tool-result { order: -1; }
}

.wheel-card { text-align: center; }
body .wheel-card .wheel-heading {
    font-size: clamp(1.4rem, 5vw, 2rem);
    margin: 0 0 var(--space-md);
    overflow-wrap: anywhere;
}

.wheel-stage {
    position: relative;
    width: 100%;
    max-width: min(560px, 100%);
    margin: 0 auto var(--space-md);
    aspect-ratio: 1;
}
.wheel-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wheel-rot { transition: opacity .3s ease; }
.wheel-stage.fading .wheel-rot { animation: wheel-fade .32s ease both; }
@keyframes wheel-fade { from { opacity: .25; } to { opacity: 1; } }

.slice { stroke: var(--color-ink); stroke-width: .7; stroke-linejoin: round; }
/* Fills from the theme's accents. Labels sit in --color-ink-on-hot, which
   stays near-black in every scheme: 8:1 or better on each of these. */
.slice--0 { fill: var(--color-yolk); }
.slice--1 { fill: var(--color-sky); }
.slice--2 { fill: var(--color-coral); }
.slice--3 { fill: var(--color-sage); }
.slice--4 { fill: var(--color-plum); }
.slice--5 { fill: var(--color-apricot); }
.slice--6 { fill: var(--color-halo); }
.slice-label {
    fill: var(--color-ink-on-hot);
    font-family: var(--font-family);
    font-weight: 800;
    text-anchor: end;
    dominant-baseline: central;
    pointer-events: none;
}
.slice-label--flip { text-anchor: start; }
.wheel-rim { fill: none; stroke: var(--color-ink); stroke-width: 2.5; pointer-events: none; }
.wheel-pointer {
    fill: var(--color-splat);
    stroke: var(--color-ink);
    stroke-width: 2;
    stroke-linejoin: round;
    pointer-events: none;
    transform-box: fill-box;
    transform-origin: 50% 0;
}
.wheel-pointer.tick { animation: pointer-tick .12s ease-out; }
@keyframes pointer-tick { 30% { transform: rotate(-14deg); } 100% { transform: none; } }

.wheel-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22%;
    height: 22%;
    min-width: var(--target-min);
    min-height: var(--target-min);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: var(--line) solid var(--color-ink);
    background: var(--color-yolk-hot);
    color: var(--color-ink-on-hot);
    box-shadow: var(--pop-sm);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(.8rem, 3.6vmin, 1.35rem);   /* vmin: a short landscape screen gets a small wheel */
    cursor: pointer;
    padding: 0;
}
.wheel-hub:active { box-shadow: var(--pop-press); transform: translate(calc(-50% + 2px), calc(-50% + 2px)); }
.wheel-hub:focus-visible { outline: 3px solid var(--color-ink); outline-offset: 3px; }
.wheel-hub[aria-disabled="true"], body .btn[aria-disabled="true"] { cursor: default; opacity: .6; }
.wheel-stage.spinning .wheel-hub { opacity: 1; }

.wheel-stage.is-empty .wheel-svg, .wheel-stage.is-empty .wheel-hub { visibility: hidden; }
.wheel-empty {
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    border: 2px dashed var(--color-warm-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12%;
    color: var(--color-muted-brown);
    font-weight: 700;
}
.wheel-empty p { margin: 0; }
.wheel-empty .empty-emoji { font-size: 40px; }

body .btn.wheel-spin { font-size: 1.25rem; min-height: 56px; max-width: 360px; }
.wheel-left { margin: var(--space-md) 0 0; }
.wheel-out { justify-content: center; margin-top: 4px; }

/* the result */
.win-card { text-align: center; }
.win { padding: 6px 4px; }
.win-kicker { margin: 0; font-weight: 700; color: var(--color-muted-brown); }
.win-name {
    margin: 4px 0 0;
    color: var(--color-deep-warm);
    min-height: 1.4em;
    overflow-wrap: anywhere;
}
.win-card.landed { background: var(--color-yolk-soft); }
.win-card.landed .win-name {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--color-ink);
    font-size: clamp(34px, 10vw, 56px);
    line-height: 1.1;
    animation: win-pop .45s var(--transition-bounce, ease) both;
}
@keyframes win-pop { from { transform: scale(.6) rotate(-4deg); } to { transform: none; } }
.win-actions { margin-top: var(--space-md); }

.history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body .history-head h2 { margin: 0; }
.history { margin: var(--space-sm) 0 0; padding-left: 2em; columns: 2; column-gap: 2em; }
.history li { overflow-wrap: anywhere; break-inside: avoid; }

@media (min-width: 900px) {
    .wheel-stage { max-width: 600px; }
}

/* Big screen: the wheel fills the screen for a TV or a shared call. */
body.wheel-big .tool-top,
body.wheel-big .tool-head,
body.wheel-big .tool-form,
body.wheel-big .tool-foot,
body.wheel-big .history-card,
body.wheel-big .wheel-left,
body.wheel-big .wheel-out { display: none !important; }
body.wheel-big .tool-page { max-width: none; padding-top: 12px; }
body.wheel-big .wheel-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
body.wheel-big .tool-result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
body.wheel-big .tool-card { box-shadow: none; }
body.wheel-big .tool-card + .tool-card { margin-top: 0; }
body.wheel-big .wheel-stage { max-width: min(100%, calc(100dvh - 260px - var(--head-h, 0px))); min-width: min(200px, 100%); }
body.wheel-big .wheel-card .wheel-heading { font-size: clamp(1.6rem, 4vw, 3rem); }
.big-exit { margin-top: var(--space-sm); }
@media (min-width: 640px) and (min-aspect-ratio: 4/3) {
    /* landscape (TV, projector, laptop, phone on its side): the result sits
       beside the wheel, so the winner is never below the fold */
    body.wheel-big .tool-result { grid-template-columns: minmax(0, 1fr) minmax(240px, 30%); align-items: center; }
    body.wheel-big .wheel-stage { max-width: min(100%, calc(100dvh - 180px - var(--head-h, 0px))); min-width: min(160px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
    .wheel-pointer.tick, .win-card.landed .win-name { animation: none; }
}
