/* ============================================================
   PRIVACY PIX TOOLS — games & sensors section
   Shared chrome for /tools/games/. Page shell inherits the site
   design system (styles.css); this file adds the game surface:
   stage frame, HUD, overlays. Warm board-game materials — wood,
   brass, felt — sitting naturally on the site's cream/forest
   palette. No external assets.
   ============================================================ */

.stage-wrap {
    max-width: 560px;
    margin: 28px auto;
    padding: 0 4px;
}

/* The physical "board frame" the canvas sits in */
.stage-frame {
    position: relative;
    border-radius: 18px;
    padding: 10px;
    background: linear-gradient(160deg, #23423a, #16302a 70%);
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.08) inset,
        0 18px 40px -18px rgba(17, 53, 44, 0.55);
}

.stage-frame canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* HUD row above the canvas */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    font-family: 'Inter', sans-serif;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 64px;
}

.hud-stat .k {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mut, #65786e);
}

.hud-stat .v {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink, #1c2b26);
    font-variant-numeric: tabular-nums;
}

.hud-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.hud-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong, #cfc6b2);
    background: var(--paper, #fff);
    color: var(--ink, #1c2b26);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.hud-btn:hover {
    border-color: var(--emerald, #0e7a55);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.hud-btn:focus-visible {
    outline: 3px solid var(--gold, #b97f1f);
    outline-offset: 2px;
}

/* Full-stage overlay: start screen, permission gate, win screen */
.stage-overlay {
    position: absolute;
    inset: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 24px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(23, 58, 49, 0.88), rgba(13, 32, 27, 0.94)),
        rgba(13, 32, 27, 0.94);
    color: #f2ede2;
    font-family: 'Inter', sans-serif;
    z-index: 5;
}

.stage-overlay[hidden] { display: none; }

.stage-overlay h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(1.5rem, 5vw, 2.1rem);
    font-weight: 700;
    color: #f7f3e8;
    margin: 0;
    line-height: 1.15;
}

.stage-overlay p {
    max-width: 40ch;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(242, 237, 226, 0.82);
}

.stage-overlay .overlay-note {
    font-size: 0.78rem;
    color: rgba(242, 237, 226, 0.55);
}

.play-btn {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 34px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #b97f1f;
    color: #201703;
    box-shadow: 0 6px 20px rgba(185, 127, 31, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}

.play-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(185, 127, 31, 0.55); }
.play-btn:active { transform: translateY(0); }
.play-btn:focus-visible { outline: 3px solid #f7f3e8; outline-offset: 3px; }

/* Small status line under the stage (sensor mode, hints) */
.stage-status {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--ink-mut, #65786e);
    text-align: center;
    margin-top: 10px;
    min-height: 1.2em;
}

.stage-status .mode-chip {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft, rgba(14, 122, 85, 0.1));
    color: var(--emerald, #0e7a55);
    margin-right: 6px;
    vertical-align: 1px;
}

/* Sensor readout panels (gyroscope test page) */
.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 18px 0;
    font-family: 'Inter', sans-serif;
}

.sensor-cell {
    background: var(--paper, #fff);
    border: 1px solid var(--line, #e4ddcf);
    border-radius: 12px;
    padding: 14px 16px;
}

.sensor-cell .k {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mut, #65786e);
    display: block;
    margin-bottom: 4px;
}

.sensor-cell .v {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink, #1c2b26);
    font-variant-numeric: tabular-nums;
}

.sensor-cell .axis-bar {
    position: relative;
    height: 6px;
    border-radius: 3px;
    background: var(--sand, #f4efe5);
    margin-top: 10px;
    overflow: hidden;
}

.sensor-cell .axis-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    background: var(--emerald, #0e7a55);
    border-radius: 3px;
}

/* Verdict banner on the test page */
.sensor-verdict {
    font-family: 'Inter', sans-serif;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 18px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid var(--line, #e4ddcf);
    background: var(--paper, #fff);
}

.sensor-verdict.is-ok {
    border-color: rgba(14, 122, 85, 0.4);
    background: rgba(14, 122, 85, 0.07);
    color: #0b5c40;
}

.sensor-verdict.is-warn {
    border-color: rgba(185, 127, 31, 0.45);
    background: rgba(185, 127, 31, 0.08);
    color: #7c5310;
}

.sensor-verdict strong { font-weight: 700; }

/* Game cards on the hub page */
.game-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin: 26px 0;
}

.game-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--paper, #fff);
    border: 1px solid var(--line, #e4ddcf);
    border-radius: 16px;
    padding: 20px;
    text-decoration: none;
    color: var(--ink, #1c2b26);
    font-family: 'Inter', sans-serif;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--emerald, #0e7a55);
    box-shadow: 0 14px 32px -12px rgba(17, 53, 44, 0.28);
}

.game-card:focus-visible {
    outline: 3px solid var(--emerald, #0e7a55);
    outline-offset: 3px;
}

.game-card .thumb {
    height: 120px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
}

.game-card h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.2rem;
    margin: 0;
}

.game-card p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--ink-soft, #43564d);
    margin: 0;
}

.game-card .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 6px;
}

.game-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--sand, #f4efe5);
    color: var(--ink-soft, #43564d);
}

.game-tag.tag-live { background: rgba(14, 122, 85, 0.12); color: #0b5c40; }
.game-tag.tag-soon { background: rgba(185, 127, 31, 0.12); color: #7c5310; }

.game-card.is-soon {
    pointer-events: none;
    opacity: 0.75;
}

/* Reduced motion: kill transforms */
@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-card:hover,
    .hud-btn,
    .play-btn,
    .play-btn:hover {
        transition: none;
        transform: none;
    }
}
