/* ============================================================
   PodCube Interactive Engine v2.1 — Stylesheet
   ============================================================ */

/* ── Menu grid ─────────────────────────────────────────────── */

.game-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
}

.game-card {
    border: 3px double var(--primary);
    background: #fff;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

@media (hover: hover){
.game-card:hover {
    background: var(--primary-dim);
    transform: translateY(-3px);
    box-shadow: 4px 4px 0 rgba(23, 104, 218, 0.15);
}}

.game-card-meta  { font-family:"Fustat"; font-size:10px; font-weight:700; color:#bbb; text-transform:uppercase; letter-spacing:0.08em; }
.game-card-title { font-family:"Libertinus Math", serif; font-size:1.4em; font-weight:700; color:var(--primary); line-height:1.1; }
.game-card-score { margin-top:auto; font-family:"Fustat"; font-weight:700; font-size:11px; color:var(--primary-dark); background:#fff; border:1px solid var(--primary-dim); padding:4px 8px; align-self:flex-start; }


/* ── Game stage (hidden until a game is inserted) ──────────── */

.game-stage        { display:none; width:100%; max-width:600px; margin:0 auto; user-select: none; }
.game-stage.active { display:block; animation:fadeStage 0.25s ease; }

@keyframes fadeStage {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0);   }
}

.game-navbar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px double var(--primary);
    user-select:none;
}

.game-navbar .icon-btn {
    margin: auto;
    width: 80%;
    border-color: var(--danger)
}


/* ── Screen ─────────────────────────────────────────────────── */

.pc-game-container { position:relative; width:100%; }

.pc-game-board {
    position: relative;
    border: 3px double var(--primary);
    background: #fdfdfc;
    overflow: hidden;
    /* touch-action none: prevents the browser stealing swipes as page scroll */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.pc-game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated; /* keeps pixel art crisp when scaled */
    vertical-align: middle;
}

/* DOM layer — sits above canvas. pointer-events:none by default so the canvas
   remains interactive; re-enabled on individual components via inline style. */
.pc-layer-dom {
    position: absolute;
    top: 0;
    left: 0;
    
    /* 1. LOCK THE RESOLUTION */
    width: 400px;
    height: 300px;
    
    /* 2. PREPARE FOR SCALING */
    transform-origin: top left;
    
    /* 3. ALLOW CLICKS (We toggle this on specific elements usually, but base should be pass-through) */
    pointer-events: none;
}

#pc-machine-view.pc-game-active {
    overflow: hidden;           /* 1. Prevents scrolling the page */
    overscroll-behavior: none;  /* 2. Prevents "Swipe Back" and "Rubber Banding" */
    touch-action: none;         /* 3. Disables pinch-zoom and pan gestures globally */
}

#pc-machine-view {
    width: 100%;
}


/* ── HUD ─────────────────────────────────────────────────────── */

.pc-game-hud {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px dashed var(--primary-dim);
    font-family: "Fustat", sans-serif;
    user-select: none;
}

.pc-hud-cell { display:flex; flex-direction:column; }
.pc-hud-cell:last-child { text-align:right; align-items:flex-end; }

.pc-hud-label { font-size:9px; font-weight:700; color:#ccc; text-transform:uppercase; letter-spacing:0.08em; display:block; }
.pc-hud-val   { font-family:"Libertinus Math"; font-size:20px; font-weight:700; color:var(--primary); line-height:1; }
.pc-hud-sub   { font-family:"Fustat"; font-size:11px; font-weight:700; color:#888; margin-top:2px; }


/* ── Start / Pause / Game Over overlay ──────────────────────── */

.pc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 20;
    transition: opacity 0.2s ease;
    padding: 24px;
    text-align: center;
}

.pc-overlay.hidden { opacity:0; pointer-events:none; }

.pc-overlay.hidden * {
    pointer-events: none !important;
}

.pc-text-title {
    font-family: "Libertinus Math";
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: pre-wrap;
    user-select: none;
}

.pc-text-body {
    font-family: "Fustat";
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    max-width: 80%;
    margin: 0;
    white-space:pre-wrap;
    user-select: none;
}


/* ── Controls hint (below board) ────────────────────────────── */

.pc-game-controls-help {
    margin-top: 10px;
    text-align: center;
    font-size: 10px;
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-top: 1px dashed var(--primary-dim);
    padding-top: 8px;
    user-select: none;
}


/* ── Buttons ─────────────────────────────────────────────────── */

.pc-btn {
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
    font-family: "Fustat";
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, transform 0.08s;
    pointer-events: auto;
}


.pc-btn:active { transform:scale(0.95); }

.pc-btn.primary { background:var(--primary); color:#fff; border-color:var(--primary-dark); }


.pc-btn.danger       { border-color:#e53e3e; color:#e53e3e; }

@media (hover: hover) {
    .pc-btn.danger:hover {
        background: #e53e3e;
        color: #fff;
    }

    .pc-btn.primary:hover { background:var(--primary-dark); }

    .pc-btn:hover  { background:var(--primary); color:#fff; }
}

.pc-btn.wide { width:100%; }

/* The main container for the UI overlay */
.pc-ui-col {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto; /* Scroll if content is too tall */
    gap: 10px;
    box-sizing: border-box;
    pointer-events: auto; /* Re-enable clicks that the board ignores */
}

/* Grid Container */
.pc-grid {
    display: grid;
    width: 100%;
    /* 'gap' and 'grid-template-columns' are set inline via JS */
}

/* Progress Bar Container */
.pc-progress {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Progress Bar Fill */
.pc-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.15s ease-out, background-color 0.2s;
}