/* ===== CSS RESET & VARIABLES ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: var(--t-bg);
    --bg-secondary: var(--t-panel);
    --bg-card: var(--t-panel);
    --bg-card-hover: #241a14;
    --bg-input: var(--t-panel-deep);
    --chrom-bg: rgba(20, 12, 8, 0.78);
    --well: rgba(0, 0, 0, 0.28);
    --hairline: rgba(255, 255, 255, 0.10);
    --tint: rgba(255, 255, 255, 0.05);

    --text-primary: var(--t-ink);
    --text-secondary: var(--t-muted);
    --text-muted: var(--t-muted);
    --text-bright: #ffffff;
    --on-accent: #171715;

    --accent: #e8590c;
    --accent-2: #ff922b;
    --accent-glow: rgba(232, 89, 12, 0.40);
    --accent-soft: rgba(232, 89, 12, 0.14);

    --danger: #e03131;
    --danger-glow: rgba(224, 49, 49, 0.30);
    --success: #2f9e44;
    --success-glow: rgba(47, 158, 68, 0.30);
    --warning: #f08c00;

    --canvas-bg: #ffffff;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.48);

    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;

    --font-main: var(--font-sans);
    --font-display: var(--font-sans);
}

html[data-theme="light"] {
    --bg-card-hover: #ece5df;
    --chrom-bg: rgba(255, 255, 255, 0.85);
    --well: rgba(0, 0, 0, 0.05);
    --hairline: rgba(0, 0, 0, 0.10);
    --tint: rgba(0, 0, 0, 0.04);
    --text-bright: #191918;
    --on-accent: #171715;
    --accent: #d9480f;
    --accent-2: #e8590c;
    --canvas-bg: #ffffff;
}

html[data-theme="dark"] {
    --bg-input: #1c1713;
    --on-accent: #171715;
    --accent: #ff922b;
    --accent-2: #ffa94d;
    --canvas-bg: #ffffff;
}

html, body {
    height: 100%;
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    height: 100%;
    position: relative;
}

.games-home-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--chrom-bg);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(10px);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.games-home-link:hover,
.games-home-link:focus-visible {
    color: var(--text-bright);
    border-color: var(--accent);
    background: var(--bg-secondary);
    outline: none;
}

/* Account button (top-right, from framework account-ui.js) */
.sketchrelay-account-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    padding: 9px 14px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--chrom-bg);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: color var(--transition), border-color var(--transition);
}

.sketchrelay-account-button:hover {
    color: var(--text-bright);
    border-color: var(--accent);
}

/* ===== PARTICLES ===== */
.particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.15;
    animation: float linear infinite;
}

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: screenIn var(--t-speed, 200ms) ease;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 25px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--hairline); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 15px var(--danger-glow); }
.btn-danger:hover { transform: translateY(-2px); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--hairline); }
.btn-ghost:hover { background: var(--tint); color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }

.btn-toggle {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--hairline);
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-toggle.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon-only:hover { color: var(--text-bright); border-color: var(--accent); background: var(--tint); }

/* ===== HOME / NAME SCREENS ===== */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 48px 24px;
    max-width: 560px;
    width: 100%;
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.logo-row { display: flex; align-items: center; gap: 16px; }
.logo-mark svg { width: 56px; height: 56px; display: block; }

.game-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.game-subtitle { color: var(--text-secondary); font-size: 1.05rem; }

.home-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: 100%;
    max-width: 360px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 100%;
}

.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.input-group label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }

.input-group input,
.change-name-input,
.chat-input-row input,
.word-input-row input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus,
.change-name-input:focus,
.chat-input-row input:focus,
.word-input-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

#game-code { text-transform: uppercase; letter-spacing: 0.15em; }

/* ===== LOBBY ===== */
.lobby-container {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    width: min(1200px, 94vw);
    margin: auto;
    padding: 80px 24px 40px;
}

.lobby-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lobby-title-section h2 { font-size: 1.5rem; font-weight: 700; }

.game-code-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.code-label { color: var(--text-secondary); font-size: 0.9rem; }
.code-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--accent-2);
    background: var(--accent-soft);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.lobby-content {
    display: flex;
    gap: 24px;
    grid-column: 1 / -1;
    align-items: stretch;
}

.lobby-left { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.lobby-right { width: 320px; display: flex; flex-direction: column; min-width: 0; }

.players-section h3,
.config-section h3,
.chat-header h3,
.chain-recap h3,
.results-chain h3,
.results-scoreboard h3,
.chain-mini h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-count {
    background: var(--accent-soft);
    color: var(--accent-2);
    font-size: 0.8rem;
    padding: 2px 9px;
    border-radius: 20px;
}

.players-list { display: flex; flex-direction: column; gap: 8px; }

.player-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.player-row.me { border-color: var(--accent); background: var(--accent-soft); }
.player-row.disconnected { opacity: 0.55; }

.player-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.player-name { flex: 1; font-weight: 600; }
.host-badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-2);
    border: 1px solid var(--accent);
    padding: 1px 6px;
    border-radius: 20px;
    margin-left: 6px;
}

.player-status { font-size: 0.8rem; color: var(--text-secondary); }

/* Config */
.name-change-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.name-change-section .change-name-input { flex: 1; }

.config-section {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 18px;
    background: var(--bg-card);
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.config-item { display: flex; flex-direction: column; gap: 8px; }
.config-item label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.number-input {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    width: fit-content;
}

.number-input span { min-width: 34px; text-align: center; font-weight: 700; font-family: var(--font-mono); }

.btn-num {
    width: 30px;
    height: 30px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-num:hover { border-color: var(--accent); color: var(--accent-2); }

.timer-config { display: flex; flex-direction: column; gap: 10px; }

/* ===== CHAT ===== */
.chat-section {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    overflow: hidden;
    flex: 1;
    min-height: 220px;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hairline);
}

.chat-header h3 { margin: 0; }

.chat-toggle-btn {
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.chat-msg { font-size: 0.88rem; line-height: 1.4; word-wrap: break-word; }
.chat-msg.system { color: var(--text-secondary); font-style: italic; text-align: center; font-size: 0.8rem; }
.chat-sender { font-weight: 700; color: var(--accent-2); margin-right: 4px; }
.chat-mention { color: var(--accent-2); font-weight: 600; }
.chat-msg.mention-highlight { background: var(--accent-soft); border-radius: 6px; padding: 4px 6px; }

.chat-reply-btn {
    margin-left: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.chat-msg:hover .chat-reply-btn { opacity: 1; }

.chat-reply-ref {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--tint);
    border-left: 2px solid var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--hairline);
}

.chat-input-row input { flex: 1; padding: 9px 12px; font-size: 0.9rem; }

.chat-reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: var(--tint);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.reply-cancel { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; }

/* ===== COUNTDOWN ===== */
.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.countdown-ring {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 3px solid var(--accent);
    box-shadow: 0 0 60px var(--accent-glow);
}

.countdown-number {
    font-size: 6rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--accent-2);
}

.countdown-text { font-size: 1.3rem; color: var(--text-secondary); }

/* ===== PLAYING ===== */
.playing-container {
    display: flex;
    flex-direction: column;
    width: min(1280px, 96vw);
    margin: auto;
    padding: 72px 24px 32px;
    gap: 16px;
    height: 100%;
}

.playing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.playing-header h2 { font-size: 1.4rem; font-weight: 700; }
.round-total { color: var(--text-secondary); font-weight: 500; }

.turn-indicator { display: flex; align-items: center; }
#turn-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-2);
    background: var(--accent-soft);
    padding: 6px 14px;
    border-radius: 20px;
}

.playing-header-actions { display: flex; gap: 8px; }

.timer-bar {
    position: relative;
    height: 26px;
    border-radius: 13px;
    background: var(--bg-input);
    border: 1px solid var(--hairline);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.timer-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background: var(--accent);
    transition: width 0.25s linear, background var(--t-speed);
}

.timer-fill.warning { background: var(--danger); }

.timer-text { position: relative; font-size: 0.8rem; font-weight: 700; color: var(--text-bright); z-index: 1; }

.playing-content {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.playing-main { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.playing-side { width: 300px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.prompt-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
    text-align: center;
}

.prompt-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-2); font-weight: 700; }
.prompt-value { font-size: 1.6rem; font-weight: 700; word-break: break-word; }
.prompt-value img { max-width: 220px; max-height: 140px; border-radius: 8px; border: 1px solid var(--hairline); }

/* Draw area */
.draw-area { display: flex; flex-direction: column; gap: 12px; }

.draw-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.tool-group { display: flex; gap: 8px; align-items: center; }
.tool-spacer { flex: 1; }

.tool-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition);
}

.tool-color:hover { transform: scale(1.12); }
.tool-color.active { border-color: var(--text-bright); transform: scale(1.12); box-shadow: 0 0 0 2px var(--accent); }

.tool-size {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--hairline);
    border-radius: 8px;
    background: var(--bg-input);
    cursor: pointer;
}

.tool-size span { background: var(--text-primary); border-radius: 50%; display: block; }
.tool-size.active { border-color: var(--accent); }

.tool-btn {
    width: 40px;
    height: 36px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--bg-input);
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tool-btn:hover { border-color: var(--accent); background: var(--tint); }
.tool-btn.active { border-color: var(--accent); background: var(--accent-soft); }

.canvas-wrap {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-md);
    background: var(--canvas-bg);
}

#draw-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }

.submit-btn { align-self: flex-start; }

/* Write area */
.write-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.write-prompt { font-size: 1.3rem; font-weight: 700; }
.word-input-row { display: flex; gap: 12px; }
.word-input-row input { flex: 1; font-size: 1.1rem; }

/* Spectate */
.spectate-area { display: flex; align-items: center; justify-content: center; }
.spectate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 40px;
    border: 1px dashed var(--hairline);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-align: center;
}

.spectate-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }

/* Chain mini */
.chain-mini {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 14px 16px;
}

.chain-mini-list { display: flex; flex-direction: column; gap: 8px; }

/* ===== CHAIN (shared by voting / results) ===== */
.chain-list { display: flex; flex-direction: column; gap: 10px; }

.chain-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.chain-item.is-drawing { border-left: 3px solid var(--accent); }
.chain-item.is-word { border-left: 3px solid var(--text-secondary); }

.chain-kind { font-size: 0.82rem; color: var(--text-secondary); flex-shrink: 0; min-width: 90px; }
.chain-val { font-weight: 600; font-size: 1rem; word-break: break-word; flex: 1; }
.chain-img { max-width: 120px; max-height: 80px; border-radius: 6px; border: 1px solid var(--hairline); background: #fff; }
.chain-skipped { color: var(--text-muted); font-style: italic; }

/* ===== VOTING ===== */
.voting-container {
    width: min(1100px, 94vw);
    margin: auto;
    padding: 72px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.voting-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.voting-header h2 { font-size: 1.6rem; font-weight: 700; }
.voting-header p { color: var(--text-secondary); }
.voting-header .timer-bar { width: min(420px, 80%); }

.voting-content { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.voting-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.voting-right { display: flex; flex-direction: column; min-width: 0; }
.voting-right .chat-section { flex: 1; }

.voting-players { display: flex; flex-wrap: wrap; gap: 12px; }

.vote-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: 2px solid var(--hairline);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 120px;
}

.vote-target:hover { border-color: var(--accent); transform: translateY(-2px); }
.vote-target.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }

.vote-target.abstain { border-style: dashed; }

.vote-target-name { font-weight: 600; font-size: 0.9rem; }
.vote-target-thumb { width: 100%; max-width: 120px; height: 80px; object-fit: contain; border-radius: 6px; border: 1px solid var(--hairline); background: #fff; }
.vote-skipped { color: var(--text-muted); font-style: italic; font-size: 0.85rem; }

.voting-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.lock-in-status { text-align: center; color: var(--text-secondary); font-size: 0.9rem; min-height: 1.2em; }

/* ===== RESULTS (round result + game over) ===== */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: min(900px, 94vw);
    margin: auto;
    padding: 80px 24px 48px;
}

.results-banner { text-align: center; }
.results-banner h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.results-banner p { color: var(--text-secondary); font-size: 1.1rem; margin-top: 6px; }

.results-scoreboard { border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--bg-card); padding: 16px 20px; }

.scoreboard-list { display: flex; flex-direction: column; gap: 8px; }

.scoreboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
}

.scoreboard-row.top { background: var(--accent-soft); border: 1px solid var(--accent); }

.score-rank { font-weight: 700; width: 24px; color: var(--text-secondary); }
.score-name { flex: 1; font-weight: 600; }
.score-val { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--accent-2); }

.results-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ===== TOAST ===== */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    padding: 12px 22px;
    border-radius: var(--radius-md);
    background: var(--chrom-bg);
    color: var(--text-bright);
    border: 1px solid var(--hairline);
    backdrop-filter: blur(12px);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.25s ease;
}

.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .lobby-container { grid-template-columns: 1fr; }
    .lobby-right { width: 100%; }
    .lobby-content { flex-direction: column; }
    .voting-content { grid-template-columns: 1fr; }
    .voting-right { order: -1; }
    .playing-content { flex-direction: column; }
    .playing-side { width: 100%; }
    .config-grid { grid-template-columns: 1fr; }
    .playing-container, .voting-container, .results-container { padding-top: 64px; }
}

@media (max-width: 560px) {
    .games-home-link { top: 12px; left: 12px; }
    .sketchrelay-account-button { top: 12px; right: 12px; }
    .game-title { font-size: 2.2rem; }
    .countdown-ring { width: 160px; height: 160px; }
    .countdown-number { font-size: 4rem; }
    .chain-kind { min-width: 0; }
    .vote-target { min-width: 100px; }
}
