/* ==========================================================================
   MAZE STUDIO — LUDO ROYAL ARCADE
   Tactical 4-Player Board Classic with 120Hz Vector Rendering
   Specialized: performance-optimizer-agent, low-ram-mobile-optimizer-agent
   ========================================================================== */

:root {
    --bg-dark: #07090e;
    --bg-card: rgba(14, 18, 28, 0.82);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(245, 158, 11, 0.35);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    /* Ludo Quad Theme Colors */
    --color-red: #ef4444;
    --color-green: #10b981;
    --color-yellow: #f59e0b;
    --color-blue: #3b82f6;

    /* Neon Accents */
    --accent-gold: #fbbf24;
    --accent-amber: #f59e0b;
    --accent-cyan: #00f0ff;
    --accent-emerald: #10b981;
    --accent-ruby: #ef4444;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
}

/* Ambient Backdrop Glow */
.ambient-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmin;
    height: 80vmin;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, rgba(239, 68, 68, 0.05) 45%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(40px);
}

/* Main Container Layout */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.stage-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 12px;
}

/* HUD Header */
.hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.hud-left, .hud-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.hud-btn svg {
    width: 18px;
    height: 18px;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-glow);
    transform: translateY(-1px);
    color: var(--accent-gold);
}

.hud-btn:active {
    transform: scale(0.94);
}

.hud-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fbbf24 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.hud-pill {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.mode-pill {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

/* Turn Status Sub-Bar */
.status-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 42px;
    padding: 0 12px;
    background: rgba(14, 18, 28, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.active-player-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-red);
    box-shadow: 0 0 10px var(--color-red);
    transition: all 0.3s ease;
}

.turn-text {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.action-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
}

.action-status.highlight {
    color: var(--accent-gold);
    animation: pulseText 1.4s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

.subbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-chip.active {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--accent-gold);
}

/* Playfield & Board Canvas */
.board-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
}

.canvas-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
    background: #0d111b;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#ludo-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
}

/* Floating / Overlay In-Canvas Notification */
.board-alert-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    background: rgba(14, 18, 28, 0.92);
    border: 1px solid var(--accent-gold);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-gold);
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    text-align: center;
    letter-spacing: 0.5px;
}

.board-alert-banner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Bottom Controls & Dice Tray Bar */
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    margin-top: 8px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-shrink: 0;
}

/* Player Mini-Tiles */
.player-tiles-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.player-tile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    transition: all 0.25s ease;
    opacity: 0.55;
}

.player-tile.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.player-tile.tile-red.active { border-color: var(--color-red); box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
.player-tile.tile-green.active { border-color: var(--color-green); box-shadow: 0 0 12px rgba(16, 185, 129, 0.4); }
.player-tile.tile-yellow.active { border-color: var(--color-yellow); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.player-tile.tile-blue.active { border-color: var(--color-blue); box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); }
.player-tile.tile-purple.active { border-color: #a855f7; box-shadow: 0 0 12px rgba(168, 85, 247, 0.4); }
.player-tile.tile-orange.active { border-color: #f97316; box-shadow: 0 0 12px rgba(249, 115, 22, 0.4); }

.tile-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.tile-color-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tile-name {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.tile-home-score {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==========================================================================
   INTERACTIVE 3D PERSPECTIVE DICE CUBE
   ========================================================================== */
.dice-action-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    perspective: 700px;
}

.dice-wrapper-3d {
    position: relative;
    width: 50px;
    height: 50px;
    perspective: 500px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dice-shadow-3d {
    position: absolute;
    bottom: -7px;
    left: 8%;
    width: 84%;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.dice-cube-3d {
    width: 48px;
    height: 48px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-16deg) rotateY(-18deg);
    transition: transform 0.65s cubic-bezier(0.18, 0.9, 0.32, 1.15);
}

.dice-face {
    position: absolute;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 45%, #e2e8f0 100%);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.95), inset 0 -2px 3px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.3);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 6px;
    align-items: center;
    justify-items: center;
    box-sizing: border-box;
    backface-visibility: hidden;
}

/* 6 Exact 3D Faces Positioned in Space */
.dice-face.face-1 { transform: rotateY(0deg) translateZ(24px); }
.dice-face.face-6 { transform: rotateY(180deg) translateZ(24px); }
.dice-face.face-2 { transform: rotateX(90deg) translateZ(24px); }
.dice-face.face-5 { transform: rotateX(-90deg) translateZ(24px); }
.dice-face.face-3 { transform: rotateY(90deg) translateZ(24px); }
.dice-face.face-4 { transform: rotateY(-90deg) translateZ(24px); }

/* Pips */
.pip {
    width: 8px;
    height: 8px;
    background: radial-gradient(circle at 35% 35%, #334155, #0f172a);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 1px rgba(255, 255, 255, 0.6);
}

.pip.pip-center-red {
    width: 13px;
    height: 13px;
    background: radial-gradient(circle at 35% 35%, #f87171, #dc2626);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Face Pips Grid Alignments */
.face-1 .pip:nth-child(1) { grid-column: 2; grid-row: 2; }

.face-2 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.face-2 .pip:nth-child(2) { grid-column: 3; grid-row: 3; }

.face-3 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.face-3 .pip:nth-child(2) { grid-column: 2; grid-row: 2; }
.face-3 .pip:nth-child(3) { grid-column: 3; grid-row: 3; }

.face-4 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.face-4 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.face-4 .pip:nth-child(3) { grid-column: 1; grid-row: 3; }
.face-4 .pip:nth-child(4) { grid-column: 3; grid-row: 3; }

.face-5 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.face-5 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.face-5 .pip:nth-child(3) { grid-column: 2; grid-row: 2; }
.face-5 .pip:nth-child(4) { grid-column: 1; grid-row: 3; }
.face-5 .pip:nth-child(5) { grid-column: 3; grid-row: 3; }

.face-6 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.face-6 .pip:nth-child(2) { grid-column: 1; grid-row: 2; }
.face-6 .pip:nth-child(3) { grid-column: 1; grid-row: 3; }
.face-6 .pip:nth-child(4) { grid-column: 3; grid-row: 1; }
.face-6 .pip:nth-child(5) { grid-column: 3; grid-row: 2; }
.face-6 .pip:nth-child(6) { grid-column: 3; grid-row: 3; }

/* 3D Tumbling Rolling Animation */
.dice-cube-3d.rolling {
    animation: diceTumble3D 0.52s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes diceTumble3D {
    0% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1);
    }
    25% {
        transform: translateY(-24px) rotateX(180deg) rotateY(90deg) rotateZ(45deg) scale(1.08);
    }
    50% {
        transform: translateY(-30px) rotateX(360deg) rotateY(270deg) rotateZ(135deg) scale(1.12);
    }
    75% {
        transform: translateY(-16px) rotateX(540deg) rotateY(450deg) rotateZ(225deg) scale(1.04);
    }
    100% {
        transform: translateY(0) rotateX(720deg) rotateY(630deg) rotateZ(360deg) scale(1);
    }
}

.dice-wrapper-3d.rolling .dice-shadow-3d {
    transform: scale(0.6);
    opacity: 0.35;
}

.roll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border: none;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}

.roll-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.roll-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.consecutive-dots {
    display: flex;
    gap: 4px;
    margin-top: 3px;
}

.consecutive-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.consecutive-dot.filled {
    background: var(--accent-gold);
    box-shadow: 0 0 6px var(--accent-gold);
}

/* Modals Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 9, 14, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background: #0f1422;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.12);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.modal-section-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-faint);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.option-pill-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Quick Presets Grid */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

.preset-chip {
    padding: 7px 5px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.preset-chip.active {
    background: rgba(245, 158, 11, 0.18);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

/* Roster List for Player Customization */
.roster-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.roster-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
}

.roster-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.roster-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.roster-name {
    font-size: 0.78rem;
    font-weight: 700;
}

.roster-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.roster-toggle-btn.is-human {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.roster-toggle-btn.is-bot {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

.option-pill {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-pill.active {
    background: rgba(245, 158, 11, 0.14);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border: none;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(245, 158, 11, 0.6);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Victory Overlay */
.victory-podium {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 0;
}

.victory-crown-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: crownFloat 2s ease-in-out infinite alternate;
}

@keyframes crownFloat {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-8px) scale(1.08); }
}

.victory-title {
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fbbf24 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.victory-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.victory-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 6px;
}

.stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.stat-lbl {
    font-size: 0.65rem;
    color: var(--text-faint);
    text-transform: uppercase;
    font-weight: 700;
}

/* Rules / Instructions List */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 20px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.rule-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.rule-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* 1GB RAM Low-Memory Optimization */
body.low-ram-mode .ambient-glow {
    display: none !important;
}

body.low-ram-mode .hud-header,
body.low-ram-mode .status-subbar,
body.low-ram-mode .bottom-bar,
body.low-ram-mode .modal-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0d121c !important;
}

body.low-ram-mode .canvas-wrapper {
    box-shadow: none !important;
}

/* Mobile & Portrait Responsive Adjustments */
@media (max-width: 600px) {
    .stage-wrapper {
        padding: 4px 6px;
    }
    .hud-header {
        height: 46px;
        padding: 0 8px;
        margin-bottom: 4px;
    }
    .hud-title {
        font-size: 0.95rem;
    }
    .hud-pill {
        display: none;
    }
    .status-subbar {
        height: 38px;
        padding: 0 8px;
        margin-bottom: 4px;
    }
    .turn-text {
        font-size: 0.78rem;
    }
    .action-status {
        font-size: 0.72rem;
    }
    .bottom-bar {
        padding: 6px 8px;
        margin-top: 4px;
        gap: 8px;
    }
    .dice-action-box {
        padding: 2px 6px;
        gap: 8px;
    }
    .dice-wrapper-3d {
        width: 42px;
        height: 42px;
    }
    .dice-cube-3d {
        width: 42px;
        height: 42px;
    }
    .dice-face {
        width: 42px;
        height: 42px;
        padding: 5px;
    }
    .dice-face.face-1 { transform: rotateY(0deg) translateZ(21px); }
    .dice-face.face-6 { transform: rotateY(180deg) translateZ(21px); }
    .dice-face.face-2 { transform: rotateX(90deg) translateZ(21px); }
    .dice-face.face-5 { transform: rotateX(-90deg) translateZ(21px); }
    .dice-face.face-3 { transform: rotateY(90deg) translateZ(21px); }
    .dice-face.face-4 { transform: rotateY(-90deg) translateZ(21px); }
    .pip {
        width: 7px;
        height: 7px;
    }
    .pip.pip-center-red {
        width: 9px;
        height: 9px;
    }
    .roll-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
    }
}
