/* ═══ SketchWreck — messy-studio theme ═══ */

:root {
    --bg: #12071d;
    --panel: #1d1030;
    --panel2: #271741;
    --line: #3a2560;
    --pop: #ff4d8a;
    --cyan: #4dd2ff;
    --yellow: #ffd24d;
    --green: #7dff4d;
    --text: #efe6fa;
    --muted: #9c86bd;
    --paper: #f7f2e9;
    --ink: #241a30;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100%;
}
body {
    background-image:
        radial-gradient(ellipse at 15% -10%, rgba(120, 40, 160, .25), transparent 55%),
        radial-gradient(ellipse at 95% 110%, rgba(255, 77, 138, .12), transparent 50%);
}

h1, h2, h3 { font-weight: 700; letter-spacing: .03em; }
h2 { font-size: 1.05rem; color: var(--pop); text-transform: uppercase; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }

/* buttons & inputs */
.btn {
    display: inline-block; background: var(--panel2); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px;
    font-size: .95rem; font-weight: 600; cursor: pointer; transition: all .15s;
    font-family: inherit;
}
.btn:hover { border-color: var(--pop); box-shadow: 0 0 14px rgba(255, 77, 138, .4); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #8a2456, #5e1038); border-color: #c04d80; color: #ffe0ec; }
.btn-large { width: 100%; padding: 14px; font-size: 1.1rem; margin-top: 14px; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }

input, textarea {
    width: 100%; background: #170b26; border: 1px solid var(--line); border-radius: 10px;
    color: var(--text); padding: 11px 12px; font-size: 1rem; margin: 6px 0 14px;
    font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--pop); box-shadow: 0 0 14px rgba(255, 77, 138, .3); }
label { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.check-row { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: .9rem; margin-bottom: 6px; }
.check-row input { width: auto; margin: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }

/* ── Home / lobby ── */
.home-container { max-width: 1000px; margin: 0 auto; padding: 28px 16px 60px; }
.hero { text-align: center; padding: 22px 0 30px; }
.game-title {
    font-size: clamp(2.4rem, 8vw, 4rem); letter-spacing: .04em; color: #fff;
    text-shadow: 0 0 20px rgba(255, 77, 138, .5);
}
.game-title .wreck {
    color: var(--pop);
    display: inline-block;
    transform: rotate(-3deg) translateY(3px);
}
.tagline { margin-top: 12px; color: var(--muted); line-height: 1.6; }
.tagline-pop { color: #ff9ebd; }
.error-banner {
    background: rgba(255, 77, 138, .12); border: 1px solid #7a2048; color: #ffb0cc;
    border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; text-align: center;
}
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; } }

.registry-head { margin: 20px 0 8px; font-size: .9rem; color: var(--muted); text-transform: uppercase; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.room-browser { list-style: none; max-height: 220px; overflow-y: auto; }
.room-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-bottom: 1px solid #241538; cursor: pointer; }
.room-row:hover { background: rgba(255, 77, 138, .06); }
.room-code { font-family: monospace; font-size: 1.05rem; color: var(--cyan); letter-spacing: .12em; }
.room-row .btn { margin-left: auto; }
.empty-msg { padding: 14px 6px; }

.how-to { margin-top: 34px; }
.how-to > h2 { text-align: center; margin-bottom: 18px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.how-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.how-icon { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.how-card b { color: #fff; }
.how-card p { color: var(--muted); font-size: .87rem; margin-top: 6px; line-height: 1.5; }
.home-footer { text-align: center; margin-top: 30px; }

.lobby-container { max-width: 640px; margin: 0 auto; padding: 26px 16px 50px; text-align: center; }
.lobby-card { text-align: left; margin: 0 0 18px; }
.room-code-display { margin: 18px 0 6px; font-size: 1.1rem; }
.room-code-display .code {
    font-family: monospace; font-size: 1.6rem; color: var(--cyan);
    letter-spacing: .25em; margin: 0 8px;
}
.share-hint { color: var(--muted); margin-bottom: 22px; font-size: .9rem; }
.player-list { list-style: none; }
.player-item { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #241538; }
.player-dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 8px currentColor; flex: none; }
.player-name { font-weight: 600; }
.host-badge {
    background: #3a2a00; color: var(--yellow); font-size: .65rem;
    border: 1px solid #6a5210; padding: 2px 7px; border-radius: 20px; letter-spacing: .1em;
}
.waiting-msg { margin-top: 22px; color: var(--muted); }
.blink { animation: pulse 1.6s infinite; }
.start-hint { color: var(--muted); font-size: .85rem; margin-top: 10px; }

/* ═══ GAME SCREEN ═══ */
.game-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    max-width: 860px; margin: 0 auto; padding: 0 10px calc(10px + env(safe-area-inset-bottom));
}
#game-top {
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 4px 8px;
}
.mini-logo { font-weight: 800; letter-spacing: .04em; }
.mini-logo .wreck { color: var(--pop); }
#phase-chip {
    font-size: .7rem; font-weight: 800; letter-spacing: .12em; padding: 4px 12px;
    border-radius: 20px; border: 1px solid var(--line); color: var(--muted);
    text-transform: uppercase;
}
#timer-chip {
    margin-left: auto; font-size: .95rem; color: var(--yellow);
    font-variant-numeric: tabular-nums;
}
#timer-chip.urgent { color: #ff6060; animation: pulse .6s infinite; }
#timer-chip b { font-size: 1.2rem; }
.hud-icon-btn {
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
    width: 36px; height: 36px; border-radius: 10px; font-size: 1rem; cursor: pointer;
}

#roster-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 10px; }
.artist-pip {
    display: flex; align-items: center; gap: 6px; font-size: .72rem;
    background: rgba(29, 16, 48, .8); border: 1px solid #2a1a44; border-radius: 20px;
    padding: 3px 10px 3px 5px;
}
.artist-pip .dot { width: 10px; height: 10px; border-radius: 50%; }
.artist-pip.done { border-color: #2a6a2a; }
.artist-pip.away { opacity: .45; }
.artist-pip .tick { color: var(--green); font-weight: 800; }

#stage { flex: 1; display: flex; flex-direction: column; }
.center-note { margin: auto; color: var(--muted); text-align: center; padding: 40px 20px; }

/* work card */
.work-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
    padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.work-title { font-size: 1.15rem; font-weight: 800; color: #fff; }
.work-sub { color: var(--muted); font-size: .88rem; }
.prompt-quote {
    background: var(--paper); color: var(--ink); border-radius: 12px;
    padding: 14px 18px; font-size: 1.2rem; font-weight: 700; text-align: center;
    transform: rotate(-.6deg); box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.byline { text-align: right; font-size: .75rem; color: #6a5a80; margin-top: 6px; font-weight: 600; }

/* drawing pad */
.pad-wrap { position: relative; width: 100%; }
#pad {
    width: 100%; background: var(--paper); border-radius: 12px; touch-action: none;
    box-shadow: 0 6px 18px rgba(0,0,0,.4); display: block; cursor: crosshair;
}
.view-canvas {
    width: 100%; background: var(--paper); border-radius: 12px; display: block;
    box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.tools {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px;
}
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; flex: none;
}
.swatch.sel { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,.6); transform: scale(1.12); }
.sizes { display: flex; gap: 5px; margin-left: 4px; }
.size-btn {
    width: 34px; height: 34px; border-radius: 10px; background: var(--panel2);
    border: 1px solid var(--line); cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}
.size-btn.sel { border-color: var(--pop); }
.size-btn i { background: var(--text); border-radius: 50%; display: block; }
.tool-btn {
    padding: 7px 12px; border-radius: 10px; background: var(--panel2);
    border: 1px solid var(--line); color: var(--text); cursor: pointer; font-size: .85rem;
    font-family: inherit;
}
.tool-btn.sel { border-color: var(--pop); color: var(--pop); }

.submit-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.submit-row .btn { flex: 1; }

/* waiting screen */
.wait-box { text-align: center; padding: 30px 10px; }
.wait-box .big { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.wait-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }

/* reveal */
.reveal-wrap { display: flex; flex-direction: column; gap: 12px; padding-bottom: 90px; }
.chain-head {
    text-align: center; font-size: 1.1rem; font-weight: 800; color: var(--yellow);
    padding: 10px 0 2px;
}
.reveal-item { animation: slideIn .45s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.reveal-text {
    background: var(--paper); color: var(--ink); border-radius: 12px; padding: 14px 18px;
    font-size: 1.15rem; font-weight: 700; max-width: 560px; margin: 0 auto; width: 100%;
    transform: rotate(-.5deg); box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.reveal-item:nth-child(even) .reveal-text { transform: rotate(.6deg); }
.reveal-drawing { max-width: 560px; margin: 0 auto; width: 100%; }
.reveal-author { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 5px; }
.reveal-author b { color: var(--text); }
#reveal-controls {
    position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
    padding: 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(18, 7, 29, .95), transparent);
}
#reveal-next { min-width: 220px; }

/* done */
.done-box { text-align: center; padding: 40px 10px; }
.done-box h2 { font-size: 1.8rem; color: var(--yellow); margin-bottom: 10px; }

@media (max-width: 700px) {
    .swatch { width: 26px; height: 26px; }
    .work-card { padding: 12px; }
}
