/* ============================================================
   Ludic Jamming! — Game CSS
   ============================================================ */

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

:root {
    --rust:   #C4603A;
    --yellow: #E8CC6A;
    --green:  #3A7D2E;
    --sage:   #6B9A5E;
    --cream:  #F0E9DC;
    --dark:   #0E1A0F;
    --muted:  #9A8E80;
    --font:   'Segoe UI', 'Inter', system-ui, sans-serif;
}

html, body {
    width: 100%; height: 100%;
    background: var(--dark);
    color: var(--cream);
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    user-select: none;
}

/* ── WRAPPER ────────────────────────────────────────────── */
#game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 900px;
    max-width: 100vw;
}

/* ── HUD ────────────────────────────────────────────────── */
#hud {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(14, 26, 15, 0.95);
    border-bottom: 2px solid var(--rust);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

#hud-left  { min-width: 100px; }
#hud-center { font-size: 14px; font-weight: 900; color: var(--cream); letter-spacing: 0.1em; text-transform: uppercase; }
#hud-right { min-width: 100px; text-align: right; }

#lives-display { font-size: 18px; letter-spacing: 2px; }
#score-label   { color: var(--muted); font-size: 11px; margin-right: 6px; text-transform: uppercase; letter-spacing: 0.12em; }
#score-display { color: var(--yellow); font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }

#btn-mute, #btn-pause {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: var(--cream);
    font-size: 16px;
    line-height: 1;
    padding: 3px 7px;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: middle;
    transition: border-color 0.15s, opacity 0.15s;
}
#btn-mute:hover, #btn-pause:hover { border-color: var(--rust); }
#btn-mute.muted   { opacity: 0.4; }

/* ── CANVAS ─────────────────────────────────────────────── */
#canvas-container {
    position: relative;
    width: 900px;
    max-width: 100vw;
    line-height: 0;
}

#gameCanvas {
    display: block;
    background: #0a150b;
    cursor: default;
    width: 100%;
}

/* ── OVERLAY SCREENS ─────────────────────────────────────── */
.overlay-screen {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 18, 9, 0.82);
    backdrop-filter: blur(4px);
    z-index: 20;
}

.overlay-screen.active {
    display: flex;
}

.screen-box {
    background: rgba(22, 32, 20, 0.97);
    border: 2px solid var(--rust);
    border-radius: 4px;
    padding: 28px 36px;
    text-align: center;
    max-width: 420px;
    box-shadow: 6px 6px 0 rgba(158, 72, 40, 0.5);
}

.screen-kicker {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sage);
    margin-bottom: 8px;
}

.screen-box h1 {
    font-size: 28px;
    font-weight: 900;
    color: var(--cream);
    line-height: 1;
    margin-bottom: 10px;
}

.screen-box p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 24px;
}

/* Lore screen */
.lore-text {
    text-align: left;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lore-text p {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--muted);
}
.lore-text strong {
    color: var(--cream);
    font-weight: 800;
}
.lore-call {
    color: var(--yellow) !important;
    font-weight: 800 !important;
    font-size: 16px !important;
    text-align: center;
    margin-top: 6px;
}

/* Controls grid */
.controls-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 28px;
}

.ctrl-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
}

kbd {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 800;
    color: var(--cream);
    letter-spacing: 0.05em;
}

/* Buttons */
.btn-game {
    background: var(--rust);
    color: var(--cream);
    border: 2px solid var(--rust);
    border-radius: 3px;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 900;
    font-family: inherit;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 4px 4px 0 #9E4828;
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 4px 6px;
    text-transform: uppercase;
}

.btn-game:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #9E4828;
}

.btn-game:active {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 #9E4828;
}

.btn-game.btn-secondary {
    background: transparent;
    color: var(--sage);
    border-color: var(--sage);
    box-shadow: 4px 4px 0 #1F5220;
}

.btn-game.btn-secondary:hover {
    background: var(--sage);
    color: var(--dark);
    box-shadow: 6px 6px 0 #1F5220;
}

/* ── FOOTER ─────────────────────────────────────────────── */
#game-footer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 7px 16px;
    background: rgba(6, 12, 8, 0.95);
    border-top: 1px solid rgba(196, 96, 58, 0.2);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.07em;
}

#game-footer a {
    color: var(--rust);
    text-decoration: none;
    font-weight: 700;
}
#game-footer a:hover { text-decoration: underline; }

/* ── TOUCH CONTROLS ───────────────────────────────── */
#touch-controls {
    display: none;
    width: 100%;
    max-width: 100vw;
    padding: 10px 20px 14px;
    background: rgba(6,12,8,0.95);
    border-top: 2px solid rgba(196,96,58,0.25);
    justify-content: space-between;
    align-items: center;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (hover: none) and (pointer: coarse) {
    #touch-controls { display: flex; }
}

#tc-dpad, #tc-actions {
    display: flex;
    gap: 12px;
}

.tc-btn {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    border: 2px solid rgba(196,96,58,0.4);
    background: rgba(196,96,58,0.12);
    color: #F0E9DC;
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    transition: background 0.08s, border-color 0.08s;
}

.tc-btn.pressed {
    background: rgba(196,96,58,0.45);
    border-color: #C4603A;
}

.tc-btn-jump {
    border-color: rgba(232,204,106,0.4);
    background: rgba(232,204,106,0.1);
    color: #E8CC6A;
}
.tc-btn-jump.pressed {
    background: rgba(232,204,106,0.4);
    border-color: #E8CC6A;
}

.tc-btn-attack {
    border-color: rgba(107,154,94,0.4);
    background: rgba(107,154,94,0.1);
    color: #6B9A5E;
}
.tc-btn-attack.pressed {
    background: rgba(107,154,94,0.4);
    border-color: #6B9A5E;
}

/* ── Map screen ──────────────────────────────────────────── */
.map-box {
    max-width: 420px;
    padding: 1.1rem 1.3rem;
}
.map-chihuahua-wrap {
    width: 100%;
    max-width: 230px;
    margin: .4rem auto .7rem;
}
.map-svg { width: 100%; display: block; }
.map-label {
    fill: #9A8E80;
    font-family: sans-serif;
    font-size: 9px;
}
#map-stars {
    font-size: 1.3rem;
    letter-spacing: .12em;
    margin: .15rem 0 .4rem;
}
#map-score-line {
    color: #9A8E80;
    font-size: .8rem;
    margin: .15rem 0 0;
}
#map-next-hint {
    color: #C4603A;
    font-weight: 700;
    font-size: .88rem;
    margin: .5rem 0 .65rem;
}
