:root {
            --gochujang-red: #a12c2a;
            --chocolate-brown: #4a2c2a;
            --jin-zong-gold: #b48c5c;
            --tinged-white: #e8e6e1;
            --black-wash: #1a1a1a;
            --muted-green: #4a5d23;
            --ancient-gold-border: #A28B55;
            --start-bg-url: none;
        }
    
        html, body {
            height: 100%;
            margin: 0;
            overflow: hidden;
        }

        body {
            background: #111;
            font-family: 'Lato', 'Verdana', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            letter-spacing: 0.5px;
        }

        /* --- SCALING & CENTERING --- */
        #gameContainer {
            position: relative;
            width: 100vw;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        #gameAreaWrapper {
            position: relative;
            transform-origin: center center;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }
        
        #backgroundCanvas {
            position: absolute;
            top: 0;
            left: 0;
            z-index: 1; /* Behind other wrapper content */
            border-radius: 8px; 
        }
        
        #gameCanvas {
            position: relative;
            z-index: 2;
            border: 4px solid var(--ancient-gold-border);
            border-radius: 8px;
            box-shadow: 0 0 20px rgba(180, 140, 92, 0.4); 
            display: block; box-sizing: border-box;
        }

        #ui, .combo-bar, #powerMeter, #powerUpBar {
             position: relative;
             z-index: 2;
        }
        
        /* --- UNIFIED UI ELEMENT STYLES --- */
        .combo-bar, #powerMeter {
            width: 100%; height: 12px; background: var(--black-wash);
            border: 2px solid var(--muted-green);
            border-radius: 10px; box-sizing: border-box;
        }
        .combo-fill, #powerFill {
            height: 100%; width: 0%; 
            background: linear-gradient(90deg, var(--tinged-white), var(--jin-zong-gold), var(--gochujang-red));
            border-radius: 8px;
        }
        #powerMeter { position: relative; }
        .star-marker {
            position: absolute; top: 50%; transform: translate(-50%, -50%); 
            color: var(--gochujang-red);
            font-size: 18px; 
            text-shadow: 0 0 5px var(--tinged-white);
            z-index: 3; pointer-events: none;
        }
        .star-marker::before { content: '★'; }

        #ui {
            width: 100%;
            display: flex; justify-content: space-between; font-size: 18px;
            font-family: 'Cinzel', serif;
            color: var(--tinged-white);
            text-shadow: 2px 2px 3px #000;
            text-transform: uppercase;
        }
        #score, #highScore { padding: 0 10px; }

        #powerUpBar {
            display: flex; gap: 10px; width: 100%; 
            box-sizing: border-box; overflow-x: hidden; flex-wrap: nowrap;
            height: 60px; 
            align-items: center;
        }
        .power-up-icon {
            width: 54px; height: 54px; 
            border: 2px solid var(--chocolate-brown);
            border-radius: 8px; cursor: pointer;
            transition: transform 0.3s ease, box-shadow 0.3s ease; transform: translateX(-100px);
            opacity: 0; flex-shrink: 0; box-sizing: border-box;
        }
        .power-up-icon.visible { transform: translateX(0); opacity: 1; }
        .power-up-icon.selected { 
            box-shadow: 0 0 20px var(--jin-zong-gold);
            transform: scale(1.1);
        }
        
        #gameOver, #instructions {
            position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
            background: rgba(26, 26, 26, 0.95);
            color: var(--tinged-white);
            padding: 30px; border-radius: 0;
            text-align: center; 
            border: 2px solid var(--chocolate-brown);
            box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
            z-index: 10;
            width: 90%; 
            display: none;
            flex-direction: column;
            max-height: 90vh;
        }
        
        #gameOver { max-width: 500px; }
        #instructions { display: flex; }
        
        #instructions h2, #gameOver h2, #gameOver p, #gameOver button {
            position: relative;
            z-index: 2;
        }

        #instructions h2, #gameOver h2 { 
            font-family: 'Cinzel', serif;
            text-align: center; 
            color: var(--gochujang-red);
            text-shadow: 2px 2px 4px #000;
            margin: 0 0 20px 0; 
            flex-shrink: 0;
            font-size: 2.5em;
            text-transform: uppercase;
        }
        
        #instructionsContent {
            overflow-y: auto; padding-right: 10px; flex-grow: 1; display: grid;
            grid-template-columns: 1fr; gap: 20px;
            text-align: left;
            position: relative; /* For pseudo-element */
        }
        
        #instructionsContent::before {
            content: '';
            position: absolute;
            top: 10px;
            left: 15%;
            width: 70%;
            height: calc(100% - 20px);
            background-image: var(--start-bg-url);
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            opacity: 0.3;
            z-index: 1;
            border-radius: 8px;
        }

        @media (min-width: 768px) {
            #instructionsContent { grid-template-columns: 1fr 1fr; }
            #instructions { max-width: 800px; }
        }
        
        /* FIX: Reduce title size on small screens to prevent wrapping */
        @media (max-width: 480px) {
            #instructions h2 {
                font-size: 1.5em;
            }
        }

        .instruction-section {
            position: relative;
            z-index: 2;
        }
        .instruction-section h3 { 
            font-family: 'Cinzel', serif;
            color: var(--gochujang-red);
            border-bottom: 1px solid var(--chocolate-brown);
            padding-bottom: 5px; margin-top: 0;
            text-transform: uppercase;
        }
        .instruction-section p, .instruction-section li { 
            font-size: 16px;
            line-height: 1.6;
            color: #d0c9bf; 
        }
        .instruction-section ul { padding-left: 20px; margin: 10px 0; }
        .instruction-section b { 
            color: var(--jin-zong-gold);
            font-weight: 700;
        }

        #buttonWrapper { position: relative; z-index: 2; padding-top: 20px; flex-shrink: 0; }
        
        button {
            padding: 12px 24px;
            font-family: 'Cinzel', serif;
            font-size: 18px;
            font-weight: 700;
            background: var(--gochujang-red);
            border: 2px solid var(--chocolate-brown);
            color: var(--tinged-white);
            text-shadow: 1px 1px 2px #000;
            border-radius: 0;
            cursor: pointer; 
            text-transform: uppercase;
            transition: background-color 0.3s, color 0.3s;
        }
        button:hover { 
            background: var(--jin-zong-gold);
            color: #000;
        }
        #startButton {
             display: block; width: 80%; max-width: 300px; margin: 0 auto; padding: 15px 20px; font-size: 22px;
        }