/* ==========================================================================
   BOARDGAME COMPANION - PREMIUM CSS DESIGN SYSTEM (PHASE 1)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & SYSTEM VARIABLES (Obsidian Dark Mode Default)
   -------------------------------------------------------------------------- */
:root {
    /* Color Palette */
    --color-bg-base: hsl(224, 25%, 8%);
    --color-bg-deep: hsl(222, 47%, 5%);
    --color-surface-glass: hsla(223, 23%, 12%, 0.7);
    --color-surface-solid: hsl(223, 23%, 12%);
    --color-border-glass: hsla(223, 20%, 30%, 0.4);
    --color-border-glow: hsla(250, 89%, 65%, 0.35);

    /* Brand Accent Colors */
    --color-primary: hsl(250, 89%, 65%);
    --color-primary-hover: hsl(250, 89%, 72%);
    --color-primary-glow: hsla(250, 89%, 65%, 0.4);
    
    --color-secondary: hsl(172, 90%, 45%);
    --color-secondary-hover: hsl(172, 90%, 55%);
    --color-secondary-glow: hsla(172, 90%, 45%, 0.3);

    --color-danger: hsl(351, 89%, 60%);
    --color-danger-hover: hsl(351, 89%, 68%);
    --color-danger-glow: hsla(351, 89%, 60%, 0.3);

    --color-success: hsl(145, 80%, 45%);
    --color-warning: hsl(42, 95%, 55%);

    /* Text Colors */
    --color-text-primary: hsl(210, 40%, 98%);
    --color-text-secondary: hsl(215, 20%, 75%);
    --color-text-muted: hsl(215, 15%, 50%);

    /* Typography */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Shadows & Border Radii */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.3);

    /* Animation Timing */
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);

    /* Layout Constraints */
    --header-height: 70px;
}

/* --------------------------------------------------------------------------
   2. MOBILE-FIRST RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-deep);
    color: var(--color-text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available; /* Fixed mobile layout jumping */
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

/* Remove tap highlight color for premium mobile feel */
button, a {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   3. BACKDROP GLOW EFFECTS (Ambient Orbs)
   -------------------------------------------------------------------------- */
.backdrop-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.45;
}

.orb-primary {
    top: -10%;
    right: -20%;
    width: 70vw;
    height: 70vw;
    background: var(--color-primary);
    animation: orbPulseSlow 20s infinite alternate;
}

.orb-secondary {
    bottom: -10%;
    left: -20%;
    width: 80vw;
    height: 80vw;
    background: var(--color-secondary-glow);
    animation: orbPulseSlow 25s infinite alternate-reverse;
}

@keyframes orbPulseSlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.35; }
    50% { transform: scale(1.15) translate(5%, -5%); opacity: 0.45; }
    100% { transform: scale(0.9) translate(-5%, 5%); opacity: 0.3; }
}

/* --------------------------------------------------------------------------
   4. APP SHELL LAYOUT
   -------------------------------------------------------------------------- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom, 16px); /* Notch device optimization */
}

/* App Header */
.app-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--color-border-glass);
    background-color: hsla(224, 25%, 8%, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 720px;
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

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

.brand-logo {
    font-size: 1.5rem;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--color-text-primary) 30%, var(--color-text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Indicator */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-normal);
    border: 1px solid var(--color-border-glass);
    background-color: rgba(255, 255, 255, 0.03);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transition: var(--transition-normal);
}

.status-online {
    border-color: rgba(145, 80, 45, 0.1);
}
.status-online .badge-dot {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-offline {
    border-color: rgba(351, 89, 60, 0.2);
}
.status-offline .badge-dot {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

/* Main Container */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    position: relative;
}

/* Screen Management */
.app-screen {
    display: none;
    flex-direction: column;
    animation: fadeIn var(--transition-normal) forwards;
}

.app-screen.active {
    display: flex;
}

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

/* Glass panel background */
.glass-panel {
    background-color: var(--color-surface-glass);
    border: 1px solid var(--color-border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* --------------------------------------------------------------------------
   5. SCREEN 1: GAME SELECTION
   -------------------------------------------------------------------------- */
.screen-header {
    margin-bottom: 20px;
}

.screen-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

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

.game-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.game-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border-glass);
    min-height: 160px;
    display: flex;
    text-align: left;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-premium);
}

.game-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: var(--transition-slow);
}

.game-card-content {
    position: relative;
    z-index: 2;
    padding: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.game-badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--color-primary);
    color: var(--color-text-primary);
    margin-bottom: 8px;
    box-shadow: 0 2px 10px var(--color-primary-glow);
}

.game-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.game-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    max-width: 80%;
}

.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 500;
}

.game-players {
    color: var(--color-text-secondary);
}

.game-action {
    color: var(--color-secondary);
    font-weight: 700;
    transition: var(--transition-fast);
}

/* Interactivity and Hover States */
.game-card:active {
    transform: scale(0.97);
}

.game-card:active .game-card-bg {
    transform: scale(1.05);
}

/* Locked Card styling */
.card-locked {
    opacity: 0.75;
    border-color: rgba(255, 255, 255, 0.05);
}

.card-locked .game-badge {
    background-color: var(--color-text-muted);
    box-shadow: none;
}

.game-action-locked {
    color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   6. SCREEN 2: GAME SESSION TIMER
   -------------------------------------------------------------------------- */
.timer-container {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 32px;
}

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

.game-session-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: hsla(250, 89%, 65%, 0.15);
    color: var(--color-primary-hover);
    border: 1px solid var(--color-border-glow);
}

.session-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-text-secondary);
}

.timer-display-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border: 3px solid var(--color-border-glass);
    box-shadow: var(--shadow-inner), 0 0 20px rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.2);
}

.timer-radial-bg {
    position: absolute;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 50%;
    border: 2px dashed rgba(172, 90, 45, 0.25);
    animation: rotateDashed 60s linear infinite;
}

@keyframes rotateDashed {
    100% { transform: rotate(360deg); }
}

.timer-display {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
    text-shadow: 0 0 15px var(--color-secondary-glow);
    z-index: 2;
}

.timer-controls {
    display: flex;
    gap: 16px;
    width: 100%;
}

/* --------------------------------------------------------------------------
   7. UTILITY ELEMENTS & PREMIUM BUTTONS
   -------------------------------------------------------------------------- */
.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-primary);
}
.btn-primary:active {
    background-color: var(--color-primary-hover);
    transform: translateY(1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-glass);
}
.btn-secondary:active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(1px);
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--color-text-primary);
}
.btn-danger:active {
    background-color: var(--color-danger-hover);
    transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   8. SCREEN 3: SCORESHEET LAYOUT & ACTIONS
   -------------------------------------------------------------------------- */
.scoresheet-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border-glass);
    border-radius: 18px;
    gap: 8px;
}

.btn-back {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: hsl(0, 100%, 75%);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-back:active {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(0.95);
    color: hsl(0, 100%, 85%);
}

.scoresheet-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--color-text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    flex: 1;
}

/* Custom override for save button inside header to prevent expansion overlap */
.action-bar .btn-primary {
    flex: none;
    width: auto;
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 10px;
    background-color: var(--color-primary);
    box-shadow: 0 2px 10px var(--color-primary-glow);
}

.action-bar .btn-primary:active {
    transform: scale(0.95);
    box-shadow: none;
}

.scoresheet-container {
    animation: fadeIn var(--transition-normal) forwards;
}

/* --------------------------------------------------------------------------
   9. TOAST NOTIFICATION CONTAINER
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    width: calc(100% - 32px);
    max-width: 380px;
}

.toast {
    background-color: var(--color-surface-solid);
    border: 1px solid var(--color-border-glass);
    color: var(--color-text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideUp var(--transition-normal) cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

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

/* --------------------------------------------------------------------------
   10. TABLET / DESKTOP WIDE VIEW OVERRIDES
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    :root {
        --header-height: 80px;
    }
    
    .app-main {
        padding: 32px 16px;
    }

    .game-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .timer-container {
        padding: 48px;
    }
    
    .timer-display {
        font-size: 2.6rem;
    }
}

/* --------------------------------------------------------------------------
   11. MULTIPLAYER SETUP & PLAYER TABS STYLING
   -------------------------------------------------------------------------- */
.player-setup-container {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setup-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.setup-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
}

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

/* Stepper Selector */
.player-count-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--color-border-glass);
    padding: 12px 16px;
    border-radius: 16px;
}

.selector-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
}

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

.btn-stepper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-glass);
    color: var(--color-text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-stepper:active {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(0.9);
}

.stepper-value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-secondary);
    min-width: 20px;
    text-align: center;
}

/* Player input lists */
.player-names-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom scrollbar for player list */
.player-names-list::-webkit-scrollbar {
    width: 4px;
}
.player-names-list::-webkit-scrollbar-thumb {
    background-color: var(--color-border-glass);
    border-radius: 4px;
}

.player-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn var(--transition-normal) forwards;
}

.player-input-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.player-input {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--color-border-glass);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 10px 14px;
    border-radius: 12px;
    transition: var(--transition-normal);
}

.player-input:focus {
    border-color: var(--color-primary);
    background-color: rgba(0, 0, 0, 0.3);
    outline: none;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.setup-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* Score Sheet Player Tabs bar */
.player-tabs-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    margin-bottom: 8px;
    box-sizing: border-box;
    width: 100%;
}

.player-tabs-bar::-webkit-scrollbar {
    display: none; /* Hide scrollbar for tabs */
}

.tab-btn {
    background-color: hsla(223, 23%, 12%, 0.4);
    border: 1px solid hsla(223, 20%, 30%, 0.3);
    color: var(--color-text-secondary);
    padding: 10px 16px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: linear-gradient(135deg, hsla(250, 89%, 65%, 0.25) 0%, hsla(172, 90%, 45%, 0.05) 100%);
    border-color: hsla(250, 89%, 65%, 0.5);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-premium);
}

.tab-total {
    font-size: 0.8rem;
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--color-secondary);
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
}

.tab-btn.active .tab-total {
    color: var(--color-text-primary);
    background-color: var(--color-primary);
    text-shadow: none;
}

/* ==========================================================================
   9. SCREEN 5: MATCH HISTORY & STATISTICS
   ========================================================================== */
.history-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Glass header history navigation trigger button */
.btn-history {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-glass);
    padding: 7px 14px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-history:active {
    transform: scale(0.95);
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--color-text-primary);
}

/* Filter pills horizontal scrollable row */
.filter-pills-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
}

.filter-pills-bar::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background-color: hsla(223, 23%, 12%, 0.4);
    border: 1px solid hsla(223, 20%, 30%, 0.3);
    color: var(--color-text-secondary);
    padding: 8px 14px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-pill.active {
    background: linear-gradient(135deg, hsla(250, 89%, 65%, 0.2) 0%, hsla(172, 90%, 45%, 0.05) 100%);
    border-color: hsla(250, 89%, 65%, 0.4);
    color: var(--color-text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* History Cards List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Premium Collapsible Match Card Panel */
.match-card {
    background: hsla(223, 23%, 12%, 0.45);
    border: 1px solid hsla(223, 20%, 30%, 0.35);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.match-card:hover {
    border-color: hsla(250, 89%, 65%, 0.35);
    background: hsla(223, 23%, 12%, 0.55);
}

.match-card.expanded {
    border-color: hsla(250, 89%, 65%, 0.5);
    background: hsla(223, 23%, 12%, 0.65);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* Main visible card details row */
.match-card-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.match-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.match-card-game-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-card-game-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.match-card-sync-icon {
    font-size: 0.85rem;
}

.match-card-date {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
}

.match-card-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
}

.match-card-duration {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
}

.match-card-winner {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Collapsible Detailed Grid Section */
.match-card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.match-card.expanded .match-card-details {
    max-height: 500px; /* Expands dynamically up to this bound */
}

.match-details-inner {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.2);
}

/* High Fidelity Side-By-Side Comparison Grid */
.match-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    text-align: left;
}

.match-details-table th {
    padding: 8px;
    font-weight: 700;
    color: var(--color-text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

.match-details-table td {
    padding: 8px;
    color: var(--color-text-secondary);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

.match-details-table tr:hover td {
    color: var(--color-text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

/* Highlighting grand totals row */
.match-details-table .totals-row td {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--color-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    padding-top: 10px;
}

/* Style for empty lists fallback text */
.history-empty-message {
    padding: 30px 20px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    background: hsla(223, 23%, 12%, 0.25);
    border: 1px dashed hsla(223, 20%, 30%, 0.25);
    border-radius: 16px;
    backdrop-filter: blur(12px);
}

/* ==========================================================================
   10. PREMIUM CUSTOM SVG ICONS LAYOUT & EFFECTS
   ========================================================================== */
.icon-svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    stroke-width: 2.25;
}

/* Specific spacing for header action items */
.btn-back .icon-svg {
    margin-right: 8px;
}

.btn-history .icon-svg {
    margin-right: 6px;
    stroke-width: 2.5;
}

/* Brand logo meeple neon glowing accentuation */
.brand-logo-svg {
    display: block;
    color: var(--color-primary);
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.45));
    transition: var(--transition-normal);
}

.brand:hover .brand-logo-svg {
    transform: rotate(5deg) scale(1.05);
    filter: drop-shadow(0 0 14px rgba(99, 102, 241, 0.65));
}

/* Shared category SVG alignment within Custom Web Component Row Icons */
.row-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    color: inherit;
    stroke-width: 2;
}
