/* playboxRummikub - Premium Glassmorphism & Ivory Tile Aesthetics */

/* Royal Blue Felt Theme (Classic Tournament Board Game Table) */
[data-theme="blue"] {
    --bg-gradient: radial-gradient(circle at 50% 30%, #103362 0%, #0a2040 60%, #040e1c 100%);
    --card-bg: rgba(12, 36, 70, 0.78);
    --card-border: rgba(147, 197, 253, 0.22);
    --card-hover-border: rgba(147, 197, 253, 0.5);
    --card-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #bae6fd;
    --text-muted: #7dd3fc;

    --primary-color: #38bdf8;
    --primary-hover: #0284c7;
    --primary-glow: rgba(56, 189, 248, 0.4);
}

/* Casino Velvet Felt Green Theme */
[data-theme="green"] {
    --bg-gradient: radial-gradient(circle at 50% 30%, #14532d 0%, #0a331a 60%, #03170a 100%);
    --card-bg: rgba(10, 46, 24, 0.78);
    --card-border: rgba(134, 239, 172, 0.22);
    --card-hover-border: rgba(134, 239, 172, 0.5);
    --card-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #bbf7d0;
    --text-muted: #86efac;

    --primary-color: #22c55e;
    --primary-hover: #16a34a;
    --primary-glow: rgba(34, 197, 94, 0.4);
}

/* Base Body & Layout (Centered in 1040px Parent Container, 100% Component Width) */
body {
    align-items: flex-start;
    padding: 16px;
}

.rummi-layout {
    width: 100%;
    max-width: 1040px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0 auto;
}

/* Header */
.rummi-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 4px;
}

.rummi-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.rummi-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rummi-brand .brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.rummi-brand .brand-logo-img {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.35));
    transition: transform 0.2s ease;
}

.rummi-brand .brand-logo-img:hover {
    transform: scale(1.05);
}

.rummi-brand .brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
}

.rummi-brand .brand-text h1 .brand-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.rummi-brand .brand-text h1 .brand-title-link:hover {
    color: var(--warning-color);
}

.rummi-brand .brand-text h1 span {
    color: var(--warning-color);
    margin-left: 2px;
}

.rummi-brand .sub-title {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Game Switcher Subrow (Positioned on lower row to avoid cramming as game catalog grows) */
.rummi-header-subrow {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 2px 0;
}

.game-switch-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.game-switch-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.game-switch-badge:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}

[data-theme="light"] .game-switch-badge {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .game-switch-badge:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Header Controls */
.rummi-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.guide-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    height: 42px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-full);
    color: #818cf8;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.guide-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    transform: translateY(-1px);
}

[data-theme="light"] .guide-btn {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

[data-theme="light"] .guide-btn:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
}

[data-theme="light"] .icon-btn {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #475569;
}

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

/* Status Ribbon */
.status-ribbon {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
}

.mode-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-picker .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.btn-group {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--card-border);
}

[data-theme="light"] .btn-group {
    background: rgba(0, 0, 0, 0.05);
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mode-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.pulse-badge {
    font-size: 0.65rem;
    font-weight: 800;
    background: #ef4444;
    color: #fff;
    padding: 1px 5px;
    border-radius: 6px;
    animation: pulse 1.5s infinite;
}

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

.stats-timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-primary);
}

[data-theme="light"] .stat-badge {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

.turn-badge {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
    font-weight: 700;
}

.turn-badge.active-turn {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #34d399;
}

.turn-badge.opponent-turn {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.timer-badge {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.timer-badge.urgent {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    animation: pulse 0.8s infinite;
}

.timer-badge.paused {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.12);
}

/* Main Workspace */
.game-workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Opponent Bar (Expanded & 3D Realistic Rack Presentation) */
.opponent-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    min-height: 86px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    gap: 16px;
}

.opponent-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.opponent-profile .avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.opponent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opponent-info .name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.opponent-info .status-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Opponent Rack & 3D Cube Tiles */
.opponent-rack {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    justify-content: flex-end;
}

.opponent-rack-tray {
    position: relative;
    padding: 6px 12px 10px 12px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .opponent-rack-tray {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="blue"] .opponent-rack-tray {
    background: linear-gradient(180deg, rgba(20, 52, 98, 0.7) 0%, rgba(10, 26, 52, 0.95) 100%);
    border-color: rgba(147, 197, 253, 0.28);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="green"] .opponent-rack-tray {
    background: linear-gradient(180deg, rgba(16, 68, 35, 0.7) 0%, rgba(8, 36, 18, 0.95) 100%);
    border-color: rgba(134, 239, 172, 0.28);
}

.opponent-tile-cards {
    display: flex;
    gap: 6px;
    max-width: 620px;
    overflow-x: auto;
    padding: 6px 4px;
    perspective: 500px;
}

/* Authentic 3D Rummikub Cube (Back of Tile) */
.tile-back {
    width: 28px;
    height: 40px;
    background: linear-gradient(155deg, #ffffff 0%, #fcf8f0 40%, #eee4ce 85%, #ded0b4 100%);
    border: 1px solid #d4c5a9;
    border-radius: 5px;
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.95),
        inset 0 -2.5px 3px rgba(175, 145, 110, 0.4),
        inset 1px 0 2px rgba(255, 255, 255, 0.7),
        inset -1px 0 2px rgba(175, 145, 110, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    transform: perspective(300px) rotateX(6deg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.tile-back:hover {
    transform: perspective(300px) rotateX(0deg) translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.tile-back-inner {
    width: 20px;
    height: 31px;
    border: 1px dashed rgba(185, 155, 115, 0.4);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
}

.tile-back-emblem {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(185, 155, 115, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(220, 200, 170, 0.4) 100%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(255, 255, 255, 0.8);
}

.tile-back-emblem i {
    font-size: 0.52rem;
    color: rgba(180, 145, 100, 0.7);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.opponent-rack-lip {
    height: 4px;
    margin-top: 2px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .opponent-rack-lip {
    background: linear-gradient(180deg, #94a3b8 0%, #cbd5e1 100%);
}

.count-pill {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.action-btn.sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.sm:hover {
    background: rgba(255, 255, 255, 0.2);
}

.action-btn.sm.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.action-btn.sm.danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Center Board Table - Luxury Casino / Tournament Felt Table */
:root {
    --felt-texture: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='feltNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23feltNoise)'/%3E%3C/svg%3E");
}

.board-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 380px;
    max-height: 54vh;
    background: var(--card-bg);
    border: 2px solid rgba(245, 158, 11, 0.3); /* Luxury Casino Gold Rim */
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

[data-theme="light"] .board-table {
    border-color: rgba(203, 213, 225, 0.8);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.board-header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 22px;
    border-bottom: 1.5px solid rgba(245, 158, 11, 0.25);
    background: linear-gradient(180deg, rgba(20, 26, 38, 0.95) 0%, rgba(10, 14, 22, 0.98) 100%);
}

[data-theme="light"] .board-header-toolbar {
    background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="blue"] .board-header-toolbar {
    background: linear-gradient(180deg, rgba(16, 42, 80, 0.95) 0%, rgba(8, 24, 48, 0.98) 100%);
    border-bottom-color: rgba(147, 197, 253, 0.3);
}

[data-theme="green"] .board-header-toolbar {
    background: linear-gradient(180deg, rgba(12, 48, 24, 0.95) 0%, rgba(6, 28, 14, 0.98) 100%);
    border-bottom-color: rgba(134, 239, 172, 0.3);
}

.board-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.board-controls {
    display: flex;
    gap: 8px;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Authentic Baize Felt Floor (Spotlight Vignette + Fabric Grain + Deep Cushion Shadow) */
.board-container {
    flex: 1;
    width: 100%;
    padding: 22px 26px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 16px;
    min-height: 320px;
    background-color: #0c1e36;
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, #184278 0%, #0c264c 55%, #051428 100%);
    box-shadow: inset 0 5px 22px rgba(0, 0, 0, 0.65), inset 0 0 80px rgba(0, 0, 0, 0.5);
    transition: all 0.25s ease;
    cursor: default;
}

[data-theme="light"] .board-container {
    background-color: #f1f5f9;
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, #ffffff 0%, #f1f5f9 60%, #e2e8f0 100%);
    box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.08), inset 0 0 40px rgba(0, 0, 0, 0.05);
}

[data-theme="blue"] .board-container {
    background-color: #0a2548;
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, #1d579e 0%, #0e3466 55%, #051833 100%);
    box-shadow: inset 0 5px 24px rgba(0, 0, 0, 0.7), inset 0 0 90px rgba(0, 0, 0, 0.6);
}

[data-theme="green"] .board-container {
    background-color: #0b3819;
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, #1b6330 0%, #0e4420 55%, #05210d 100%);
    box-shadow: inset 0 5px 24px rgba(0, 0, 0, 0.7), inset 0 0 90px rgba(0, 0, 0, 0.6);
}

.board-container.has-rack-selection {
    cursor: pointer;
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, rgba(99, 102, 241, 0.35) 0%, rgba(15, 23, 42, 0.75) 70%, rgba(8, 14, 26, 0.95) 100%);
    outline: 2.5px dashed rgba(99, 102, 241, 0.6);
    outline-offset: -5px;
}

.board-container.drag-over {
    background-image: var(--felt-texture), radial-gradient(circle at 50% 35%, rgba(99, 102, 241, 0.45) 0%, rgba(15, 23, 42, 0.85) 70%, rgba(8, 14, 26, 0.98) 100%);
    outline: 3px dashed var(--primary-color);
    outline-offset: -5px;
}

.empty-board-hint {
    width: 100%;
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    padding: 30px 10px;
    pointer-events: none;
    user-select: none;
}

.empty-board-hint i {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--warning-color);
    opacity: 0.7;
}

.empty-board-hint p {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Board Tile Sets Container on Felt */
.tile-set-zone {
    display: inline-flex;
    align-items: center;
    padding: 6px 9px;
    background: rgba(0, 0, 0, 0.24);
    border: 1.5px dashed rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    gap: 3px;
    min-width: 80px;
    min-height: 64px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tile-set-zone.drag-over {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.65), inset 0 0 10px rgba(99, 102, 241, 0.3) !important;
    transform: scale(1.03);
}

.player-rack-container.drag-over,
.rack-surface.drag-over {
    outline: 2px dashed var(--warning-color);
    outline-offset: -4px;
}

[data-theme="light"] .tile-set-zone {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Set validation glowing states */
.tile-set-zone.valid-set {
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.28), inset 0 0 8px rgba(16, 185, 129, 0.15);
}

.tile-set-zone.invalid-set {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.28), inset 0 0 8px rgba(239, 68, 68, 0.15);
}

/* Realistic Ivory Melamine Tiles */
.rummi-tile {
    width: 44px;
    height: 62px;
    background: linear-gradient(150deg, #ffffff 0%, #faf5ec 45%, #eee3ce 85%, #ded0b4 100%);
    border: 1px solid #d4c5a9;
    border-radius: 6px;
    box-shadow: 
        0 5px 12px rgba(0, 0, 0, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1.5px 1.5px rgba(255, 255, 255, 0.95),
        inset 0 -2.5px 3px rgba(175, 145, 110, 0.35),
        inset 1px 0 2px rgba(255, 255, 255, 0.6),
        inset -1px 0 2px rgba(175, 145, 110, 0.25);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: grab;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.rummi-tile:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.rummi-tile:active {
    cursor: grabbing;
}

.rummi-tile.selected {
    box-shadow: 0 0 0 3px var(--primary-color), 0 8px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-5px);
}

.rummi-tile.dragging {
    opacity: 0.6;
    transform: scale(0.95);
}

/* Tile Typography & Colors */
.tile-num {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tile-underline {
    width: 14px;
    height: 2px;
    margin-top: 3px;
    border-radius: 1px;
}

.tile-black .tile-num { color: #1e293b; }
.tile-black .tile-underline { background: #1e293b; }

.tile-blue .tile-num { color: #0284c7; }
.tile-blue .tile-underline { background: #0284c7; }

.tile-red .tile-num { color: #dc2626; }
.tile-red .tile-underline { background: #dc2626; }

.tile-yellow .tile-num { color: #d97706; }
.tile-yellow .tile-underline { background: #d97706; }

/* Joker Tile */
.tile-joker .joker-icon {
    font-size: 1.5rem;
    color: #f59e0b;
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.4));
}

.tile-joker .joker-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: #b45309;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Player Dock & 2-Tier Rack */
.player-dock {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 14px 18px;
}

.player-status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.meld-tag {
    padding: 3px 10px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-full);
    color: #f59e0b;
    font-size: 0.75rem;
    font-weight: 700;
}

.meld-tag.done {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

/* 2-Tier Wooden/Glass Rack */
.player-rack-container {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #475569;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .player-rack-container {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
}

.rack-surface {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 136px;
    align-content: flex-start;
}

/* Player Controls */
.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sort-group, .action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    height: 42px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

[data-theme="light"] .ctrl-btn {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

[data-theme="light"] .ctrl-btn:hover {
    background: #f1f5f9;
}

.ctrl-btn.draw-btn {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.ctrl-btn.draw-btn:hover {
    background: rgba(245, 158, 11, 0.25);
}

.ctrl-btn.undo-btn {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.ctrl-btn.undo-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.ctrl-btn.submit-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.ctrl-btn.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Shortcut Keys */
.shortcut-key {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--text-muted);
}

[data-theme="light"] .shortcut-key {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: #64748b;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-card.wide {
    max-width: 680px;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pvp-option-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

[data-theme="light"] .pvp-option-card {
    background: rgba(0, 0, 0, 0.02);
}

.pvp-option-card h3 {
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pvp-option-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.form-row {
    display: flex;
    gap: 8px;
}

.glass-input {
    flex: 1;
    height: 42px;
    padding: 0 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

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

.glass-input.sm {
    max-width: 110px;
}

.modal-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: #ffffff;
}

.modal-btn.primary:hover {
    background: var(--primary-hover);
}

.modal-btn.accent {
    background: var(--warning-color);
    color: #ffffff;
}

.modal-btn.secondary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.modal-btn.large {
    height: 48px;
    font-size: 1rem;
    padding: 0 26px;
    border-radius: var(--radius-full);
}

.invite-link-box {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

[data-theme="light"] .invite-link-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.link-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--warning-color);
}

.link-copy-row {
    display: flex;
    gap: 6px;
}

.link-text {
    font-family: monospace;
    font-size: 0.75rem;
}

.invite-guide {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pvp-divider {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
}

.modal-btn.outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

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

[data-theme="light"] .modal-btn.outline:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

[data-theme="light"] .modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Result Modal */
.result-card {
    text-align: center;
    align-items: center;
}

.result-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 4px;
}

.result-score-box {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 12px 0 16px 0;
    width: 100%;
}

@media (max-width: 480px) {
    .result-score-box {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.result-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-item strong {
    font-size: 1.15rem;
    color: var(--text-primary);
}

/* Stats Tabs (All-Time vs Monthly) */
.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 8px;
}

.stats-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 7px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

[data-theme="light"] .stats-tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.stats-tab-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
}

.month-sub {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.85;
}

/* Stats Modal Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}

@media (max-width: 520px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s ease;
}

[data-theme="light"] .stat-card {
    background: rgba(0, 0, 0, 0.02);
}

.stat-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.stat-num {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-heading);
}

.stat-lbl {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.countdown-circle {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    border: 4px solid #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #f59e0b;
    margin: 16px auto;
}

/* Fullscreen Win Canvas */
#win-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .rummi-layout {
        padding: 6px;
        gap: 10px;
    }

    .rummi-header {
        padding: 6px 4px;
    }

    .rummi-brand .brand-logo-img {
        width: 36px;
        height: 36px;
    }

    .rummi-brand .brand-text h1 {
        font-size: 1.3rem;
    }

    .rummi-header-subrow {
        overflow-x: auto;
        padding: 2px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .rummi-header-subrow::-webkit-scrollbar {
        display: none;
    }

    .game-switch-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .game-switch-badge {
        padding: 4px 9px;
        font-size: 0.72rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .guide-btn span {
        display: none;
    }

    .status-ribbon {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .stats-timer-container {
        justify-content: space-between;
    }

    .rummi-tile {
        width: 36px;
        height: 52px;
    }

    .tile-num {
        font-size: 1.35rem;
    }

    .player-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-group, .action-group {
        justify-content: space-between;
    }

    .ctrl-btn {
        flex: 1;
        justify-content: center;
    }

    .shortcut-key {
        display: none;
    }
}

/* Ad Areas - Invisible */
.playbox-ad-slot,
.ad-placeholder {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}
