/* Formal Design System & Modern Dark UI Theme for Sadari Pro */
:root {
    /* Exact Design Tokens */
    --color-primary: #6366f1;
    --color-primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --color-surface: rgba(21, 30, 48, 0.7);
    --color-surface-hover: rgba(30, 41, 67, 0.85);
    --color-bg-dark: #090d16;
    --color-border: rgba(255, 255, 255, 0.12);
    --color-border-subtle: rgba(255, 255, 255, 0.06);

    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.45);
    --shadow-glow-lg: 0 0 40px rgba(99, 102, 241, 0.6);
    --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-rose: #fb7185;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Color Theme Schemes - High Contrast & Harmonious Aesthetics */
body[data-theme="dark"] {
    --color-bg-dark: #0a0e17;
    --color-surface: rgba(18, 26, 43, 0.85);
    --color-surface-hover: rgba(28, 38, 62, 0.95);
    --color-border: rgba(255, 255, 255, 0.16);
    --color-border-subtle: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-rose: #f43f5e;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;
    --color-primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.45);
    --canvas-bg: rgba(12, 18, 30, 0.7);
    --canvas-line: rgba(255, 255, 255, 0.18);
    --canvas-rung: rgba(255, 255, 255, 0.35);
}

body[data-theme="cyber"] {
    --color-bg-dark: #0a0118;
    --color-surface: rgba(26, 11, 46, 0.88);
    --color-surface-hover: rgba(42, 18, 74, 0.95);
    --color-border: rgba(0, 240, 255, 0.28);
    --color-border-subtle: rgba(255, 0, 127, 0.18);
    --text-primary: #ffffff;
    --text-secondary: #e2d9f3;
    --text-muted: #a78bfa;
    --accent-blue: #00f0ff;
    --accent-purple: #ff007f;
    --accent-rose: #ff3366;
    --accent-emerald: #00ff66;
    --accent-amber: #ffe600;
    --color-primary-gradient: linear-gradient(135deg, #00f0ff 0%, #ff007f 100%);
    --shadow-glow: 0 0 25px rgba(255, 0, 127, 0.5);
    --canvas-bg: rgba(16, 5, 32, 0.8);
    --canvas-line: rgba(0, 240, 255, 0.22);
    --canvas-rung: rgba(255, 0, 127, 0.4);
}

body[data-theme="emerald"] {
    --color-bg-dark: #041a12;
    --color-surface: rgba(10, 38, 27, 0.88);
    --color-surface-hover: rgba(16, 54, 38, 0.95);
    --color-border: rgba(52, 211, 153, 0.25);
    --color-border-subtle: rgba(52, 211, 153, 0.12);
    --text-primary: #f0fdf4;
    --text-secondary: #a7f3d0;
    --text-muted: #6ee7b7;
    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-rose: #f43f5e;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --color-primary-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.45);
    --canvas-bg: rgba(6, 26, 18, 0.8);
    --canvas-line: rgba(52, 211, 153, 0.2);
    --canvas-rung: rgba(52, 211, 153, 0.4);
}

body[data-theme="light"] {
    --color-bg-dark: #f1f5f9;
    --color-surface: #ffffff;
    --color-surface-hover: #f8fafc;
    --color-border: #cbd5e1;
    --color-border-subtle: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-blue: #0284c7;
    --accent-purple: #7c3aed;
    --accent-rose: #e11d48;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --color-primary-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --shadow-card: 0 10px 25px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);
    --canvas-bg: #f8fafc;
    --canvas-line: #94a3b8;
    --canvas-rung: #64748b;
}

/* Light Mode Input & Element Overrides for Perfect Contrast */
body[data-theme="light"] .custom-select,
body[data-theme="light"] input[type="text"] {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body[data-theme="light"] .custom-select option {
    background: #ffffff;
    color: #0f172a;
}

body[data-theme="light"] .range-stepper,
body[data-theme="light"] .tabs-header {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body[data-theme="light"] .step-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body[data-theme="light"] .step-btn:hover {
    background: #e2e8f0;
}

body[data-theme="light"] .tab-btn {
    color: #475569;
}

body[data-theme="light"] .tab-btn.active {
    color: #ffffff;
}

body[data-theme="light"] .btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

body[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0;
}

body[data-theme="light"] .avatar-picker-btn {
    background: #ffffff;
    border-color: #cbd5e1;
}

body[data-theme="light"] .status-indicator,
body[data-theme="light"] .btn-icon {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}

body[data-theme="light"] .btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

body[data-theme="light"] .result-card-item {
    background: #ffffff;
    border-color: #e2e8f0;
}

body[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.4);
}

/* Theme Selector Grid */
.theme-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.theme-btn {
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

body[data-theme="light"] .theme-btn {
    background: rgba(255, 255, 255, 0.8);
}

.theme-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
}

.theme-btn.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.15);
}

.theme-preview {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.theme-preview.dark { background: linear-gradient(135deg, #090d16, #38bdf8); }
.theme-preview.cyber { background: linear-gradient(135deg, #0d0221, #ff007f); }
.theme-preview.emerald { background: linear-gradient(135deg, #062016, #34d399); }
.theme-preview.light { background: linear-gradient(135deg, #f1f5f9, #0284c7); }

/* Reset & Global Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Material Symbols Icon Integration */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 22px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
}

/* Ambient Background Orbs */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #3b82f6;
}

.orb-2 {
    bottom: -15%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #8b5cf6;
    animation-delay: -7s;
}

.orb-3 {
    top: 40%;
    left: 30%;
    width: 35vw;
    height: 35vw;
    background: #ec4899;
    animation-delay: -14s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.1); }
}

/* Enhanced Glassmorphism Card Style */
.glass-card {
    background: var(--color-surface);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

/* App Layout Container */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 12px;
    background: var(--color-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transition: transform var(--transition-fast);
}

.logo-icon:hover {
    transform: scale(1.08) rotate(-4deg);
}

.logo-icon .material-symbols-outlined {
    font-size: 22px;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

body[data-theme="light"] .logo-title {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.35);
    letter-spacing: 0.5px;
    line-height: 1;
}

.subtitle {
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.2;
    margin-top: 2px;
}

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    flex: 1;
}

@media (max-width: 960px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

#mobile-trace-all-anchor:empty { display: none; }
#mobile-trace-all-anchor { margin-top: 16px; }

/* Sidebar Panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    padding: 22px;
    gap: 18px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-section.flex-grow {
    flex: 1;
}

/* Advanced-settings toggle: irrelevant on desktop (always shown, so the
   button stays hidden there), but on mobile it's what keeps density/speed
   and the participant/result lists from pushing the actual ladder off
   screen — collapsed by default, see the mobile media query below. */
.btn-toggle-advanced {
    display: none;
}
.advanced-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Controls & Form Elements */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-row {
    display: flex;
    gap: 12px;
}

.control-group.half {
    flex: 1;
}

label {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count-badge {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.custom-select, input[type="text"] {
    font-family: var(--font-body);
    width: 100%;
    padding: 10px 14px;
    min-height: 44px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition-fast);
}

.custom-select:focus, input[type="text"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background: rgba(15, 23, 42, 0.85);
}

/* Range Stepper */
.range-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.65);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.step-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.step-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.2);
}

.step-btn:active {
    transform: scale(0.93) translateY(1px);
    box-shadow: var(--shadow-inset);
    background: rgba(255, 255, 255, 0.25);
}

input[type="range"] {
    flex: 1;
    accent-color: var(--accent-blue);
    cursor: pointer;
    min-height: 44px;
}

/* Tabs */
.tabs-header {
    display: flex;
    background: rgba(15, 23, 42, 0.65);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
    border: 1px solid var(--color-border-subtle);
}

.tab-btn {
    font-family: var(--font-body);
    flex: 1;
    padding: 10px 12px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--color-primary-gradient);
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.tab-btn:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: var(--shadow-inset);
}

.tab-content {
    display: none;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.tab-content.active {
    display: block;
}

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

.input-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-picker-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: rgba(15, 23, 42, 0.8);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.avatar-picker-btn:hover {
    transform: scale(1.12);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.avatar-picker-btn:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-inset);
}

.input-index {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    width: 22px;
    color: var(--text-muted);
    text-align: right;
}

/* Action Buttons & Tactile Active States */
.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.btn {
    font-family: var(--font-body);
    padding: 12px 18px;
    min-height: 48px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: var(--shadow-inset);
    filter: brightness(0.92);
}

.btn-primary {
    background: var(--color-primary-gradient);
    color: #fff;
}

.primary-glow {
    box-shadow: var(--shadow-glow);
}

.primary-glow:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-lg);
}

.primary-glow:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: var(--shadow-inset);
}

.btn-group {
    display: flex;
    gap: 10px;
}
/* Three action buttons (results / reset / change-ladder) now share this
   row — .btn-secondary already flexes evenly, give the other two the
   same so all three split the width equally instead of sizing to content. */
.btn-group .btn-danger,
.btn-group .btn-primary {
    flex: 1;
}
/* English labels ("Show all results", "Change ladder") are long enough to
   wrap and break the layout at 1/3 width each — shrink text/icon/padding
   for both languages so three buttons always fit on one line cleanly. */
.btn-group .btn {
    font-size: 0.58rem;
    padding: 9px 3px;
    gap: 2px;
    min-height: 44px;
    line-height: 1.15;
    white-space: nowrap;
}
.btn-group .btn .material-symbols-outlined {
    font-size: 14px;
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-danger {
    background: rgba(251, 113, 133, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.35);
}

.btn-danger:hover {
    background: rgba(251, 113, 133, 0.28);
    border-color: rgba(251, 113, 133, 0.5);
}

/* Stage Panel & Ladder Canvas */
.stage-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    min-height: 540px;
}

.stage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    z-index: 5;
    flex-wrap: wrap;
    gap: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--color-border);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

.status-dot.animating {
    background: var(--accent-amber);
    box-shadow: 0 0 10px var(--accent-amber);
    animation: pulseDot 0.8s infinite alternate;
}

@keyframes pulseDot {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 1; }
}

.status-text {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}
/* English status lines ("Click a player at the top to trace the ladder!")
   run noticeably longer than their Korean equivalents and wrap to a
   second line at the default size — shrink a bit so both languages fit
   on one line in the status pill. */
html[lang="en"] .status-text {
    font-size: 0.74rem;
}

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

.btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-icon:active {
    transform: scale(0.93) translateY(1px);
    box-shadow: var(--shadow-inset);
}

.btn-icon.active {
    color: var(--accent-blue);
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* Canvas Container & 3D Volumetric Cloud Overlay */
.canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 480px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--canvas-bg, rgba(10, 15, 26, 0.55));
    border: 1px solid var(--color-border-subtle);
    touch-action: none;
    transition: background-color 0.3s ease;
}

/* Organic 3D Volumetric Cloud Cluster Over Ladder Stage */
.volumetric-cloud-layer {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    z-index: 3;
    overflow: hidden;
    perspective: 1000px;
    opacity: 1;
    cursor: pointer;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.volumetric-cloud-layer.hidden {
    opacity: 0;
    pointer-events: none;
}

.cloud-cluster {
    position: relative;
    width: 88%;
    height: 60%;
    margin-top: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cloudClusterFloat 10s ease-in-out infinite alternate;
}
.cloud-cluster::before {
    content: '';
    position: absolute;
    z-index: 2;
    left: 11%; bottom: 17%; width: 78%; height: 37%;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 64%, #dbe5ef 100%);
    box-shadow: inset 0 -12px 20px rgba(148,163,184,.28), inset 0 8px 14px rgba(255,255,255,.92), 0 20px 35px rgba(15,23,42,.15);
}
body[data-theme="dark"] .cloud-cluster::before,
body[data-theme="cyber"] .cloud-cluster::before,
body[data-theme="emerald"] .cloud-cluster::before { background: linear-gradient(180deg,#3b506b,#1e293b 68%,#111827); box-shadow: inset 0 -12px 20px rgba(2,6,23,.75), inset 0 8px 14px rgba(148,163,184,.24), 0 20px 35px rgba(0,0,0,.5); }

.cloud-puff {
    position: absolute;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f1f5f9 60%, #e2e8f0 100%);
    border-radius: 50%;
    box-shadow: 
        inset 0 -12px 24px rgba(148, 163, 184, 0.4),
        inset 0 12px 20px rgba(255, 255, 255, 1),
        0 20px 40px rgba(15, 23, 42, 0.18);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

body[data-theme="dark"] .cloud-puff,
body[data-theme="cyber"] .cloud-puff,
body[data-theme="emerald"] .cloud-puff {
    background: radial-gradient(circle at 35% 35%, #334155 0%, #1e293b 65%, #0f172a 100%);
    box-shadow: 
        inset 0 -12px 24px rgba(2, 6, 23, 0.8),
        inset 0 12px 20px rgba(148, 163, 184, 0.3),
        0 20px 45px rgba(0, 0, 0, 0.6);
}

.puff-center {
    width: 280px;
    height: 280px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.puff-left-top {
    width: 220px;
    height: 220px;
    top: 15%;
    left: 15%;
    z-index: 4;
}

.puff-right-top {
    width: 240px;
    height: 240px;
    top: 18%;
    right: 12%;
    z-index: 4;
}

.puff-left-bottom {
    width: 230px;
    height: 230px;
    bottom: 12%;
    left: 18%;
    z-index: 4;
}

.puff-right-bottom {
    width: 250px;
    height: 250px;
    bottom: 10%;
    right: 15%;
    z-index: 4;
}

.puff-extra-1 {
    width: 190px;
    height: 190px;
    top: 30%;
    left: 2%;
    z-index: 3;
}

.puff-extra-2 {
    width: 200px;
    height: 200px;
    top: 25%;
    right: 2%;
    z-index: 3;
}

/* Interactive Cloud Hint Badge */
.cloud-interactive-hint {
    position: absolute;
    z-index: 10;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(56, 189, 248, 0.3);
    pointer-events: none;
    animation: hintPulse 2.5s ease-in-out infinite;
}

body[data-theme="light"] .cloud-interactive-hint {
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 0 18px rgba(56, 189, 248, 0.25);
}

.hint-icon {
    font-size: 20px;
    color: var(--accent-blue);
}

.volumetric-cloud-layer:hover .cloud-puff {
    filter: brightness(1.05);
}

.volumetric-cloud-layer:hover .cloud-interactive-hint {
    transform: translate(-50%, -50%) scale(1.05);
    border-color: var(--accent-blue);
}

@keyframes cloudClusterFloat {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(0.8deg); }
    100% { transform: translateY(8px) rotate(-0.5deg); }
}

@keyframes hintPulse {
    0% { opacity: 0.88; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
    100% { opacity: 0.88; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 768px) {
    .volumetric-cloud-layer { align-items: center; }
    .cloud-cluster { width: 100%; height: 72%; margin-top: 0; }
    .cloud-puff { box-shadow: inset 0 -8px 16px rgba(148,163,184,.28), inset 0 7px 12px rgba(255,255,255,.9), 0 12px 24px rgba(15,23,42,.13); }
    .puff-center { width: clamp(158px, 51vw, 230px); height: clamp(126px, 38vw, 190px); top: 47%; left: 50%; }
    .puff-left-top { width: clamp(108px, 34vw, 170px); height: clamp(94px, 29vw, 150px); top: 21%; left: 7%; }
    .puff-right-top { width: clamp(112px, 36vw, 180px); height: clamp(96px, 30vw, 156px); top: 17%; right: 6%; }
    .puff-left-bottom { width: clamp(105px, 32vw, 165px); height: clamp(88px, 27vw, 140px); bottom: 10%; left: 13%; }
    .puff-right-bottom { width: clamp(110px, 34vw, 175px); height: clamp(92px, 28vw, 146px); bottom: 9%; right: 11%; }
    .puff-extra-1 { width: clamp(84px, 26vw, 130px); height: clamp(74px, 23vw, 120px); top: 37%; left: 0; }
    .puff-extra-2 { width: clamp(88px, 27vw, 138px); height: clamp(76px, 24vw, 124px); top: 34%; right: 0; }
    .cloud-interactive-hint { max-width: calc(100% - 32px); padding: 9px 14px; font-size: .8rem; white-space: nowrap; }
}

#sadari-canvas {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    width: 100%;
    max-width: 560px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: modalPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% { transform: scale(0.88); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.28rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-blue);
}
/* "당첨 확률 시뮬레이션 분석" is long enough to wrap to two lines at the
   default modal-header size — every other modal title is short enough not
   to need this, so scope the shrink to just this one. */
#prob-modal-title {
    font-size: 1.05rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.btn-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-close:active {
    transform: scale(0.92);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.result-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.result-card-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.result-player {
    font-family: var(--font-body);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.result-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-value {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--accent-purple);
    padding: 4px 10px;
    background: rgba(192, 132, 252, 0.14);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(192, 132, 252, 0.25);
}

.result-card-item.badge-winner {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}

.result-card-item.badge-winner .result-value {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
}

.result-card-item.badge-penalty {
    background: rgba(251, 113, 133, 0.1);
    border-color: rgba(251, 113, 133, 0.35);
}

.result-card-item.badge-penalty .result-value {
    color: #fb7185;
    background: rgba(251, 113, 133, 0.18);
    border-color: rgba(251, 113, 133, 0.4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Probability Modal Grid */
.prob-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.prob-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
}

.prob-item-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body[data-theme="light"] .prob-item-card {
    background: #ffffff;
    border-color: #cbd5e1;
}

.prob-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
}

.prob-bars-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prob-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
}

.prob-result-label {
    width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.prob-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

body[data-theme="light"] .prob-bar-track {
    background: #e2e8f0;
}

.prob-bar-fill {
    height: 100%;
    background: var(--color-primary-gradient);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.prob-percent {
    width: 45px;
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-blue);
}

/* Avatar Selector Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 10px 0;
}

.avatar-option {
    font-size: 2rem;
    padding: 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.avatar-option:hover {
    transform: scale(1.15);
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.18);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.avatar-option:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-inset);
}

/* Ladder game joins the same soft toy-world art direction while preserving all canvas controls. */
body[data-theme="light"] .canvas-container {
    background: radial-gradient(ellipse at 50% 95%, rgba(56, 189, 248, .18), transparent 42%), radial-gradient(circle at 12% 15%, rgba(255,255,255,.72) 0 3px, transparent 4px) 0 0 / 44px 44px, linear-gradient(180deg, #e1f5ff, #f8f2da);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), inset 0 -18px 40px rgba(62,116,137,.08);
}
.avatar-option {
    border-width: 2px;
    background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(56,189,248,.08));
    box-shadow: inset 0 2px 0 rgba(255,255,255,.42), 0 5px 0 rgba(30,64,99,.12);
}
body[data-theme="light"] .avatar-option { background: linear-gradient(145deg, #ffffff, #e2f3ff); border-color: rgba(14,116,144,.25); }
.avatar-option:hover { box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 7px 0 rgba(30,64,99,.14), 0 12px 18px rgba(14,116,144,.18); }

/* Onboarding Carousel Modal */
.onboarding-card {
    max-width: 480px;
    text-align: center;
}

.onboarding-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
}

.onboarding-slide.active {
    display: flex;
}

.onboarding-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.onboarding-icon .material-symbols-outlined {
    font-size: 36px;
}

.onboarding-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
}

.onboarding-desc {
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--transition-fast);
}

.dot.active {
    background: var(--accent-blue);
    width: 22px;
    border-radius: 10px;
}

/* Quick Input Toolbar */
.quick-input-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-quick {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--color-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

body[data-theme="light"] .btn-quick {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.btn-quick:hover {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-blue);
    border-color: rgba(56, 189, 248, 0.3);
}

.btn-quick.danger:hover {
    background: rgba(251, 113, 133, 0.12);
    color: var(--accent-rose);
    border-color: rgba(251, 113, 133, 0.3);
}

.btn-quick:active {
    transform: scale(0.95);
}

.btn-quick .material-symbols-outlined {
    font-size: 16px;
}

/* Toast Alert UI */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-msg {
    padding: 10px 20px;
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--color-border);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow-glow);
    animation: toastPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), toastFade 0.3s ease 2.2s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

body[data-theme="light"] .toast-msg {
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
}

@keyframes toastPop {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFade {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Responsive Mobile Layout Verification */
@media (max-width: 960px) {
    .app-container {
        padding: 16px;
    }
    .main-content {
        grid-template-columns: 1fr;
    }
    .stage-panel {
        min-height: 460px;
    }

    /* Mobile: preset + player count are enough to play immediately, so
       everything else collapses behind this toggle instead of forcing a
       scroll past it to reach the ladder. */
    .btn-toggle-advanced {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 12px 14px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        color: var(--text-primary);
        font-family: var(--font-body);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-fast);
    }
    .btn-toggle-advanced:hover {
        border-color: var(--accent-blue);
        background: rgba(56, 189, 248, 0.1);
    }
    .btn-toggle-advanced .toggle-label {
        flex: 1;
        min-width: 0;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .btn-toggle-advanced .chevron {
        margin-left: auto;
        transition: transform 0.25s ease;
    }
    .btn-toggle-advanced[aria-expanded="true"] .chevron {
        transform: rotate(180deg);
    }
    .advanced-settings-panel {
        display: none;
    }
    .advanced-settings-panel.expanded {
        display: flex;
    }

    /* All primary action buttons move down to sit right above the canvas
       stage / below it on mobile (see #mobile-trace-all-anchor in app.js)
       instead of at the bottom of a (now much shorter) sidebar. */
    #mobile-trace-all-anchor .panel-actions {
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 12px;
        gap: 12px;
    }
    .logo-title {
        font-size: 1.5rem;
    }
    .stage-panel {
        padding: 14px;
        min-height: 420px;
    }
    .canvas-container {
        min-height: 380px;
    }
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .btn-group {
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    /* "사다리 게임" + the badge pill don't fit alongside the icon and
       header-right buttons on narrow phones — the flex title wraps
       mid-word instead. Shrink everything in the header row so it fits
       on one line. */
    .app-header {
        padding: 4px 2px;
    }
    .logo-container {
        gap: 8px;
    }
    .logo-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-radius: 10px;
    }
    .logo-icon .material-symbols-outlined {
        font-size: 18px;
    }
    .logo-title {
        font-size: 1.05rem;
        gap: 6px;
    }
    .badge {
        font-size: 0.52rem;
        padding: 2px 6px;
    }
    .logo-container {
        min-width: 0;
    }
    .logo-container > div:not(.logo-icon) {
        min-width: 0;
    }
    .subtitle {
        font-size: 0.66rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-right {
        gap: 6px;
    }
    .app-header .btn-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .sidebar-panel {
        padding: 16px;
    }
    .control-row {
        flex-direction: column;
    }
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .stage-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .status-indicator {
        justify-content: center;
    }
    .toolbar-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    .modal-card {
        padding: 18px;
        max-height: 92vh;
        overflow-y: auto;
    }
    .results-grid {
        grid-template-columns: 1fr;
        max-height: 55vh;
    }
    .canvas-container {
        min-height: 300px;
    }
    .stage-panel {
        min-height: 360px;
        padding: 12px;
    }
    .tab-content {
        max-height: 190px;
    }
    .prob-grid {
        max-height: 55vh;
    }
}

/* Button overrides for trace-all (replaces inline style) */
.btn-trace-all-main {
    width: 100%;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px;
}

/* Settings modal first section spacing (replaces inline style) */
.settings-section-first {
    margin-bottom: 16px;
}

/* Touch scroll improvements */
.tab-content,
.results-grid,
.prob-grid {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Reduce vertical line weight when columns are very close */
@media (max-width: 480px) {
    .stage-toolbar {
        gap: 8px;
    }
}

/* Light-theme contrast guardrails for the standalone ladder UI. */
body[data-theme="light"] .input-index { color: #334155; }
body[data-theme="light"] .btn-quick { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }
body[data-theme="light"] .btn-quick:hover { background: #eaf4ff; border-color: #0284c7; color: #0c4a6e; }
body[data-theme="light"] .result-card-item { background: #f8fafc; border-color: #cbd5e1; }
body[data-theme="light"] .result-card-item:hover { border-color: #94a3b8; }
body[data-theme="light"] .result-player { color: #0f172a; }
body[data-theme="light"] .result-arrow { color: #475569; }
body[data-theme="light"] .result-value { background: #f3e8ff; border-color: #c4b5fd; color: #5b21b6; }
body[data-theme="light"] .result-card-item.badge-winner { background: #fffbeb; border-color: #fbbf24; }
body[data-theme="light"] .result-card-item.badge-winner .result-value { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
body[data-theme="light"] .result-card-item.badge-penalty { background: #fff1f2; border-color: #fda4af; }
body[data-theme="light"] .result-card-item.badge-penalty .result-value { background: #ffe4e6; border-color: #fb7185; color: #9f1239; }

.game-explanation {
    margin: 0 0 20px;
    line-height: 1.65;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.quick-input-toolbar { flex-wrap: wrap; }

/* Keep the embedded game within its site viewport, including blocked fonts. */
.main-content > * { min-width: 0; }
.material-symbols-outlined { flex-shrink: 0; width: 1em; overflow: hidden; white-space: nowrap; }
@media (max-width: 960px) {
    .main-content { grid-template-columns: minmax(0, 1fr); }
}
/* Shared site links: this standalone game does not load shared/base.css. */
.game-site-footer {
    position:relative;
    z-index:1;
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:8px 18px;
    width:min(760px,calc(100% - 32px));
    margin:18px auto 30px;
    padding:16px;
    border-top:1px solid var(--color-border-subtle);
    font-size:.8rem;
}
.game-site-footer a {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:44px;
    color:var(--text-secondary);
    font-weight:700;
    text-decoration:none;
    line-height:1.5;
}
.game-site-footer a:hover { color:var(--accent-blue); text-decoration:underline; }
.game-site-footer a:focus-visible { outline:3px solid var(--accent-blue); outline-offset:4px; border-radius:4px; }
