:root {
    color-scheme: dark;
    --bg: #0e0f12;
    --panel: #16181d;
    --ink: #e7e9ee;
    --muted: #7b8190;
    --line: #262a31;
}
* {
    box-sizing: border-box;
}
*::before,
*::after {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* ── decoy canvas toy ── */
.bar {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
.logo {
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    user-select: none;
}
.muted {
    color: var(--muted);
    font-size: 12px;
}
#stage {
    flex: 1;
    min-height: 0;
    padding: 14px;
}
#c {
    width: 100%;
    height: 100%;
    display: block;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--line);
    touch-action: none;
    cursor: crosshair;
}
.tools {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}
.tools label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}
.tools button {
    background: #20242c;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    font: inherit;
}
.tools button:hover {
    background: #2a2f39;
}
input[type="color"] {
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: none;
}

/* ── unlock prompt ("load session") ── */
.pw-back {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 9, 11, 0.78);
    backdrop-filter: blur(2px);
}
.pw-box {
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.pw-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.pw-sub {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}
.pw-err {
    color: #f87171;
    font-size: 12px;
    margin-bottom: 10px;
}
.pw-box input[type="password"] {
    width: 100%;
    padding: 9px 11px;
    background: #0f1115;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    margin-bottom: 10px;
}
.pw-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 14px;
}
.pw-box button {
    width: 100%;
    padding: 9px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.pw-box button:hover {
    background: #1d4ed8;
}

/* ── viewer overlay (covers the canvas once unlocked) ── */
.viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: #0b0b0c;
    color: #e5e5e5;
}
#viewer-host {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 14px;
}

.stage {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}
.media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    filter: blur(var(--score-blur, 0px));
    transition: filter 250ms ease-out;
}
.stage.fit {
    max-width: none;
    width: 100%;
}
.stage.fit .media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}
.media.blurred {
    filter: blur(40px);
    cursor: pointer;
}
.reveal-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #fff;
    font-size: 15px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.04em;
}

.rating {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #161618;
    border: 1px solid #232326;
    border-radius: 999px;
}
.rating button {
    font-size: 26px;
    line-height: 1;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 120ms ease-out, background 120ms;
    filter: grayscale(0.6) opacity(0.55);
}
.rating button:hover {
    transform: scale(1.18);
    filter: none;
}
.rating button.active {
    filter: none;
    background: #232326;
    border-color: #3a3a3e;
}
.reactions {
    position: fixed;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 45;
}
.rating.solo {
    padding: 4px;
    border-radius: 50%;
}
.rating.solo button {
    padding: 3px;
    font-size: 24px;
}

.score {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    background: #161618;
    border: 1px solid #232326;
    border-radius: 14px;
}
.score.pop {
    animation: favGlow 650ms ease-out;
}
.score-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.star {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.7);
}
.score.lvl-stars .star {
    animation: twinkle var(--d, 3s) ease-in-out infinite var(--delay, 0s);
}
@keyframes twinkle {
    0%,
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 0.7;
        transform: scale(1);
    }
}
.drop {
    position: absolute;
    top: -14px;
    font-size: 12px;
    opacity: 0;
    line-height: 1;
}
.score.lvl-drops .drop {
    animation: fall var(--d, 5s) linear infinite var(--delay, 0s);
}
@keyframes fall {
    0% {
        transform: translateY(-14px);
        opacity: 0;
    }
    12% {
        opacity: 0.45;
    }
    88% {
        opacity: 0.45;
    }
    100% {
        transform: translateY(150px);
        opacity: 0;
    }
}
.score-preview,
.slider-row {
    position: relative;
    z-index: 2;
}
.slider-row {
    width: 100%;
    display: flex;
    align-items: center;
}
.shine {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    overflow: hidden;
    pointer-events: none;
}
.shine::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -55%;
    width: 55%;
    opacity: 0;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-18deg);
}
.score.lvl-shine .shine::before {
    opacity: 1;
    animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep {
    0% {
        left: -55%;
    }
    55%,
    100% {
        left: 135%;
    }
}
@media (prefers-reduced-motion: reduce) {
    .star,
    .drop,
    .shine::before {
        animation: none;
    }
    .drop {
        display: none;
    }
}
.score-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: #ccc;
    font-size: 15px;
    margin-bottom: 10px;
    min-height: 40px;
}
.score-preview .score-label {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.score-preview .score-emoji {
    font-size: 36px;
    line-height: 1;
}
.score.unrated .score-preview {
    opacity: 0.5;
}
.score.fav .score-preview {
    color: #ffcf5a;
    font-weight: 600;
}
.score input[type="range"] {
    width: 100%;
    height: 26px;
    cursor: pointer;
    accent-color: #d05a7a;
}
.score.fav input[type="range"] {
    accent-color: #ffcf5a;
}
.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    padding: 5px 10px;
    background: #1a1a1c;
    color: #ffcf5a;
    border: 1px solid #6a5520;
    opacity: 0;
    transform: scale(0.7);
    pointer-events: none;
    transform-origin: top right;
    transition: opacity 180ms ease, transform 180ms ease, background 150ms;
    z-index: 3;
}
.fav-btn.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.fav-btn.show:hover {
    transform: scale(1.08);
}
.fav-btn.active {
    background: #ffcf5a;
    color: #221a00;
    border-color: #ffcf5a;
    font-weight: 700;
}
.fav-btn.pop {
    animation: favPop 420ms ease-out;
}
@keyframes favPop {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.35);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}
@keyframes favGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 207, 90, 0);
        border-color: #232326;
    }
    30% {
        box-shadow: 0 0 18px 3px rgba(255, 207, 90, 0.55);
        border-color: #ffcf5a;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 207, 90, 0);
        border-color: #232326;
    }
}

.note {
    display: flex;
    gap: 6px;
    width: 100%;
    max-width: 420px;
}
.note textarea {
    flex: 1;
    resize: vertical;
    min-height: 38px;
    background: #161618;
    color: #e5e5e5;
    border: 1px solid #232326;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
}
.note textarea::placeholder {
    color: #666;
}
.note button {
    align-self: stretch;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1c;
    color: #e5e5e5;
    border: 1px solid #2a2a2c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.note button:hover {
    background: #232326;
}
.note button:disabled {
    opacity: 0.6;
    cursor: default;
}

.speed {
    display: flex;
    gap: 6px;
    align-items: center;
}
.speed button {
    padding: 4px 10px;
    background: #1a1a1c;
    color: #bbb;
    border: 1px solid #2a2a2c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.speed button:hover {
    background: #232326;
}
.speed button.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
