/* ═══════════════════════════════════════════════════
 * UBXTY Quest — Game Shell Styles (v2 Pro)
 * ═══════════════════════════════════════════════════ */

/* ── Section background ────────────────────────── */
.portfolio-game-section {
    background:
        radial-gradient(circle at 10% 10%, rgba(32,171,160,0.13) 0%, transparent 35%),
        radial-gradient(circle at 90% 20%, rgba(37,99,235,0.11) 0%, transparent 38%),
        linear-gradient(180deg, #f6fbff 0%, #edf7fa 100%);
}

/* ── Game shell container ──────────────────────── */
.game-shell {
    background: linear-gradient(180deg, #071625, #061220);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 20px 48px rgba(8, 26, 43, 0.38);
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ── HUD strip ─────────────────────────────────── */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(8, 18, 32, 0.95), rgba(7, 26, 46, 0.95));
    color: #e2e8f0;
    font-family: 'Space Grotesk', monospace, sans-serif;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.hud-cluster {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hud-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    transition: border-color 0.15s ease;
}

.hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #93c5fd;
}

.hud-pill strong {
    font-size: 0.84rem;
    color: #fff;
}

.game-btn {
    font-size: 0.75rem;
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
}

/* ── Boss health bar ───────────────────────────── */
#bossHud {
    min-width: 140px;
}

#bossHealthTrack {
    width: 100px;
    height: 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
    overflow: hidden;
}

#bossHealthBar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width 0.18s ease;
}

#bossHud.hidden {
    display: none;
}

/* ── Game stage / canvas wrapper ───────────────── */
.game-stage-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #0f4f8f;
}

#ubxtyPhaserGame {
    width: 100%;
    min-height: 420px;
    touch-action: manipulation;
}

#ubxtyPhaserGame canvas {
    width: 100%;
    max-height: 76vh;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ── Overlay (start / pause / win / fail) ─────── */
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
    color: #fff;
    background:
        radial-gradient(circle at 30% 20%, rgba(14,165,233,0.25), transparent 45%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.4), rgba(2, 6, 23, 0.85));
    z-index: 3;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.2s ease;
}

.game-overlay h3 {
    color: #fff;
    margin: 0;
    font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.game-overlay p {
    margin: 0;
    color: #dbeafe;
    max-width: 680px;
    line-height: 1.7;
}

.game-overlay.hidden {
    display: none;
    opacity: 0;
}

/* ── Contact form (victory screen) ─────────────── */
.quest-contact-form {
    width: 100%;
    max-width: 520px;
    margin-top: 8px;
}

.quest-contact-form.hidden {
    display: none;
}

.quest-contact-form form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quest-form-row {
    display: flex;
    gap: 10px;
}

.quest-form-row > input {
    flex: 1;
}

.quest-contact-form input,
.quest-contact-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.quest-contact-form input::placeholder,
.quest-contact-form textarea::placeholder {
    color: rgba(255,255,255,0.45);
}

.quest-contact-form input:focus,
.quest-contact-form textarea:focus {
    border-color: #20aba0;
    background: rgba(255,255,255,0.12);
}

.quest-contact-form textarea {
    resize: vertical;
    min-height: 60px;
}

.quest-form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}

.quest-form-actions .btn-accent {
    flex: 1;
    max-width: 200px;
}

.btn-skip {
    padding: 10px 18px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-skip:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.quest-form-msg {
    font-size: 0.85rem;
    min-height: 1.2em;
    text-align: center;
}

.quest-form-msg.success {
    color: #4ade80;
}

.quest-form-msg.error {
    color: #fca5a5;
}

/* ── Touch controls — dual-cluster layout ──────── */
.game-touch {
    display: none;
    padding: 12px 16px;
    background: linear-gradient(180deg, #06111d, #040d18);
    align-items: center;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.touch-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
}

.touch-spacer {
    flex: 1;
}

.game-touch button {
    border: 2px solid rgba(255,255,255,0.24);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,0.08);
    font-size: 1.3rem;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.24);
    transition: background 0.08s, transform 0.08s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-touch button:active,
.game-touch button.pressed {
    background: rgba(255,255,255,0.22);
    transform: scale(0.92);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.18);
}

.game-touch #touchShoot {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.4);
}

.game-touch #touchShoot:active {
    background: rgba(249, 115, 22, 0.35);
}

/* ── Meta panels below game ────────────────────── */
.game-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.game-discovery-panel,
.game-progress-panel {
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.discovery-header,
.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.discovery-header h3,
.progress-header h3 {
    font-size: 1.03rem;
    margin: 0;
}

#latestTag {
    font-size: 0.73rem;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--accent-dark);
    background: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

#latestBody {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.62;
}

#progressPercent {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #dbe7f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}

#progressBar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #20aba0, #22d3ee);
    transition: width 0.25s ease;
}

/* ── Mini-map ──────────────────────────────────── */
.mini-map-wrap {
    margin-bottom: 10px;
}

.mini-map {
    position: relative;
    width: 100%;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, #cbd5e1, #e2e8f0);
    overflow: hidden;
}

.mini-map::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: linear-gradient(90deg, #4ade80, #22c55e);
}

.mini-player,
.mini-flag {
    position: absolute;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.15s ease;
}

.mini-player {
    left: 2%;
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.mini-flag {
    left: 98%;
    background: #111827;
}

/* ── Milestone checklist ───────────────────────── */
.milestone-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.milestone-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    color: #334155;
}

.milestone-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 1px solid #94a3b8;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.milestone-list li.done .milestone-dot {
    background: #22c55e;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

/* ═══════════════ RESPONSIVE ═══════════════════ */

@media (max-width: 991px) {
    .game-meta-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-touch {
        display: flex;
    }

    .game-hud {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    .hud-pill {
        padding: 4px 7px;
        gap: 5px;
    }

    .hud-label {
        font-size: 0.62rem;
    }

    .game-touch button {
        width: 64px;
        height: 64px;
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .game-touch button {
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }

    .game-overlay h3 {
        font-size: 1.2rem;
    }

    .game-overlay p {
        font-size: 0.85rem;
    }
}