/* POKE 6 — Interactive 1989 Home Computer Magazine & Punch-64X Console */

[hidden] {
    display: none !important;
}

#mag-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* White glove pointing finger on the front cover — makes clicking/turning obvious! */
#cover-hand {
    position: fixed;
    z-index: 12;
    height: clamp(78px, 14vmin, 128px);
    width: auto;
    pointer-events: none;
    transform-origin: 11.1% 2%;
    translate: -11.1% -2%;
    filter: drop-shadow(0 6px 0 rgba(10, 4, 30, 0.38));
    animation: cover-tap 1.15s ease-in-out infinite;
}

@keyframes cover-tap {
    0%, 100% { transform: translate(16px, 14px); }
    45% { transform: translate(0, 0) scale(1); }
    55% { transform: translate(0, 0) scale(0.9); }
    70% { transform: translate(4px, 3px) scale(1); }
}

/* Keep bottom bar crisp & hide it cleanly while playing a Punch-64X game */
body.in-game #bar {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

#bar .gap {
    width: 10px;
}

#bar button.active {
    background: var(--punch);
    color: #000;
}

#bar button:disabled {
    opacity: 0.32;
    pointer-events: none;
}

/* Volume slider menu behind holdable sound button */
#vol-menu {
    bottom: calc(var(--gap) + 56px);
    padding: 12px 16px;
    z-index: 30;
}

#vol-slider {
    width: 128px;
    accent-color: var(--punch);
    cursor: pointer;
    display: block;
}

/* ---- Punch-64X Fantasy Console Overlay ---- */
#punch64x {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: radial-gradient(circle at 50% 42%, #242632 0%, #14151c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.86);
    transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.2, 0.9, 0.25, 1);
}

#punch64x.open {
    opacity: 1;
    transform: scale(1);
}

#punch64x.closing {
    opacity: 0;
    transform: scale(0.92);
}

.crt-cabinet {
    width: min(94vw, calc(76vh * 1.25));
    max-width: 880px;
    background: linear-gradient(180deg, #32343f 0%, #20222a 100%);
    border: 3px solid #101116;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    padding: 12px 14px 12px;
    border-radius: 6px;
    box-sizing: border-box;
}

.crt-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 10px;
    font: 700 13px/1 "Chakra Petch", ui-monospace, monospace;
    letter-spacing: 0.08em;
    color: #c8cedc;
}

.crt-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crt-brand .led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3855;
    box-shadow: 0 0 8px #ff3855;
    display: inline-block;
}

.crt-title {
    color: var(--punch);
    margin-left: auto;
}

.crt-reset {
    background: #14151c;
    color: #c8cedc;
    border: 1px solid #4a4e5e;
    padding: 4px 9px;
    font: 700 11px/1 "Chakra Petch", monospace;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.crt-reset:hover {
    background: var(--punch);
    color: #000;
    border-color: #000;
}

.crt-bezel {
    position: relative;
    background: #0a0b10;
    border: 4px solid #121319;
    aspect-ratio: 4 / 3;
    width: 100%;
    overflow: hidden;
}

.crt-controls-hint {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 18px;
    margin-top: 10px;
    padding: 9px 14px;
    background: #12131a;
    border: 2px solid #090a0e;
    border-radius: 4px;
}

.ctrl-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 700 13px/1 "Chakra Petch", ui-monospace, monospace;
    letter-spacing: 0.06em;
    color: #f4f6ff;
}

.ctrl-item kbd {
    display: inline-block;
    padding: 4px 8px;
    background: var(--punch);
    color: #000;
    border: 2px solid #000;
    border-radius: 3px;
    box-shadow: 0 2px 0 #000;
    font: 700 13px/1 "Chakra Petch", ui-monospace, monospace;
    letter-spacing: 0.04em;
}

.ctrl-item em {
    font-style: normal;
    color: #e4e8f5;
}

.touch-pad {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    gap: 12px;
}

.touch-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.touch-mid {
    display: flex;
    gap: 34px;
}

.touch-pad button {
    width: 46px;
    height: 46px;
    border: 2px solid #000;
    background: #2e3140;
    color: #fff;
    font: 700 16px/1 "Chakra Petch", sans-serif;
    border-radius: 6px;
    touch-action: none;
}

.touch-pad button.held {
    background: var(--punch);
    color: #000;
}

.touch-ab {
    display: flex;
    gap: 14px;
}

.touch-ab .ab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #c82233;
    font-size: 18px;
}

.touch-ab .ab-a {
    background: var(--punch);
    color: #000;
}

.crt-screen {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
}

.crt-skip {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: var(--punch);
    color: #000;
    font: 700 12px/1 "Chakra Petch", monospace;
    padding: 7px 12px;
    cursor: pointer;
    letter-spacing: 0.08em;
    border: 2px solid #000;
}

/* Bold Back-to-Magazine button in bottom-left, clear of top-left badge (per SOUL.md!) */
.back-mag {
    position: fixed;
    left: max(18px, env(safe-area-inset-left));
    bottom: max(18px, env(safe-area-inset-bottom));
    height: 52px;
    padding: 0 18px 0 14px;
    background: var(--punch);
    color: #000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 700 15px/1 "Chakra Petch", sans-serif;
    letter-spacing: 0.08em;
    cursor: pointer;
    z-index: 60;
    --c: 9px;
    --t: 3px;
    --edge: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    transition: transform 0.14s, background 0.14s, color 0.14s;
}

.back-mag:hover {
    background: #ffffff;
    color: #000;
    transform: translateY(-2px) scale(1.04);
}

.back-mag svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ---- Interactive 4-Panel Unfolding Centrefold Poster ---- */
#poster-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(16, 17, 24, 0.88);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#poster-overlay.unfolded {
    opacity: 1;
}

.poster-stage {
    perspective: 1400px;
    width: min(94vw, calc(86vh * 1.5));
    aspect-ratio: 3 / 2;
}

.poster-sheet {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
    transform-style: preserve-3d;
}

.poster-panel {
    background-image: url('./assets/art/poster.webp');
    background-size: 200% 200%;
    transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1), filter 0.55s ease;
    backface-visibility: hidden;
    position: relative;
}

.poster-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.p-tl {
    background-position: 0% 0%;
    transform-origin: right bottom;
    transform: rotateY(-58deg) rotateX(22deg);
    filter: brightness(0.75);
}
.p-tr {
    background-position: 100% 0%;
    transform-origin: left bottom;
    transform: rotateY(58deg) rotateX(22deg);
    filter: brightness(0.75);
}
.p-bl {
    background-position: 0% 100%;
    transform-origin: right top;
    transform: rotateY(-58deg) rotateX(-22deg);
    filter: brightness(0.75);
}
.p-br {
    background-position: 100% 100%;
    transform-origin: left top;
    transform: rotateY(58deg) rotateX(-22deg);
    filter: brightness(0.75);
}

#poster-overlay.unfolded .poster-panel {
    transform: rotateY(0deg) rotateX(0deg);
    filter: brightness(1);
}

.poster-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 14px;
    background: rgba(12, 12, 18, 0.78);
    color: var(--punch);
    font: 700 13px/1 "Chakra Petch", monospace;
    letter-spacing: 0.1em;
    text-align: center;
}

/* ---- Fake Competition Coupon Modal ---- */
#compo-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(12, 13, 18, 0.72);
    display: grid;
    place-items: center;
    padding: 20px;
}

.compo-card {
    position: relative;
    width: min(420px, 92vw);
    background: #fff9d6;
    color: #16161d;
    border: 4px dashed #16161d;
    padding: 22px 24px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
    font-family: "Chakra Petch", sans-serif;
}

.compo-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: #d61a2c;
}

.compo-card p {
    margin: 0 0 14px;
    font: 600 14px/1.4 Georgia, serif;
}

.compo-choices {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.compo-choices label {
    flex: 1;
    background: #fff;
    border: 2px solid #16161d;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    font: 700 13px/1.2 ui-monospace, monospace;
}

.compo-card input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    margin-bottom: 10px;
    border: 2px solid #16161d;
    background: #fff;
    color: #14369c;
    font: italic 700 16px Georgia, serif;
}

.compo-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.compo-actions button {
    flex: 1;
    padding: 10px;
    border: 3px solid #16161d;
    background: var(--punch);
    color: #111;
    font: 700 15px "Chakra Petch", sans-serif;
    cursor: pointer;
}

.compo-actions button.cancel {
    background: #e4dec4;
}
