:root {
  color-scheme: dark;
  font-family: Manrope, system-ui, sans-serif;
  font-synthesis: none;
  --ink: #f8f1e8;
  --muted: #c2b8cb;
  --panel: rgba(25, 20, 37, 0.84);
  --edge: rgba(255, 255, 255, 0.13);
  --gold: #f4ce73;
  --pink: #f181ad;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #171324; }
body { color: var(--ink); }
button { font: inherit; }

.game-shell { position: relative; width: 100%; height: 100%; overflow: hidden; isolation: isolate; }
#game { display: block; width: 100%; height: 100%; outline: none; }

.topbar { position: absolute; z-index: 2; top: 22px; left: 24px; display: flex; align-items: center; gap: 13px; text-shadow: 0 2px 15px #15101f; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #f4ce7377; border-radius: 14px; background: #f4ce7320; color: var(--gold); font: 500 14px 'DM Mono', monospace; letter-spacing: -1px; }
.eyebrow { margin: 0 0 4px; color: #e4ca94; font: 500 9px 'DM Mono', monospace; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(20px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.055em; }
h1 span { color: var(--pink); font-weight: 500; }
.rent-chip { margin-left: 6px; padding: 8px 11px; border: 1px solid var(--edge); border-radius: 999px; background: rgba(21, 17, 31, .72); color: var(--muted); font-size: 10px; backdrop-filter: blur(12px); }
.rent-chip strong { color: var(--gold); font-weight: 700; }
.rent-dot, .room-pip { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #78d4a2; box-shadow: 0 0 12px #78d4a2; vertical-align: 1px; }

.mission-card { position: absolute; z-index: 2; top: 100px; left: 24px; width: min(292px, calc(100vw - 36px)); padding: 16px 17px 15px; border: 1px solid var(--edge); border-radius: 16px; background: var(--panel); box-shadow: 0 14px 48px #0c081555; backdrop-filter: blur(15px); }
.mission-card h2 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.035em; }
.mission-card > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.task-list { display: grid; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; }
.task-list li { display: flex; gap: 8px; align-items: center; color: #e9e0ed; font-size: 10px; }
.task-list li.done { color: #b4d7bb; text-decoration: line-through; text-decoration-color: #b4d7bb77; }
.task-check { display: grid; width: 15px; height: 15px; flex: 0 0 15px; place-items: center; border: 1px solid #ffffff39; border-radius: 50%; color: #161522; font-size: 9px; }
.done .task-check { border-color: #8ad0a2; background: #8ad0a2; }

.room-label { position: absolute; z-index: 2; top: 69px; right: 24px; padding: 8px 11px; border: 1px solid var(--edge); border-radius: 999px; background: #191426a8; color: #d7cfe0; font: 10px 'DM Mono', monospace; backdrop-filter: blur(12px); }
.room-pip { background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.audio-controls { position: absolute; z-index: 3; top: 25px; right: 24px; display: flex; gap: 7px; }
.audio-controls button, #close-interview { padding: 8px 11px; border: 1px solid var(--edge); border-radius: 999px; background: rgba(25, 20, 37, .88); color: #f8f1e8; font-size: 10px; backdrop-filter: blur(12px); cursor: pointer; }
.audio-controls button[aria-pressed="true"] { border-color: #f4ce7380; color: var(--gold); }
.controls-card { position: absolute; z-index: 2; right: 24px; bottom: 55px; width: 226px; padding: 13px 14px; border: 1px solid var(--edge); border-radius: 15px; background: var(--panel); box-shadow: 0 14px 48px #0c081555; backdrop-filter: blur(15px); }
.control-row { display: flex; align-items: center; gap: 5px; min-height: 25px; }
.control-caption { margin-left: 5px; color: #ded5e5; font-size: 10px; }
.keycap { display: inline-grid; min-width: 21px; height: 21px; place-items: center; border: 1px solid #ffffff39; border-bottom-width: 2px; border-radius: 6px; background: #ffffff10; color: var(--gold); font: 500 10px 'DM Mono', monospace; }
.keycap.wide { min-width: 75px; }
.tiny-note { margin-top: 9px; padding-top: 8px; border-top: 1px solid #ffffff15; color: #a99fb4; font-size: 9px; line-height: 1.5; }
.touch-controls { display: none; }

.interaction { position: absolute; z-index: 3; bottom: 21%; left: 50%; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 8px; transform: translateX(-50%); border: 1px solid #f4ce735f; border-radius: 999px; background: rgba(25, 20, 37, .9); box-shadow: 0 7px 25px #09071155; color: #fff8ed; font-size: 11px; white-space: nowrap; backdrop-filter: blur(12px); }
.interaction .keycap { width: 25px; height: 25px; background: var(--gold); color: #24202b; font-weight: 700; }
.toast { position: absolute; z-index: 4; bottom: 20px; left: 50%; max-width: min(540px, calc(100% - 32px)); padding: 11px 15px; transform: translate(-50%, 14px); border: 1px solid #f4ce735f; border-radius: 12px; background: rgba(26, 20, 37, .95); box-shadow: 0 12px 34px #09071166; color: #fff6e4; font-size: 12px; line-height: 1.5; opacity: 0; pointer-events: none; text-align: center; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.interview { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; padding: 5vh 5vw; background: linear-gradient(180deg, #100d1b1c 0%, #100d1b05 46%, #100d1bb8 100%); pointer-events: none; }
.interview-frame { position: relative; display: flex; width: min(900px, 94vw); height: min(760px, 90vh); flex-direction: column; justify-content: flex-start; padding: 18px; border: 1px solid #fff7; border-radius: 22px; background: linear-gradient(135deg, #ffffff0d, transparent 35%); box-shadow: inset 0 0 0 7px #120e1a18, 0 22px 70px #08061055; }
.interview-topline { display: flex; justify-content: space-between; gap: 12px; color: #fff5e7; font: 600 10px 'DM Mono', monospace; letter-spacing: .08em; text-shadow: 0 2px 8px #000; }
.record-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #ff5574; box-shadow: 0 0 12px #ff5574; animation: record-pulse 1.3s ease-in-out infinite; }
.camera-label { color: #efe5d0b8; }
.camera-corners { position: absolute; inset: 58px 22% 120px; pointer-events: none; }
.camera-corners i { position: absolute; width: 24px; height: 24px; border-color: #fff9; border-style: solid; }
.camera-corners i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.camera-corners i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.camera-corners i:nth-child(3) { right: 0; bottom: 0; border-width: 0 1px 1px 0; }
.camera-corners i:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.interview-caption { position: absolute; bottom: 18px; left: 18px; width: min(520px, calc(100% - 190px)); margin: 0; padding: 13px 16px; border-left: 3px solid var(--pink); background: #171324d9; box-shadow: 0 8px 25px #0005; }
.interview-caption .eyebrow { font-size: 8px; }
.interview-caption p:last-child { margin: 0; color: #fff4e4; font-size: clamp(12px, 2vw, 16px); line-height: 1.5; }
#close-interview { position: absolute; right: 18px; bottom: 18px; pointer-events: auto; border-color: #f4ce7380; color: var(--gold); font-weight: 700; }
.interview-mode > .topbar, .interview-mode > .mission-card, .interview-mode > .room-label, .interview-mode > .audio-controls, .interview-mode > .interaction, .interview-mode > .toast, .interview-mode > .controls-card, .interview-mode > .touch-controls, .interview-mode > .footer-note { opacity: 0; pointer-events: none; transition: opacity .25s ease; }
@keyframes record-pulse { 50% { opacity: .4; } }
.footer-note { position: absolute; z-index: 2; bottom: 19px; left: 24px; display: flex; gap: 9px; align-items: center; color: #bfb5c6; font-size: 9px; text-shadow: 0 2px 10px #100b1c; }
.footer-note span:first-child { color: #f0c6dd; font: 500 8px 'DM Mono', monospace; letter-spacing: .12em; }
.footer-note span + span::before { content: '·'; margin-right: 8px; color: #99899f; }

.loading, .error { position: absolute; z-index: 10; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; background: radial-gradient(ellipse at 50% 45%, #362b48, #171324 70%); text-align: center; }
.loading p { margin: 9px 0 0; font-weight: 700; }
.loading small { color: var(--muted); font-size: 11px; }
.loader { width: 28px; height: 28px; border: 2px solid #ffffff30; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
.error { padding: 24px; color: #ffcfda; line-height: 1.6; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .topbar { top: 12px; left: 13px; gap: 9px; }
  .brand-mark { width: 37px; height: 37px; border-radius: 12px; }
  .rent-chip { display: none; }
  .mission-card { top: 67px; left: 12px; width: min(245px, calc(100vw - 24px)); padding: 12px; }
  .mission-card h2 { font-size: 14px; }
  .mission-card > p:not(.eyebrow) { font-size: 10px; }
  .task-list { gap: 6px; margin-top: 10px; }
  .task-list li { font-size: 9px; }
  .room-label { top: 55px; right: 12px; font-size: 8px; }
  .audio-controls { top: 12px; right: 12px; gap: 5px; }
  .audio-controls button { padding: 7px 8px; font-size: 9px; }
  .controls-card { right: 12px; bottom: 49px; width: 203px; padding: 9px 10px; }
  .tiny-note { font-size: 8px; }
  .footer-note { bottom: 120px; left: 50%; display: grid; width: calc(100% - 24px); gap: 3px; transform: translateX(-50%); justify-items: center; font-size: 8px; }
  .footer-note span + span::before { display: none; }
  .interaction { bottom: 25%; }
  .toast { bottom: 145px; font-size: 11px; }
  .interview { padding: 14px; }
  .interview-frame { width: 100%; height: calc(100vh - 28px); padding: 12px; border-radius: 16px; }
  .interview-topline { font-size: 8px; }
  .camera-label { display: none; }
  .camera-corners { inset: 48px 8% 145px; }
  .interview-caption { bottom: 70px; left: 12px; width: calc(100% - 24px); max-width: none; padding: 11px 12px; }
  #close-interview { right: 12px; bottom: 12px; padding: 10px 12px; }
  .controls-card { display: none; }
  .touch-controls { position: absolute; z-index: 5; right: 14px; bottom: 19px; left: 14px; display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
  .touch-pad { display: grid; grid-template-columns: repeat(3, 43px); grid-template-rows: repeat(2, 43px); gap: 5px; pointer-events: auto; touch-action: none; }
  .touch-pad button, #touch-action { border: 1px solid #ffffff40; background: rgba(25, 20, 37, .78); color: #fff4dd; box-shadow: 0 5px 18px #09071155; backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent; user-select: none; }
  .touch-pad button { border-radius: 13px; font-size: 13px; }
  .touch-pad button:active, #touch-action:active { border-color: var(--gold); background: #f4ce7344; }
  .pad-empty { pointer-events: none; }
  #touch-action { display: grid; width: 70px; height: 70px; align-content: center; justify-items: center; gap: 2px; border-color: #f4ce7377; border-radius: 50%; background: rgba(57, 42, 59, .88); color: var(--gold); pointer-events: auto; touch-action: none; }
  #touch-action span { font: 700 18px 'DM Mono', monospace; }
  #touch-action small { color: #fff0d8; font-size: 8px; }
}

@media (pointer: coarse) and (min-width: 721px) {
  .touch-controls { position: absolute; z-index: 5; right: 20px; bottom: 20px; left: 20px; display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
  .touch-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 6px; pointer-events: auto; touch-action: none; }
  .touch-pad button, #touch-action { border: 1px solid #ffffff40; background: rgba(25, 20, 37, .78); color: #fff4dd; box-shadow: 0 5px 18px #09071155; backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent; user-select: none; }
  .touch-pad button { border-radius: 14px; font-size: 14px; }
  .pad-empty { pointer-events: none; }
  #touch-action { display: grid; width: 78px; height: 78px; align-content: center; justify-items: center; gap: 2px; border-color: #f4ce7377; border-radius: 50%; background: rgba(57, 42, 59, .88); color: var(--gold); pointer-events: auto; touch-action: none; }
  #touch-action span { font: 700 20px 'DM Mono', monospace; }
  #touch-action small { color: #fff0d8; font-size: 9px; }
}

@media (max-height: 520px) {
  .mission-card { top: 75px; padding: 10px 12px; }
  .mission-card > p:not(.eyebrow) { display: none; }
  .task-list { margin-top: 7px; }
  .controls-card { bottom: 43px; }
  .footer-note { bottom: 10px; }
}
