/* ── Reset & base ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --blue:  #00aaff;
    --blue2: #005599;
    --dark: #0d0d0d;
}
body {
    font-family: 'Oswald', sans-serif;
    background: var(--dark);
    color: #fff;
    min-height: 100vh;
    padding: 10px 14px 24px;
    font-size: 17px;
}

/* ── Header ───────────────────────────────────────────────── */
.sto-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #222;
}
.sto-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    color: #fff;
    flex-shrink: 0;
}
.sto-participants {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: 0;
}
.sto-participants::-webkit-scrollbar { display: none; }
.sto-participants img {
    width: 53px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #333;
    flex-shrink: 0;
}
.sto-participants img.p-eliminated {
    border-color: #880000;
    filter: grayscale(80%) brightness(0.45);
    opacity: 0.5;
}
.sto-participants img.p-nominated {
    border-color: #fff;
}
.sto-nav {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.sto-nav-btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.15s, box-shadow 0.15s;
}
.sto-nav-menu {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #111;
    box-shadow: 0 0 12px rgba(255,180,0,0.4);
}
.sto-nav-menu:hover { transform: scale(1.05); box-shadow: 0 0 22px rgba(255,180,0,0.7); }

.sto-header-tts {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
}
.sto-tts {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}
.sto-tts-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.sto-tts-btn:hover { transform: scale(1.12); }
.tts-play  { background: #22c55e; color: #fff; }
.tts-pause { background: #f59e0b; color: #fff; }
.tts-stop  { background: #ef4444; color: #fff; }
.tts-speed { background: #444; color: #fff; font-weight: bold; font-size: 15px; }
.sto-tts-speed {
    min-width: 28px;
    text-align: center;
    font-size: 0.85rem;
    color: #aaa;
    flex-shrink: 0;
}

/* ── Main 2-column ────────────────────────────────────────── */
.sto-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 900px) { .sto-main { grid-template-columns: 1fr; } }

/* ── Grid panel ───────────────────────────────────────────── */
.sto-grid-wrap {
    background: rgba(0,0,0,0.4);
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    padding: 14px;
}
.sto-grid-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.sto-grid-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: #fff;
    letter-spacing: 0.1em;
    text-align: left;
    margin: 0;
    flex: 1;
}

/* 6 columns × 4 rows = 24 boxes (same layout as Problems) */
.sto-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.sto-box {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 2px solid var(--blue2);
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 1.9rem);
    color: #888;
    cursor: default;
    position: relative;
    transition: all 0.2s;
    user-select: none;
}
.sto-box:not(.used):hover {
    border-color: var(--blue2);
    color: #888;
    transform: none;
    box-shadow: none;
}
.sto-box.selected {
    border-color: #fff;
    color: #fff;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 22px rgba(255,255,255,0.55);
    animation: stoBoxPulse 1s ease-in-out infinite;
}
@keyframes stoBoxPulse { 50% { transform: scale(1.05); } }

.sto-box.used {
    background: rgba(0,85,153,0.45);
    color: #fff;
    border-color: var(--blue2);
    opacity: 0.65;
    cursor: pointer;
}
.sto-box.used:hover {
    opacity: 0.85;
    border-color: var(--blue);
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 0 14px rgba(0,170,255,0.35);
}

.sto-box.has-assign::after {
    content: '👤';
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 9px;
    background: #0f0;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Roll button */
.sto-roll-btn {
    width: auto;
    flex-shrink: 0;
    padding: 8px 20px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, var(--blue2), #003366);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(0,170,255,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.sto-roll-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 28px rgba(0,170,255,0.65);
}
.sto-roll-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    background: linear-gradient(135deg, #333, #222);
    color: #888;
}
.sto-roll-btn--exhausted {
    opacity: 0.45;
    cursor: pointer;
    box-shadow: none;
    background: linear-gradient(135deg, #333, #222);
    color: #888;
}
.sto-roll-msg {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.35);
    color: #ffe9a8;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ── Result panel ─────────────────────────────────────────── */
.sto-result-wrap {
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--blue);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 0 28px rgba(0,170,255,0.12);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s, transform 0.35s;
}
.sto-result-wrap.visible { opacity: 1; transform: translateY(0); }
.sto-result-wrap.pop-in  { animation: stoPopIn 0.4s ease; }
@keyframes stoPopIn {
    0%   { opacity: 0; transform: scale(0.93) translateY(12px); }
    70%  { transform: scale(1.02) translateY(-3px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.sto-result-head {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2a2a;
}
.sto-result-head h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    color: #fff;
    letter-spacing: 0.04em;
    -webkit-font-smoothing: antialiased;
}

.sto-result-body { line-height: 1.65; }
.sto-result-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    color: #fff;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
    -webkit-font-smoothing: antialiased;
}
.sto-result-assigned {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.sto-result-assigned img {
    width: 40px; height: 53px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid var(--blue);
    box-shadow: 0 0 8px rgba(0,170,255,0.4);
}
.sto-result-text {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(2rem, 3.6vw, 2.4rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #ccc;
    line-height: 1.35;
    margin-top: 4px;
}

/* ── Context menu ─────────────────────────────────────────── */
.sto-ctx-menu {
    position: fixed;
    background: #1e1e1e;
    border: 2px solid var(--blue2);
    border-radius: 8px;
    padding: 4px 0;
    display: none;
    z-index: 3000;
    min-width: 170px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.sto-ctx-menu.active { display: block; }
.sto-ctx-menu div {
    padding: 14px 24px;
    cursor: pointer;
    font-size: 1.3rem;
    color: #ddd;
    transition: background 0.15s;
}
.sto-ctx-menu div:hover { background: var(--blue2); color: #fff; }

/* ── Assign overlay ───────────────────────────────────────── */
.sto-assign-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}
.sto-assign-overlay.active { display: flex; }
.sto-assign-panel {
    background: #1a1a1a;
    border: 3px solid var(--blue);
    border-radius: 14px;
    padding: 22px;
    max-width: 820px;
    width: 95%;
    box-shadow: 0 0 50px rgba(0,170,255,0.4);
}
.sto-assign-panel h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    color: var(--blue);
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 8px;
}
.assign-counter {
    text-align: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    transition: background 0.2s, color 0.2s;
    background: rgba(255,255,255,0.06);
    color: #aaa;
}
.assign-counter.ac-ok      { background: rgba(34,197,94,0.18);  color: #22c55e; }
.assign-counter.ac-over    { background: rgba(239,68,68,0.18);  color: #ef4444; }
.assign-counter.ac-under   { background: rgba(245,158,11,0.18); color: #f59e0b; }
.sto-assign-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.sto-assign-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border-radius: 9px;
    padding: 8px 6px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}
.sto-assign-item:hover { background: #2a2a2a; }
.sto-assign-item.selected { border-color: var(--blue); background: rgba(0,170,255,0.12); }
.sto-assign-item.elim { opacity: 0.35; cursor: default; filter: grayscale(80%); }
.sto-assign-item img {
    width: 100%;
    aspect-ratio: 80/110;
    object-fit: cover;
    border-radius: 7px;
    border: 2px solid #333;
}
.sto-assign-item.selected img { border-color: var(--blue); }
.sto-assign-item .assign-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-top: 5px;
    text-align: center;
}
.sto-assign-close {
    display: block;
    width: 100%;
    padding: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    background: #333;
    color: #aaa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.sto-assign-close:hover { background: #444; color: #fff; }

/* ── Tooltip ──────────────────────────────────────────────── */
.sto-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.88);
    border: 1px solid var(--blue2);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #eee;
    pointer-events: none;
    z-index: 5000;
    display: none;
    max-width: 200px;
}

/* highlight during roulette */
.sto-box.highlight-roulette {
    border-color: #66ccff !important;
    background: rgba(0,150,255,0.22) !important;
    color: #cceeff !important;
    box-shadow: 0 0 24px rgba(0,150,255,0.85) !important;
}

/* -- No-participants prompt ----------------------------------- */
.mod-no-p {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 12px 0;
    text-align: center;
}
.mod-no-p-label {
    font-family: 'Oswald', sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: #888;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.mod-no-p-label strong {
    color: #fff;
    font-size: 2rem;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.1em;
}
.mod-no-p-btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    letter-spacing: 5px;
    padding: 14px 52px;
    background: #000;
    color: #fff;
    border: 3px solid #00ff55;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    box-shadow: 0 0 12px rgba(0,255,85,0.7), 0 0 30px rgba(0,255,85,0.3);
    animation: mod-btn-glow 2s ease-in-out infinite alternate;
    transition: transform 0.15s;
}
@keyframes mod-btn-glow {
    from { box-shadow: 0 0 10px rgba(0,255,85,0.6), 0 0 25px rgba(0,255,85,0.25); }
    to   { box-shadow: 0 0 22px rgba(0,255,85,1),   0 0 55px rgba(0,255,85,0.5); }
}
.mod-no-p-btn:hover  { transform: scale(1.06); }
.mod-no-p-btn:active { transform: scale(0.97); }

/* ── Needs-shuffle / needs-choice badge on grid (NEW) ─── */
.sto-box.sto-box--needs-shuffle,
.sto-box.sto-box--needs-choice {
    border-color: #facc15 !important;
    opacity: 1 !important;
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.55), inset 0 0 12px rgba(250, 204, 21, 0.12);
    animation: sto-needs-choice-pulse 1.4s ease-in-out infinite;
}
.sto-box.sto-box--needs-shuffle.selected,
.sto-box.sto-box--needs-choice.selected {
    animation: sto-needs-choice-pulse 1.4s ease-in-out infinite;
}
.sto-box.sto-box--needs-shuffle::before,
.sto-box.sto-box--needs-choice::before {
    content: 'NEW';
    position: absolute;
    top: -8px;
    right: -6px;
    left: auto;
    padding: 2px 7px;
    border-radius: 6px;
    background: #facc15;
    color: #111;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-shadow: none;
    pointer-events: none;
    z-index: 20;
}
@keyframes sto-needs-choice-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(250, 204, 21, 0.45), inset 0 0 8px rgba(250, 204, 21, 0.08); }
    50% { box-shadow: 0 0 22px rgba(250, 204, 21, 0.75), inset 0 0 14px rgba(250, 204, 21, 0.16); }
}

.sto-result-text-wrap {
    min-height: 0;
    flex: 1;
}
.sto-result-simple,
.sto-result-main,
.sto-result-outcome {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(1.6rem, 2.8vw, 2.1rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #ccc;
    line-height: 1.4;
    margin-top: 4px;
    white-space: pre-line;
}
.sto-result-simple:has(.mod-no-p) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
}
.sto-result-split[hidden] { display: none !important; }
.sto-result-main { margin-bottom: 0; }
.sto-result-chosen {
    margin: 0.85em 0 0;
    padding: 0.65em 0 0;
    border-top: 1px solid #3a3a3a;
    font-family: 'Oswald', sans-serif;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    line-height: 1.4;
    letter-spacing: 0.04em;
    white-space: pre-line;
}
.sto-result-chosen[hidden] { display: none !important; }
.sto-result-chosen--a { color: var(--blue); }
.sto-result-chosen--b { color: #ff8c00; }
.sto-result-outcome { margin-top: 0; padding-top: 4px; }
.sto-result-outcome[hidden] { display: none !important; }
.sto-result-continue {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0 10px;
}
.sto-result-continue[hidden] { display: none !important; }
.sto-result-play-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}
.sto-result-play-btn--blink,
.sto-tts-play--blink {
    animation: stoPlayBlink 1.1s ease-in-out infinite;
}
@keyframes stoPlayBlink {
    0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 26px rgba(34, 197, 94, 1); transform: scale(1.1); }
}

.sto-branch {
    flex-shrink: 0;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #2a2a2a;
}
.sto-branch[hidden] { display: none !important; }
.sto-choice-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.sto-btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.35rem;
    letter-spacing: 0.08em;
    padding: 10px 22px;
    border-radius: 8px;
    border: 2px solid var(--blue);
    background: rgba(0, 85, 153, 0.35);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.sto-btn-choice {
    min-width: 88px;
    font-size: 1.6rem;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
}
.sto-btn-choice:hover {
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.45);
}
.sto-branch--yesno .sto-preview-row,
.sto-preview-row[hidden],
.sto-question[hidden] {
    display: none !important;
}
