/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #002E33;
    --bg-light: #003338;
    --accent: #D7FFC2;
    --accent-shadow: #94C28E;
    --text: #F3F4ED;
    --text-muted: #BEBCAB;
    --border: #1a6a6e;
    --secondary: #BEBCAB;
    --secondary-shadow: #7A786A;
    --party-color: #D7FFC2;
    --party-dark: #002E33;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* ===== SCREENS ===== */
#app {
    width: 100%;
    height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.screen {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.screen.active { display: flex; }

/* ===== INTRO SCREEN ===== */
#intro-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
    animation: fadeIn 0.5s ease;
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

.logo {
    width: 100%;
    max-width: 260px;
    height: auto;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

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

.tagline p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    line-height: 1.8;
}

.tagline .highlight {
    color: var(--accent);
    font-weight: 800;
    margin-top: 6px;
    font-size: 12px;
}

.version {
    position: absolute;
    bottom: 12px;
    left: 0; right: 0;
    text-align: center;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 2px;
    opacity: 0.6;
}

/* ===== BUTTONS ===== */
.btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 1px;
}

.btn:active { transform: translateY(2px); }

.btn-primary {
    background: var(--accent);
    color: #002228;
    box-shadow: 0 4px 0 var(--accent-shadow);
}
.btn-primary:hover { background: #fff; }
.btn-primary:active { box-shadow: 0 2px 0 var(--accent-shadow); }

.btn-secondary {
    background: var(--secondary);
    color: #002228;
    box-shadow: 0 4px 0 var(--secondary-shadow);
}
.btn-secondary:hover { background: #fff; }
.btn-secondary:active { box-shadow: 0 2px 0 var(--secondary-shadow); }

.btn-mute {
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    box-shadow: none;
    margin-top: 12px;
    padding: 8px;
}

/* ===== PARTY SELECTION ===== */
#party-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.party-content {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.party-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

.party-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-style: italic;
}

.party-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.party-card {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: 'JetBrains Mono', monospace;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.party-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.party-card:hover::before { opacity: 1; }
.party-card:active { transform: scale(0.97); }

.party-symbol {
    font-size: 40px;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.party-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
}

.party-full {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.party-tagline {
    font-size: 10px;
    font-style: italic;
    opacity: 0.8;
    margin-top: 2px;
}

/* UDF Card */
.party-udf {
    background: linear-gradient(135deg, #003d1f 0%, #002E33 100%);
    border-color: #006B3F;
    color: #e0ffe0;
}
.party-udf .party-symbol { background: rgba(0,107,63,0.3); }
.party-udf:hover { border-color: #00ff7f; box-shadow: 0 0 20px rgba(0,107,63,0.4); }

/* LDF Card */
.party-ldf {
    background: linear-gradient(135deg, #3d0000 0%, #002E33 100%);
    border-color: #CC0000;
    color: #ffe0e0;
}
.party-ldf .party-symbol { background: rgba(204,0,0,0.3); }
.party-ldf:hover { border-color: #ff4444; box-shadow: 0 0 20px rgba(204,0,0,0.4); }

/* NDA Card */
.party-nda {
    background: linear-gradient(135deg, #3d2200 0%, #002E33 100%);
    border-color: #FF6600;
    color: #fff0e0;
}
.party-nda .party-symbol { background: rgba(255,102,0,0.3); }
.party-nda:hover { border-color: #ff9933; box-shadow: 0 0 20px rgba(255,102,0,0.4); }

/* ===== GAME SCREEN ===== */
#game-screen {
    background: var(--bg);
    flex-direction: column;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* HUD */
#hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 14px;
    background: linear-gradient(to bottom, rgba(0,46,51,0.92) 0%, transparent 100%);
    z-index: 10;
    pointer-events: none;
}

#hud-left { display: flex; flex-direction: column; gap: 2px; }

#hud-timer {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

#hud-party-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
}

#hud-center { text-align: center; }

#hud-best {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#hud-powerup {
    font-size: 11px;
    font-weight: 800;
    margin-top: 4px;
    animation: pulse 0.6s ease infinite;
}

#hud-powerup.hidden { display: none; }

#hud-hearts {
    font-size: 16px;
    letter-spacing: 1px;
}

/* Tap zones */
.tap-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 5;
    /* Invisible but tappable */
}

#tap-left { left: 0; }
#tap-right { right: 0; }

/* Discovery popup */
.discovery {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    z-index: 20;
    text-align: center;
    animation: slideDown 0.3s ease;
    max-width: 280px;
}

.discovery.hidden { display: none; }

.discovery-text {
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

/* ===== GAME OVER ===== */
#gameover-screen {
    background: rgba(0,46,51,0.95);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 50;
    animation: fadeIn 0.4s ease;
    overflow-y: auto;
    padding: 16px;
    padding-top: 24px;
}

.gameover-content {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.gameover-img {
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto 4px;
}

.score-box {
    background: var(--bg-light);
    padding: 14px;
    text-align: center;
    width: 100%;
}

.score-time {
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.score-percentile {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 6px;
}

.score-party {
    font-size: 10px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

.accent { color: var(--accent); font-weight: 800; }

.death-box {
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 16px;
    width: 100%;
}

#death-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 6px;
    color: var(--text);
}

.death-quote {
    font-size: 12px;
    color: var(--accent);
    font-style: italic;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.5;
}

.death-story {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.gameover-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.gameover-buttons .btn {
    flex: 1;
    padding: 12px 10px;
    font-size: 12px;
}

#switch-party-btn {
    max-width: 200px;
    margin-top: 4px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -16px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 8px var(--party-color); }
    50% { box-shadow: 0 0 20px var(--party-color); }
}

/* ===== TUTORIAL ===== */
.tutorial {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.tutorial.hidden {
    display: none !important;
}

.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.tutorial-box {
    position: relative;
    z-index: 1001;
    background: var(--bg-light);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    animation: slideDown 0.4s ease-out;
}

.tutorial-title {
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 24px;
    letter-spacing: 2px;
}

.tutorial-content {
    display: flex;
    gap: 24px;
    margin: 20px 0 28px 0;
    justify-content: center;
    align-items: center;
}

.tutorial-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tutorial-arrow {
    font-size: 48px;
    animation: pulse 1.5s ease-in-out infinite;
}

.tutorial-section p {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

.tutorial-section strong {
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}

.tutorial-divider {
    width: 2px;
    height: 60px;
    background: var(--accent);
    opacity: 0.3;
}

.tutorial-goal {
    font-size: 12px;
    color: var(--text-muted);
    margin: 20px 0;
    font-style: italic;
}

#tutorial-btn {
    margin-top: 12px;
}
