/* DoorForge: adventures played inside the arcade. Same visual language as the room. */
.df-root { position: absolute; inset: 0; z-index: 50; background: #000; overflow: hidden; touch-action: none; user-select: none; }
.df-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.df-root::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55)), repeating-linear-gradient(0deg, rgba(0, 0, 0, .06) 0 1px, transparent 1px 3px); }

/* HUD */
.df-hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.df-hud > * { pointer-events: auto; }
.df-exit { position: absolute; left: 12px; top: calc(10px + var(--safe-t)); font: 10px var(--pixel); padding: 10px 11px 9px; background: rgba(18, 13, 28, .72); color: var(--cream); border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(246, 231, 200, .22); }
.df-inv { position: absolute; right: 66px; top: calc(10px + var(--safe-t)); display: flex; gap: 6px; pointer-events: none; }
.df-slot { width: 44px; height: 44px; display: grid; place-items: center; background: rgba(18, 13, 28, .66); border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(233, 180, 76, .5), 0 0 12px rgba(233, 180, 76, .25); animation: slot .5s cubic-bezier(.2, 1.4, .4, 1); }
.df-slot canvas { width: 34px; height: 34px; }
@keyframes slot { from { transform: scale(0) rotate(-20deg); } }
.df-cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(246, 231, 200, .55); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); pointer-events: none; }
.df-prompt { position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); font: 10px var(--pixel); color: var(--ink); background: var(--mustard); padding: 6px 8px 5px; border-radius: 2px; box-shadow: 3px 3px 0 var(--ink); pointer-events: none; white-space: nowrap; }
.df-bar { position: absolute; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); width: min(46vw, 320px); height: 8px; background: rgba(0, 0, 0, .6); box-shadow: 0 0 0 2px rgba(246, 231, 200, .4); pointer-events: none; }
.df-bar i { display: block; height: 100%; width: 100%; background: var(--mustard); transition: width .1s linear; }
.df-bar.low i { background: #ff4a3a; animation: blink 0.5s steps(2) infinite; }
.df-battery { top: auto; bottom: calc(22px + var(--safe-b)); width: 120px; left: auto; right: 16px; transform: none; }
.df-battery b { position: absolute; right: -6px; top: 2px; width: 4px; height: 4px; background: rgba(246, 231, 200, .4); }
.df-joy { position: absolute; left: 30px; bottom: calc(40px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; background: rgba(246, 231, 200, .07); box-shadow: inset 0 0 0 2px rgba(246, 231, 200, .18); pointer-events: none; opacity: .6; }
.df-joy.on { opacity: 1; }
.df-joy i { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(246, 231, 200, .25); }

/* the Pick-a-Door card */
.df-banner { position: absolute; left: 0; right: 0; top: 34%; z-index: 6; text-align: center; font: clamp(18px, 3.4vw, 34px) var(--pixel); color: #fff; text-shadow: 0 4px 0 #000, 0 0 30px rgba(0, 0, 0, .8); opacity: 0; transform: scale(1.08); transition: opacity .4s, transform .6s; pointer-events: none; letter-spacing: .06em; }
.df-banner.on { opacity: 1; transform: none; }
.df-fade { position: absolute; inset: 0; z-index: 8; background: #000; opacity: 0; pointer-events: none; transition-property: opacity; }
.df-fade.on { opacity: 1; }

/* hiding: you see the room through the slats */
.df-root.df-hidden::before { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(180deg, #050403 0 22px, transparent 22px 38px), radial-gradient(ellipse at center, transparent 30%, #000 85%); }
.df-root.df-hidden .df-cross { display: none; }

/* panels */
.df-overlay { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; background: rgba(6, 4, 10, .72); opacity: 0; transition: opacity .2s; padding: 16px; }
.df-overlay.on { opacity: 1; }
.df-overlay .btn-x { position: absolute; }
.df-panel { max-width: min(94vw, 720px); max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.df-title { font: 11px var(--pixel); color: var(--cream); opacity: .8; }
.df-body { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.df-clue { width: min(86vw, 720px); height: auto; max-height: 72vh; object-fit: contain; box-shadow: 0 0 0 10px #f1e8d2, 0 22px 60px rgba(0, 0, 0, .8); transform: rotate(-1deg); }
.df-keypad .df-body { background: linear-gradient(#3a3d42, #24262a); padding: 18px; border-radius: 10px; box-shadow: inset 0 0 0 2px #5c6066, 0 20px 50px rgba(0, 0, 0, .7); }
.df-kp-marks { width: auto; height: 46px; background: #15171a; border-radius: 4px; padding: 4px; }
.df-kp-screen { width: 240px; text-align: center; font: 40px/52px var(--term); color: #5dff9b; background: #07120b; border-radius: 4px; box-shadow: inset 0 0 14px rgba(93, 255, 155, .2); text-shadow: 0 0 8px rgba(93, 255, 155, .6); letter-spacing: .1em; }
.df-kp-screen.ok { color: #9dffbe; background: #0d2a16; }
.df-kp-screen.bad { color: #ff6a5a; background: #2a0b0b; text-shadow: 0 0 8px rgba(255, 90, 80, .6); }
.df-kp-keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.df-kp-keys button { height: 56px; font: 22px var(--pixel); color: #222; background: linear-gradient(#e8e4d8, #bdb8aa); border-radius: 8px; box-shadow: 0 4px 0 #6a665c; }
.df-kp-keys button:active { transform: translateY(3px); box-shadow: 0 1px 0 #6a665c; }
.df-kp-keys button:nth-child(11) { grid-column: 2; }
.df-power .df-body { background: #c9c4b4; padding: 16px; border-radius: 6px; box-shadow: inset 0 0 0 3px #8a8576, 0 20px 50px rgba(0, 0, 0, .7); min-width: min(90vw, 380px); }
.df-power.trip .df-body { animation: shake .3s; background: #e8b0a0; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.df-pw-meter { display: flex; gap: 3px; padding: 6px; background: #1e1a2b; border-radius: 3px; }
.df-pw-meter i { width: 18px; height: 22px; background: #3a3444; }
.df-pw-meter i.on { background: #5dff9b; box-shadow: 0 0 8px #5dff9b; }
.df-pw-meter i.over { background: #ff4a3a; }
.df-pw-meter i.x { outline: 1px dashed #ff8a7a; }
.df-pw-rows { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.df-pw-row { display: flex; align-items: center; gap: 12px; padding: 6px 10px; background: #2a2a33; border-radius: 4px; color: var(--cream); }
.df-pw-row canvas { width: 34px; height: 34px; }
.df-pw-row.need { box-shadow: inset 0 0 0 2px #e9b44c; }
.df-pw-load { flex: 1; text-align: left; font: 18px var(--term); color: #e9b44c; letter-spacing: .1em; }
.df-pw-sw { width: 34px; height: 34px; display: grid; place-items: center; font: 14px var(--pixel); background: #111; color: #666; border-radius: 3px; }
.df-pw-row.on .df-pw-sw { background: #e9b44c; color: #1e1a2b; }
.df-radio .df-body { background: linear-gradient(#5a3a24, #3a2416); padding: 18px; border-radius: 12px; box-shadow: inset 0 0 0 3px #7a5434, 0 20px 50px rgba(0, 0, 0, .7); }
.df-radio-disp { font: 42px var(--term); color: #ffb648; text-shadow: 0 0 10px rgba(255, 182, 72, .6); background: #120a04; padding: 0 18px; border-radius: 4px; }
.df-radio-disp.lock { color: #9dffbe; text-shadow: 0 0 12px #5dff9b; }
.df-scope { width: min(80vw, 560px); height: auto; border-radius: 4px; box-shadow: inset 0 0 0 2px #000; }
.df-dial { width: min(80vw, 560px); accent-color: #e9b44c; height: 36px; }

/* endings */
.df-end { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; opacity: 0; transition: opacity .8s;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px), radial-gradient(ellipse at 50% 45%, #15101c, #000 70%); }
.df-end.on { opacity: 1; }
.df-end.good, .df-end.alt, .df-end.hard { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .03) 0 1px, transparent 1px 3px), radial-gradient(ellipse at 50% 45%, #fff6e2, #d8c8a8 75%); color: #1e1a2b; }
.df-end.secret { background: radial-gradient(ellipse at 50% 45%, #4a1838, #12060e 75%); }
.df-end-kind { font: 10px var(--pixel); opacity: .6; letter-spacing: .2em; }
.df-end h2 { margin: 0; font: clamp(18px, 4vw, 32px)/1.5 var(--pixel); }
.df-end h2 span { opacity: 0; animation: type .01s forwards; }
.df-end p { margin: 0; font-size: 28px; opacity: .85; max-width: 640px; }
.df-end-meta { font: 18px var(--term); opacity: .55; }
.df-end-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.df-end-row button { font: 11px var(--pixel); padding: 13px 16px 11px; background: rgba(30, 26, 43, .85); color: var(--cream); box-shadow: 3px 3px 0 rgba(0, 0, 0, .5); }
.df-end-row button.primary { background: var(--mustard); color: var(--ink); box-shadow: 4px 4px 0 var(--coral); }

/* the cartridge slot inside the arcade screen */
.cart { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; padding: 7% 6%; gap: 4%; background: radial-gradient(circle at 50% 30%, #2b1d3f, #0d0a16 75%); color: var(--cream); font-family: var(--pixel); }
.cart-title { font-size: clamp(11px, 2.4vmin, 18px); color: #efb73e; text-align: center; text-shadow: 3px 3px 0 #e4572e; }
.cart-list { flex: 1; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.cart-item { --c: #efb73e; text-align: left; padding: 8px 10px; background: rgba(255, 255, 255, .04); border-left: 4px solid var(--c); display: flex; flex-direction: column; gap: 4px; }
.cart-item b { font: clamp(9px, 1.9vmin, 14px) var(--pixel); font-weight: normal; }
.cart-item small { font: clamp(13px, 2.4vmin, 19px) var(--term); opacity: .7; }
.cart-item.on { background: rgba(239, 183, 62, .18); box-shadow: inset 0 0 0 1px rgba(239, 183, 62, .5); }
.cart-hint { font: clamp(8px, 1.5vmin, 11px) var(--pixel); text-align: center; opacity: .5; }
.cart-seed { display: flex; gap: 6px; }
.cart-seed input { flex: 1; min-width: 0; font: 20px var(--term); padding: 4px 8px; background: #07050c; color: var(--phosphor); border: 1px solid #5dff9b55; }
.cart-seed button { font: 12px var(--pixel); padding: 0 12px; background: var(--mustard); color: var(--ink); }

@media (prefers-reduced-motion: reduce) { .df-banner, .df-end, .df-slot, .df-end h2 span { animation: none; transition: none; } }

/* the cinematic first choice: the playroom's 2.5D Stage shows through */
.df-root.df-cine { background: transparent; pointer-events: none; }
.df-root.df-cine .df-canvas, .df-root.df-cine .df-cross { visibility: hidden; }
.df-root.df-cine .df-hud > *, .df-root.df-cine .df-clip, .df-root.df-cine .skip, .df-root.df-cine .df-end, .df-root.df-cine .df-overlay { pointer-events: auto; }
/* the intro clip sits under the HUD (z 5): the way back is never covered */
.df-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 4; background: #000; }
.df-root.df-clipping .df-cross, .df-root.df-clipping .df-inv, .df-root.df-clipping .df-prompt { visibility: hidden; }
.df-root > .skip { z-index: 7; }

/* pause button, Studio way back, pause menu */
.df-pausebtn { position: absolute; right: 12px; top: calc(10px + var(--safe-t)); width: 44px; height: 40px; font: 14px var(--pixel); background: rgba(18, 13, 28, .72); color: var(--cream); border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(246, 231, 200, .22); pointer-events: auto; }
.df-exit.df-studio { top: calc(56px + var(--safe-t)); background: rgba(28, 78, 138, .85); }
.df-pause .df-pause-row { flex-direction: column; min-width: min(80vw, 300px); }
.df-pause .df-pause-row button { min-height: 46px; }
