/* --- Base Setup & Theming --- */
:root {
    --background-color: #121212;
    --glass-bg: rgba(22, 22, 22, 0.6);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #EAEAEA;
    --primary-color: #03A9F4;
    --secondary-color: #FF00FF;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --font-body: 'Roboto', sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --font-title: 'Audiowide', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* --- Title Screen --- */
#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out;
    opacity: 1;
}
#title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}
.title-main {
    font-family: var(--font-title);
    font-size: clamp(4rem, 15vw, 10rem);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(3px 3px 8px rgba(0,0,0,0.7));
    margin-bottom: 2rem;
}
#press-start-text {
    font-family: var(--font-display);
    font-size: clamp(1rem, 3vw, 1.5rem);
    letter-spacing: 2px;
    animation: flash 1.5s infinite ease-in-out;
}
@keyframes flash {
    0%, 100% { opacity: 1; text-shadow: 0 0 5px rgba(255,255,255,0.5); }
    50% { opacity: 0.3; text-shadow: none; }
}


/* --- Video Wall --- */
#video-wall-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden; background-color: #000;
}
#video-wall-container .overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.3);
}
#video-wall-container iframe {
    position: absolute; top: 50%; left: 50%;
    width: 178vh; min-width: 100vw;
    height: 56.25vw; min-height: 100vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
#video-wall-container video {
     position: absolute; top: 0; left: 0; width: 100%; height: 100%;
     object-fit: cover;
     pointer-events: none;
}


#game-overlay {
    width: 100%; height: 100%; padding: 2rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}

#fullscreen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    z-index: 100;
}
#fullscreen-btn svg {
    width: 100%;
    height: 100%;
    fill: white;
}
#fullscreen-btn .hidden {
    display: none;
}


.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 2rem;
}

/* --- Connection Setup Facelift & Animation --- */
#connection-setup {
    width: 100%; max-width: 550px; display: flex;
    flex-direction: column; gap: 2rem; text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
#connection-setup.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}
#connection-setup h1 {
    font-family: var(--font-title);
    font-size: 4rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}
.input-group { display: flex; flex-direction: column; gap: 1rem; }
.input-row { display: flex; gap: 1rem; align-items: center; }
.input-group input[type="text"] {
    width: 100%; padding: 1rem 1.25rem; background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border); border-radius: 8px;
    color: var(--text-color); font-size: 1.1rem; text-align: center;
    transition: box-shadow 0.3s, border-color 0.3s;
}
.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(3, 169, 244, 0.5);
}
.toggle-group {
    display: flex; justify-content: space-around; align-items: center;
    background: rgba(0, 0, 0, 0.2); padding: 0.5rem; border-radius: 8px;
}
.toggle-switch { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.toggle-switch span { transition: color 0.3s; }
.toggle-switch input { display: none; }
.toggle-switch .slider {
    position: relative; width: 40px; height: 20px;
    background-color: #333; border-radius: 10px; transition: background-color 0.3s;
}
.toggle-switch .slider:before {
    content: ''; position: absolute; width: 16px; height: 16px;
    border-radius: 50%; background-color: white; top: 2px; left: 2px;
    transition: transform 0.3s;
}
.toggle-switch input:checked + .slider { background-color: var(--primary-color); }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }
.button-group { display: flex; gap: 1rem; justify-content: center; }
.btn {
    padding: 0.85rem 2rem; border: none; border-radius: 8px;
    font-size: 1.1rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s ease; text-transform: uppercase;
    transform: scale(1);
}
.btn:hover {
    transform: scale(1.05);
}
.btn-primary { background: var(--primary-color); color: white; box-shadow: 0 0 10px var(--primary-color), 0 4px 15px rgba(3, 169, 244, 0.3); }
.btn-primary:hover { background: #0398dc; box-shadow: 0 0 20px var(--primary-color), 0 4px 20px rgba(3, 169, 244, 0.4); }
.btn-secondary { background: #444; color: #ccc; }
.btn-secondary:hover { background: #555; }


/* --- Game Area --- */
#game-area { display: none; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;}
#game-container { display: flex; gap: 2rem; width: 100%; max-width: 1400px; align-items: flex-start; justify-content: center; }
.player-area { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1rem; position: relative; width: 100%; }
.player-area.shake { animation: screen-shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
.player-header { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; }
.player-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.player-lives { display: flex; gap: 0.5rem; }
.life-heart { width: 24px; height: 24px; color: var(--danger-color); filter: drop-shadow(0 0 5px var(--danger-color)); }
.game-grid { width: 100%; height: 200px; position: relative; overflow: hidden; transition: box-shadow 0.3s, filter 0.2s, transform 0.3s ease-out; -webkit-tap-highlight-color: transparent; }
.sequence-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: var(--arrow-gap, 1rem); /* Use variable with fallback */
    transition: transform 0.2s ease-in-out, gap 0.3s ease-in-out; /* Added gap transition */
    pointer-events: none;
}

.arrow-icon {
    width: var(--arrow-size, 64px); /* Use variable with fallback */
    height: var(--arrow-size, 64px); /* Use variable with fallback */
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s, width 0.3s ease-in-out, height 0.3s ease-in-out; /* Added size transition */
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
    pointer-events: none;
}
.arrow-icon .arrow-bg { transition: fill 0.2s; }
.arrow-icon .arrow-shape { transition: fill 0.2s; }
.arrow-icon.correct { opacity: 0; transform: scale(0.8); }
.arrow-icon.correct .arrow-bg { fill: url(#grad-success) !important; }

/* --- Grid State Animations --- */
.game-grid.fail-flash { animation: flash-red 0.3s ease; }
@keyframes flash-red { 0%, 100% { background: var(--glass-bg); } 50% { background: rgba(244, 67, 54, 0.5); } }

.game-grid.success-glow { animation: glow-green 0.5s ease; }
@keyframes glow-green {
    0% { box-shadow: 0 0 5px rgba(76, 175, 80, 0), 0 0 5px rgba(76, 175, 80, 0) inset; }
    50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.8), 0 0 15px rgba(76, 175, 80, 0.7) inset; }
    100% { box-shadow: 0 0 5px rgba(76, 175, 80, 0), 0 0 5px rgba(76, 175, 80, 0) inset; }
}

.game-grid.danger-state { animation: pulse-red 1.5s infinite; }
@keyframes pulse-red {
    0% { box-shadow: 0 0 10px rgba(244, 67, 54, 0.5); }
    50% { box-shadow: 0 0 25px rgba(244, 67, 54, 1); }
    100% { box-shadow: 0 0 10px rgba(244, 67, 54, 0.5); }
}

.game-grid.attack-launch { animation: attack-launch 0.4s ease-out; }
@keyframes attack-launch {
    50% { box-shadow: 0 0 25px var(--primary-color), 0 0 20px var(--primary-color) inset; }
}

.game-grid.grid-tilting { animation: grid-tilt 0.5s ease-in-out; }
@keyframes grid-tilt {
    0%, 100% { transform: rotate(0) translateX(0); }
    50% { transform: rotate(7deg) translateX(20px); }
}


.timer-bar-container { width: 100%; height: 10px; background: rgba(0, 0, 0, 0.3); border-radius: 5px; overflow: hidden; position: relative; }
.timer-bar {
    width: 100%; height: 100%;
    background: linear-gradient(90deg, var(--success-color), #FFEB3B, var(--danger-color));
    border-radius: 5px; transition: width 0.1s linear;
}

.timer-bar-container.decay-active .timer-bar {
    animation: pulse-red-timer 0.5s infinite;
}
@keyframes pulse-red-timer {
    50% { box-shadow: 0 0 15px var(--danger-color); }
}


/* --- Combo Counter --- */
.combo-counter-container {
    font-family: var(--font-display);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}
.combo-counter-container.visible {
    opacity: 1;
    transform: translateY(0);
}
.combo-count {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
    display: inline-block;
    color: #FFEB3B;
    text-shadow: 0 0 8px #FFEB3B;
}
.combo-label {
    font-size: 1rem;
    font-weight: 700;
    display: block;
    color: var(--text-color);
}
.combo-count.pop {
    animation: pop-in 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes pop-in {
    0% { transform: scale(0.8); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* --- Chat UI --- */
#popup-chat-container {
    position: absolute;
    top: 45%; left: 50%;
    transform: translateX(-50%);
    width: 80%; max-width: 800px;
    z-index: 100;
    display: flex; flex-direction: column-reverse;
    align-items: center; pointer-events: none;
}
#chat-bubbles {
    display: flex; flex-direction: column;
    gap: 10px; margin-bottom: 10px;
}
.chat-bubble {
    padding: 1rem 1.5rem; border-radius: 20px;
    font-size: 1.75rem; font-weight: 700;
    font-family: var(--font-display);
    color: white; text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    max-width: 100%; pointer-events: all;
    animation: pop-in-out 5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}
.chat-bubble.mine {
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
    align-self: flex-end;
}
.chat-bubble.theirs {
    background-color: var(--secondary-color);
    box-shadow: 0 0 15px var(--secondary-color);
    align-self: flex-start;
}
#chat-input-container {
    position: absolute; bottom: 2rem;
    width: 100%; max-width: 500px;
    left: 50%; transform: translateX(-50%);
    z-index: 201; /* Raised to appear above game-over screen */
    display: flex;
    gap: 0.5rem;
}
#chat-input {
    width: 100%; padding: 1rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg); border-radius: 8px;
    color: var(--text-color); text-align: center;
    font-size: 1rem; backdrop-filter: blur(8px);
    flex-grow: 1;
}
#chat-send-btn {
    padding: 0 1.5rem;
    flex-shrink: 0;
}

@keyframes pop-in-out {
    0% { transform: scale(0.5); opacity: 0; }
    15% { transform: scale(1.1); opacity: 1; }
    25% { transform: scale(1); opacity: 1; }
    85% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}

/* --- Game Over Screen --- */
#game-over-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(18, 18, 18, 0.9) 0%, rgba(18, 18, 18, 0) 70%);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
#game-over-screen.visible {
    opacity: 1;
    pointer-events: all;
}
#game-over-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}
#game-over-title {
    font-family: var(--font-title);
    font-size: 5rem;
    line-height: 1;
    text-transform: uppercase;
    color: var(--danger-color);
    text-shadow: 0 0 15px var(--danger-color);
    margin-bottom: 0;
}
#game-over-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-100px);
    animation-fill-mode: forwards;
}
#game-over-screen.visible .char {
    animation: fall-in 0.6s cubic-bezier(0.76, 0, 0.24, 1);
}
#winner-name-display {
    font-family: var(--font-display);
    font-size: 2rem;
    opacity: 0;
    animation-fill-mode: forwards;
    margin-bottom: 1rem;
}
#game-over-screen.visible #winner-name-display {
    opacity: 1;
    animation: glimmer 2.5s infinite;
    animation-delay: 1s; /* Start after letters fall */
}
#game-over-content .btn {
    pointer-events: all;
    opacity: 0;
    animation-fill-mode: forwards;
}
#game-over-screen.visible .btn {
    animation: fade-in 1s ease forwards;
    animation-delay: 1.2s; /* Start after winner name appears */
}
#post-game-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem 2rem;
    border-radius: 12px;
}
.stat-item {
    text-align: center;
    min-width: 120px;
}
.stat-label {
    font-size: 0.9rem;
    color: #aaa;
    display: block;
    text-transform: uppercase;
}
.stat-value {
    font-size: 2rem;
    font-family: var(--font-display);
    line-height: 1.2;
}
#next-video-section {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 450px;
    align-items: center;
}
#next-video-input {
    flex-grow: 1;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
    text-align: center;
}
#change-video-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}


@keyframes fall-in {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes glimmer {
    0% {
        color: white;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    }
    50% {
        color: #FFEB3B;
        text-shadow: 0 0 20px #FFEB3B, 0 0 30px #FFC107;
    }
    100% {
        color: white;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    }
}
@keyframes fade-in {
    to { opacity: 1; }
}

/* --- Boss Area --- */
#boss-area {
    width: 100%;
    max-width: 800px;
    margin-bottom: 2rem;
    text-align: center;
    font-family: var(--font-display);
    transition: transform 0.2s, filter 0.5s;
}
#boss-area.boss-acting { animation: boss-lunge-attack 1s; }
#boss-area.boss-healing { animation: boss-lunge-heal 1s; }
#boss-area.enraged {
    animation: pulse-enraged 1.2s infinite ease-in-out;
}
@keyframes pulse-enraged {
    50% {
        filter: drop-shadow(0 0 25px var(--danger-color));
        transform: scale(1.02);
        box-shadow: inset 0 0 20px rgba(244, 67, 54, 0.5);
    }
}

#boss-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}
#boss-name {
    font-size: 2rem;
    font-weight: 700;
}
#boss-area.fire #boss-name { color: #ff8c00; text-shadow: 0 0 10px #ff4800; }
#boss-area.poison #boss-name { color: #76ff03; text-shadow: 0 0 10px #76ff03; }
#boss-area.ice #boss-name { color: #40c4ff; text-shadow: 0 0 10px #40c4ff; }
#boss-level {
    font-size: 1rem;
    font-weight: 700;
    color: #ccc;
}
#boss-health-bar-container {
    width: 100%;
    height: 30px;
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--glass-border);
    border-radius: 15px;
    padding: 4px;
    position: relative; /* Needed for crack effect */
    overflow: hidden;   /* Needed for crack effect */
}
#boss-health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.5s ease-out;
}
@keyframes boss-lunge-attack { 
    25% { transform: translateY(-10px) scale(1.03); filter: drop-shadow(0 0 15px var(--danger-color)); }
    50% { transform: translateY(0) scale(1); }
    75% { transform: translateY(-10px) scale(1.03); filter: drop-shadow(0 0 15px var(--danger-color)); }
}
@keyframes boss-lunge-heal { 
    25% { transform: translateY(-10px) scale(1.03); filter: drop-shadow(0 0 15px var(--success-color)); }
    50% { transform: translateY(0) scale(1); }
    75% { transform: translateY(-10px) scale(1.03); filter: drop-shadow(0 0 15px var(--success-color)); }
}

/* --- Boss Health Bar Animations --- */
#boss-health-bar-container.jiggle { animation: jiggle 0.3s; }
@keyframes jiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-3px); }
}

#boss-health-bar-container.heavy-shake { animation: heavy-shake 0.5s; }
@keyframes heavy-shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  10%, 90% { transform: translate(-8px, 0) rotate(-2deg); }
  20%, 80% { transform: translate(8px, -4px) rotate(2deg); }
  30%, 50%, 70% { transform: translate(-8px, 4px) rotate(-1deg); }
  40%, 60% { transform: translate(8px, 0) rotate(1deg); }
}

.health-crack-effect {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(115deg, transparent 48%, rgba(255,255,255,0.7) 50%, transparent 52%);
    animation: crack-fade 0.4s;
    opacity: 0;
}
@keyframes crack-fade {
    50% { opacity: 1; }
}


/* --- Boss Attack Effects --- */
.attack-announcement {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    font-family: var(--font-title);
    font-size: 2.5rem;
    color: var(--danger-color);
    text-shadow: 0 0 10px var(--danger-color);
    opacity: 0;
    pointer-events: none;
}
.attack-announcement.dramatic {
    font-size: 5rem;
    color: var(--danger-color);
    text-shadow: 0 0 20px var(--danger-color);
}
.attack-announcement.visible { opacity: 1; }
.attack-announcement .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-50px);
    animation-fill-mode: forwards;
}
.attack-announcement.visible .char {
     animation-name: fall-in, fade-out-announcement;
     animation-duration: 0.6s, 1s;
     animation-delay: 0s, 1.5s;
     animation-fill-mode: forwards;
}
@keyframes fade-out-announcement { to { opacity: 0; transform: translateY(50px); } }

.game-grid.blurred { filter: blur(12px); }
.sequence-container.stealth .arrow-icon { animation: fade-out-stealth 3s forwards 1s; }
@keyframes fade-out-stealth { to { opacity: 0; } }
@keyframes screen-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
.player-area.shake { animation: screen-shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }


.timer-effect {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 5px;
    opacity: 0;
    pointer-events: none;
}
.timer-effect.visible {
    animation: effect-fade-out 0.5s 0.5s forwards;
    opacity: 1;
}
.timer-fire-effect { background: linear-gradient(to top, #ff4800, transparent); animation-name: flicker; animation-duration: 0.1s; animation-iteration-count: 5; }
.timer-poison-effect { background: radial-gradient(circle, #76ff03 10%, transparent 70%); animation-name: bubble; animation-duration: 0.5s; animation-iteration-count: 1; }
.timer-ice-effect { box-shadow: inset 0 0 10px #40c4ff; border: 1px solid #40c4ff; animation-name: ice-crack; animation-duration: 0.5s; animation-iteration-count: 1;}

@keyframes effect-fade-out { to { opacity: 0; } }
@keyframes flicker { 50% { opacity: 0.7; transform: scaleX(1.05); } }
@keyframes bubble { 0% { transform: scale(0); } 100% { transform: scale(1.5); } }
@keyframes ice-crack { 50% { backdrop-filter: blur(2px); } }

/* --- Mobile Responsive Styles --- */
@media (max-width: 768px) {
    #game-container {
        flex-direction: column;
        justify-content: flex-start;
        gap: 1rem;
        padding-top: 1rem;
    }
    #boss-area {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    #boss-name { font-size: 1.5rem; }
    #connection-setup h1 { font-size: 2.5rem; }
    .attack-announcement.dramatic { font-size: 3.5rem; }

    .game-grid.blurred { 
        filter: blur(5px); /* Adaptive Blur */
    }

    /* Make the grid a flex container to handle centering of the sequence */
    .game-grid {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Change the sequence container's positioning to be constrained */
    .sequence-container {
        position: relative; /* No longer absolute */
        top: auto;
        left: auto;
        transform: none;    /* Remove the transform */
        max-width: 100%;    /* This is the magic: it cannot overflow! */
        justify-content: center; /* Ensures arrows are centered within the now-constrained container */
    }

    /* Compact Remote Player View */
    .player-area.is-remote-player {
        order: 2; /* Ensure remote player is always at the bottom */
        flex: 0;
        padding: 0.5rem;
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        background: rgba(0,0,0,0.2);
    }
    .player-area.is-local-player {
        order: 1;
    }
    .is-remote-player .game-grid,
    .is-remote-player .timer-bar-container,
    .is-remote-player .combo-counter-container,
    .is-remote-player .attack-announcement {
        display: none;
    }
    .is-remote-player .player-header { padding: 0;}
    .is-remote-player .player-name { font-size: 1.2rem; }
    .is-remote-player .life-heart { width: 20px; height: 20px; }
    #chat-input-container { bottom: 1rem; }
}
