/* Ginkgo Secret Santa — built on the ginkgo Employee App tokens
   (employee_app/src/styles/tokens.css): dark green ground, #0ACB64 accent, Poppins, glass surfaces. */
:root {
    --gk-bg: #17332C;
    --gk-bg-glow: radial-gradient(74% 40% at 50% 0%, #26493F 0%, rgba(38,73,63,0.55) 42%, rgba(38,73,63,0) 76%);
    --gk-bg-fade: linear-gradient(180deg, #173730 0%, #132A25 30%, #0C1A17 70%, #060F0D 100%);
    --gk-surface-glass: rgba(164,226,196,0.13);
    --gk-surface-faint: rgba(255,255,255,0.04);
    --gk-surface: rgba(255,255,255,0.12);
    --gk-surface-strong: rgba(255,255,255,0.16);
    --gk-fg: #FCFFFE;
    --gk-fg-secondary: rgba(255,255,255,0.72);
    --gk-fg-muted: rgba(255,255,255,0.55);
    --gk-accent: #0ACB64;
    --gk-accent-soft: rgba(10,203,100,0.22);
    --gk-accent-fg: #7BEBB0;
    --gk-accent-line: #108F50;
    --gk-mint: #B0E8CA;
    --gk-sheet-bg: #132A25;
    --gk-scrim: rgba(6,15,13,0.7);
    --gk-hairline: inset 0 0 0 1px rgba(255,255,255,0.06);
    --gk-shadow-calc: inset 0 1px 0 rgba(255,255,255,0.16), 0 8px 24px rgba(0,0,0,0.20);
    --gk-shadow-hero: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 30px rgba(10,15,41,0.14);
    --gk-radius-md: 14px;
    --gk-radius-xl: 24px;
    --gk-radius-pill: 9999px;
    --gk-font: 'Poppins', system-ui, -apple-system, sans-serif;

    --pad: clamp(16px, 4vw, 40px);
    --wheel: min(86vw, 58svh, 440px);
}

*, *::before, *::after { box-sizing: border-box; }

html { background: #060F0D; overflow-x: clip; }

body {
    margin: 0;
    min-height: 100svh;
    font-family: var(--gk-font);
    color: var(--gk-fg);
    background: var(--gk-bg-glow), var(--gk-bg-fade);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---------- Header: static, never moves ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(env(safe-area-inset-top) + 14px) var(--pad) 14px;
    background: rgba(19,42,37,0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.wordmark { height: 26px; width: auto; display: block; }

.tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--gk-accent-fg);
    background: var(--gk-accent-soft);
    padding: 6px 12px;
    border-radius: var(--gk-radius-pill);
    white-space: nowrap;
}

/* ---------- Layout ---------- */
.layout {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    margin: 0 auto;
    padding: clamp(24px, 5vh, 56px) var(--pad) calc(env(safe-area-inset-bottom) + 48px);
    display: grid;
    gap: clamp(28px, 5vw, 64px);
    align-items: center;
}

@media (min-width: 900px) {
    :root { --wheel: min(42vw, 70svh, 500px); }
    .layout {
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: calc(100svh - 60px);
    }
}

/* ---------- Intro ---------- */
.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gk-accent);
}

.title {
    margin: 0;
    font-size: clamp(32px, 6vw, 56px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.lead {
    margin: 12px 0 0;
    font-size: clamp(14px, 1.6vw, 16px);
    line-height: 1.55;
    color: var(--gk-fg-secondary);
    max-width: 44ch;
}

/* ---------- Card ---------- */
.card {
    margin-top: clamp(20px, 4vh, 32px);
    padding: clamp(18px, 3vw, 24px);
    border-radius: var(--gk-radius-xl);
    background: var(--gk-surface-faint);
    box-shadow: var(--gk-hairline), var(--gk-shadow-calc);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.step-head { display: flex; align-items: center; gap: 10px; }
.step-head--second { margin-top: 22px; }

.step-num {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    background: var(--gk-surface-strong);
    color: var(--gk-fg);
    transition: background .2s, color .2s;
}
.step-num.done { background: var(--gk-accent); color: #0C1A17; }

.step-title { margin: 0; font-size: 16px; font-weight: 600; }

.hint {
    margin: 8px 0 0 36px;
    font-size: 14px;
    color: var(--gk-fg-muted);
}

/* Name chips */
.elves {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.elf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px 5px 5px;
    border: 0;
    border-radius: var(--gk-radius-pill);
    background: var(--gk-surface);
    color: var(--gk-fg);
    font: 600 14px/1 var(--gk-font);
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    transition: background .15s, box-shadow .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.elf img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 30%;
    background: #fff;
}
.elf:hover { background: var(--gk-surface-strong); }
.elf:active { transform: scale(0.97); }
.elf:focus-visible { outline: 2px solid var(--gk-accent); outline-offset: 2px; }
.elf[aria-checked="true"] {
    background: var(--gk-accent-soft);
    box-shadow: inset 0 0 0 2px var(--gk-accent);
    color: var(--gk-accent-fg);
}
.is-spinning .elf { pointer-events: none; opacity: .6; }

/* ---------- Wheel ---------- */
.stage { display: grid; place-items: center; }

.wheel-wrap {
    position: relative;
    width: var(--wheel);
    aspect-ratio: 1;
}

.wheel {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    /* background (one segment per person) is set by app.js */
    background: #1E4034;
    box-shadow:
        0 0 0 6px rgba(255,255,255,0.08),
        0 0 0 7px rgba(255,255,255,0.14),
        0 24px 60px rgba(0,0,0,0.45),
        inset 0 0 40px rgba(0,0,0,0.25);
    transition: transform 4.2s cubic-bezier(0.15, 0.85, 0.15, 1);
    will-change: transform;
}

.slot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--wheel) * 0.24);
    aspect-ratio: 1;
    margin: calc(var(--wheel) * -0.12) 0 0 calc(var(--wheel) * -0.12);
    transform: rotate(calc(var(--i) * var(--seg, 72deg))) translateY(calc(var(--wheel) * -0.31));
}
.slot img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 30%;
    background: #fff;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    /* stay upright while the wheel turns */
    transform: rotate(calc(-1 * (var(--rot, 0deg) + var(--i) * var(--seg, 72deg))));
    transition: opacity .2s, filter .2s, transform 4.2s cubic-bezier(0.15, 0.85, 0.15, 1);
}
.slot.is-self img { opacity: .35; filter: grayscale(1); }

.pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    z-index: 3;
    width: 28px;
    height: 34px;
    transform: translateX(-50%);
    background: var(--gk-fg);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}

.spin {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    width: calc(var(--wheel) * 0.26);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 50%;
    background: var(--gk-fg);
    color: #0C1A17;
    font: 700 clamp(14px, calc(var(--wheel) * 0.045), 20px)/1 var(--gk-font);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 0 6px rgba(10,203,100,0.35), 0 10px 24px rgba(0,0,0,0.35);
    transition: transform .15s, box-shadow .2s, background .2s;
    -webkit-tap-highlight-color: transparent;
}
.spin:not(:disabled) { animation: pulse 2s ease-in-out infinite; }
.spin:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.05); }
.spin:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.96); }
.spin:focus-visible { outline: 3px solid var(--gk-accent); outline-offset: 4px; }
.spin:disabled {
    cursor: not-allowed;
    background: #C9D6D0;
    color: rgba(12,26,23,0.5);
    box-shadow: 0 0 0 6px rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.35);
}
.is-spinning .spin { animation: none; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(10,203,100,0.35), 0 10px 24px rgba(0,0,0,0.35); }
    50%      { box-shadow: 0 0 0 12px rgba(10,203,100,0.15), 0 10px 24px rgba(0,0,0,0.35); }
}

/* ---------- Reveal ---------- */
.reveal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: var(--pad);
    background: var(--gk-scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade .25s ease-out;
}
.reveal[hidden] { display: none; }

.reveal-card {
    width: min(100%, 380px);
    padding: 28px 24px 24px;
    text-align: center;
    border-radius: var(--gk-radius-xl);
    background: radial-gradient(115% 85% at 50% -10%, #1E4034 0%, #163027 45%, #101F1D 100%);
    box-shadow: var(--gk-shadow-hero), 0 30px 80px rgba(0,0,0,0.5);
    animation: pop .35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.reveal-card .lead { margin-inline: auto; font-size: 14px; }

.reveal-avatar {
    width: 120px;
    height: 120px;
    margin: 8px auto 0;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 30%;
    background: #fff;
    border: 4px solid var(--gk-accent);
}

.reveal-name {
    margin: 14px 0 0;
    font-size: clamp(34px, 8vw, 44px);
    font-weight: 900;
    line-height: 1.1;
    color: var(--gk-mint);
}

.btn {
    margin-top: 20px;
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: var(--gk-radius-pill);
    background: var(--gk-accent);
    color: #0C1A17;
    font: 600 16px/1 var(--gk-font);
    cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--gk-fg); outline-offset: 3px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(12px); } }

/* ---------- Password gate ---------- */
[hidden] { display: none !important; }

.gate {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: calc(100svh - 60px);
    padding: var(--pad);
}

.card.gate-card {
    width: min(100%, 400px);
    margin: 0;
    text-align: center;
}

.title--gate { font-size: clamp(28px, 6vw, 38px); }
.gate-card .lead { margin-inline: auto; }

.field {
    width: 100%;
    margin-top: 20px;
    padding: 14px 18px;
    border: 0;
    border-radius: var(--gk-radius-pill);
    background: var(--gk-surface);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
    color: var(--gk-fg);
    font: 400 16px/1.2 var(--gk-font);
    text-align: center;
}
.field::placeholder { color: var(--gk-fg-muted); }
.field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gk-accent); }

.error {
    min-height: 20px;
    margin: 10px 0 0;
    font-size: 14px;
    color: #FF8A8E;
}
.gate-card .btn { margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: progress; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Snow ---------- */
.snow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.snow i {
    position: absolute;
    top: -10px;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: #fff;
    animation: fall var(--d) linear infinite;
}
@keyframes fall {
    to { transform: translate(var(--x), 105svh); }
}

/* ---------- Small screens ---------- */
@media (max-width: 899px) {
    .intro { text-align: center; }
    .lead { margin-inline: auto; }
    .card { text-align: left; max-width: 520px; margin-inline: auto; }
}

@media (max-width: 420px) {
    .wordmark { height: 22px; }
    .elf { padding-right: 12px; font-size: 13px; }
    .elf img { width: 28px; height: 28px; }
    .hint { margin-left: 0; }
}

@media (max-height: 520px) and (orientation: landscape) {
    :root { --wheel: min(44vw, 78svh, 360px); }
    .layout { grid-template-columns: minmax(0, 1fr) auto; }
    .intro { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    .wheel, .slot img { transition-duration: 1s; }
    .spin:not(:disabled) { animation: none; }
}
