@font-face {
  font-family: SUIT;
  src: url('assets/fonts/SUIT-Variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --gw-bg: #130c1d;
  --gw-panel: #21142b;
  --gw-panel-elevated: #2b1837;
  --gw-outline: #b36cc5;
  --gw-outline-soft: #75437f;
  --gw-text: #f2e4ef;
  --gw-muted: #c8a6c7;
  --gw-accent: #ed93d3;
  --gw-danger: #e65b86;
  --gw-paper: #f1d7be;
  --gw-paper-text: #402036;
  --gw-radius: 4px;
  --gw-space-1: 4px;
  --gw-space-2: 8px;
  --gw-space-3: 12px;
  --gw-space-4: 16px;
  --gw-transition-panel: 250ms;
  --shutter-duration: 700ms;
  --hud-height: 80px;
  --title-height: 40px;
  --layout-gap: var(--gw-space-4);
  --page-padding: 16px;
  --panel-padding: 14px;
  --slot-size: 58px;
  --bottom-height: 208px;
  --dialogue-height: 264px;
  --notes-width: 28%;
  --compact-padding: 10px;
  --font-body: 15px;
  --font-title: 17px;
  --font-small: 12px;
  --font-code: 11px;
  font-family: SUIT, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: var(--font-body);
  line-height: 22px;
  font-weight: 500;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--gw-bg); color: var(--gw-text); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button, a, [tabindex] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid #fff0b3; outline-offset: -3px; }
button { transition: background-color .15s, border-color .15s, box-shadow .15s; }
button:hover { border-color: #f5c7ee; }
button svg { pointer-events: none; }
h1, h2, h3, h4, p, ul, dl, dd, blockquote { margin: 0; }
small { font-size: var(--font-small); line-height: 17px; }
svg { display: block; }
.ui-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.pixel-icon { width: 100%; height: 100%; display: block; filter: drop-shadow(2px 3px 0 #09050d80); }
.prologue-screen {
  isolation: isolate;
  max-width: 2400px;
  height: 100dvh;
  min-height: 700px;
  margin: auto;
  padding: 0 var(--page-padding);
  display: grid;
  grid-template-rows: var(--hud-height) minmax(0, 1fr) var(--bottom-height) 44px;
  gap: var(--layout-gap);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #3d224b55, transparent 70%), repeating-linear-gradient(125deg, #190f23 0 3px, #130c1d 3px 8px);
}

.top-header { display: grid; grid-template-columns: 18fr 21fr 25fr 36fr; align-items: center; min-width: 0; border-bottom: 1px solid #8c427a; }
.top-header > * { min-width: 0; padding: 8px 18px; }
.top-header > * + * { border-left: 1px solid #9f4f8c88; }
.brand { display: flex; align-items: center; gap: var(--gw-space-3); padding-left: 4px; }
.sigil { width: 42px; flex: 0 0 42px; color: var(--gw-accent); filter: drop-shadow(0 0 4px #c75eb25c); }
.sigil svg { width: 100%; height: 48px; fill: none; stroke: currentColor; stroke-width: 2; }
.brand strong { display: block; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
.brand small { display: block; font-size: var(--font-code); line-height: 15px; color: var(--gw-accent); white-space: nowrap; margin-top: 2px; }
.case-heading { text-align: center; }
.case-heading > span { display: block; color: var(--gw-accent); font-size: var(--font-code); line-height: 15px; letter-spacing: 1.5px; font-weight: 600; }
.case-heading h1 { font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: 3px; color: #f2a7d0; }
.case-heading em { font-size: var(--font-small); line-height: 17px; font-family: Georgia, serif; letter-spacing: 1px; }
.clock { display: flex; align-items: center; justify-content: space-evenly; gap: var(--gw-space-3); height: 44px; margin: 0 18px; padding: 0 12px; border: 1px solid var(--gw-outline); border-radius: var(--gw-radius); background: #1b1026cf; box-shadow: inset 0 0 0 2px #38203e; white-space: nowrap; }
.clock span { display: inline-flex; align-items: center; justify-content: center; gap: var(--gw-space-2); font-size: var(--font-small); line-height: 17px; }
.clock span:first-child { padding-right: 12px; border-right: 1px solid #925583; }
.clock span:last-child { padding-left: 12px; border-left: 1px solid #925583; }
.clock strong { font-size: 22px; line-height: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.top-header nav { display: flex; justify-content: flex-end; gap: var(--gw-space-2); padding-right: 0; }
.pixel-button { min-height: 46px; min-width: 40px; padding: 10px 12px; border: 1px solid #a568b3; border-radius: var(--gw-radius); background: linear-gradient(#37213f, #22132d); box-shadow: inset 0 0 0 2px #29172f, inset 0 2px #c68bb333; display: inline-flex; align-items: center; justify-content: center; gap: var(--gw-space-2); font-size: 15px; line-height: 20px; font-weight: 600; }
.pixel-button:hover { background: #4b2855; box-shadow: inset 0 0 0 2px #693c74, 0 0 8px #ba6bb144; }
.pixel-button .ui-icon { width: 20px; height: 20px; flex-basis: 20px; color: #e7b3e4; }
.top-header .pixel-button { height: 40px; min-height: 40px; white-space: nowrap; padding: 8px 11px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; padding: 8px; border: 1px solid #a16caf; border-radius: var(--gw-radius); background: linear-gradient(#402348, #25142d); color: var(--gw-accent); }
.icon-button:hover { background: #5d3063; }
.icon-button .ui-icon { width: 20px; height: 20px; flex-basis: 20px; }

.stage { min-height: 0; position: relative; pointer-events: none; }
.stage > .pixel-frame { pointer-events: auto; }
.scene-viewport { position: absolute; inset: -8px -16px; overflow: hidden; z-index: -1; background: radial-gradient(ellipse, #542850, #160f21); pointer-events: auto; }
.scene-viewport::before { content: ''; position: absolute; inset: -64px; background-image: var(--scene-backdrop); background-size: cover; background-position: center top; filter: blur(24px) brightness(.9); transform: scale(1.03); pointer-events: none; }
.scene-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center top; image-rendering: pixelated; mask-image: linear-gradient(to right, transparent var(--scene-image-left, 0px), #000 calc(var(--scene-image-left, 0px) + 32px), #000 calc(var(--scene-image-right, 100%) - 32px), transparent var(--scene-image-right, 100%)), linear-gradient(to bottom, #000 calc(var(--scene-image-bottom, 100%) - 32px), transparent var(--scene-image-bottom, 100%)); mask-composite: intersect; }
.field-shutters { position: absolute; inset: 0; overflow: hidden; z-index: 4; pointer-events: none; }
.field-shutter { position: absolute; top: 0; bottom: 0; width: 50.15%; background-repeat: repeat; background-size: 100% 100%; image-rendering: pixelated; will-change: transform; }
.field-shutter-left { left: 0; transform: translateX(-101%); }
.field-shutter-right { right: 0; transform: translateX(101%); }
.field-shutter::after { content: ''; position: absolute; top: 0; bottom: 0; width: 3px; background: linear-gradient(to right, #170e22, #4b3153, #231628); box-shadow: 0 0 0 1px #170e22; }
.field-shutter-left::after { right: 0; }
.field-shutter-right::after { left: 0; }
.protagonist-layer { position: absolute; left: 2%; top: 3%; width: 43%; height: 97%; overflow: hidden; pointer-events: none; user-select: none; z-index: 1; }
.protagonist-layer img { display: block; width: auto; max-width: none; height: 210%; transform: translateX(-28%) scaleX(-1); transform-origin: center; image-rendering: pixelated; filter: drop-shadow(0 6px 4px #10091b77); }
.entity-layer { position: absolute; left: 48%; top: 20%; width: 8%; height: 24%; opacity: .6; filter: drop-shadow(0 0 8px #cd80ef); mix-blend-mode: screen; }
.lighting-overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(90deg, #10091b55, transparent 25%, transparent 70%, #170c2055), linear-gradient(0deg, #10091988, transparent 28%); box-shadow: inset 0 0 70px #0a051866; }
.lighting-overlay::after { content: ''; position: absolute; inset: 0; opacity: .1; background: repeating-linear-gradient(transparent 0 3px, #0d051a 3px 4px); }
.scene-caption { position: absolute; top: 10px; left: var(--gw-space-3); padding: 8px 12px; background: #170e23bd; border-left: 2px solid var(--gw-accent); font-size: var(--font-small); line-height: 17px; z-index: 3; }
.scene-caption > span:last-child { color: var(--gw-muted); margin-left: 12px; }
.live-dot { display: inline-block; width: 5px; height: 5px; background: var(--gw-accent); margin-right: 8px; box-shadow: 0 0 8px #ef5b8a; }
.pixel-frame { min-height: 0; min-width: 0; position: relative; display: grid; grid-template-rows: var(--title-height) minmax(0, 1fr); border: 1px solid var(--gw-outline); border-radius: var(--gw-radius); background: linear-gradient(115deg, #25162deF, #130b1ceF); box-shadow: 0 0 0 2px #29172f, 0 0 0 3px #75437f88, inset 0 0 0 3px #38203e; }
.pixel-frame::before, .pixel-frame::after { content: ''; position: absolute; width: 6px; height: 6px; border: 1px solid var(--gw-accent); transform: rotate(45deg); background: #2a1532; z-index: 4; pointer-events: none; }
.pixel-frame::before { left: -3px; top: 5px; }
.pixel-frame::after { right: -3px; bottom: 5px; }
.panel-heading { min-width: 0; height: var(--title-height); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #9c599b; padding-left: 12px; gap: var(--gw-space-2); background: linear-gradient(100deg, #392039bb, #1b1126); }
.panel-heading h2 { display: flex; align-items: center; gap: var(--gw-space-2); min-width: 0; font-size: var(--font-title); line-height: 22px; font-weight: 700; white-space: nowrap; }
.panel-heading h2 > .ui-icon { color: var(--gw-accent); }
.panel-heading small { font-size: var(--font-code); line-height: 15px; font-weight: 600; letter-spacing: 1px; color: var(--gw-accent); }
.panel-toggle { border-top: 0; border-right: 0; border-bottom: 0; height: 40px; border-radius: 0 3px 0 0; }
.panel-content { min-width: 0; min-height: 0; overflow: hidden; }
.panel-content[hidden] { display: none; }
.panel-body { padding: var(--panel-padding); }
.collapsible[data-collapsed=true] { height: calc(var(--title-height) + 2px); }
.case-info { height: 100%; }
.case-body { height: 100%; padding: var(--compact-padding); overflow-y: auto; scrollbar-gutter: stable; }
.case-body, .notes-list, .note-detail, .dialogue-copy, .popover-content, .patch-notes { scrollbar-width: thin; scrollbar-color: #b070bd #24142e; overscroll-behavior: contain; }
.time-line { display: flex; justify-content: space-between; align-items: center; padding-bottom: 4px; border-bottom: 0; font-size: var(--font-small); line-height: 17px; }
.time-line strong { font-weight: 600; }
.time-line span { display: inline-flex; align-items: center; gap: var(--gw-space-2); }
.location { padding: 4px 0 6px; border-bottom: 1px solid #95538a; }
.location small { display: none; }
.location strong { display: block; margin: 0; font-size: var(--font-body); line-height: 22px; font-weight: 600; }
.location > span { display: none; }
.case-body h3 { display: flex; align-items: center; gap: var(--gw-space-2); margin: 8px 0 4px; font-size: var(--font-body); line-height: 22px; }
.case-body h3 .ui-icon { color: var(--gw-danger); fill: var(--gw-danger); }
.objectives { list-style: none; padding: 0; display: grid; gap: 6px; }
.objectives li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--font-body); line-height: 22px; }
.checkbox { width: 14px; height: 14px; border: 1px solid #e4bde5; border-radius: 2px; margin-top: 4px; flex: 0 0 14px; }
.case-stamp { border-top: 1px solid #663960; margin-top: 18px; padding-top: 10px; font-size: var(--font-small); color: #ac88b1; }
.case-stamp b { float: right; color: #d1a1cb; font-variant-numeric: tabular-nums; }
.inventory { height: 100%; grid-template-rows: var(--title-height) minmax(0, 1fr); }
.inventory .panel-content { overflow: visible; }
.inventory .panel-heading h2 { flex: 1; }
.inventory-grid { display: grid; grid-template-columns: repeat(var(--inventory-columns, 6), var(--slot-size)); grid-template-rows: repeat(2, var(--slot-size)); gap: 10px; justify-content: safe center; align-content: center; height: 100%; padding: 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #b070bd #24142e; }
.inventory-slot { user-select: none; touch-action: none; width: var(--slot-size); height: var(--slot-size); aspect-ratio: 1; padding: 5px; border: 1px solid #9e6baf; border-radius: 2px; position: relative; background: radial-gradient(ellipse at 50% 80%, #48304e55, #110c1c 80%); box-shadow: inset 0 0 0 2px #271831; }
.inventory-slot::before { content: ''; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; border-left: 2px solid #e8c0eb; border-top: 2px solid #e8c0eb; }
.inventory-slot:hover { background: #4b2855; box-shadow: 0 0 9px #d778c555; }
.inventory-slot.selected { border-color: #f4c5ef; background: #512446; box-shadow: 0 0 8px #df7acb99, inset 0 0 0 2px #a767ac; }
.dialogue { position: absolute; left: 0; bottom: 0; width: min(1040px, calc(100% - var(--notes-width) - var(--layout-gap))); height: var(--dialogue-height); }
.dialogue .panel-heading { padding-left: 16px; }
.dialogue-body { height: 100%; display: flex; align-items: stretch; gap: 18px; position: relative; }
.portrait { position: relative; width: 134px; flex: 0 0 134px; height: 100%; min-height: 60px; background: radial-gradient(ellipse, #854c77, #301b3e 65%); border: 1px solid #9f64a9; border-radius: 2px; overflow: hidden; }
.portrait img { position: absolute; width: 230%; max-width: none; height: auto; left: -60%; top: -8%; image-rendering: pixelated; }
.portrait small { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; background: #160c22dc; color: #c9a6cb; font-size: var(--font-code); line-height: 15px; }
.dialogue-copy { flex: 1; min-width: 0; overflow-y: auto; padding-right: 8px; }
.dialogue-index { display: block; color: #d79ac8; font-size: var(--font-code); line-height: 15px; letter-spacing: 1px; margin-bottom: 10px; }
.dialogue-copy p { font-size: 18px; line-height: 28px; font-weight: 500; }
.dialogue-arrow { position: absolute; bottom: 8px; right: 8px; color: var(--gw-accent); pointer-events: none; filter: drop-shadow(0 0 4px #f25bac); }
.dialogue-arrow .ui-icon { width: 24px; height: 24px; }
.notebook { position: absolute; right: 0; bottom: 0; width: var(--notes-width); height: 100%; max-height: 100%; background: var(--gw-paper); }
.notebook-inner { height: 100%; padding: 5px; color: var(--gw-paper-text); display: grid; grid-template-rows: 40px minmax(0, 1fr); gap: 5px; background: linear-gradient(110deg, #f5dcc1, #d5b29e); }
.note-tabs { display: flex; gap: var(--gw-space-1); min-width: 0; }
.note-tabs button { flex: 1; min-width: 40px; min-height: 40px; padding: 6px 4px; font-size: var(--font-body); line-height: 22px; border: 1px solid #a47b96; border-radius: 4px 4px 0 0; background: #805672; color: #f1d6e7; }
.note-tabs button[aria-selected=true] { background: #f0d0af; color: var(--gw-paper-text); border-color: #b48a77; box-shadow: inset 0 3px #fff0ce; font-weight: 700; }
.notes-columns { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 0; min-width: 0; gap: var(--gw-space-2); }
.notes-list { overflow-y: auto; min-height: 0; border: 1px solid #bc9286; background: #edcbae; }
.note-entry { display: flex; align-items: center; gap: 9px; min-height: 40px; width: 100%; padding: 7px 8px; text-align: left; border: 0; border-bottom: 1px solid #c6978f; background: transparent; color: var(--gw-paper-text); font-size: var(--font-body); line-height: 22px; word-break: keep-all; }
.note-entry:hover { background: #e3af9e; }
.note-entry.active { background: #df9391; box-shadow: inset 2px 0 #b54d65; font-weight: 700; }
.note-checkbox { width: 6px; height: 6px; border: 1px solid #b45c68; flex: 0 0 6px; }
.note-detail { min-width: 0; overflow-y: auto; padding: 8px; border: 1px solid #c69c89; background: #f0d2b8; }
.evidence-image { min-height: 100px; height: 120px; border: 5px solid #d6ae92; background: repeating-linear-gradient(17deg, #3b2446 0 4px, #492e55 4px 8px); display: flex; align-items: center; justify-content: center; }
.evidence-image .pixel-icon { max-height: 100px; }
.note-writing h3 { font-size: var(--font-body); line-height: 22px; margin-top: 10px; }
.note-writing > span { display: block; color: #96616b; font-size: var(--font-small); line-height: 17px; margin: 4px 0 8px; }
.note-writing p, .note-writing blockquote { font-size: var(--font-body); line-height: 22px; word-break: keep-all; }
.note-writing blockquote { color: #a02e4d; margin-top: 8px; font-weight: 600; }

.bottom-panels { display: grid; grid-template-columns: minmax(330px, 24fr) minmax(300px, 23fr) minmax(200px, 16fr) minmax(340px, 22fr) minmax(230px, 15fr); grid-template-rows: minmax(0, 1fr); gap: var(--gw-space-4); min-height: 0; padding: 0 5px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #b070bd #24142e; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(46px, 1fr)); height: 100%; gap: var(--gw-space-3); }
.action-grid .pixel-button { padding: 8px 5px; }
.action-grid button[aria-pressed=true] { background: linear-gradient(#e1a8ed, #ab6fcb); color: #2b1735; border-color: #f4d1f3; box-shadow: inset 0 0 0 2px #ae79bc, 0 0 10px #c25ca566; }
.action-grid button[aria-pressed=true] .ui-icon { color: #492258; }
.status-body { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; height: 100%; padding: var(--compact-padding); align-items: center; }
.vitals { display: grid; gap: 24px; }
.stat-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--gw-space-3); align-items: end; }
.stat-row > span { display: inline-flex; align-items: center; gap: var(--gw-space-2); white-space: nowrap; padding-bottom: 1px; }
.stat-row .ui-icon { color: var(--gw-accent); }
.stat-row > div > small { display: block; text-align: right; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.progress { height: 18px; border: 1px solid #e8b8e3; padding: 3px; background: #100b17; box-shadow: 0 0 0 1px #613268; }
.progress > i { height: 100%; display: block; }
.progress.health > i { background: linear-gradient(#cdfb9e, #85c861); }
.progress.sanity > i { background: linear-gradient(#f0c0f4, #b878d0); }
.abilities { border: 1px solid #6c3b77; padding: 2px 8px; background: #1c1029; }
.abilities > div { display: flex; justify-content: space-between; align-items: center; gap: var(--gw-space-2); min-height: 24px; border-bottom: 1px solid #68426b88; }
.abilities > div:last-child { border-bottom: 0; }
.abilities dt { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: var(--font-body); line-height: 22px; }
.abilities .ui-icon { width: 14px; height: 14px; flex-basis: 14px; color: var(--gw-accent); }
.abilities dd { font-variant-numeric: tabular-nums; }
.threat-body { height: 100%; position: relative; padding: var(--compact-padding) 26% var(--compact-padding) var(--compact-padding); }
.threat-level { display: flex; justify-content: space-between; align-items: center; gap: var(--gw-space-2); margin-bottom: 8px; }
.threat-level strong { font-size: 22px; line-height: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.threat-level strong small { font-size: var(--font-body); line-height: 22px; }
.progress.danger { height: 18px; border-color: #f4afcb; box-shadow: 0 0 0 1px #87354e; }
.progress.danger > i { background: linear-gradient(#ff94b7, #d93b70); }
.next-sign { display: flex; align-items: center; gap: 6px; border-top: 1px solid #854069; margin-top: 10px; padding-top: 8px; }
.next-sign > .ui-icon { width: 18px; height: 18px; flex-basis: 18px; color: var(--gw-danger); }
.next-sign small { color: var(--gw-accent); }
.next-sign p { margin-top: 3px; font-size: var(--font-body); line-height: 22px; }
.next-sign p span { color: var(--gw-muted); }
.ghost { position: absolute; right: 10px; top: 12px; width: 20%; height: calc(100% - 24px); background: repeating-linear-gradient(90deg, #a0285533 0 3px, #42112a55 3px 8px); border: 1px solid #ac315e; border-radius: 50% 50% 0 0; clip-path: polygon(0 100%, 6% 19%, 20% 3%, 50% 0, 80% 8%, 94% 29%, 100% 100%, 86% 91%, 74% 99%, 59% 90%, 40% 100%, 25% 92%, 11% 100%); }
.ghost i { position: absolute; top: 29%; width: 5px; height: 7px; background: #f279ad; box-shadow: 0 0 8px #f43883; }
.ghost i:first-child { left: 29%; }
.ghost i:last-child { right: 29%; }
.screen-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--gw-space-3); border-top: 1px solid #74376d; color: var(--gw-muted); font-size: var(--font-small); line-height: 17px; }
.screen-footer > span { display: inline-flex; align-items: center; gap: var(--gw-space-2); white-space: nowrap; }
.screen-footer .ui-icon { width: 14px; height: 14px; flex-basis: 14px; color: var(--gw-accent); }
.screen-footer i { font-style: normal; margin: 0 6px; color: #b279a5; }
.preview-toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 8px); max-width: calc(100vw - 32px); padding: 10px 20px; border: 1px solid var(--gw-outline); border-radius: var(--gw-radius); background: #21132ef5; color: var(--gw-text); z-index: 10; font-size: var(--font-small); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.preview-toast.visible { opacity: 1; transform: translate(-50%, 0); }

.dialog-open body { overflow: hidden; }
.gw-dialog { color: var(--gw-text); border: 1px solid var(--gw-outline); border-radius: var(--gw-radius); padding: 0; background: linear-gradient(120deg, #2b1837f7, #130b1bf7); box-shadow: 0 0 0 2px #412349, 0 0 0 3px #9f5baa, 0 0 24px #ad55a244; overflow: hidden; }
.gw-dialog::backdrop { background: #10091b45; }
.modal-heading { height: 50px; display: flex; align-items: center; justify-content: space-between; gap: var(--gw-space-3); padding: 5px 10px 5px 16px; border-bottom: 1px solid var(--gw-outline); box-shadow: inset 0 -3px #56275877; background: linear-gradient(90deg, #48213f, #24132e); }
.modal-heading h2 { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 20px; line-height: 26px; font-weight: 700; }
.modal-heading h2 > span { overflow-wrap: anywhere; }
.modal-heading h2 .ui-icon { color: var(--gw-accent); }
.item-popover { position: fixed; inset: auto; margin: 0; width: min(320px, calc(100vw - 16px)); padding: 0; border: 1px solid var(--gw-outline); border-radius: var(--gw-radius); color: var(--gw-text); background: linear-gradient(120deg, #2b1837, #160d20); box-shadow: 0 0 0 2px #412349, 0 8px 24px #09030f88; overflow: visible; }
.item-name-tooltip { position: fixed; z-index: 110; max-width: min(280px, calc(100vw - 16px)); padding: 4px 8px; border: 1px solid var(--gw-outline-soft); border-radius: var(--gw-radius); color: var(--gw-text); background: var(--gw-panel); box-shadow: 0 2px 8px #09030f88; font-size: var(--font-small); line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.item-popover::after { content: ''; position: absolute; width: 8px; height: 8px; background: #21142b; border: solid var(--gw-outline); border-width: 0 1px 1px 0; transform: rotate(45deg); pointer-events: none; }
.item-popover[data-placement=top]::after { left: calc(var(--anchor-x) - 4px); bottom: -5px; }
.item-popover[data-placement=bottom]::after { left: calc(var(--anchor-x) - 4px); top: -5px; transform: rotate(225deg); }
.item-popover[data-placement=left]::after { right: -5px; top: calc(var(--anchor-y) - 4px); transform: rotate(-45deg); }
.item-popover[data-placement=right]::after { left: -5px; top: calc(var(--anchor-y) - 4px); transform: rotate(135deg); }
.popover-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--gw-space-2); min-height: 42px; padding-left: var(--gw-space-3); border-bottom: 1px solid var(--gw-outline-soft); }
.popover-heading h2 { min-width: 0; font-size: var(--font-title); line-height: 22px; overflow-wrap: anywhere; }
.popover-heading .icon-button { border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0 3px 0 0; }
.popover-content { max-height: calc(100dvh - 100px); overflow-y: auto; padding: var(--gw-space-3); }
.item-summary { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--gw-space-3); align-items: center; }
.item-small-art { width: 64px; height: 64px; padding: 4px; background: #38203f; border: 1px solid var(--gw-outline-soft); border-radius: var(--gw-radius); }
.item-information { min-width: 0; }
.item-tags { display: flex; flex-wrap: wrap; gap: var(--gw-space-1); margin-bottom: 6px; }
.item-tags span { padding: 0 5px; font-size: var(--font-small); line-height: 17px; border: 1px solid #89507e; border-radius: 3px; background: #2f1837; }
.item-tags span:first-child { background: #71334f; border-color: #cf769d; }
.item-information p { font-size: var(--font-body); line-height: 22px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.item-targets { display: flex; flex-wrap: wrap; list-style: none; gap: var(--gw-space-2); padding: var(--gw-space-2) 0 0; border-top: 1px solid var(--gw-outline-soft); margin-top: var(--gw-space-2); }
.item-targets[hidden] { display: none; }
.item-targets li { display: inline-flex; align-items: center; gap: var(--gw-space-1); font-size: var(--font-small); line-height: 17px; color: var(--gw-muted); }
.item-targets .ui-icon { width: 14px; height: 14px; flex-basis: 14px; }

.settings-dialog { width: min(680px, calc(100vw - 40px)); max-height: calc(100dvh - 48px); margin: auto; }
.settings-dialog::backdrop { background: #0b061599; }
.settings-tabs { padding: 16px 20px 0; }
.settings-tabs button { min-height: 40px; padding: 8px 20px; border: 1px solid #a964ad; border-radius: 4px 4px 0 0; background: #613566; font-size: var(--font-body); line-height: 22px; }
.patch-notes { max-height: calc(100dvh - 210px); padding: 20px; overflow-y: auto; }
.patch-notes article + article { border-top: 1px solid #74417e; margin-top: 24px; padding-top: 24px; }
.patch-notes article > header { display: flex; align-items: center; justify-content: space-between; gap: var(--gw-space-3); flex-wrap: wrap; }
.patch-notes h3 { color: var(--gw-accent); font-size: 20px; line-height: 26px; }
.patch-notes time { font-size: var(--font-small); line-height: 17px; color: var(--gw-muted); }
.patch-notes h4 { font-size: var(--font-body); line-height: 22px; margin: 18px 0 8px; color: var(--gw-accent); }
.patch-notes ul { padding-left: 22px; font-size: var(--font-body); line-height: 22px; }
.patch-notes li + li { margin-top: 8px; }

@media (max-width: 1650px) {
  :root { --page-padding: 12px; --panel-padding: 12px; --layout-gap: var(--gw-space-3); --hud-height: 78px; --bottom-height: 192px; --dialogue-height: 248px; --compact-padding: 8px; }
  .top-header > * { padding-left: 12px; padding-right: 12px; }
  .top-header nav { gap: 6px; padding-right: 0; }
  .top-header .pixel-button { padding: 8px; }
  .clock { margin: 0 12px; gap: var(--gw-space-2); padding: 0 8px; }
  .clock span:first-child { padding-right: 8px; }
  .clock span:last-child { padding-left: 8px; }
  .brand { padding-left: 0; gap: var(--gw-space-2); }
  .brand small { font-size: 10px; }
  .inventory-grid { padding: 6px 8px; }
  .action-grid .pixel-button { flex-direction: column; gap: var(--gw-space-1); padding: 4px; }
  .portrait { width: 115px; flex-basis: 115px; }
  .dialogue-body { gap: 14px; }
  .bottom-panels { gap: var(--gw-space-4); }
  .stat-row { gap: var(--gw-space-2); }
  .abilities { padding: 2px 6px; }
}

@media (max-width: 1440px) {
  :root { --page-padding: 10px; --panel-padding: 10px; --layout-gap: var(--gw-space-3); --hud-height: 76px; --slot-size: 52px; --bottom-height: 180px; --dialogue-height: 232px; --notes-width: 30%; --compact-padding: 6px; }
  .prologue-screen { grid-template-rows: var(--hud-height) minmax(0, 1fr) var(--bottom-height) 32px; }
  .top-header { grid-template-columns: 18fr 20fr 25fr 37fr; }
  .top-header > * { padding-left: 10px; padding-right: 10px; }
  .brand strong { font-size: 20px; line-height: 26px; }
  .sigil { width: 36px; flex-basis: 36px; }
  .brand small { font-size: 9px; }
  .case-heading h1 { font-size: 18px; line-height: 24px; letter-spacing: 2px; }
  .clock { margin: 0 8px; gap: 6px; }
  .clock span { gap: 5px; }
  .clock strong { font-size: 20px; }
  .top-header .pixel-button { padding: 8px 6px; gap: 6px; font-size: 14px; }
  .panel-heading { padding-left: 8px; gap: var(--gw-space-1); }
  .panel-heading h2 { gap: 6px; }
  .panel-heading small { letter-spacing: 0; font-size: 10px; }
  .inventory-grid { padding: 2px 6px; }
  .action-grid .pixel-button { padding: 1px 2px; gap: 2px; }
  .abilities > div { min-height: 22px; }
  .portrait { width: 100px; flex-basis: 100px; }
  .dialogue-body { gap: var(--gw-space-3); }
  .dialogue-index { margin-bottom: 6px; }
  .notes-columns { grid-template-columns: 1.1fr 1fr; gap: 5px; }
  .note-entry { padding: 7px 6px; gap: 6px; }
  .bottom-panels { gap: var(--gw-space-3); }
  .abilities dt { gap: var(--gw-space-1); }
  .stat-row > span { gap: 5px; }
  .next-sign { margin-top: 8px; padding-top: 6px; }
}

@media (max-width: 1100px) {
  .prologue-screen { min-width: 800px; height: auto; min-height: 1100px; grid-template-rows: var(--hud-height) 700px 360px 44px; }
  .top-header { grid-template-columns: 1fr 1fr 1.1fr; }
  .top-header nav { position: fixed; bottom: 8px; right: 10px; z-index: 5; padding: 4px; border: 1px solid var(--gw-outline-soft); background: var(--gw-panel); }
  .clock { margin-right: 0; }
  .screen-footer > span:nth-child(2) { display: none; }
}



.demo-mode-label { padding: 2px 6px; border: 1px solid var(--gw-outline-soft); border-radius: var(--gw-radius); font-size: var(--font-small); color: var(--gw-accent); background: var(--gw-panel); }
.demo-field-targets { position: absolute; pointer-events: none; z-index: 3; }
.demo-field-target { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; min-width: 128px; min-height: 46px; padding: 6px 10px; border: 1px solid #b36cc577; border-radius: var(--gw-radius); color: var(--gw-text); background: #21142bd9; text-align: left; box-shadow: 0 2px 6px #0c061b88; }
.demo-field-target strong { display: block; font-size: var(--font-body); line-height: 22px; font-weight: 600; }
.demo-field-target span { display: block; font-size: var(--font-small); line-height: 17px; color: var(--gw-muted); }
.demo-field-target:disabled { opacity: .4; pointer-events: none; }
.demo-tool { width: min(360px, calc(100vw - 16px)); }
.demo-tool::after { content: none; }
.demo-tool-content { padding: var(--gw-space-3); max-height: min(420px, calc(100dvh - 100px)); overflow-y: auto; overscroll-behavior: contain; }
.demo-tool-content p { font-size: var(--font-body); line-height: 22px; margin-bottom: var(--gw-space-3); }
.demo-tool-content > .pixel-button { width: 100%; justify-content: flex-start; margin: 4px 0; }
.demo-tool [data-demo-place]:disabled { opacity: .55; cursor: default; }
.demo-tool-content h3 { font-size: var(--font-title); line-height: 22px; margin-bottom: var(--gw-space-3); color: var(--gw-accent); }
.demo-analysis-list { display: grid; gap: var(--gw-space-2); margin-bottom: var(--gw-space-3); }
.demo-analysis-list label { display: flex; align-items: center; gap: var(--gw-space-2); min-height: 40px; font-size: var(--font-body); line-height: 22px; cursor: pointer; }
.demo-analysis-list input { accent-color: var(--gw-accent); width: 18px; height: 18px; flex-shrink: 0; }
.demo-hypothesis { color: var(--gw-accent); margin-top: var(--gw-space-3); }
.demo-dialogue-choices { display: grid; gap: var(--gw-space-2); margin-top: var(--gw-space-3); }
.demo-choice { min-height: 40px; padding: 8px 10px; text-align: left; border: 1px solid var(--gw-outline-soft); border-radius: var(--gw-radius); background: #30203edb; color: var(--gw-text); font-size: var(--font-body); line-height: 22px; }
.demo-choice:hover { background: #54305d; }
.demo-session-controls:empty, .demo-dialogue-choices:empty { display: none; }
.demo-session-controls { margin-top: var(--gw-space-3); }
.demo-use-button { min-height: 40px; width: 100%; margin-top: var(--gw-space-2); }
.demo-use-button[hidden] { display: none; }

.demo-item-near { outline: 2px solid var(--gw-accent); outline-offset: 3px; }
.inventory-slot.demo-using { outline: 2px solid #fff0b3; outline-offset: -3px; box-shadow: 0 0 10px #ed93d388; }
[data-demo-mode=investigate] [data-perception-zone], [data-demo-mode=investigate] .scene-viewport { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill='%2321142b' stroke='%23f2c3e7' stroke-width='2' d='M4 3h10v2h2v9h-2v2H4v-2H2V5h2z'/%3E%3Cpath stroke='%23f2c3e7' stroke-width='4' d='m14 14 8 8'/%3E%3Cpath stroke='%23b36cc5' stroke-width='2' d='m5 7 5-2'/%3E%3C/svg%3E") 9 9, crosshair; }
.demo-perception-surface { position: fixed; inset: 0; z-index: 100; pointer-events: none; mask-image: radial-gradient(circle var(--lens-radius) at var(--lens-x) var(--lens-y), #000 0, #000 calc(100% - 2px), transparent 100%); -webkit-mask-image: radial-gradient(circle var(--lens-radius) at var(--lens-x) var(--lens-y), #000 0, #000 calc(100% - 2px), transparent 100%); }
.demo-trace { position: absolute; transform: translate(-50%, -50%); width: 170px; padding: 8px; text-align: center; font-size: var(--font-small); line-height: 20px; white-space: pre-line; background: repeating-linear-gradient(0deg, #2e123be6 0 3px, #c73c6a77 3px 4px); border-block: 2px solid #e35a90; }
.demo-trace-weak { color: #edd0e8; opacity: .7; text-shadow: 0 0 4px #b36cc5; }
.demo-trace-abnormal { color: #ff8fba; text-shadow: -2px 1px #7a1e4f, 1px 0 #ee315f; }
.demo-lens { position: fixed; z-index: 101; border: 2px solid #e7b3e4; border-radius: 50%; box-shadow: inset 0 0 0 2px #b36cc577, 0 0 8px #120b1d66; pointer-events: none; }
.demo-lens[data-level=abnormal] { border-color: #ec81b4; }
.demo-item-cursor { width: 32px; height: 32px; position: fixed; z-index: 102; pointer-events: none; padding: 2px; background: #21142bd9; border: 1px solid var(--gw-accent); border-radius: var(--gw-radius); }
@media (prefers-reduced-motion: reduce) {
  button, .preview-toast { transition: none; }
}

