/* CSS Variables */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --accent-gold: #ffd700;
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-pink: #ff6b9d;
    --accent-green: #22c55e;
    --accent-orange: #ff8c00;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Background effects */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 8s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 300px;
    height: 300px;
    background: rgba(168, 85, 247, 0.15);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.bg-orb:nth-child(2) {
    width: 250px;
    height: 250px;
    background: rgba(0, 212, 255, 0.1);
    bottom: -50px;
    right: -50px;
    animation-delay: -3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 16px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-cyan);
    text-decoration: none;
    font-family: 'Jua', sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s, transform 0.2s;
    position: absolute;
    left: 16px;
}

.back-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.05);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

header h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 28px;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.subtitle {
    font-family: 'Jua', sans-serif;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

/* Game Wrapper - Flighter specific */
#gw {
    position: relative;
    width: min(400px, calc(100vw - 16px));
    aspect-ratio: 4 / 7;
    height: auto;
    max-height: 80vh;
    max-height: 80dvh;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 3px solid #2a2a5a;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(100, 100, 255, .15);
}

/* Screens (start / game over) */
.scr {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 20, .92);
    z-index: 20;
    pointer-events: all;
    gap: 12px;
}

.scr .game-logo-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #ffcc44;
    text-shadow: 0 0 20px rgba(255, 200, 50, .6), 2px 2px 0 #aa6600;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 2px;
}

.scr h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: #ff4466;
    text-shadow: 0 0 15px rgba(255, 68, 102, .5);
}

.sub {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #8888cc;
    margin-top: 4px;
}

.logo {
    width: 120px;
    height: 120px;
    image-rendering: pixelated;
    margin-bottom: 6px;
}

.scr .btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    padding: 14px 28px;
    border: 2px solid #ffcc44;
    background: transparent;
    color: #ffcc44;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
    pointer-events: all;
    letter-spacing: 1px;
    margin-top: 12px;
}

.scr .btn:hover {
    background: #ffcc44;
    color: #0a0a1a;
    box-shadow: 0 0 20px rgba(255, 200, 50, .4);
}

.fs {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffcc44;
    margin: 6px 0;
}

.fd {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: #88aaff;
}

.hs {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #ff88aa;
    margin-top: 4px;
}

.ci {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #6666aa;
    text-align: center;
    line-height: 2;
    margin-top: 10px;
}

.il {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #aaa;
    text-align: left;
    line-height: 2.4;
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px solid #333;
    border-radius: 4px;
    background: rgba(255, 255, 255, .03);
}

.il .t {
    color: #ffcc44;
    font-size: 7px;
    margin-bottom: 4px;
}

.il i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    vertical-align: middle;
    margin-right: 4px;
    font-style: normal;
}

.hidden {
    display: none !important;
}

/* Article section */
.game-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-content h2 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 20px;
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.game-content p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tip-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tip-box p {
    margin-bottom: 8px;
}

.tip-box p:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer a {
    color: var(--accent-cyan);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Fullscreen mode */
body.fullscreen-active #gw {
    width: min(calc(100dvh * 4 / 7), calc(100vw - 16px));
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    aspect-ratio: 4 / 7;
}

body.fullscreen-active canvas {
    border: none;
    border-radius: 0;
}

body.fullscreen-active .container {
    padding: 0 !important;
}

/* Mobile responsive */
@media (max-width: 420px) {
    #gw {
        max-height: none;
    }

    canvas {
        border: none;
        border-radius: 0;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 22px;
    }

    .back-btn {
        left: 8px;
    }
}
