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

:root {
    --bg-1: #1e3a8a;
    --bg-2: #0f172a;
    --accent: #22d3ee;
    --accent-dark: #0891b2;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --good: #22c55e;
    --bad: #ef4444;
}

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
    min-height: 100%;
    -webkit-tap-highlight-color: transparent;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.hidden { display: none !important; }

/* ---------- Screens ---------- */
.screen {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* ---------- Card ---------- */
.card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 32px 24px;
    text-align: center;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.title {
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    letter-spacing: 0.5px;
}

.subtitle {
    color: var(--muted);
    margin: 10px 0 24px;
    font-size: 0.95rem;
}

/* ---------- Form / inputs ---------- */
.name-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#name-input {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font-size: 1rem;
    text-align: center;
    outline: none;
}

#name-input:focus { border-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #06222b;
}

.btn-primary:hover { filter: brightness(1.08); }

/* ---------- HUD ---------- */
.hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 16px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.hud-value {
    font-size: 1.25rem;
    font-weight: 800;
    margin-top: 2px;
}

.hud-value.warning { color: var(--bad); }

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

/* ---------- Game board ---------- */
.image-wrap {
    position: relative;
    width: 100%;
    line-height: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

#game-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Image labels */
.img-label {
    position: absolute;
    top: 8px;
    font-size: clamp(0.6rem, 2.2vw, 0.8rem);
    font-weight: 700;
    line-height: 1;
    padding: 5px 9px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, 0.78);
    pointer-events: none;
    z-index: 3;
}

.img-label-left { left: 8px; }

.img-label-right {
    right: 8px;
    background: var(--accent-dark);
    color: #06222b;
}

/* Image 1 (left half) is reference only: block taps + show it's not playable */
.left-guard {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    cursor: not-allowed;
    z-index: 2;
}

/* Hotspots: invisible tap targets positioned by % so they scale with the image */
.hotspot {
    position: absolute;
    width: 9%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 4;
}

/* When found, reveal a marker ring */
.hotspot.found {
    background: rgba(34, 197, 94, 0.25);
    border: 3px solid var(--good);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
    cursor: default;
    animation: pop 0.3s ease;
}

@keyframes pop {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Wrong-tap feedback */
.image-wrap.shake { animation: shake 0.3s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ---------- Result overlay ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.result-card h2 { font-size: 1.8rem; margin-bottom: 8px; }
.result-card #result-text { color: var(--muted); margin-bottom: 22px; }
.result-card.win h2 { color: var(--good); }
.result-card.lose h2 { color: var(--bad); }
