        * {
            box-sizing: border-box;
        }

        body {
            background-color: #020617;
            color: #f8fafc;
            font-family: system-ui, -apple-system, sans-serif;
            margin: 0;
            overflow: hidden;
            touch-action: none;
            min-height: 100vh;
            min-height: 100dvh;
        }

        .game-wrapper {
            position: relative;
            width: 100vw;
            height: 100vh;
            height: 100dvh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #020617;
            overflow: hidden;
            padding: 0;
        }

        .field-area {
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: padding 0.3s;
        }

        canvas {
            background-color: #14532d;
            display: block;
            touch-action: none;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 4px;
        }

        .hud-layer {
            position: absolute;
            inset: 0;
            pointer-events: none;
            padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        }

        .interactive {
            pointer-events: auto;
        }

        /* Score Display */
        .score-hud {
            position: absolute;
            top: 10px;
            left: 15px;
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(8px);
            border-radius: 8px;
            padding: 4px 10px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            gap: 8px;
            align-items: center;
        }

        /* Stone Clock - Top Right */
        .stone-hud {
            position: absolute;
            top: 5px;
            right: 15px;
            text-align: center;
            width: 130px;
        }

        /* Side Info Panel (Right Side, below stone clock) */
        .side-info-panel {
            position: relative;
            width: 100%;
            background: rgba(15, 23, 42, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            padding: 4px;
            /* Minimal padding */
            border-radius: 12px;
            color: white;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            gap: 2px;
            opacity: 1;
            pointer-events: auto;
            transform: none;
            z-index: 100;
        }

        .side-info-panel.active {
            opacity: 1;
            transform: none;
        }

        /* Default Mobile/Tablet Base Styles */
        .hud-left-top,
        .hud-left-bottom,
        .hud-right-bottom {
            width: auto;
            max-width: none;
        }

        /* PC / Desktop Specific Isolation */
        /* Includes iPad Landscape (1024px) */
        @media (min-width: 1024px) {
            div.hud-left-top {
                position: absolute;
                top: 20px;
                left: 20px;
                width: var(--side-panel-width, 130px) !important;
                max-width: 130px !important;
                pointer-events: none;
                z-index: 100;
                display: flex;
                flex-direction: column;
                gap: 15px;
                padding-top: 40px;
            }

            div.hud-left-bottom {
                position: absolute;
                bottom: 25px;
                left: 20px;
                width: var(--side-panel-width, 130px) !important;
                max-width: 130px !important;
                pointer-events: auto;
                z-index: 100;
            }

            div.hud-right-bottom {
                position: absolute;
                bottom: 25px;
                right: 20px;
                width: var(--side-panel-width, 130px) !important;
                max-width: 130px !important;
                pointer-events: auto;
                z-index: 100;
            }
        }

        .tactic-controls {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .side-info-panel .info-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 9px;
            /* Smallest readable font */
            color: #ccc;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            padding-bottom: 2px;
        }

        .side-info-panel .info-row:last-child {
            border-bottom: none;
        }

        .side-info-panel .info-value {
            font-weight: 700;
            color: #fff;
        }

        /* Controls (Right Vertical) - Wider for better touch */
        .vertical-controls {
            position: absolute;
            bottom: 25px;
            right: 15px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            width: 130px;
        }

        .formation-controls {
            display: flex;
            flex-direction: column;
            gap: 8px;
            width: 100%;
            margin-bottom: 10px;
        }

        .btn-base {
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            text-transform: uppercase;
            font-weight: 800;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
            width: 100%;
            box-sizing: border-box;
            cursor: pointer;
            border: none;
            position: relative;
            overflow: hidden;
        }

        .btn-base::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .btn-base:hover::before {
            left: 100%;
        }

        .btn-base:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.3);
        }

        .btn-base:active {
            transform: translateY(1px);
            box-shadow: 0 2px 4px (0, 0, 0, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .btn-action {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
            padding: 16px 0;
            border-radius: 12px;
            font-size: 12px;
            border-bottom: 3px solid #1e40af;
        }

        .btn-action:hover {
            background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
        }

        .btn-action:active {
            border-bottom-width: 1px;
        }

        .btn-mini {
            background: linear-gradient(135deg, #475569 0%, #334155 100%);
            color: #f1f5f9;
            padding: 12px 0;
            border-radius: 10px;
            font-size: 10px;
            border: 1px solid rgba(255, 255, 255, 0.15);
        }

        .btn-mini:hover {
            background: linear-gradient(135deg, #64748b 0%, #475569 100%);
        }

        .btn-change {
            background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
            color: white;
            padding: 16px 0;
            border-radius: 12px;
            font-size: 12px;
            border-bottom: 3px solid #c2410c;
        }

        .btn-change:hover {
            background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
        }

        .btn-change:active {
            border-bottom-width: 1px;
        }

        .btn-change.disabled {
            background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
            color: #475569 !important;
            border-bottom: 0 !important;
            opacity: 0.5;
            pointer-events: none;
            box-shadow: none;
        }

        .stone-beat {
            transition: transform 0.1s;
        }

        .stone-active {
            color: #fbbf24;
            transform: scale(1.1);
            text-shadow: 0 0 15px #fbbf24;
        }

        #match-end-screen {
            position: absolute;
            inset: 0;
            background: rgba(15, 23, 42, 0.85);
            backdrop-filter: blur(8px);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            opacity: 0;
            visibility: hidden;
            transition: opacity 2s, visibility 2s;
            z-index: 2000;
            pointer-events: auto;
        }

        #match-end-screen.active {
            opacity: 1;
            visibility: visible;
        }

        #setup-screen {
            position: absolute;
            inset: 0;
            background: rgba(2, 6, 23, 0.95);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            /* Change from center to flex-start */
            padding-top: 10vh;
            /* Controlled gap from top */
            z-index: 500;
            transition: opacity 0.5s;
            pointer-events: auto;
        }

        #setup-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }

        /* Hide in-game HUD elements when setup screen is active */
        #setup-screen:not(.hidden)~.game-wrapper .hud-layer,
        #setup-screen:not(.hidden)~.game-wrapper .setup-controls,
        #setup-screen:not(.hidden)~.game-wrapper .hud-left-top,
        #setup-screen:not(.hidden)~.game-wrapper .hud-left-bottom,
        #setup-screen:not(.hidden)~.game-wrapper .hud-right-bottom {
            display: none !important;
        }

        .setup-group {
            margin-bottom: 4vh;
            width: 80%;
            max-width: 500px;
        }

        .setup-label {
            color: #94a3b8;
            font-size: 14px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 12px;
            text-align: center;
        }

        .setup-options {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        .setup-btn {
            background: rgba(30, 41, 59, 0.5);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #cbd5e1;
            padding: 12px 0;
            flex: 1;
            border-radius: 8px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            text-transform: uppercase;
            font-size: 12px;
        }

        .setup-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.3);
        }

        .setup-btn.selected {
            background: #3b82f6;
            color: white;
            border-color: #3b82f6;
            box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
        }

        .setup-start-btn {
            background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
            /* Yellow/Gold */
            color: black;
            border: none;
            padding: 20px 60px;
            font-size: 20px;
            font-weight: 900;
            text-transform: uppercase;
            border-radius: 99px;
            cursor: pointer;
            transition: transform 0.1s;
            box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
        }

        .setup-start-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 0 30px rgba(234, 179, 8, 0.5);
        }

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

        .val-text {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            font-weight: 800;
            color: white;
            font-size: 15px;
        }

        /* --- New Native CSS to replace Tailwind --- */
        .flex {
            display: flex;
        }

        .flex-col {
            flex-direction: column;
        }

        .flex-1 {
            flex: 1;
        }

        .items-center {
            align-items: center;
        }

        .justify-center {
            justify-content: center;
        }

        .gap-2 {
            gap: 8px;
        }

        .mb-2 {
            margin-bottom: 8px;
        }

        .pb-2 {
            padding-bottom: 8px;
        }

        .text-center {
            text-align: center;
        }

        .font-black {
            font-weight: 900;
        }

        .uppercase {
            text-transform: uppercase;
        }

        .italic {
            font-style: italic;
        }

        .leading-none {
            line-height: 1;
        }

        .block {
            display: block;
        }

        .score-team-label {
            font-size: 8px;
            font-weight: 900;
            text-transform: uppercase;
        }

        .score-val {
            font-size: 42px;
            font-weight: 900;
            font-style: italic;
            line-height: 1;
        }

        .score-divider {
            width: 1px;
            height: 36px;
            background: rgba(255, 255, 255, 0.2);
            margin: 0 8px;
        }

        .stone-val {
            font-size: 42px;
            font-family: monospace;
            font-weight: 900;
            color: rgba(148, 163, 184, 0.6);
            line-height: 1;
            margin: 0;
        }

        .stone-sub {
            font-size: 7px;
            font-weight: 900;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin: 2px 0 0 0;
        }

        .panel-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            /* Strictly lock height to prevent any layout shifting from 1 vs 2 line titles */
            height: 32px;
            box-sizing: content-box;
        }

        .panel-icon {
            font-size: 20px;
        }

        .panel-title {
            font-weight: 900;
            color: white;
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            /* Fixed height to prevent layout shifting between 1 and 2 lines */
            min-height: 24px;
            display: flex;
            align-items: center;
            margin: 0;
            flex: 1;
        }

        .tactic-btn {
            font-size: 13px !important;
            padding: 18px 6px !important;
            min-height: 50px;
            touch-action: manipulation;
        }

        #tactic-buttons button {
            background: transparent;
            border: none;
            color: #cbd5e1;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 700;
            position: relative;
        }

        #tactic-buttons button::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 2px;
            background: #3b82f6;
            transition: width 0.2s;
        }

        #tactic-buttons button.active {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
        }

        #tactic-buttons button:hover:not(.active) {
            background: rgba(255, 255, 255, 0.1);
            color: #f1f5f9;
        }

        #tactic-buttons button:hover:not(.active)::after {
            width: 80%;
        }

        .end-title {
            font-size: 15vmin;
            font-weight: 900;
            font-style: italic;
            color: #eab308;
            margin-bottom: 2vh;
            text-transform: uppercase;
            letter-spacing: -0.05em;
        }

        .end-scores {
            display: flex;
            gap: 5vmin;
            align-items: center;
            margin-bottom: 5vh;
        }

        .end-team-box {
            text-align: center;
        }

        .end-team-name {
            font-size: 4vmin;
            font-weight: 700;
            text-transform: uppercase;
            margin-bottom: 1vh;
        }

        .end-score-val {
            font-size: 20vmin;
            font-weight: 900;
            line-height: 1;
            margin: 0;
        }

        .end-vs {
            font-size: 8vmin;
            font-weight: 700;
            color: rgba(255, 255, 255, 0.1);
            font-style: italic;
        }

        .end-restart-btn {
            pointer-events: auto;
            padding: 2vh 8vw;
            background: white;
            color: black;
            border-radius: 9999px;
            font-weight: 900;
            font-size: 5vmin;
            border: none;
            cursor: pointer;
            transition: transform 0.1s;
        }

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

        .goal-text {
            font-size: 80px;
            font-weight: 900;
            color: white;
            font-style: italic;
            text-transform: uppercase;
            letter-spacing: -0.05em;
            text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
        }

        .goal-msg-container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.3s;
            z-index: 200;
            white-space: nowrap;
        }

        #portrait-warning {
            position: fixed;
            inset: 0;
            background: rgba(2, 6, 23, 0.98);
            z-index: 10000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 30px;
            color: white;
            backdrop-filter: blur(10px);
        }

        .warning-content {
            background: rgba(30, 41, 59, 0.7);
            padding: 40px 30px;
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            max-width: 80%;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        }

        .warning-icon {
            font-size: 64px;
            animation: rotate-shimmy 2s infinite ease-in-out;
        }

        @keyframes rotate-shimmy {

            0%,
            100% {
                transform: rotate(0deg);
            }

            25% {
                transform: rotate(15deg);
            }

            75% {
                transform: rotate(-15deg);
            }
        }

        .warning-content h3 {
            margin: 0;
            font-size: 24px;
            font-weight: 900;
            color: #fbbf24;
            text-transform: uppercase;
        }

        .warning-content p {
            margin: 0;
            font-size: 16px;
            color: #94a3b8;
            line-height: 1.5;
        }

        /* Show warning when in portrait on mobile devices */
        @media (orientation: portrait) and (max-width: 1024px) {
            #portrait-warning {
                display: flex;
            }
        }

        /* Mobile Responsive Adjustments */
        /* Covers Phones and Portrait Tablets (< 1024px) */
        @media (max-width: 1200px) and (max-height: 600px),
        (max-width: 1023px) {
            .score-hud {
                display: none;
                /* Replaced by top-hud-bar */
            }

            .stone-hud {
                display: none;
                /* Replaced by top-hud-bar */
            }

            .top-hud-bar {
                top: 2px;
                gap: 10px;
            }

            .top-hud-bar>div {
                padding: 2px 8px;
            }

            .stone-container {
                min-width: 60px;
            }

            .stone-val {
                font-size: 28px;
            }

            .score-val {
                font-size: 28px;
            }

            .stone-sub {
                font-size: 5px;
            }

            /* Independent Top Container for Info Panel */
            .hud-left-top {
                position: absolute;
                top: 0;
                left: 0;
                width: 120px;
                padding: 10px 5px;
                z-index: 1000;
                pointer-events: auto;
            }

            /* Independent Bottom Container for Tactic Buttons */
            .hud-left-bottom {
                position: absolute;
                bottom: 0;
                left: 0;
                width: 120px;
                padding: 10px 5px;
                z-index: 1000;
                pointer-events: auto;
            }

            /* Independent Bottom Container for Formation Buttons */
            .hud-right-bottom {
                position: absolute;
                bottom: 0;
                right: 0;
                width: 120px;
                padding: 10px 5px;
                z-index: 1000;
                pointer-events: auto;
            }

            .tactic-controls,
            .formation-controls {
                display: flex;
                flex-direction: column;
                gap: 6px;
                width: 100%;
            }

            .side-info-panel {
                padding: 4px;
                display: flex;
                gap: 1px;
                flex-shrink: 0;
                margin: 0;
                width: 100%;
            }

            .side-info-panel .panel-header {
                height: 20px;
                margin-bottom: 3px;
                padding-bottom: 3px;
            }

            .side-info-panel .panel-icon {
                font-size: 16px;
            }

            .side-info-panel .panel-title {
                font-size: 9px;
                min-height: 18px;
            }

            .side-info-panel .info-row {
                font-size: 8px;
                padding-bottom: 1px;
            }

            .vertical-controls {
                bottom: 15px;
                right: 10px;
                gap: 6px;
                width: 110px;
            }

            /* Match Setup Overlay Mobile Refinement */
            #setup-screen {
                padding: 20px;
                justify-content: flex-start;
                /* Flow from top on small screens */
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }

            #setup-screen .end-title {
                font-size: 6vmin !important;
                margin-top: 20px;
                margin-bottom: 3vh !important;
            }

            .setup-group {
                margin-bottom: 2vh;
                width: 95%;
            }

            .setup-label {
                font-size: 12px;
                margin-bottom: 8px;
            }

            .setup-btn {
                padding: 8px 0;
                font-size: 11px;
            }

            .setup-start-btn {
                padding: 12px 30px !important;
                font-size: 16px !important;
            }

            #setup-screen>div[style*="display:flex"] {
                margin-top: 10px !important;
                gap: 8px !important;
            }



            .end-title {
                font-size: 10vmin;
            }

            .end-score-val {
                font-size: 15vmin;
            }

            .end-restart-btn {
                padding: 10px 40px;
                font-size: 18px;
            }

            /* Larger Touch Targets */
            .tactic-btn-v,
            .formation-btn {
                padding: 8px 10px;
                font-size: 13px;
                min-height: 48px;
                /* Easy to tap */
                display: flex;
                flex-direction: column;
                justify-content: center;
                line-height: 1.2;
            }

            /* Tutorial Overlay Mobile Positioning */
            #tutorial-overlay {
                top: 25%;
                left: auto;
                right: 10px;
                transform: none;
                width: 160px;
                padding: 12px;
                border-radius: 12px;
                text-align: left;
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
                border-width: 1px;
            }

            .tut-title {
                font-size: 14px;
                margin-bottom: 6px;
                word-wrap: break-word;
            }

            .tut-text {
                font-size: 11px;
                line-height: 1.3;
                margin-bottom: 10px;
            }

            .tut-btn {
                padding: 4px 12px;
                font-size: 11px;
                width: 100%;
            }
        }

        /* Weapon Selection Popup */
        .weapon-popup {
            position: absolute;
            background: rgba(15, 23, 42, 0.95);
            backdrop-filter: blur(15px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            padding: 8px;
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 6px;
            z-index: 1100;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            pointer-events: auto;
            transform: scale(0);
            transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            transform-origin: center;
        }

        .weapon-popup.active {
            transform: scale(1);
        }

        .weapon-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(51, 65, 85, 0.5);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 8px;
            cursor: pointer;
            transition: all 0.2s;
            min-width: 60px;
        }

        .weapon-btn:hover {
            background: rgba(59, 130, 246, 0.4);
            border-color: rgba(59, 130, 246, 0.5);
        }

        .weapon-btn.disabled {
            opacity: 0.3;
            pointer-events: none;
            filter: grayscale(1);
        }

        .weapon-btn span:first-child {
            font-size: 18px;
            margin-bottom: 2px;
        }

        .weapon-btn span:last-child {
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
        }

        .setup-controls {
            position: absolute;
            top: 10px;
            right: 10px;
            display: flex;
            flex-direction: row;
            /* Horizontal stack */
            gap: 4px;
            z-index: 200;
            pointer-events: auto;
            align-items: stretch;
            /* Equal height */
        }

        .setup-controls button {
            font-size: 10px !important;
            padding: 4px 6px !important;
            white-space: nowrap;
            width: auto !important;
        }

        .top-hud-bar {
            position: absolute;
            top: 5px;
            /* Minimal top margin */
            left: 0;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 20px;
            /* Space between scores and timer */
            z-index: 200;
            pointer-events: none;
            /* Let clicks pass through empty space */
        }

        .top-hud-bar>div {
            pointer-events: auto;
            background: rgba(15, 23, 42, 0.25);
            /* More transparent */
            /* Individual backgrounds */
            backdrop-filter: blur(8px);
            /* Increased blur */
            padding: 2px 12px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.05);
            /* Softer border */
        }

        .stone-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-width: 80px;
        }

        .score-val {
            font-size: 32px;
            /* Smaller as requested */
        }

        .stone-val {
            font-size: 36px;
            /* Kept large/standard */
        }

        .tactic-controls {
            /* Now inside the column, so static */
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 8px;
            pointer-events: auto;
            margin-top: 5px;
        }

        .tactic-btn-v {
            background: rgba(15, 23, 42, 0.8);
            backdrop-filter: blur(4px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #cbd5e1;
            padding: 6px 8px;
            /* Reduced padding */
            border-radius: 8px;
            font-size: 11px;
            font-weight: 700;
            color: white;
            opacity: 1;
            /* Always visible */
            transform: none;
            width: 100%;
            pointer-events: auto;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }

        .side-info-panel.active {
            opacity: 1;
            transform: none;
        }

        .tactic-btn-v:hover {
            background: rgba(30, 41, 59, 0.9);
            transform: translateX(2px);
        }

        .tactic-btn-v.active {
            border-color: #fbbf24;
            box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
        }

        /* Specific Active Colors */
        .tactic-btn-v#btn-def.active {
            background: linear-gradient(90deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.8));
            color: white;
            border-color: #60a5fa;
        }

        .tactic-btn-v#btn-bal.active {
            background: linear-gradient(90deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.8));
            color: white;
            border-color: #34d399;
        }

        .tactic-btn-v#btn-agg.active {
            background: linear-gradient(90deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.8));
            color: white;
            border-color: #f87171;
        }

        .formation-btn.active {
            background: linear-gradient(90deg, #8b5cf6, #7c3aed);
            border-color: #a78bfa;
            box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
        }

        /* Tutorial Overlay */
        #tutorial-overlay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            /* Center it properly */
            background: rgba(15, 23, 42, 0.95);
            border: 2px solid #3b82f6;
            border-radius: 16px;
            padding: 24px;
            max-width: 400px;
            width: 80vw;
            height: auto;
            min-height: 270px;
            /* Balanced height for title, 4 lines of text, and button */
            display: flex;
            /* Use flexbox */
            flex-direction: column;
            /* Vertical stack */
            justify-content: space-between;
            /* Space out title/text/btn */
            color: white;
            z-index: 1000;
            display: none;
            /* Default hidden */
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            text-align: center;
            opacity: 0;
            transition: opacity 0.3s;
            pointer-events: auto;
        }

        #tutorial-overlay.active {
            display: flex;
            /* Override to flex */
            opacity: 1;
        }

        .tut-title {
            font-size: 1.2rem;
            font-weight: 800;
            color: #60a5fa;
            margin-bottom: 12px;
            flex-shrink: 0;
        }

        .tut-text {
            font-size: 1rem;
            line-height: 1.5;
            color: #cbd5e1;
            margin-bottom: 20px;
            flex-grow: 1;
            /* Take up available space */
            overflow-y: auto;
            /* Scroll if too long (failsafe) */
            text-align: left;
            /* Better readability */
            padding: 0 10px;
            /* Inner padding */
            display: block;
            /* Restore block layout */
        }

        .tut-btn {
            background: #3b82f6;
            color: white;
            border: none;
            padding: 8px 24px;
            border-radius: 99px;
            font-weight: 700;
            cursor: pointer;
        }

        .tut-btn:hover {
            background: #2563eb;
        }

        /* Toggle Switch Style */
        input[type="checkbox"] {
            appearance: none;
            -webkit-appearance: none;
            width: 50px;
            height: 28px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 99px;
            position: relative;
            cursor: pointer;
            transition: background 0.3s;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        input[type="checkbox"]::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 22px;
            height: 22px;
            background: #94a3b8;
            border-radius: 50%;
            transition: transform 0.3s, background 0.3s;
        }

        input[type="checkbox"]:checked {
            background: rgba(59, 130, 246, 0.2);
            border-color: #3b82f6;
        }

        input[type="checkbox"]:checked::after {
            transform: translateX(22px);
            background: #3b82f6;
            box-shadow: 0 0 10px #3b82f6;
        }

        /* Utility Class */
        .hidden {
            display: none !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }