/* styles.css — Smoke's Escape: Through the Shattered Mirror */
/* Mobile-first, portrait-mode responsive layout */

:root {
    --bg-dark: #050010;
    --card-bg: rgba(15, 5, 25, 0.90);
    --border-color: rgba(155, 93, 229, 0.25);
    --neon-purple: #9b5de5;
    --neon-pink: #f72585;
    --neon-cyan: #00b4d8;
    --neon-gold: #ffd60a;
    --text-color: #e0d0ff;
    --text-muted: #a090cc;
    --font-pixel: 'Press Start 2P', monospace;
    --font-sans: 'Outfit', sans-serif;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: var(--font-sans), sans-serif;
    color: var(--text-color);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ─── Game Container — Portrait-first ─────────────────────────────────────── */
#game-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    overflow: hidden;
}

#game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 540px;   /* cap width for tablet/desktop, keeps portrait feel */
    max-height: 100vh;
    overflow: hidden;
    background: #080020;
    box-shadow: 0 0 60px rgba(123,47,255,0.4), 0 0 120px rgba(123,47,255,0.15);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* On very wide screens, add decorative side borders */
@media (min-width: 540px) {
    #game-wrapper {
        border-left: 1px solid rgba(123,47,255,0.25);
        border-right: 1px solid rgba(123,47,255,0.25);
    }
}

/* ─── Canvas ───────────────────────────────────────────────────────────────── */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;  /* prevent browser touch scroll/zoom on canvas */
    cursor: pointer;
    image-rendering: auto;
}

/* ─── SEO H1 (hidden visually, visible to search engines) ─────────────────── */
#game-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ─── Loading Screen ───────────────────────────────────────────────────────── */
#loadingScreen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #050010;
    z-index: 100;
    transition: opacity 0.5s ease;
}

#loadingScreen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    font-family: var(--font-pixel);
    font-size: clamp(16px, 4vw, 24px);
    color: #9b5de5;
    text-shadow: 0 0 30px rgba(123,47,255,0.8);
    margin-bottom: 12px;
    letter-spacing: 0.1em;
}

.loading-sub {
    font-size: clamp(11px, 2.5vw, 14px);
    color: #6040a0;
    font-family: var(--font-sans);
    margin-bottom: 32px;
}

.loading-bar-wrapper {
    width: 200px;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #9b5de5, #f72585);
    border-radius: 3px;
    animation: loadingPulse 1.5s ease-in-out infinite;
    width: 60%;
}

@keyframes loadingPulse {
    0%, 100% { width: 20%; opacity: 0.8; }
    50% { width: 90%; opacity: 1; }
}

/* ─── Overlays & Cards ────────────────────────────────────────────────────── */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 0, 15, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* ensure hidden overlays do not capture layout */
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 28px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(155, 93, 229, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 90%;
    overflow-y: auto;
}

.border-gold {
    border-color: rgba(255, 214, 10, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 214, 10, 0.2);
}

.border-red {
    border-color: rgba(247, 37, 133, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(247, 37, 133, 0.2);
}

.logo {
    font-family: var(--font-pixel);
    font-size: clamp(18px, 5vw, 24px);
    font-weight: 700;
    letter-spacing: 1px;
    color: #e0d0ff;
    text-shadow: 0 0 20px rgba(155, 93, 229, 0.8);
    margin-bottom: 8px;
}

.tagline {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.smoke-portrait {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}

#smoke-portrait-canvas {
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    border: 1px solid rgba(155, 93, 229, 0.3);
    box-shadow: 0 0 15px rgba(155, 93, 229, 0.2);
}

.story-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.4;
    color: #c0b0e0;
    text-align: left;
    border-left: 3px solid var(--neon-purple);
}

.controls-card {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
    font-family: var(--font-sans);
    color: #b8acda;
    border: 1px solid rgba(255,255,255,0.03);
}

.controls-card p {
    margin-bottom: 3px;
}

.key {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-bottom: 2px solid rgba(0,0,0,0.5);
    border-radius: 4px;
    padding: 1px 4px;
    font-weight: bold;
    color: #fff;
}

.btn {
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-pink) 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-sans);
    font-weight: bold;
    font-size: 14px;
    padding: 10px 20px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
    box-shadow: 0 4px 15px rgba(155, 93, 229, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(155, 93, 229, 0.6);
    filter: brightness(1.1);
}

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

.btn-restart {
    background: linear-gradient(135deg, #4a2080 0%, #15003a 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-restart:hover {
    box-shadow: 0 6px 15px rgba(155, 93, 229, 0.3);
}

.btn-back {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    box-shadow: none;
}

.btn-back:hover {
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    box-shadow: none;
}

.btn-share {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    box-shadow: 0 4px 15px rgba(0, 243, 255, 0.35);
}

.btn-share:hover {
    box-shadow: 0 6px 20px rgba(0, 243, 255, 0.55);
}

.cookie-warn {
    font-size: 10px;
    color: #f72585;
    margin: 4px 0;
    line-height: 1.3;
}

.stats-footer {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.8;
    margin-top: 4px;
}

/* Scores and Stats display */
.scores-row {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin: 8px 0;
}

.score-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 8px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-card span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.score-card strong {
    font-size: 20px;
    color: #fff;
    margin-top: 4px;
}

.gold-text {
    color: var(--neon-gold) !important;
    text-shadow: 0 0 15px rgba(255, 214, 10, 0.6) !important;
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 24px;
    margin: 6px 0;
    color: var(--neon-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.gameover-title {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.3);
    letter-spacing: 0.5px;
}

.gameover-desc {
    font-family: var(--font-sans);
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* Settings sliders */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.settings-row input[type="range"] {
    flex: 1;
    max-width: 150px;
    accent-color: var(--neon-purple);
}

.settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--neon-purple);
}

/* ─── HUD (Heads Up Display) ──────────────────────────────────────────────── */
#hud {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 30;
}

#hud.hidden {
    display: none !important;
}

.hud-item {
    background: rgba(10, 0, 25, 0.7);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(4px);
    pointer-events: auto;
    font-family: var(--font-sans);
    min-width: 60px;
}

.hud-label {
    font-size: 8px;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.hud-value {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    margin-top: 2px;
}

.hud-btn {
    height: 34px;
    width: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-color);
    background: rgba(10, 0, 25, 0.7);
    border: 1px solid rgba(155, 93, 229, 0.2);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.hud-btn:hover {
    background: rgba(155, 93, 229, 0.35);
    border-color: var(--neon-purple);
}

.hud-btn svg {
    pointer-events: none;
}

/* ─── Objective Bar ────────────────────────────────────────────────────────── */
#objective-bar {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(10, 0, 25, 0.8);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    backdrop-filter: blur(4px);
    z-index: 30;
    transition: opacity 0.3s ease;
    font-family: var(--font-sans);
}

#objective-bar.hidden {
    display: none !important;
}

.objective-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-color);
    width: 100%;
}

.objective-preview {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.objective-bar-container {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.objective-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.objective-text {
    font-weight: bold;
    min-width: 60px;
    text-align: right;
    font-size: 10px;
}

/* ─── Orientation Warning ──────────────────────────────────────────────────── */
#orientationWarn {
    display: none;
    position: fixed;
    inset: 0;
    background: #050010;
    z-index: 999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}

#orientationWarn p {
    font-size: 18px;
    color: #9b5de5;
    margin-top: 16px;
    font-family: var(--font-sans);
}

/* Show landscape warning */
@media (orientation: landscape) and (max-height: 500px) {
    #orientationWarn {
        display: flex;
    }
    #game-container {
        display: none;
    }
}

/* ─── Scrollbar styling ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: #0a0020;
}
::-webkit-scrollbar-thumb {
    background: #4a2080;
    border-radius: 2px;
}

