/* public/games/football-squares/CSS/styles.css */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&display=swap');

@font-face {
    font-family: 'DSEG7Classic';
    src: url('../fonts/DSEG7Classic-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'DSEG7Classic';
    src: url('../fonts/DSEG7Classic-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --fs-bg-base: #111827;
    --fs-bg-surface: #1f2937;
    --fs-bg-elevated: #374151;
    --fs-text-primary: #f3f4f6;
    --fs-text-muted: #9ca3af;
    --fs-accent-emerald: #10b981;
    --fs-accent-indigo: #6366f1;
    --fs-border-subtle: #4b5563;
}

body {
    background-color: var(--fs-bg-base);
    background: radial-gradient(circle at 50% 0%, #374151 0%, #111827 60%, #000000 100%);
    background-attachment: fixed;
    color: var(--fs-text-primary);
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translate(-50%, 16px) scale(0.95);
    }
    60% {
        opacity: 1;
        transform: translate(-50%, -2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.25s ease-out forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Enforce Hidden State */
.hidden {
    display: none !important;
}

/* Hide number input arrows (Spinners) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Custom Scrollbar - High-Visibility Tactile Slider */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #6366f1 #111827;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #111827;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 4px;
    border: 2px solid #111827;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #818cf8;
}

/* Modal & Component Outline Reset (Eliminate Harsh White Outlines) */
div[role="dialog"],
.modal-card,
button:focus {
    outline: none !important;
}

button:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5) !important;
}

/* Grid Cell Styling & Mobile Touch Ergonomics */
#squaresGrid {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    container-type: inline-size;
    container-name: squares-board;
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: default;
    transition: background-color 0.12s ease, transform 0.1s ease, opacity 0.15s ease, filter 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    text-align: center;
    line-height: 1.1;
    padding: 2px;
}

.grid-cell.header {
    background-color: var(--fs-bg-surface);
    color: var(--fs-text-muted);
    font-size: 1rem;
}

.grid-cell.corner {
    background-color: var(--fs-bg-base);
    border: none;
}

.grid-cell.square {
    background-color: var(--fs-bg-elevated);
    color: #d1d5db;
}

.grid-cell.square:hover {
    background-color: #4b5563;
}

.grid-cell.taken {
    background-color: #064e3b;
    color: #ffffff;
    border-color: #065f46;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

.grid-cell.mine {
    background-color: #312e81;
    color: #ffffff;
    border-color: #3730a3;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

.grid-cell.selectable {
    cursor: pointer;
}

.grid-cell.selectable:hover {
    background-color: #4b5563;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.grid-cell.selectable:active {
    transform: scale(0.96);
}

/* ============================================================================
   Container-Proportional Grid Scaling (Scales Smoothly Below 350px to 260px)
   ============================================================================ */
#squaresGrid .grid-lock-icon {
    width: clamp(11px, 4.4cqw, 20px) !important;
    height: clamp(11px, 4.4cqw, 20px) !important;
}

#squaresGrid .grid-team-header {
    font-size: clamp(0.62rem, 3.6cqw, 1.5rem) !important;
    letter-spacing: clamp(0.01em, 0.2cqw, 0.06em);
    overflow: hidden !important;
}

#squaresGrid .grid-team-header.grid-team-left {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    text-align: center !important;
    font-size: clamp(0.62rem, 3.6cqw, 1.5rem) !important;
    letter-spacing: clamp(0.01em, 0.2cqw, 0.06em) !important;
    overflow: hidden !important;
    position: relative !important;
}

#squaresGrid .grid-team-header span {
    position: relative !important;
    z-index: 20 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, 0.9) !important;
}

#squaresGrid .grid-team-watermark-top {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: clamp(6.75rem, 12cqw, 9.375rem) !important;
    width: auto !important;
    max-height: none !important;
    max-width: none !important;
    object-fit: contain !important;
    opacity: 1 !important;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.85)) !important;
    z-index: 5 !important;
    pointer-events: none !important;
}

#squaresGrid .grid-team-watermark-left {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) rotate(90deg) !important;
    width: clamp(6.75rem, 12cqw, 9.375rem) !important;
    height: clamp(6.75rem, 12cqw, 9.375rem) !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    opacity: 1 !important;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.85)) !important;
    z-index: 5 !important;
    pointer-events: none !important;
}

#squaresGrid .grid-spacer-cell {
    font-size: clamp(0.5rem, 2.8cqw, 0.875rem) !important;
}

#squaresGrid .grid-num-header {
    font-size: clamp(0.58rem, 3.3cqw, 1.125rem) !important;
}

#squaresGrid .grid-cell.sq-len-1 {
    font-size: clamp(0.68rem, 4.6cqw, 2.25rem) !important;
}

#squaresGrid .grid-cell.sq-len-2 {
    font-size: clamp(0.54rem, 3.5cqw, 1.75rem) !important;
}

#squaresGrid .grid-cell.sq-len-3 {
    font-size: clamp(0.42rem, 2.6cqw, 1.25rem) !important;
}

/* ============================================================================
   Quarter Corner Dog-Ear Triangles (Winner Markers on Squares)
   ============================================================================ */
#squaresGrid .corner-triangle {
    position: absolute !important;
    width: clamp(7.5px, 2.2cqw, 12px) !important;
    height: clamp(7.5px, 2.2cqw, 12px) !important;
    pointer-events: none !important;
    z-index: 20 !important;
    filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.85)) !important;
}

#squaresGrid.grid-5x5 .corner-triangle {
    width: clamp(12px, 3.8cqw, 18px) !important;
    height: clamp(12px, 3.8cqw, 18px) !important;
}

/* Q1: Top-Left (Emerald) */
#squaresGrid .corner-q1 {
    top: 0 !important;
    left: 0 !important;
    background-color: #10b981 !important;
    clip-path: polygon(0 0, 100% 0, 0 100%) !important;
}

/* Q2: Top-Right (Sky Blue) */
#squaresGrid .corner-q2 {
    top: 0 !important;
    right: 0 !important;
    background-color: #38bdf8 !important;
    clip-path: polygon(0 0, 100% 0, 100% 100%) !important;
}

/* Q3: Bottom-Left (Purple / Violet) */
#squaresGrid .corner-q3 {
    bottom: 0 !important;
    left: 0 !important;
    background-color: #c084fc !important;
    clip-path: polygon(0 0, 0 100%, 100% 100%) !important;
}

/* FINAL: Bottom-Right (Athletic Gold) */
#squaresGrid .corner-final {
    bottom: 0 !important;
    right: 0 !important;
    background-color: #facc15 !important;
    clip-path: polygon(100% 0, 100% 100%, 0 100%) !important;
}

/* Winning Cell Glow Rings & Outlines */
#squaresGrid .grid-cell.winner-cell-q1 {
    box-shadow: 0 0 9px rgba(16, 185, 129, 0.7), inset 0 0 4px rgba(16, 185, 129, 0.3) !important;
    border-color: #10b981 !important;
}
#squaresGrid .grid-cell.winner-cell-q2 {
    box-shadow: 0 0 9px rgba(56, 189, 248, 0.7), inset 0 0 4px rgba(56, 189, 248, 0.3) !important;
    border-color: #38bdf8 !important;
}
#squaresGrid .grid-cell.winner-cell-q3 {
    box-shadow: 0 0 9px rgba(192, 132, 252, 0.7), inset 0 0 4px rgba(192, 132, 252, 0.3) !important;
    border-color: #c084fc !important;
}
#squaresGrid .grid-cell.winner-cell-final {
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.8), inset 0 0 4px rgba(250, 204, 21, 0.3) !important;
    border-color: #facc15 !important;
}
#squaresGrid .grid-cell.winner-cell-multi {
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.95), inset 0 0 6px rgba(250, 204, 21, 0.4) !important;
    border-color: #facc15 !important;
}

#squaresGrid .grid-cell.ring-yellow-400 {
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.45) !important;
}

@container squares-board (max-width: 340px) {
    #squaresGrid .grid-cell {
        padding: 1px;
    }

    #squaresGrid .badge-tl {
        top: 1px !important;
        left: 1px !important;
    }

    #squaresGrid .badge-tr {
        top: 1px !important;
        right: 1px !important;
    }

    #squaresGrid .badge-bl {
        bottom: 1px !important;
        left: 1px !important;
    }

    #squaresGrid .badge-br {
        bottom: 1px !important;
        right: 1px !important;
    }

    #squaresGrid .grid-team-watermark-top {
        height: 5.625rem !important;
        opacity: 1 !important;
    }

    #squaresGrid .grid-team-watermark-left {
        width: 5.625rem !important;
        height: 5.625rem !important;
        opacity: 1 !important;
    }
}

@media (max-width: 768px) {
    .grid-cell {
        font-size: 0.6rem;
    }

    .grid-cell.header {
        font-size: 0.8rem;
    }
}

/* ============================================================================
   Quarterly Reshuffle Tab Bar & 5x5 Grid Styling
   ============================================================================ */
#quarterTabsBar {
    backdrop-filter: blur(8px);
}

.q-tab-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #9ca3af;
    background-color: transparent;
}

.q-tab-btn:hover {
    background-color: #374151;
    color: #ffffff;
}

.q-tab-btn.active-qtab {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* Quarterly Reshuffle Corner Numbers */
.reshuffle-num-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

.reshuffle-corner {
    position: absolute;
    font-size: clamp(6.5px, 2.2cqw, 11px);
    line-height: 1;
    font-weight: 800;
    pointer-events: none;
    user-select: none;
}

.reshuffle-corner-q1 {
    top: 2px;
    left: 2px;
}

.reshuffle-corner-q2 {
    top: 2px;
    right: 2px;
}

.reshuffle-corner-q3 {
    bottom: 2px;
    left: 2px;
}

.reshuffle-corner-final {
    bottom: 2px;
    right: 2px;
}

.reshuffle-center-num {
    font-size: clamp(0.7rem, 3.8cqw, 1.3rem);
    font-weight: 900;
    line-height: 1;
}

.reshuffle-all-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    padding: 1.5px;
    box-sizing: border-box;
}

.reshuffle-all-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(7.5px, 2.6cqw, 13px);
    font-weight: 800;
    line-height: 1;
}

/* 5x5 Proportional Cell and Font Sizing */
#squaresGrid.grid-5x5 .grid-num-header {
    font-size: clamp(0.7rem, 4.2cqw, 1.35rem) !important;
}

#squaresGrid.grid-5x5 .grid-cell.sq-len-1 {
    font-size: clamp(1.1rem, 7.5cqw, 3.25rem) !important;
}

#squaresGrid.grid-5x5 .grid-cell.sq-len-2 {
    font-size: clamp(0.85rem, 5.8cqw, 2.5rem) !important;
}

#squaresGrid.grid-5x5 .grid-cell.sq-len-3 {
    font-size: clamp(0.68rem, 4.2cqw, 1.85rem) !important;
}

/* ============================================================================
   Mobile Viewport Fluid Scaling (< 420px and < 350px)
   Ensures icons, text, and buttons continue shrinking proportionally
   ============================================================================ */
/* Board Top Bar (Full-Width Player Card on Top, Full-Width Scores Bar Underneath) */
#boardTopBar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    width: 100% !important;
    margin-bottom: 0.75rem !important;
}
#boardTopBar #myPlayerCard {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
    padding: 0.5rem 0.85rem !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: left !important;
    box-sizing: border-box !important;
}
#boardTopBar #gameScoresContainer {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 0.5rem 0.75rem !important;
    box-sizing: border-box !important;
}
#gameScoresContainer .scores-grid-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1.45fr) repeat(4, minmax(44px, 72px)) !important;
    gap: 0.4rem !important;
    align-items: center !important;
    width: 100% !important;
}
#gameScoresContainer .score-input {
    width: 100% !important;
    max-width: 72px !important;
    height: 28px !important;
    padding: 0 4px !important;
    text-align: center !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    margin: 0 auto !important;
}
@media (min-width: 640px) {
    #gameScoresContainer .score-input {
        height: 32px !important;
        font-size: 14px !important;
    }
}
#gameScoresContainer .score-team-label {
    width: 100% !important;
    text-align: left !important;
    padding-right: 0.5rem !important;
    font-weight: 800 !important;
    font-size: clamp(11px, 2.2vw, 13px) !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
}
#gameScoresContainer .score-q-label {
    width: 100% !important;
    text-align: center !important;
    font-weight: 700 !important;
    font-size: 10px !important;
}
#gameScoresContainer .score-q-badge {
    width: 100% !important;
    max-width: 72px !important;
    margin: 0 auto !important;
    text-align: center !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    padding: 3px 6px !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}
#gameScoresContainer .score-header-title {
    font-size: clamp(9px, 2vw, 11px) !important;
    font-weight: 800 !important;
    color: #9ca3af !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.25rem !important;
    padding-right: 0.35rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
}

/* ============================================================================
   Desktop & Full Width Viewport (min-width: 640px)
   Full-width Player Bar + Full-width Scores Bar across the board
   ============================================================================ */
@media (min-width: 640px) {
    #boardTopBar {
        gap: 0.7rem !important;
        margin-bottom: 0.9rem !important;
    }

    #boardTopBar #myPlayerCard {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0.6rem 1rem !important;
        border-radius: 0.875rem !important;
    }

    #myPlayerCard #cardAvatarBtn,
    #myPlayerCard .player-card-avatar {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        max-width: 38px !important;
        max-height: 38px !important;
    }

    #myPlayerCard .player-card-name {
        font-size: 0.95rem !important;
        font-weight: 800 !important;
    }

    #myPlayerCard .player-card-picked-num {
        font-size: 0.95rem !important;
        font-weight: 800 !important;
    }

    #myPlayerCard #cardRequestBtn {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.9rem !important;
    }

    #boardTopBar #gameScoresContainer {
        flex: 1 1 auto !important;
        width: 100% !important;
        padding: 0.6rem 0.9rem !important;
        border-radius: 0.875rem !important;
    }

    #gameScoresContainer .scores-grid-row {
        grid-template-columns: minmax(150px, 1.6fr) repeat(4, minmax(56px, 84px)) !important;
        gap: 0.45rem !important;
    }

    #gameScoresContainer .score-input {
        height: 34px !important;
        max-width: 84px !important;
        font-size: 14px !important;
        font-weight: 800 !important;
    }

    #gameScoresContainer .score-q-badge {
        max-width: 84px !important;
        font-size: 10.5px !important;
        padding: 4px 0 !important;
        border-radius: 6px !important;
    }

    #gameScoresContainer .score-team-label {
        font-size: clamp(11.5px, 1.5vw, 13.5px) !important;
        font-weight: 800 !important;
        padding-right: 0.5rem !important;
    }

    #gameScoresContainer .score-header-title {
        font-size: 11px !important;
        padding-right: 0.5rem !important;
    }
}

/* ============================================================================
   Player Card & Avatar Base Styling (Desktop & Responsive)
   ============================================================================ */
#myPlayerCard #cardAvatarBtn,
#myPlayerCard .player-card-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.75rem !important;
    position: relative !important;
    overflow: hidden !important;
}

#myPlayerCard .player-card-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: 2px !important;
}

/* Avatar Picker Modal - Robust High-Z-Index Stacking & Solid Backdrop */
#avatarPickerModal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 100000 !important;
    background-color: rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#avatarPickerModal > div {
    position: relative !important;
    z-index: 100001 !important;
    background-color: #111827 !important; /* solid gray-900 */
}

/* Avatar Picker Grids & Buttons */
#emojisGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)) !important;
    gap: 0.5rem !important;
    width: 100% !important;
}

.emoji-btn {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    height: 48px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    padding: 0 !important;
    border-radius: 0.75rem !important;
}

#nflTeamsGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)) !important;
    gap: 0.5rem !important;
    width: 100% !important;
}

.team-logo-btn {
    min-height: 70px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.75rem !important;
}

@media (max-width: 420px) {
    /* Compact outer container & card padding on mobile */
    #gameView {
        padding: 0.5rem !important;
    }

    .pool-header-card,
    .pool-sidebar-card {
        padding: 0.75rem !important;
    }

    .pool-board-card {
        padding: 0.375rem !important;
    }

    /* Navbar scaling */
    #gameNavbar {
        padding: 0.375rem 0.5rem !important;
    }

    #gameNavbar .nav-brand-title {
        font-size: clamp(0.75rem, 3.8vw, 1rem) !important;
    }

    #gameNavbar .nav-back-icon {
        width: clamp(14px, 4.2vw, 18px) !important;
        height: clamp(14px, 4.2vw, 18px) !important;
    }

    #roomBadge {
        padding: 0.15rem 0.4rem !important;
        gap: 0.25rem !important;
    }

    #roomCodeDisplay {
        font-size: clamp(0.72rem, 3.6vw, 0.95rem) !important;
        letter-spacing: 0.06em !important;
    }

    #roomBadge .share-icon-svg {
        width: clamp(11px, 3.5vw, 15px) !important;
        height: clamp(11px, 3.5vw, 15px) !important;
    }

    #roleDropdownBtn,
    #userMenuBtn {
        padding: 0.3rem !important;
    }

    #roleDropdownBtn svg,
    #userMenuBtn svg {
        width: clamp(17px, 5vw, 22px) !important;
        height: clamp(17px, 5vw, 22px) !important;
    }

    /* Pool Header & Stats */
    #poolNameDisplay {
        font-size: clamp(0.95rem, 4.6vw, 1.25rem) !important;
    }

    #poolNameDisplay #editPoolNameBtn svg {
        width: clamp(12px, 3.8vw, 15px) !important;
        height: clamp(12px, 3.8vw, 15px) !important;
    }

    #poolStatsContainer .stats-pot-summary {
        font-size: clamp(9.5px, 2.9vw, 11.5px) !important;
        gap: 0.25rem 0.65rem !important;
    }

    #poolStatsContainer .stats-payout-grid {
        font-size: clamp(8.5px, 2.6vw, 10px) !important;
        padding: 0.25rem !important;
    }

    #poolStatsContainer .stats-action-link,
    #poolStatsContainer .stats-action-badge,
    #poolStatsContainer .stats-remaining-badge {
        font-size: clamp(8.5px, 2.6vw, 10px) !important;
    }

    #poolStatsContainer .stats-remaining-num {
        font-size: clamp(10.5px, 3.2vw, 13px) !important;
    }

    /* Board Top Bar & Player Card (Full-Width Stack on Mobile) */
    #boardTopBar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
        margin-bottom: 0.6rem !important;
    }

    #boardTopBar #myPlayerCard {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: 0 0 auto !important;
        padding: 0.45rem 0.65rem !important;
        margin-bottom: 0 !important;
    }

    #boardTopBar #gameScoresContainer {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.4rem 0.5rem !important;
        margin-top: 0 !important;
    }

    #myPlayerCard .player-card-avatar {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
        max-width: 30px !important;
        max-height: 30px !important;
        padding: 0 !important;
    }

    #myPlayerCard .player-card-label {
        font-size: clamp(7.5px, 2vw, 9px) !important;
        letter-spacing: 0.03em !important;
    }

    #myPlayerCard .player-card-name {
        font-size: clamp(0.75rem, 3vw, 0.88rem) !important;
    }

    #myPlayerCard .player-card-invited {
        font-size: clamp(7.5px, 2.2vw, 9px) !important;
    }

    #myPlayerCard #cardRequestBtn {
        font-size: 10px !important;
        padding: 0.3rem 0.65rem !important;
        letter-spacing: 0.04em !important;
    }

    #myPlayerCard .player-card-picked-num {
        font-size: clamp(0.8rem, 3.2vw, 0.95rem) !important;
    }

    #myPlayerCard .player-card-picked-label {
        font-size: clamp(7px, 2vw, 8.5px) !important;
    }

    /* Quarter Score Inputs (Full-Width Scores Bar on Mobile) */
    #gameScoresContainer .scores-grid-row {
        grid-template-columns: minmax(0, 1.35fr) repeat(4, clamp(34px, 11vw, 48px)) !important;
        gap: 0.25rem !important;
    }

    #gameScoresContainer .score-input {
        font-size: 12px !important;
        padding: 0 2px !important;
        height: 26px !important;
        max-width: 48px !important;
    }

    #gameScoresContainer .score-q-label {
        font-size: 9px !important;
    }

    #gameScoresContainer .score-team-label {
        font-size: 10.5px !important;
        padding-right: 0.3rem !important;
    }

    /* Participant List Rows */
    #participantList .participant-row {
        padding: clamp(0.28rem, 1.5vw, 0.45rem) clamp(0.35rem, 1.8vw, 0.5rem) !important;
        font-size: clamp(10px, 3.1vw, 12px) !important;
    }

    #participantList .part-action-btn {
        padding: 0.15rem 0.2rem !important;
        margin-left: 0.125rem !important;
    }

    #participantList .part-action-btn svg {
        width: clamp(10px, 3.1vw, 12px) !important;
        height: clamp(10px, 3.1vw, 12px) !important;
    }

    #participantList .part-allowed-input {
        width: clamp(22px, 7vw, 30px) !important;
        height: clamp(16px, 5vw, 20px) !important;
        font-size: clamp(9.5px, 2.9vw, 11.5px) !important;
    }

    /* Landing View */
    #landingView h1 {
        font-size: clamp(1.55rem, 7.8vw, 2.25rem) !important;
    }
}

@media (max-width: 355px) {
    /* Ultra-compact phones (320px–355px: iPhone SE, Galaxy Z Fold cover, compact split-screen) */
    #roomBadge .room-badge-label {
        display: none !important;
    }

    #gameNavbar .nav-brand-group {
        gap: 0.35rem !important;
    }

    #gameNavbar .nav-right-group {
        gap: 0.25rem !important;
    }

    #myPlayerCard .player-card-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
        border-radius: 8px !important;
    }

    #landingHubBackBtn {
        top: 0.75rem !important;
        left: 0.75rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    #landingView > div.absolute.top-6.right-6 {
        top: 0.75rem !important;
        right: 0.75rem !important;
        gap: 0.4rem !important;
    }

    #landingShareBtn,
    #landingUserMenuBtn {
        padding: 0.35rem !important;
    }

    #landingShareBtn svg,
    #landingUserMenuBtn svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* ============================================================================
   Tutorial Overlay & Spotlight Stacking (Always on Absolute Top Layer)
   ============================================================================ */
#tutorialOverlayRoot {
    display: contents !important;
}

#tutBackdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999990 !important;
    background-color: rgba(0, 0, 0, 0.28) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    pointer-events: auto !important;
    cursor: not-allowed !important;
}

#tutHighlight {
    position: fixed !important;
    z-index: 1000000 !important;
    pointer-events: none !important;
    box-sizing: border-box !important;
    transition: none !important;
}

#tutTooltip {
    position: fixed !important;
    z-index: 1000005 !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
    transition: none !important;
}

/* ============================================================================
   Desktop Board & Sidebar Flex Layout (Side-by-side on wide screens)
   ============================================================================ */
@media (min-width: 1024px) {
    #gameView > div.flex {
        flex-direction: row !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }
}

/* ============================================================================
   Matchup Hero Banner & Ambient Watermark Logo Visuals
   ============================================================================ */
#gameAmbientBackdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

@keyframes subtleFloatLeft {
    0%, 100% { transform: translateY(0) rotate(-12deg); }
    50% { transform: translateY(-10px) rotate(-10deg); }
}

@keyframes subtleFloatRight {
    0%, 100% { transform: translateY(0) rotate(12deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
}

.ambient-watermark-left img {
    animation: subtleFloatLeft 14s ease-in-out infinite;
    will-change: transform;
}

.ambient-watermark-right img {
    animation: subtleFloatRight 14s ease-in-out infinite;
    will-change: transform;
}

.pool-header-card {
    overflow-x: clip !important;
}

.matchup-hero-card {
    will-change: transform;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden !important;
    clip-path: inset(0 round 0.75rem) !important;
    -webkit-clip-path: inset(0 round 0.75rem) !important;
    contain: paint !important;
    isolation: isolate !important;
}

.matchup-hero-card:hover {
    box-shadow: 0 12px 35px -8px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.matchup-logo-wrap img {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.matchup-logo-wrap:hover img {
    transform: scale(1.08);
}

.matchup-team-bg-logo {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: clamp(140px, 24vw, 210px) !important;
    height: clamp(140px, 24vw, 210px) !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    opacity: 0.35 !important;
    pointer-events: none !important;
    user-select: none !important;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8)) !important;
    z-index: 2 !important;
}

.matchup-team-bg-logo-left {
    left: 8px !important;
}

.matchup-team-bg-logo-right {
    right: 8px !important;
}

.matchup-team-text-wrap {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, 0.9) !important;
}

.matchup-team-text-wrap span {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, 0.9) !important;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
}

.matchup-status-text {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000, 0 0 8px rgba(0, 0, 0, 0.85) !important;
    filter: drop-shadow(0 1px 2px #000);
}

.matchup-team-logo {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

@media (min-width: 480px) {
    .matchup-team-logo {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
}

@media (min-width: 640px) {
    .matchup-team-logo {
        width: 48px !important;
        height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
    }
}

.matchup-score-badge {
    font-family: 'DSEG7Classic', monospace !important;
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    letter-spacing: 0.04em !important;
    font-variant-numeric: tabular-nums !important;
    min-width: 42px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 6px;
    background-color: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 133, 0, 0.5);
    border-radius: 0.375rem;
    box-sizing: border-box;
    line-height: 1;
    color: #ff8500 !important;
    text-shadow: 0 0 8px rgba(255, 133, 0, 0.55) !important;
    box-shadow: 0 0 10px rgba(255, 133, 0, 0.22) inset, 0 1px 4px rgba(0, 0, 0, 0.7) !important;
}

@media (min-width: 480px) {
    .matchup-score-badge {
        font-size: 1.35rem !important;
        min-width: 48px;
        height: 36px;
        padding: 0 8px;
    }
}

@media (min-width: 640px) {
    .matchup-score-badge {
        font-size: 1.65rem !important;
        min-width: 56px;
        height: 42px;
        padding: 0 10px;
    }
}






/* ==========================================================================
   Basketball Squares — League Switcher Tabs & Modal Inputs
   ========================================================================== */
.league-tab {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, filter 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    outline: none !important;
}

.league-tab-active {
    opacity: 1 !important;
    transform: scale(1.12) !important;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.75)) !important;
}

.league-tab-inactive {
    opacity: 0.45 !important;
    filter: grayscale(35%) !important;
    transform: scale(1) !important;
}

.league-tab-inactive:hover {
    opacity: 1 !important;
    filter: grayscale(0%) !important;
    transform: scale(1.06) !important;
}

/* Strict constraints to prevent any image or container blowout in Game Picker Modal */
#gamePickerModal .league-switcher-container {
    max-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid rgba(55, 65, 81, 0.8) !important;
}

#gamePickerModal .league-tab,
#gamePickerModal button[data-sport] {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

#gamePickerModal .league-tab img,
#gamePickerModal button[data-sport] img {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    object-fit: contain !important;
    display: block !important;
    pointer-events: none !important;
}

.game-picker-search {
    background-color: #0b0f19 !important;
    border: 1px solid #374151 !important;
    color: #ffffff !important;
    outline: none !important;
}

.game-picker-search:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35) !important;
}

.game-picker-search::placeholder {
    color: #9ca3af !important;
}


/* Details / Summary Dropdown Reset */
details summary::-webkit-details-marker,
details summary::marker {
    display: none !important;
}

/* ==========================================================================
   Global Dark Border Safeguards (Eliminate White/CurrentColor Fallbacks)
   ========================================================================== */
.border,
.border-t,
.border-b,
.border-l,
.border-r {
    border-color: rgba(55, 65, 81, 0.7);
}

.border-gray-700\/60,
.border-gray-700\/70,
.border-gray-700\/80,
.border-gray-700\/50,
.border-gray-800\/60,
.border-gray-800\/80,
.border-gray-800 {
    border-color: rgba(55, 65, 81, 0.7) !important;
}

.divide-gray-700\/70 > :not([hidden]) ~ :not([hidden]),
.divide-gray-700\/60 > :not([hidden]) ~ :not([hidden]),
.divide-gray-700 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgba(55, 65, 81, 0.7) !important;
}

#rulesModal > div,
#adminGuideModal > div,
#recentPoolsModal > div,
#gamePickerModal > div,
#teamPickerModal > div,
#settingsModal > div,
#moveParticipantModal > div {
    border-color: rgba(55, 65, 81, 0.7) !important;
}

#rulesModal details {
    border: 1px solid rgba(55, 65, 81, 0.6) !important;
    background-color: rgba(31, 41, 55, 0.4) !important;
}

/* Action Card League Tabs Corner Rounding */
#quickLeagueBar {
    border-top-left-radius: 1rem !important;
    border-top-right-radius: 1rem !important;
    overflow: hidden !important;
}

#quickLeagueBar > :first-child {
    border-top-left-radius: 1rem !important;
}

#quickLeagueBar > :last-child {
    border-top-right-radius: 1rem !important;
}

/* Landing Games Dropdown Styling */
#landingGamesDropdown {
    background-color: #111827 !important;
    opacity: 1 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 10px 10px -5px rgba(0, 0, 0, 0.6) !important;
}

/* =========================================================================
   CLEAN NAKED NAVBAR ICONS (No Squares or Borders Around Icons)
   ========================================================================= */

#roleDropdownBtn,
#userMenuBtn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 6px !important;
    color: #9ca3af !important;
    transition: color 0.15s ease !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0 !important;
}

#roleDropdownBtn:hover,
#userMenuBtn:hover {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

#roleDropdownBtn svg,
#userMenuBtn svg {
    width: 22px !important;
    height: 22px !important;
}

/* ============================================================================
   Widescreen TV Display Mode (?tv=1)
   Giant Squares Board on the Left, All Details (Header, Scores, Roster) on Right
   ============================================================================ */
@media (min-width: 900px) {
    body.tv-display-mode {
        padding-top: 52px !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    body.tv-display-mode main {
        height: calc(100vh - 52px) !important;
        overflow: hidden !important;
    }

    body.tv-display-mode #gameView {
        max-width: 100vw !important;
        width: 100% !important;
        height: 100% !important;
        padding: 10px 18px !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    body.tv-display-mode #gameView > div {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: center !important;
        gap: 18px !important;
        height: 100% !important;
        width: 100% !important;
    }

    /* Left Column: Giant Squares Grid sized as large as viewport height permits */
    body.tv-display-mode #gameView > div > div:first-child {
        width: min(calc(100vh - 76px), 62vw) !important;
        max-width: none !important;
        flex: 0 0 auto !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    body.tv-display-mode .pool-board-card {
        max-width: none !important;
        width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    body.tv-display-mode .pool-board-card > .overflow-x-auto {
        padding-bottom: 0 !important;
        overflow: visible !important;
    }

    body.tv-display-mode #boardTopBar {
        display: none !important;
    }

    /* Right Column: Pool Details + Full-Width Scores + Participants */
    body.tv-display-mode #gameView > div > div:nth-child(2) {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 340px !important;
        max-width: 600px !important;
        height: 100% !important;
        position: static !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        overflow: hidden !important;
        padding-bottom: 0 !important;
    }

    body.tv-display-mode #gameView > div > div:nth-child(2) > * {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    body.tv-display-mode .pool-header-card {
        max-width: none !important;
        width: 100% !important;
        margin-bottom: 0 !important;
        padding: 12px 14px !important;
        flex-shrink: 0 !important;
    }

    body.tv-display-mode .pool-header-card h2 {
        font-size: 1.35rem !important;
    }

    body.tv-display-mode #gameScoresContainer.tv-scores-card {
        width: 100% !important;
        flex-shrink: 0 !important;
        padding: 10px 14px !important;
        background: rgba(31, 41, 55, 0.92) !important;
        border: 1px solid rgba(75, 85, 99, 0.8) !important;
        border-radius: 0.75rem !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35) !important;
    }

    body.tv-display-mode .pool-sidebar-card {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 12px 14px 120px 14px !important;
        overflow: hidden !important;
    }

    body.tv-display-mode #participantList {
        flex: 1 1 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
    }

    /* Keep team logos crisp and proportional in TV mode (matching mobile look) */
    body.tv-display-mode #squaresGrid .grid-team-watermark-top {
        height: 82% !important;
        max-height: 44px !important;
        width: auto !important;
    }

    body.tv-display-mode #squaresGrid .grid-team-watermark-left {
        width: 44px !important;
        height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
    }

    body.tv-display-mode .matchup-team-bg-logo {
        width: 88px !important;
        height: 88px !important;
        opacity: 0.4 !important;
    }
}
