/* COLUMNS 1997 Style Sheet */
@property --tile-color-1 {
    syntax: '<color>';
    initial-value: #0a2550;
    inherits: true;
}

@property --tile-color-2 {
    syntax: '<color>';
    initial-value: #053b3d;
    inherits: true;
}

:root {
    --bg-color: #0b0518;
    --panel-bg: rgba(22, 11, 46, 0.65);
    --border-glow: #ff0077;
    --neon-blue: #00ffff;
    --neon-pink: #ff0055;
    --neon-purple: #bd00ff;
    --neon-green: #00ff66;
    --neon-yellow: #ffcc00;
    --text-primary: #f3ecff;
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --tile-color-1: #0a2550;
    --tile-color-2: #053b3d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--tile-color-1);
    background-image: 
        linear-gradient(45deg, var(--tile-color-2) 25%, transparent 25%), 
        linear-gradient(-45deg, var(--tile-color-2) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, var(--tile-color-2) 75%), 
        linear-gradient(-45deg, transparent 75%, var(--tile-color-2) 75%),
        radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 80px 80px, 80px 80px, 80px 80px, 80px 80px, 8px 8px;
    background-position: 0 0, 0 40px, 40px -40px, -40px 0px, 0 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: --tile-color-1 1s ease, --tile-color-2 1s ease;
}

/* CRT Screen Effect Overlays */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.04),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.04)
    );
    background-size: 100% 4px, 6px 100%;
    z-index: 999;
    pointer-events: none;
}

.glare {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 50% 15%, 
        rgba(255, 255, 255, 0.05) 0%, 
        transparent 70%
    );
    z-index: 1000;
    pointer-events: none;
}

/* Main Layout */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
    padding: 20px;
    z-index: 10;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.glow-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink),
        0 0 40px var(--neon-purple);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.year-badge {
    background: linear-gradient(45deg, var(--neon-pink), var(--neon-purple));
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    text-shadow: none;
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.5);
}

.subtitle {
    font-family: var(--font-mono);
    color: var(--neon-blue);
    letter-spacing: 4px;
    font-size: 0.9rem;
    margin-top: 5px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Arcade Cabinet Layout */
.arcade-cabinet {
    display: grid;
    grid-template-columns: 220px 360px 220px;
    gap: 20px;
    background: rgba(14, 7, 33, 0.85);
    border: 4px solid #1a0f38;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(189, 0, 255, 0.15) inset,
        0 0 3px 2px rgba(0, 255, 255, 0.3);
    position: relative;
    backdrop-filter: blur(10px);
}

/* Side Panels */
.panel {
    background: var(--panel-bg);
    border: 2px solid rgba(189, 0, 255, 0.25);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.panel-section h2 {
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--neon-blue);
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.4);
    text-align: center;
}

.digital-display {
    font-family: var(--font-mono);
    background: #05020c;
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 4px;
    padding: 10px;
    font-size: 1.8rem;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 8px var(--neon-blue);
    letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6) inset;
}

.digital-display.large {
    font-size: 2.2rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

/* Controls Guide */
.controls-guide h3 {
    font-size: 0.8rem;
    color: var(--neon-pink);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-align: center;
}

.controls-guide ul {
    list-style: none;
}

.controls-guide li {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(189, 0, 255, 0.15);
    color: rgba(243, 236, 255, 0.8);
}

.controls-guide li span {
    color: var(--neon-blue);
    font-weight: bold;
}

/* Next Block Preview Box */
.next-preview-box {
    background: #05020c;
    border: 2px solid rgba(189, 0, 255, 0.3);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 170px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6) inset;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.icon-btn {
    background: #1c0e3a;
    border: 1px solid rgba(189, 0, 255, 0.5);
    color: var(--text-primary);
    padding: 8px 12px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 0 2px #000;
}

.icon-btn:hover {
    background: #2b155c;
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.icon-btn.muted {
    opacity: 0.6;
    border-color: rgba(255, 0, 85, 0.3);
}

.icon-btn.muted:hover {
    opacity: 0.9;
    border-color: var(--neon-pink);
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.3);
}

/* Board Wrapper with Columns/Pillars */
.board-wrapper {
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: relative;
}

/* Sega Columns (Classic Grey Greek Pillars) */
.pillar {
    width: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 5;
}

.pillar-left {
    margin-right: -4px; /* overlapping the screen slightly */
}

.pillar-right {
    margin-left: -4px;
}

.pillar-cap {
    height: 16px;
    background: linear-gradient(to right, #6b6b6b, #b3b3b3 25%, #ffffff 50%, #b3b3b3 75%, #6b6b6b);
    border: 2px solid #4a4a4a;
    border-bottom: none;
    position: relative;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.5);
}

/* Ionic Volutes (Curls) on the capitals */
.pillar-cap::before, .pillar-cap::after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at center, #ffffff, #b3b3b3 40%, #7a7a7a 80%);
    border: 2px solid #4a4a4a;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    z-index: 6;
}

.pillar-left .pillar-cap::before { left: -5px; }
.pillar-left .pillar-cap::after { right: 1px; }

.pillar-right .pillar-cap::before { left: 1px; }
.pillar-right .pillar-cap::after { right: -5px; }

.pillar-shaft {
    flex-grow: 1;
    background: linear-gradient(to right, 
        #525252 0%, 
        #8f8f8f 20%, 
        #e0e0e0 45%, 
        #ffffff 50%, 
        #e0e0e0 55%, 
        #8f8f8f 80%, 
        #525252 100%
    );
    border-left: 2px solid #4a4a4a;
    border-right: 2px solid #4a4a4a;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Vertical fluting grooves */
.pillar-shaft::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    width: 80%;
    height: 100%;
    background: repeating-linear-gradient(to right,
        rgba(0, 0, 0, 0.25) 0px,
        rgba(0, 0, 0, 0.25) 2px,
        transparent 2px,
        transparent 6px
    );
    opacity: 0.85;
}

.pillar-base {
    height: 20px;
    background: linear-gradient(to right, #6b6b6b, #b3b3b3 25%, #ffffff 50%, #b3b3b3 75%, #6b6b6b);
    border: 2px solid #4a4a4a;
    border-top: none;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Board screen */
.board-screen {
    position: relative;
    border: 4px solid #00a3a3; /* Classic cyan/turquoise border frame */
    background: #000000;       /* Pure black playfield */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.95) inset;
    width: 300px;
    height: 650px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Overlay Screen Styles (Menus, Game Over, etc.) */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 2, 12, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
    padding: 20px;
    text-align: center;
}

.overlay-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content h2 {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: 3px;
    text-shadow: 0 0 15px var(--neon-pink);
}

.overlay-content .game-over-title {
    font-size: 2.6rem;
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink), 0 0 5px #fff;
    animation: pulse 1.5s infinite alternate;
}

.overlay-content .desc {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: rgba(243, 236, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 30px;
    padding: 0 10px;
}

.score-summary {
    margin-bottom: 30px;
}

.score-summary p {
    font-size: 0.8rem;
    color: var(--neon-blue);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

/* Neon buttons */
.neon-btn {
    background: transparent;
    border: 2px solid var(--neon-blue);
    color: #fff;
    padding: 12px 28px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.2),
        0 0 5px rgba(0, 255, 255, 0.2) inset;
    transition: all 0.3s ease;
}

.neon-btn:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 
        0 0 20px var(--neon-blue),
        0 0 40px rgba(0, 255, 255, 0.4);
    text-shadow: none;
}

.neon-btn:active {
    transform: scale(0.97);
}

/* Combo Popup Notifications */
.combo-popup {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(255, 0, 85, 0.95);
    border: 2px solid #fff;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 
        0 0 25px var(--neon-pink),
        0 0 10px #000;
    pointer-events: none;
    opacity: 0;
    z-index: 30;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.combo-count {
    font-size: 2.2rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.8);
    display: block;
    text-align: center;
}

/* Mobile Virtual Gamepad */
.virtual-gamepad {
    display: none; /* hidden on desktop */
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding: 10px 20px;
}

.dpad {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dpad-center {
    width: 40px;
    height: 40px;
    background: #140d2a;
    border-radius: 50%;
    border: 2px solid rgba(189, 0, 255, 0.3);
}

.gamepad-btn {
    background: rgba(22, 11, 46, 0.8);
    border: 2px solid var(--neon-purple);
    color: #fff;
    font-family: var(--font-display);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.1s ease;
}

.arrow-btn {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    font-size: 1.4rem;
}

.arrow-btn:active, .action-btn:active {
    background: var(--neon-purple);
    border-color: #fff;
    box-shadow: 0 0 15px var(--neon-purple);
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.2);
}

.cycle-btn:active {
    background: var(--neon-pink);
    border-color: #fff;
    box-shadow: 0 0 15px var(--neon-pink);
}

.drop-btn {
    border-color: var(--neon-green);
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.2);
}

.drop-btn:active {
    background: var(--neon-green);
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 15px var(--neon-green);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); text-shadow: 0 0 15px var(--neon-pink); }
    100% { transform: scale(1.05); text-shadow: 0 0 25px var(--neon-pink), 0 0 8px #fff; }
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.animate-pulse {
    animation: pulse 1.2s infinite alternate;
}

/* Responsive styles */
@media (max-width: 850px) {
    body {
        align-items: flex-start;
        padding-top: 10px;
        height: auto;
    }
    
    .arcade-cabinet {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
        max-width: 360px;
    }

    .board-screen {
        width: min(300px, 70vw);
        height: min(650px, calc(70vw * 13 / 6), 50vh);
    }

    .overlay-content h2 {
        font-size: 1.6rem;
        margin-bottom: 12px;
    }

    .overlay-content .game-over-title {
        font-size: 1.8rem;
    }

    .overlay-content .desc {
        font-size: 0.75rem;
        margin-bottom: 15px;
    }

    .panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        gap: 10px;
    }

    .panel-section {
        flex: 1 1 40%;
    }

    .next-section {
        flex: 1 1 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .next-preview-box {
        width: 100px;
        height: 100px;
    }

    #next-canvas {
        transform: rotate(-90deg); /* Horizontal preview on mobile */
    }

    .controls-guide {
        display: none; /* Hide keyboard controls on mobile */
    }

    .audio-controls {
        flex-direction: row;
        width: 100%;
        gap: 10px;
    }

    .audio-controls button {
        flex: 1;
    }

    .virtual-gamepad {
        display: flex;
    }
}

/* Retro Title Screen Styling */
.title-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
    opacity: 1;
    visibility: visible;
}

.title-screen-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.title-content-wrapper {
    width: min(100vw, 100vh * 4 / 3);
    height: min(100vh, 100vw * 3 / 4);
    position: relative;
    background-image: url('columns_title_bg_no_angels.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 30px rgba(0, 255, 255, 0.2);
    container-type: both;
    container-name: title-wrapper;
    overflow: hidden;
}

/* Logo placement precisely in the blue trapezoid */
.title-logo-container {
    position: absolute;
    top: 18.5%;
    left: 50%;
    transform: translate(-50%, -20%);
    width: 50%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.title-logo-text {
    font-family: var(--font-display);
    font-size: 7.2cqw;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.08em;
    color: #ffdd44;
    text-shadow: 
        0 1px 0 #ccaa00, 
        0 2px 0 #b39300, 
        0 3px 0 #997e00, 
        0 4px 0 #806900, 
        0 5px 0 #665400,
        0 6px 4px rgba(0,0,0,0.6), 
        0 0 10px rgba(255, 221, 68, 0.4);
    line-height: 1;
}

.title-logo-year {
    font-family: var(--font-mono);
    font-size: 3.5cqw;
    font-weight: bold;
    color: #ffdd44;
    text-shadow: 
        0 0 4px #ff0000,
        0 0 8px #ff0000,
        1px 1px 1px #000;
    margin-top: 1cqw;
    letter-spacing: 0.15em;
    line-height: 1;
}

/* Pulsing Start Prompt */
.title-prompt-container {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    text-align: center;
}

.title-prompt-text {
    font-family: var(--font-mono);
    font-size: 3.6cqw;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 0.1em;
    text-shadow: 
        0 0 6px rgba(255, 255, 255, 0.8),
        0 0 12px var(--neon-blue);
    animation: retro-blink 1s infinite steps(2, start);
}

.title-copyright {
    position: absolute;
    bottom: 4.8%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 100%;
}

.title-copyright p {
    font-family: var(--font-mono);
    font-size: 2cqw;
    color: #ffd700;
    letter-spacing: 0.15em;
    text-shadow: 1px 1px 2px #000;
}

@keyframes retro-blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Flying Angels Styling */
.title-angel {
    position: absolute;
    width: 20cqw;
    height: auto;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.title-angel.loaded {
    opacity: 1;
}

.title-angel-left {
    bottom: 12%;
    left: 12%;
    animation: fly-around-left 10s ease-in-out infinite alternate;
}

.title-angel-right {
    bottom: 12%;
    right: 12%;
    transform: scaleX(-1);
    animation: fly-around-right 12s ease-in-out infinite alternate;
}

@keyframes fly-around-left {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(4cqw, -5cqw) rotate(3deg);
    }
    66% {
        transform: translate(-3cqw, -9cqw) rotate(-4deg);
    }
    100% {
        transform: translate(3cqw, -3cqw) rotate(1deg);
    }
}

@keyframes fly-around-right {
    0% {
        transform: scaleX(-1) translate(0, 0) rotate(0deg);
    }
    33% {
        transform: scaleX(-1) translate(-4cqw, -6cqw) rotate(-3deg);
    }
    66% {
        transform: scaleX(-1) translate(3cqw, -10cqw) rotate(4deg);
    }
    100% {
        transform: scaleX(-1) translate(-2cqw, -4cqw) rotate(-1deg);
    }
}
