/* ---------- top bar ---------- */
.so-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.so-title { display: flex; align-items: center; gap: .9rem; }
.so-title h1 { font-size: 2rem; font-weight: 800; }
.so-title p { font-size: .95rem; }
.so-title-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.1rem;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--violet), var(--pink));
    box-shadow: 0 4px 0 hsl(262 60% 40%);
    animation: wiggle 3s ease-in-out infinite;
}
.so-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.so-class-select { width: auto; min-width: 11rem; }

/* ---------- empty state ---------- */
.so-drop {
    display: block;
    text-align: center;
    padding: 3.5rem 1.5rem;
    border: 3px dashed hsl(262 60% 80%);
    background: hsl(0 0% 100% / .75);
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
}
.so-drop:hover, .so-drop.dragging { border-color: var(--primary); background: hsl(262 90% 98%); transform: scale(1.01); }
.so-drop-emoji { font-size: 4rem; animation: bounce 1.6s ease-in-out infinite; }
.so-drop h2 { font-size: 1.6rem; font-weight: 800; margin: .5rem 0; }
.so-drop p { margin-top: .4rem; }
.so-drop .small { font-size: .9rem; }
.so-privacy {
    display: inline-block;
    margin-top: 1.25rem !important;
    padding: .35rem .8rem;
    border-radius: 999px;
    background: hsl(152 60% 94%);
    color: hsl(152 60% 26%);
    font-size: .85rem;
    font-weight: 700;
}

/* ---------- layout ---------- */
.so-main {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 991.98px) { .so-main { grid-template-columns: minmax(0, 1fr); } }

.so-stage-card { padding: 1.25rem; }
.so-session { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.so-session .btn { margin-left: auto; }

/* ---------- stage ---------- */
.so-stage {
    --stage-a: #6d28d9;
    --stage-b: #db2777;
    position: relative;
    overflow: hidden;
    min-height: 17rem;
    border-radius: 1.5rem;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, var(--stage-a), var(--stage-b));
    box-shadow: inset 0 -6px 0 hsl(0 0% 0% / .15), 0 18px 40px -18px var(--stage-a);
    transition: background .5s, box-shadow .5s;
}
.so-stage-glow {
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 0deg, transparent, hsl(0 0% 100% / .18), transparent 30%);
    animation: spin 8s linear infinite;
    pointer-events: none;
}
.so-stage > :not(.so-stage-glow) { position: relative; }

.so-stage-no {
    min-height: 1.9rem;
    font-weight: 800;
    font-size: .95rem;
}
.so-stage-no:not(:empty) {
    display: inline-block;
    padding: .2rem .8rem;
    border-radius: 999px;
    background: hsl(0 0% 100% / .22);
}
.so-stage-name {
    margin: .4rem 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.4rem, 6.5vw, 5.25rem);
    line-height: 1.05;
    text-shadow: 0 4px 0 hsl(0 0% 0% / .18);
    word-break: break-word;
}
.so-quip {
    min-height: 1.6rem;
    font-weight: 700;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    opacity: .95;
}

.so-stage.idle .so-stage-name { opacity: .95; }
.so-stage.rolling { --stage-a: #4338ca; --stage-b: #9333ea; }
.so-stage.rolling .so-stage-glow { animation-duration: 1.2s; }
.so-stage.rolling .so-stage-name { animation: flick .12s ease-out; }
.so-stage.picked { --stage-a: #ea580c; --stage-b: #facc15; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.so-stage.picked .so-stage-name { color: #fff; }
.so-stage.result-plus { --stage-a: #059669; --stage-b: #34d399; animation: pop .5s ease-out; }
.so-stage.result-minus { --stage-a: #be123c; --stage-b: #fb7185; animation: shake .5s ease-in-out; }
.so-stage.result-super {
    --stage-a: #7c3aed; --stage-b: #ec4899;
    background: linear-gradient(120deg, #7c3aed, #ec4899, #f59e0b, #10b981, #0ea5e9, #7c3aed);
    background-size: 300% 300%;
    animation: pop .6s ease-out, rainbow 3s linear infinite;
}
.so-stage.result-pass { --stage-a: #475569; --stage-b: #94a3b8; }

/* ---------- spin button ---------- */
.so-spin-row { display: flex; flex-direction: column; align-items: center; margin-top: 1.25rem; }
.so-spin {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    padding: .85rem 2.25rem;
    border: 0;
    border-radius: 999px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--violet), var(--pink));
    box-shadow: 0 6px 0 hsl(300 60% 35%), 0 14px 30px -10px hsl(300 80% 50% / .6);
    transition: transform .1s, box-shadow .1s, filter .2s;
}
.so-spin:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-2px); }
.so-spin:hover:not(:disabled) .so-spin-dice { animation: roll .6s ease-in-out; }
.so-spin:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 hsl(300 60% 35%); }
.so-spin:focus-visible { outline: none; box-shadow: 0 6px 0 hsl(300 60% 35%), 0 0 0 4px var(--ring); }
.so-spin:disabled { cursor: not-allowed; filter: grayscale(.6) opacity(.6); }
.so-spin.busy .so-spin-dice { animation: roll .5s linear infinite; }
.so-spin-dice { display: inline-block; font-size: 1.9rem; }
.so-spin span:last-child { white-space: nowrap; }

@media (max-width: 575.98px) {
    .so-title h1 { font-size: 1.6rem; }
    .so-title-icon { width: 2.8rem; height: 2.8rem; font-size: 1.6rem; }
    .so-controls { width: 100%; }
    .so-class-select { flex: 1; min-width: 0; }
    .so-stage { min-height: 13rem; padding: 1.5rem 1rem; }
    .so-spin { font-size: 1.3rem; padding: .75rem 1.6rem; }
    .so-spin-dice { font-size: 1.5rem; }
    .so-stage-card, .so-board { padding: 1rem; }
    .so-filter { max-width: none; }
}
.so-hint { margin-top: .6rem; font-size: .8rem; }

/* ---------- grade buttons ---------- */
.so-grade {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
    margin-top: 1.25rem;
    animation: pop-in .3s cubic-bezier(.2, 1.4, .4, 1);
}
@media (max-width: 575.98px) { .so-grade { grid-template-columns: repeat(2, 1fr); } }

.so-g {
    --g: var(--slate);
    --g-edge: #334155;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    padding: .8rem .5rem .7rem;
    border: 0;
    border-radius: 1.1rem;
    color: #fff;
    cursor: pointer;
    background: var(--g);
    box-shadow: 0 5px 0 var(--g-edge);
    transition: transform .1s, box-shadow .1s, filter .15s;
}
.so-g span { font-size: 2rem; line-height: 1.1; transition: transform .2s; }
.so-g b { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.so-g kbd { position: absolute; top: .45rem; right: .5rem; color: var(--foreground); opacity: .75; }
.so-g:hover { filter: brightness(1.08); }
.so-g:hover span { transform: scale(1.2) rotate(-8deg); }
.so-g:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--g-edge); }
.so-g:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.so-g-plus { --g: #10b981; --g-edge: #047857; }
.so-g-minus { --g: #f43f5e; --g-edge: #be123c; }
.so-g-super { --g: linear-gradient(135deg, #8b5cf6, #ec4899, #f59e0b); --g-edge: #9d174d; }
.so-g-pass { --g: #64748b; --g-edge: #334155; }

/* ---------- history ---------- */
.so-history-wrap { margin-top: 1.5rem; }
.so-section-title { font-family: var(--font-body); font-size: .8rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: .5rem; }
.so-history { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.so-history:empty::before { content: "Henüz kimse yanmadı… şimdilik 😇"; color: var(--muted-foreground); font-size: .9rem; }
.so-history li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .4rem .3rem .75rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    background: var(--muted);
    border: 1px solid var(--border);
}
.so-history li:first-child { animation: pop-in .3s ease-out; }
.so-history li:not(:first-child) { opacity: .8; padding-right: .75rem; }
.so-history .h-plus { background: hsl(152 60% 94%); border-color: hsl(152 50% 80%); }
.so-history .h-minus { background: hsl(350 90% 96%); border-color: hsl(350 70% 86%); }
.so-history .h-super { background: linear-gradient(90deg, hsl(262 90% 96%), hsl(330 90% 95%)); border-color: hsl(290 60% 85%); }
.so-history .h-pass { background: hsl(215 25% 94%); border-color: hsl(215 20% 84%); }
.so-undo {
    border: 0;
    background: #fff;
    border-radius: 999px;
    padding: .05rem .5rem;
    font-size: .75rem;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
}
.so-undo:hover { background: var(--primary); color: #fff; }

/* ---------- leaderboard ---------- */
.so-board { padding: 1.25rem; }
.so-board-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: .75rem; }
.so-board-head > div { flex: 1 1 12rem; }
.so-filter { flex: 1 1 10rem; max-width: 14rem; }
.so-list-scroll { max-height: 68vh; overflow-y: auto; margin: 0 -.5rem; padding: 0 .5rem; }

.so-table th { position: sticky; top: 0; background: #fff; z-index: 1; white-space: nowrap; }
.so-table th[data-sort] { cursor: pointer; user-select: none; }
.so-table th[data-sort]:hover { color: var(--foreground); }
.so-table th[data-dir="asc"]::after { content: " ↑"; }
.so-table th[data-dir="desc"]::after { content: " ↓"; }
.so-table .c { text-align: center; width: 2.4rem; }
.so-table .r { text-align: right; }
.so-table td.no { color: var(--muted-foreground); font-variant-numeric: tabular-nums; width: 3.5rem; }
.so-table td.name { font-weight: 700; }
.so-table td.name .medal { margin-left: .3rem; }
.so-table td.c { font-weight: 800; color: var(--muted-foreground); }
.so-table td.c.has { color: var(--foreground); }

.pts {
    display: inline-block;
    min-width: 2.2rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    text-align: center;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: var(--muted);
    color: var(--muted-foreground);
}
.pts.pos { background: hsl(152 60% 92%); color: hsl(152 70% 26%); }
.pts.neg { background: hsl(350 90% 95%); color: hsl(350 70% 42%); }

.so-table tr.used td.name { text-decoration: line-through; text-decoration-color: hsl(350 80% 60% / .7); text-decoration-thickness: 2px; color: var(--muted-foreground); }
.so-table tr.current td { background: hsl(45 100% 92%); }
.so-table tr.current td.name::before { content: "👉 "; }
.so-table tr.bump td { animation: bump-row 1s ease-out; }

/* ---------- 3D show overlay (sanli-show.js) ---------- */
html.show-open { overflow: hidden; }
.show-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    overflow: hidden;
    animation: fade-in .35s ease-out;
    user-select: none;
}
.show-overlay.leaving { opacity: 0; transform: scale(1.04); transition: opacity .45s, transform .45s; }
.show-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 45%, #3b1a7a 0%, #1d0b45 45%, #0b0420 100%);
}
.show-bg::after {
    content: "";
    position: absolute;
    inset: -50%;
    background: conic-gradient(from 0deg, transparent 0 10%, hsl(300 90% 60% / .12) 15%, transparent 20% 45%, hsl(200 90% 60% / .1) 50%, transparent 55% 80%, hsl(45 95% 60% / .1) 85%, transparent 90%);
    animation: spin 14s linear infinite;
}
.show-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.show-quip {
    position: absolute;
    top: 4vh;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
    text-align: center;
    padding: .4rem 1.2rem;
    border-radius: 999px;
    background: hsl(260 60% 10% / .55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.3rem, 3.2vw, 2.4rem);
    text-shadow: 0 4px 18px hsl(300 90% 50% / .6);
}
.show-quip:empty { display: none; }
.show-quip.pop { animation: quip-pop .35s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes quip-pop { from { opacity: 0; transform: translateX(-50%) scale(.9); } }
.show-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 7vh;
    text-align: center;
    text-shadow: 0 4px 20px hsl(260 80% 10% / .8);
    padding: 0 1rem;
    color: #fff;
    opacity: 0;
    transform: translateY(20px) scale(.9);
}
.show-overlay.revealed .show-caption { opacity: 1; transform: none; transition: opacity .4s .25s, transform .5s .25s cubic-bezier(.2, 1.5, .4, 1); }
.show-caption-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.8rem, 5vw, 3.6rem);
    line-height: 1.1;
    background: linear-gradient(90deg, #fde047, #f472b6, #a78bfa, #60a5fa, #fde047);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow 2.5s linear infinite;
}
.show-caption-text { margin-top: .35rem; font-weight: 800; font-size: clamp(1.1rem, 2.4vw, 1.6rem); }
.show-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.show-overlay.revealed .show-flash { animation: flash .6s ease-out; }
.show-skip {
    position: absolute;
    bottom: 2.5vh;
    left: 0;
    right: 0;
    text-align: center;
    color: hsl(0 0% 100% / .55);
    font-size: .85rem;
    font-weight: 700;
    opacity: 0;
}
.show-overlay.revealed .show-skip { opacity: 1; transition: opacity .4s 1.2s; }
.show-overlay.revealed { cursor: pointer; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes roll { to { transform: rotate(1turn); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes flick { from { transform: translateY(-8px) scale(.97); opacity: .6; } }
@keyframes pop { 0% { transform: scale(.92); } 55% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-1deg); } 40% { transform: translateX(9px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes rainbow { to { background-position: 300% 50%; } }
@keyframes bump-row { from { background: hsl(262 90% 90%); } }
