@font-face {
  font-family: 'Jua';
  src: url('fonts/Jua-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Poor Story';
  src: url('fonts/PoorStory-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  font-family: 'Poor Story', system-ui, sans-serif;
  color: #e8eceb;
  background: #101820;
  font-size: 18px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(circle at 20% 0, #263a3b 0, transparent 35%), #101820;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.app {
  max-width: 1510px;
  margin: auto;
  padding: 20px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  font-size: 38px;
  color: #a3d78a;
}
.brand strong {
  display: block;
  font:
    32px 'Jua',
    sans-serif;
  color: #f8e9bc;
  letter-spacing: 0.02em;
}
.brand small {
  display: block;
  color: #aac1b7;
  font-size: 14px;
}
.shift {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #1a2930;
  border: 2px solid #42625a;
  border-radius: 10px;
  padding: 8px 20px;
  box-shadow: 0 5px 0 #0b1218;
}
.shift span {
  font-size: 15px;
  color: #acc6bb;
}
.shift strong {
  font: 28px 'Jua';
  color: #f5d78a;
}
.outline {
  background: #263942;
  border: 2px solid #6e9386;
  border-radius: 8px;
  padding: 8px 18px;
}
main {
  display: grid;
  grid-template-columns: minmax(0, 960px) minmax(290px, 1fr);
  gap: 20px;
}
.game-column {
  min-width: 0;
}
.map-top {
  display: flex;
  justify-content: space-between;
  background: #20333b;
  padding: 8px 14px;
  border: 2px solid #45645d;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  color: #d8e9ce;
}
.map-top span:first-child {
  font-family: 'Jua';
}
.canvas-wrap {
  background: #111a23;
  border: 3px solid #45645d;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 9px 0 #080e14;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.controls {
  display: flex;
  gap: 12px;
  margin-top: 19px;
  align-items: stretch;
}
.controls button {
  border: 2px solid #466861;
  background: #253943;
  box-shadow: 0 4px 0 #101b20;
  border-radius: 7px;
  min-height: 42px;
}
.controls button:hover,
.controls button:focus-visible {
  background: #3a5d61;
  outline: 2px solid #b7d786;
}
.controls button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #101b20;
}
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.dpad button {
  width: 48px;
}
.dpad > div {
  display: flex;
  gap: 3px;
}
.action-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  flex: 1;
}
.action-pad button {
  white-space: nowrap;
  padding: 4px;
}
.action-pad button.danger {
  background: #613e46;
  border-color: #ae6a69;
}
.action-pad button.active {
  background: #69734c;
  border-color: #d1d88b;
}
kbd {
  font-size: 12px;
  color: #adc1b9;
  margin-left: 3px;
}
.key-hint {
  margin: 10px 0;
  color: #9dafac;
  font-size: 15px;
}
.sidebar {
  display: grid;
  gap: 13px;
  align-content: start;
}
.panel {
  background: #1b2a32;
  border: 2px solid #3d5c58;
  box-shadow: 0 5px 0 #0a1419;
  border-radius: 10px;
  padding: 13px 15px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}
.panel h2 {
  font: 21px 'Jua';
  margin: 0;
  color: #f5e4b3;
}
.panel-heading > span {
  font-size: 14px;
  color: #b5c9ba;
}
.meter {
  margin: 9px 0;
}
.meter > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
}
.meter b {
  font-weight: normal;
}
.track,
.mini-progress {
  height: 13px;
  background: #0e1c22;
  border: 1px solid #415c59;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
}
.track i,
.mini-progress i {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.2s;
}
.suspicion {
  background: linear-gradient(90deg, #dbad6d, #d76965);
}
.urge {
  background: linear-gradient(90deg, #a6bb7a, #bd6790);
}
.status-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.status-tags span {
  background: #30434a;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 14px;
}
.objective-panel p {
  margin: 0 0 10px;
  line-height: 1.25;
  color: #d7e2db;
}
.mini-progress i {
  background: #9dc98a;
}
.objective-panel small {
  color: #a6bbb3;
}
.person {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid #35504f;
}
.person:first-child {
  border-top: 0;
}
.person em {
  font-style: normal;
  color: #b5ccba;
  font-size: 14px;
}
.person b {
  font-weight: normal;
}
.person .ally {
  color: #c8dc82;
}
.person .suspect {
  color: #d9a3b4;
}
.person-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.person-actions button {
  border: 1px solid #65887a;
  background: #304e50;
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 15px;
}
.log-panel {
  min-height: 156px;
}
.log-panel ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 15px;
  color: #c6d6cd;
}
.log-panel li {
  padding-bottom: 5px;
  border-bottom: 1px solid #314748;
}
.log-panel time {
  color: #98ae9f;
  margin-right: 6px;
}
footer {
  margin-top: 17px;
  color: #91a9a1;
  font-size: 15px;
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 16, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5;
}
.overlay.hidden {
  display: none;
}
.overlay-card {
  width: min(560px, 100%);
  background: #20343b;
  border: 3px solid #97b493;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 16px 0 #071217;
}
.overlay-card h1 {
  font: 34px 'Jua';
  margin: 0 0 8px;
  color: #f5deaa;
}
.overlay-card p {
  line-height: 1.4;
}
.overlay-card ul {
  padding-left: 22px;
  line-height: 1.5;
}
.overlay-card .buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.overlay-card button {
  background: #aacb83;
  color: #142322;
  border: 2px solid #d3e6aa;
  border-radius: 7px;
  padding: 9px 15px;
  font-family: 'Jua';
}
.overlay-card button.secondary {
  background: #355159;
  color: #e0e8db;
  border-color: #70958b;
}
@media (max-width: 1100px) {
  main {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  .app {
    padding: 9px;
  }
  .topbar {
    gap: 6px;
    flex-wrap: wrap;
  }
  .brand strong {
    font-size: 24px;
  }
  .shift {
    padding: 5px 8px;
    gap: 6px;
  }
  .shift strong {
    font-size: 21px;
  }
  .outline {
    padding: 5px;
  }
  .sidebar {
    grid-template-columns: 1fr;
  }
  .controls {
    flex-direction: column;
  }
  .action-pad {
    grid-template-columns: repeat(4, 1fr);
  }
  .action-pad button {
    font-size: 14px;
  }
  .key-hint {
    font-size: 13px;
  }
}
button[data-action='work'] {
  grid-column: 1/-1;
}

/* 따뜻한 도트 사무실 팔레트와 게임 패널 */
:root {
  color: #f1ead8;
  background: #242a29;
}
body {
  background:
    radial-gradient(circle at 8% 5%, rgba(165, 126, 81, 0.22), transparent 32%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 7px), #222a2b;
}
.brand-icon {
  color: #d4b374;
  text-shadow: 3px 3px #514438;
}
.brand strong {
  color: #ffe1a7;
  text-shadow: 3px 3px #513e32;
}
.brand small,
.key-hint,
footer {
  color: #bcb5a4;
}
.shift,
.panel {
  background: #303b39;
  border: 3px solid #8b765c;
  border-radius: 4px;
  box-shadow:
    5px 6px 0 #151d1e,
    inset 0 0 0 2px #43514c;
}
.shift strong,
.panel h2 {
  color: #f4d295;
}
.shift span,
.panel-heading > span {
  color: #c9c0ab;
}
.map-top {
  background: #594536;
  border: 3px solid #a1845e;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  color: #f6e2b7;
  box-shadow: inset 0 2px #83684b;
}
.canvas-wrap {
  background: #242c2d;
  border: 6px solid #705339;
  border-radius: 0 0 4px 4px;
  box-shadow:
    0 0 0 2px #b38c5e,
    7px 9px 0 #111819;
}
.controls button,
.outline {
  background: #45544d;
  border: 3px solid #927d5f;
  border-radius: 4px;
  box-shadow: 3px 4px 0 #1b2423;
  color: #f8edd0;
}
.controls button:hover,
.controls button:focus-visible,
.outline:hover {
  background: #677a64;
  outline: 2px solid #e3c987;
}
.controls button.danger {
  background: #75504a;
  border-color: #be8c71;
}
.controls button.active {
  background: #6e7650;
  border-color: #d5c689;
}
.track,
.mini-progress {
  background: #202c2b;
  border: 2px solid #786c56;
  border-radius: 1px;
}
.suspicion {
  background: linear-gradient(90deg, #d6af73, #cb6e5d);
}

.urge {
  background: linear-gradient(90deg, #a3bb80, #c4798f);
}
.mini-progress i {
  background: #c2b882;
}
.status-tags span {
  background: #516356;
  border: 1px solid #829374;
  border-radius: 2px;
  color: #eee5c8;
}
.objective-panel p,
.log-panel ol {
  color: #e2ddca;
}
.person {
  border-color: #56605a;
}
.person em {
  color: #bcb7a7;
}
.person-actions button {
  background: #5b6b5b;
  border-color: #9c9a72;
  border-radius: 2px;
}
.overlay-card {
  background: #37443e;
  border: 4px solid #d5ae77;
  border-radius: 4px;
  box-shadow:
    10px 12px 0 #141c1c,
    inset 0 0 0 3px #6d7153;
}
.overlay-card h1 {
  color: #ffe0a1;
}
.overlay-card button {
  background: #c3c986;
  border: 3px solid #efe4ad;
  border-radius: 3px;
}
.overlay-card button.secondary {
  background: #62776c;
  border-color: #9eae8d;
}
.overlay {
  overflow-y: auto;
}
.overlay-card:has(.scene-image) {
  width: min(820px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.scene-image {
  display: block;
  width: 100%;
  max-height: min(57vh, 460px);
  object-fit: cover;
  object-position: center;
  border: 3px solid #a68763;
  background: #1b2525;
  image-rendering: pixelated;
}
.overlay-card:has(.scene-image) p {
  margin: 12px 0 0;
}
.overlay-card:has(.story-image) {
  width: min(900px, 100%);
}
.overlay-card:has(.story-image) .buttons {
  justify-content: space-between;
  align-items: center;
}
.overlay-card:has(.story-image) .buttons button:last-child {
  margin-left: auto;
}
.overlay-card button.story-skip {
  background: #566e62;
  color: #eef0db;
  border-color: #b2c49a;
}
.story-progress {
  margin: -3px 0 9px;
  color: #d5c59e;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.story-image {
  aspect-ratio: 16/9;
  max-height: min(55vh, 490px);
  object-position: center;
}
.overlay-card .story-caption {
  margin: 13px 0 0;
  color: #f1e5c7;
  font:
    20px/1.45 'Jua',
    sans-serif;
  text-align: center;
}
.prop-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 6px;
  background: #25302d;
  border: 1px solid #6e725b;
  color: #d5caae;
  font-size: 13px;
}
.prop-strip img {
  width: 74px;
  height: 48px;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  border: 1px solid #938667;
}
#mobileMore {
  display: none;
}
.dpad button {
  touch-action: none;
  user-select: none;
}
.inhibitor {
  background: linear-gradient(90deg, #9cc4a4, #e4d28e);
}
@media (max-width: 760px) {
  body {
    overscroll-behavior-y: contain;
  }
  .app {
    padding: 7px 7px calc(182px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
  }
  .brand {
    gap: 4px;
    min-width: 0;
  }
  .brand-icon {
    display: none;
  }
  .brand strong {
    font-size: 20px;
    white-space: nowrap;
  }
  .brand small {
    display: none;
  }
  .shift {
    padding: 5px 7px;
    gap: 5px;
    box-shadow: 2px 2px 0 #151d1e;
  }
  .shift span {
    font-size: 10px;
  }
  .shift span:last-child {
    display: none;
  }
  .shift strong {
    font-size: 17px;
    white-space: nowrap;
  }
  .outline {
    padding: 5px 7px;
    font-size: 13px;
    white-space: nowrap;
  }
  main {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }
  .sidebar {
    display: contents;
  }
  .status-panel {
    order: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 7px 8px;
    box-shadow: none;
  }
  .status-panel .panel-heading,
  .status-tags {
    display: none;
  }
  .status-panel .meter {
    min-width: 0;
    margin: 0;
  }
  .meter > div:first-child {
    font-size: 11px;
    gap: 2px;
    flex-wrap: wrap;
  }
  .meter b {
    font-size: 13px;
    white-space: nowrap;
  }
  .status-panel .track {
    height: 7px;
    margin-top: 2px;
  }
  .game-column {
    order: 1;
    width: 100%;
  }
  .map-top {
    padding: 5px 7px;
    font-size: 13px;
    gap: 5px;
    flex-wrap: wrap;
  }
  .map-top span:last-child {
    font-size: 12px;
  }
  .canvas-wrap {
    border-width: 3px;
    box-shadow: 2px 3px 0 #111819;
  }
  .canvas-wrap canvas {
    height: min(58dvh, 520px);
    object-fit: cover;
    object-position: 50% center;
  }
  .objective-panel {
    order: 2;
  }
  .people-panel {
    order: 3;
  }
  .log-panel {
    order: 4;
  }
  .panel {
    box-shadow: none;
    padding: 10px;
  }
  .panel h2 {
    font-size: 18px;
  }
  .controls {
    position: fixed;
    z-index: 4;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(28, 39, 38, 0.97);
    border-top: 3px solid #ac8b60;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.35);
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 58%);
    gap: 6px;
    align-items: stretch;
  }
  .dpad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 70px 70px;
    gap: 4px;
    align-content: end;
  }
  .dpad > button {
    grid-column: 2;
    grid-row: 1;
  }
  .dpad > div {
    display: contents;
  }
  .dpad > div > button:nth-child(1) {
    grid-column: 1;
    grid-row: 2;
  }
  .dpad > div > button:nth-child(2) {
    grid-column: 2;
    grid-row: 2;
  }
  .dpad > div > button:nth-child(3) {
    grid-column: 3;
    grid-row: 2;
  }
  .dpad button {
    width: 100%;
    height: 70px;
    min-height: 0;
    font-size: 20px;
  }
  .action-pad {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 45px;
    gap: 4px;
    align-content: center;
  }
  .action-pad button {
    min-height: 0;
    padding: 2px;
    font-size: 13px;
    white-space: normal;
    line-height: 1.05;
  }
  .action-pad button[data-action='work'] {
    grid-column: auto;
  }
  .action-pad button kbd {
    display: none;
  }
  .action-pad button[data-action='hide'],
  .action-pad button[data-action='resist'],
  .action-pad button[data-action='jump'],
  .action-pad button[data-action='decoy'] {
    display: none;
  }
  .controls.expanded .action-pad button[data-action='hide'],
  .controls.expanded .action-pad button[data-action='resist'],
  .controls.expanded .action-pad button[data-action='jump'],
  .controls.expanded .action-pad button[data-action='decoy'] {
    display: block;
  }
  #mobileMore {
    display: block;
  }
  .key-hint,
  footer {
    display: none;
  }
  .overlay {
    padding: 8px;
  }
  .overlay-card {
    padding: 16px;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    box-shadow: 4px 5px 0 #141c1c;
  }
  .overlay-card h1 {
    font-size: 25px;
  }
  .overlay-card p,
  .overlay-card li {
    font-size: 15px;
  }
  .overlay-card .buttons {
    margin-top: 10px;
  }
  .overlay-card button {
    padding: 8px 12px;
  }
  .overlay-card .story-caption {
    font-size: 16px;
    line-height: 1.4;
  }
}
@media (max-width: 360px) {
  .brand strong {
    font-size: 17px;
  }
  .shift strong {
    font-size: 15px;
  }
  .dpad {
    grid-template-rows: 62px 62px;
  }
  .dpad button {
    height: 62px;
  }
  .action-pad {
    grid-auto-rows: 40px;
  }
}

.action-pad button[data-action='interact'] {
  display: none;
}
@media (max-width: 760px) {
  .canvas-wrap {
    position: relative;
    touch-action: none;
  }
  .controls {
    grid-template-columns: 1fr;
  }
  .controls > .dpad {
    display: none;
  }
  .action-pad {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.touch-move-stick {
  position: absolute;
  z-index: 3;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.touch-move-stick[hidden] {
  display: none;
}
.touch-move-stick.is-active {
  opacity: 1;
}
.touch-move-ring {
  position: relative;
  width: 84px;
  height: 84px;
  border: 3px solid rgba(235, 221, 177, 0.8);
  border-radius: 50%;
  background: rgba(29, 43, 40, 0.72);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 3px rgba(130, 151, 115, 0.48);
}
.touch-move-arrow {
  position: absolute;
  color: #f1e5c1;
  font:
    12px/1 'Jua',
    sans-serif;
  opacity: 0.82;
}
.touch-move-up {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}
.touch-move-right {
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.touch-move-down {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
}
.touch-move-left {
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.touch-move-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 31px;
  border: 3px solid #f0dfab;
  border-radius: 50%;
  background: linear-gradient(145deg, #9ba881, #566e61);
  box-shadow: 0 3px 0 #182521;
  transform: translate(calc(-50% + var(--stick-x, 0px)), calc(-50% + var(--stick-y, 0px)));
}
.overlay-card button:disabled {
  opacity: 0.46;
  filter: saturate(0.55);
  cursor: default;
}

/* Investigation uses the existing office palette and scene assets. */
#saveStatus {
  font-size: 12px;
  color: #d6d9bd;
  max-width: 190px;
}
.investigation-panel {
  border-color: #c0a16c;
  background: #303d35;
}
.investigation-panel p {
  line-height: 1.45;
  margin: 8px 0 12px;
  color: #f0e3bb;
}
.investigation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.investigation-panel summary {
  cursor: pointer;
  padding: 10px 7px;
  min-height: 44px;
  color: #f0d293;
}
.investigation-actions button {
  padding: 8px 7px;
  border: 1px solid #a49069;
  background: #26362f;
  text-align: left;
  min-height: 54px;
  font-size: 16px;
}
.investigation-actions button:first-child {
  grid-column: 1/-1;
  background: #4d6050;
}
.investigation-actions small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #c4cfbb;
}
.investigation-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
.investigation-actions button:focus-visible,
.evidence-card:focus-visible {
  outline: 3px solid #f6d793;
  outline-offset: 2px;
}
.overlay-card {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.overlay-card:has(.evidence-grid) {
  width: min(900px, 100%);
}
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.overlay-card .evidence-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-align: left;
  padding: 14px;
  background: #27362f;
  border: 2px solid #8a8063;
  color: #f3ecd6;
  box-shadow: none;
  white-space: normal;
}
.evidence-card small {
  color: #bdcbb8;
  font-size: 13px;
}
.evidence-card strong {
  font-size: 20px;
  color: #f4d495;
}
.evidence-card span {
  font-size: 16px;
  line-height: 1.5;
}
.overlay-card .evidence-card[aria-pressed='true'] {
  background: #465b43;
  border-color: #f6d793;
}
.case-note {
  padding: 10px;
  border-left: 3px solid #bca071;
  background: #29362f;
  color: #d4dbc9;
  font-size: 15px !important;
}
.case-feedback {
  padding: 12px;
  background: #455841;
  border: 1px solid #bea676;
  line-height: 1.5;
}
.case-warning {
  padding: 10px;
  background: #523c35;
  border-left: 3px solid #d9a17a;
}
.case-reasons {
  padding-left: 22px;
  color: #c6caba;
  font-size: 14px;
}
.case-reasons li {
  margin-bottom: 9px;
}
.case-journal {
  padding-left: 22px;
}
.case-journal p {
  font-size: 15px;
}
.case-journal small {
  color: #c8b98f;
}
.action-pad button[data-action='interact'] {
  display: block;
}
@media (max-width: 760px) {
  #saveStatus {
    display: block;
    grid-column: 1/-1;
    font-size: 11px;
    max-width: none;
  }
  .investigation-panel {
    order: 0;
  }
  .status-panel {
    order: 1;
  }
  .game-column {
    order: 2;
  }
  .objective-panel {
    order: 3;
  }
  .people-panel {
    order: 4;
  }
  .log-panel {
    order: 5;
  }
  .evidence-grid {
    grid-template-columns: 1fr;
  }
  .overlay-card .buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .overlay-card .buttons button {
    width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
    min-height: 44px;
  }
  .canvas-wrap canvas {
    height: min(48dvh, 420px);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Native safe areas: status bar, rounded display corners and home indicator. */
.native-app .app {
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-left: max(7px, env(safe-area-inset-left));
  padding-right: max(7px, env(safe-area-inset-right));
}
.native-app .controls {
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}
.native-app .overlay {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}
.native-app .overlay-card {
  max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
}
.native-app body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
.controls button {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
@media (max-height: 500px) and (orientation: landscape) {
  .native-app .controls {
    position: fixed;
    bottom: 0;
  }
  .native-app .canvas-wrap canvas {
    height: 52dvh;
  }
}

.door-status {
  color: #c8dfa6;
  font-size: 12px;
  margin-left: auto;
  padding-right: 12px;
}
.door-status:empty {
  display: none;
}

/* Shared office art direction: quiet surfaces, readable testimony, compact HUD. */
body {
  background: #202a28;
}
.brand strong {
  font-size: 28px;
}
.brand small {
  color: #c0c7b5;
}
.panel {
  border-width: 1px;
  border-color: #7c8067;
  box-shadow: 3px 3px 0 #151e1b;
  background: #29372f;
}
.map-top {
  background: #33463c;
  border-color: #84947b;
  box-shadow: none;
}
.canvas-wrap {
  border: 3px solid #84947b;
  box-shadow: 3px 4px 0 #151e1b;
}
.shift {
  border: 2px solid #84947b;
  background: #29372f;
  box-shadow: 3px 3px 0 #151e1b;
}
.controls button,
.outline {
  border-width: 2px;
  border-color: #89977d;
  box-shadow: 2px 3px 0 #151e1b;
}
.objective-panel {
  display: none;
}
.prop-strip {
  display: none;
}
.overlay-card {
  background: #293b33;
  border: 2px solid #c3b28a;
  box-shadow: 8px 8px 0 #14211b;
  line-height: 1.5;
}
.overlay-card p {
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #f1ecdd;
}
.overlay-card.person-dialogue {
  width: min(720px, 100%);
}
.dialogue-scene {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #617161;
}
.dialogue-portrait {
  flex: 0 0 174px;
  width: 174px;
  height: 174px;
  background-size: 300% 300%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  background-color: #1e3028;
  border-bottom: 3px solid #bda16c;
}
.dialogue-copy {
  flex: 1;
  min-width: 0;
}
.dialogue-copy p {
  margin: 8px 0 0;
}
.dialogue-kicker {
  font:
    12px system-ui,
    sans-serif;
  color: #c7bd94;
  letter-spacing: 0.08em;
}
.case-reasons:empty {
  display: none;
}
.canvas-wrap.urge-active {
  border-color: #d69a7c;
  box-shadow: 0 0 0 2px #6f4338;
}
.urge-active::after {
  content: '충동 · 약을 쓰거나 시선을 피해 버티세요';
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 10px;
  background: #583d32;
  color: #fff0d2;
  border: 1px solid #d69a7c;
  font:
    13px 'Jua',
    sans-serif;
  pointer-events: none;
}
@media (max-width: 760px) {
  .app {
    padding-bottom: calc(125px + env(safe-area-inset-bottom));
  }
  #saveStatus {
    display: none;
  }
  .investigation-panel {
    padding: 7px 9px;
  }
  .investigation-panel .panel-heading {
    margin: 0;
  }
  .investigation-panel h2 {
    font-size: 14px;
  }
  .investigation-panel p {
    font:
      13px system-ui,
      sans-serif;
    line-height: 1.4;
    margin: 5px 0;
  }
  .investigation-panel summary {
    padding: 5px 0;
    min-height: 32px;
    font-size: 13px;
  }
  .investigation-actions button {
    font-size: 15px;
    min-height: 48px;
  }
  .status-panel {
    padding: 6px 8px;
  }
  .status-panel .meter > div:first-child {
    font-size: 12px;
  }
  .map-top {
    padding: 4px 7px;
  }
  .map-top span:last-child {
    font-size: 11px;
  }
  .canvas-wrap canvas {
    height: min(60dvh, 570px);
  }
  .controls {
    display: block;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  }
  .dpad {
    display: none;
  }
  .action-pad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 48px;
    gap: 5px;
  }
  .action-pad button {
    font-size: 14px;
    line-height: 1.2;
    min-height: 48px;
  }
  .action-pad button[data-action='interact'] {
    order: 0;
  }
  .action-pad button[data-action='talk'] {
    order: 1;
  }
  .action-pad button[data-action='notebook'] {
    order: 2;
  }
  #mobileMore {
    order: 3;
  }
  .action-pad button[data-action='run'],
  .action-pad button[data-action='work'],
  .action-pad button[data-action='inject'],
  .action-pad button[data-action='bite'] {
    display: none;
  }
  .controls.expanded .action-pad button[data-action],
  body.has-urge .action-pad button[data-action='inject'],
  body.has-urge .action-pad button[data-action='bite'] {
    display: block;
    order: 4;
  }
  .app:has(.controls.expanded) {
    padding-bottom: calc(230px + env(safe-area-inset-bottom));
  }
  .controls.expanded .action-pad button[data-action='work'] {
    grid-column: auto;
  }
  .dialogue-scene {
    gap: 14px;
    padding: 12px 0;
    align-items: flex-start;
  }
  .dialogue-portrait {
    flex-basis: 104px;
    width: 104px;
    height: 104px;
  }
  .overlay-card h1 {
    font-size: 23px;
  }
  .overlay-card p {
    font-size: 14px;
    line-height: 1.65;
  }
  .dialogue-kicker {
    font-size: 11px;
  }
  .overlay-card .buttons button {
    font-size: 15px;
  }
}
@media (max-width: 380px) {
  .dialogue-scene {
    gap: 10px;
  }
  .dialogue-portrait {
    flex-basis: 84px;
    width: 84px;
    height: 84px;
  }
  .action-pad button {
    font-size: 12px;
  }
}

/* Preserve native illustrated details on fractional and Retina displays. */
canvas,
.scene-image,
.dialogue-portrait,
.prop-strip img {
  image-rendering: auto;
}

/* The world comes first. Persistent risk HUD, optional destination list. */
body {
  background: #192720;
  color: #eee9d9;
  font-family: system-ui, sans-serif;
  font-size: 15px;
}
.app {
  max-width: 1440px;
  padding: 16px 20px 20px;
}
.topbar {
  margin-bottom: 12px;
  gap: 12px;
}
.brand strong {
  font-size: 25px;
}
.brand small {
  font: 11px system-ui;
  letter-spacing: 0.06em;
}
.shift {
  padding: 7px 14px;
  border-width: 1px;
  box-shadow: none;
}
.shift strong {
  font-size: 25px;
}
.outline {
  font: 13px system-ui;
  box-shadow: none;
  min-height: 40px;
}
.brand-icon {
  font-size: 26px;
}
#saveStatus {
  font-size: 11px;
  color: #a3b7a4;
}
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 10px 16px;
  align-items: start;
}
.sidebar {
  display: contents;
}
.status-panel {
  grid-column: 1/-1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 9px 14px;
  background: #243c30;
  border: 1px solid #536d55;
  box-shadow: none;
  border-radius: 8px;
}
.status-panel .panel-heading {
  display: none;
}
.status-panel .meter {
  width: 150px;
  margin: 0;
}
.status-panel .meter > div:first-child {
  font-size: 12px;
}
.status-panel .track {
  height: 5px;
  border: 0;
  margin-top: 4px;
}
.status-panel .status-tags {
  margin: 0 0 0 auto;
  gap: 5px;
}
.status-tags span {
  font-size: 10px;
  background: #2c4738;
}
.game-column {
  grid-column: 1;
  grid-row: 2/6;
  position: relative;
}
.investigation-panel {
  grid-column: 2;
  grid-row: 2;
}
.people-panel {
  grid-column: 2;
  grid-row: 3;
}
.log-panel {
  grid-column: 2;
  grid-row: 4;
  min-height: 0;
}
.panel {
  border: 1px solid #50664e;
  border-radius: 8px;
  background: #23372b;
  box-shadow: none;
  padding: 14px;
}
.panel h2 {
  font: 18px 'Jua';
}
.panel-heading {
  margin-bottom: 10px;
}
.panel-heading > span {
  font: 11px system-ui;
  color: #a9b89e;
}
.investigation-panel p {
  font: 15px system-ui;
  line-height: 1.65;
  margin: 10px 0 16px;
  color: #f0e8ce;
}
.investigation-panel summary,
.people-panel > summary,
.log-panel > summary {
  font: 13px system-ui;
  color: #c5c9ab;
  cursor: pointer;
  min-height: 24px;
}
.people-panel[open] > summary,
.log-panel[open] > summary {
  margin-bottom: 12px;
}
.investigation-actions {
  grid-template-columns: 1fr;
  max-height: 48dvh;
  overflow-y: auto;
  padding-right: 3px;
}
.investigation-actions button {
  text-align: left;
  font: 13px system-ui;
  min-height: 48px;
  padding: 9px 11px;
  background: #304739;
  border: 1px solid #637358;
  box-shadow: none;
  border-radius: 5px;
}
.investigation-actions small {
  font-size: 10px;
  display: block;
  color: #b4c3ac;
  line-height: 1.4;
  margin-top: 4px;
}
.person {
  font-size: 12px;
  line-height: 1.5;
}
.person em {
  display: block;
  font-size: 10px;
}
.log-panel ol {
  font: 12px system-ui;
  line-height: 1.6;
}
.map-top {
  border: 0;
  border-radius: 8px 8px 0 0;
  background: #304536;
  padding: 9px 12px;
  font-size: 12px;
}
.map-top span:last-child {
  color: #aebea6;
  font: 11px system-ui;
}
.canvas-wrap {
  border: 1px solid #687655;
  border-radius: 0 0 8px 8px;
  box-shadow: none;
  position: relative;
  background: #1e3028;
}
.canvas-wrap canvas {
  width: 100%;
  height: clamp(300px, calc(100vh - 265px), 650px);
  height: clamp(300px, calc(100dvh - 265px), 650px);
  object-fit: cover;
  image-rendering: auto;
}
.context-cue {
  font: 12px system-ui;
  line-height: 1.5;
  color: #e3d5aa;
  padding: 8px 2px;
  min-height: 34px;
}
.controls {
  margin-top: 0;
  display: block;
}
.dpad {
  display: none;
}
.action-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  grid-auto-rows: 44px;
}
.controls button {
  font: 13px system-ui;
  min-height: 44px;
  white-space: normal;
  background: #304938;
  border: 1px solid #839276;
  border-radius: 5px;
  box-shadow: none;
}
.controls button:disabled {
  opacity: 0.4;
  cursor: default;
}
.action-pad button[data-action] {
  display: none;
}
.action-pad button[data-action='interact'],
.action-pad button[data-action='talk'],
.action-pad button[data-action='notebook'],
#mobileMore {
  display: block;
}
.action-pad button[data-action='interact'] {
  order: 0;
  background: #dec48b;
  color: #263c2c;
  border-color: #dec48b;
}
.action-pad button[data-action='talk'] {
  order: 1;
}
.action-pad button[data-action='notebook'] {
  order: 2;
}
#mobileMore {
  order: 3;
}
.controls.expanded .action-pad button[data-action],
body.has-urge .action-pad button[data-action='inject'],
body.has-urge .action-pad button[data-action='resist'],
body.has-urge .action-pad button[data-action='hide'],
body.has-urge .action-pad button[data-action='bite'] {
  display: block;
  order: 4;
}
.controls kbd {
  font: 10px system-ui;
  color: inherit;
  opacity: 0.7;
}
.key-hint {
  font: 10px system-ui;
  color: #9cac91;
  margin: 9px 0 0;
}
footer {
  display: none;
}
.scene-toast {
  position: absolute;
  top: 52px;
  left: 14px;
  right: 14px;
  z-index: 2;
  pointer-events: none;
  background: rgba(37, 54, 40, 0.96);
  color: #f3e6c5;
  border-left: 3px solid #dcc38f;
  padding: 12px 16px;
  font: 13px system-ui;
  line-height: 1.6;
  box-shadow: 0 5px 14px #18251c55;
  border-radius: 4px;
}
.scene-toast[hidden] {
  display: none;
}
.overlay {
  background: rgba(9, 20, 15, 0.82);
  padding: 22px;
}
.overlay-card {
  width: min(880px, 100%);
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  background: #263d30;
  border: 1px solid #abac7d;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 20px 80px #08140d99;
}
.overlay-card h1 {
  font: 27px 'Jua';
  margin: 0 0 16px;
}
.overlay-card h2 {
  font: 19px 'Jua';
  margin: 20px 0 12px;
}
.overlay-card .buttons button {
  font: 13px system-ui;
  min-height: 44px;
  box-shadow: none;
  border-radius: 5px;
}
.overlay-card.person-dialogue {
  width: min(760px, 100%);
}
.dialogue-scene {
  gap: 22px;
  border: 0;
  align-items: flex-start;
}
.dialogue-portrait {
  border-radius: 6px;
  border-bottom: 0;
  flex-basis: 138px;
  width: 138px;
  height: 138px;
}
.dialogue-copy p {
  font-size: 17px;
  line-height: 1.8;
}
.dialogue-kicker {
  font-size: 11px;
}
.clue-receipt {
  font-size: 12px !important;
  color: #bcccaa !important;
  border-top: 1px solid #55705a;
  padding-top: 12px;
}
.scene-reaction {
  background: #314c38;
  border-left: 2px solid #c6b980;
  padding: 10px 14px;
  font-size: 13px !important;
}
.case-note {
  font-size: 12px !important;
  background: none;
  border-left: 0;
  padding: 0;
}
.case-feedback {
  border-left: 3px solid #d5bd7a;
  padding: 12px 16px;
  background: #354d38;
  color: #fff0cc !important;
}
.opening-memory {
  background: #354b38;
  border-left: 3px solid #cfb77c;
  padding: 20px;
  border-radius: 5px;
}
.opening-memory small {
  color: #bfc6a4;
  font-size: 11px;
}
.opening-memory strong {
  display: block;
  margin-top: 12px;
  font: 22px 'Jua';
  color: #f6e0a5;
}
.opening-memory p {
  font-size: 14px;
}
.clue-art {
  margin: 0 auto 16px;
  width: min(350px, 100%);
}
.clue-art svg {
  display: block;
  width: 100%;
  height: auto;
}
.clue-art figcaption {
  font: 11px system-ui;
  text-align: center;
  color: #b8c7ab;
  margin-top: 8px;
}
.clue-art.compact {
  width: 100px;
  margin: 0;
  grid-row: 1/4;
}
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.overlay-card .evidence-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 5px;
  text-align: left;
  padding: 12px !important;
  background: #304a37 !important;
  color: #f3ebd5 !important;
  border: 1px solid #6e8265 !important;
}
.evidence-card small {
  font: 10px system-ui;
  line-height: 1.5;
  color: #c3d0b6;
}
.evidence-card strong {
  font: 15px 'Jua';
  color: #f5dfac;
}
.evidence-card > span {
  font: 12px system-ui;
  line-height: 1.7;
}
.evidence-card[aria-pressed='true'] {
  border: 2px solid #f0d091 !important;
  background: #405b3e !important;
  outline: 2px solid #f0d091;
  outline-offset: 1px;
}
.evidence-card:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #f5d78e;
  outline-offset: 3px;
}
@media (max-width: 1100px) and (min-width: 761px) {
  main {
    grid-template-columns: minmax(0, 1fr) 230px;
  }
  .status-panel {
    gap: 14px;
  }
  .status-panel .status-tags {
    display: none;
  }
  .evidence-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .app {
    padding: 8px 8px calc(90px + env(safe-area-inset-bottom));
  }
  .app:has(.controls.expanded),
  body.has-urge .app {
    padding-bottom: calc(205px + env(safe-area-inset-bottom));
  }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    margin-bottom: 8px;
  }
  .brand strong {
    font-size: 20px;
  }
  .shift {
    padding: 5px 8px;
  }
  .shift strong {
    font-size: 18px;
  }
  .shift span {
    font-size: 10px;
  }
  main {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }
  .status-panel {
    order: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    padding: 8px 10px;
  }
  .status-panel .meter {
    width: auto;
  }
  .status-panel .meter > div:first-child {
    font-size: 10px;
  }
  .status-panel .status-tags {
    display: none;
  }
  .investigation-panel {
    order: 1;
    width: 100%;
    padding: 10px 12px;
  }
  .investigation-panel .panel-heading {
    margin: 0;
  }
  .investigation-panel h2 {
    font-size: 15px;
  }
  .investigation-panel p {
    font-size: 13px;
    line-height: 1.5;
    margin: 5px 0 7px;
  }
  .investigation-panel summary {
    font-size: 11px;
    min-height: 20px;
  }
  .investigation-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 40dvh;
    margin-top: 8px;
  }
  .game-column {
    order: 2;
    width: 100%;
  }
  .canvas-wrap canvas {
    height: clamp(260px, calc(100vh - 310px), 560px);
    height: clamp(260px, calc(100dvh - 310px), 560px);
  }
  .map-top {
    padding: 7px 9px;
  }
  .context-cue {
    font-size: 11px;
    min-height: 30px;
    padding: 7px 2px;
  }
  .people-panel {
    order: 3;
    width: 100%;
    padding: 10px 12px;
  }
  .log-panel {
    order: 4;
    width: 100%;
    padding: 10px 12px;
  }
  .people-panel > summary,
  .log-panel > summary {
    font-size: 12px;
    min-height: 20px;
  }
  .controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    border-top: 1px solid #8d9877;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: #213b2ef5;
    box-shadow: 0 -4px 20px #10251e55;
  }
  .action-pad {
    grid-auto-rows: 48px;
    gap: 6px;
  }
  .controls button {
    font-size: 12px;
    min-height: 48px;
  }
  .controls kbd {
    display: none;
  }
  .scene-toast {
    top: 42px;
    left: 10px;
    right: 10px;
    font-size: 12px;
    padding: 10px 12px;
  }
  .overlay {
    padding: 10px;
  }
  .overlay-card {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 18px;
  }
  .overlay-card h1 {
    font-size: 23px;
  }
  .overlay-card h2 {
    font-size: 18px;
  }
  .overlay-card p {
    font-size: 14px;
  }
  .dialogue-scene {
    gap: 14px;
  }
  .dialogue-portrait {
    flex-basis: 94px;
    width: 94px;
    height: 94px;
  }
  .dialogue-copy p {
    font-size: 14px;
  }
  .evidence-grid {
    grid-template-columns: 1fr;
  }
  .overlay-card .evidence-card {
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .clue-art.compact {
    width: 88px;
  }
  .clue-art {
    width: 245px;
  }
  .overlay-card .buttons button {
    font-size: 13px;
    min-height: 46px;
  }
  .opening-memory {
    padding: 15px;
  }
  .opening-memory strong {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .canvas-wrap canvas {
    height: clamp(230px, calc(100vh - 397px), 560px);
    height: clamp(230px, calc(100dvh - 397px), 560px);
  }
  .app,
  .app:has(.controls.expanded),
  body.has-urge .app {
    padding-bottom: calc(var(--controls-height, 65px) + 40px);
  }
}

@media (max-width: 760px) {
  .overlay-card .buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overlay-card .buttons button:last-child {
    grid-column: 1/-1;
  }
}

.ending-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0 22px;
}
.ending-summary > div {
  background: #354d38;
  border: 1px solid #869270;
  border-radius: 6px;
  padding: 15px 12px;
}
.ending-summary small {
  display: block;
  font: 11px system-ui;
  color: #bdcbae;
  margin-bottom: 8px;
}
.ending-summary strong {
  font: 17px 'Jua';
  color: #f2d399;
}
@media (max-width: 760px) {
  .ending-summary {
    grid-template-columns: 1fr;
  }
  .ending-summary > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
  }
  .ending-summary small {
    margin: 0;
  }
  .ending-summary strong {
    font-size: 16px;
  }
}

/* Native object artwork on a desk-like inspection surface, shared with the map. */
.illustrated-clue {
  width: min(330px, 100%);
}
.clue-tabletop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 20px 34px;
  border: 1px solid #b68d54;
  border-radius: 5px;
  background: repeating-linear-gradient(
    0deg,
    #b78048 0 2px,
    #bd8850 2px 22px,
    #bf8b53 22px 24px,
    #b9834b 24px 45px
  );
  box-shadow:
    inset 0 0 0 3px #d3a467,
    inset 0 -6px 0 #8e6339;
}
.clue-art .clue-tabletop svg {
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  filter: none;
  image-rendering: auto;
  overflow: hidden;
}
.illustrated-clue.compact {
  width: 100px;
}
.compact .clue-tabletop {
  min-height: 84px;
  height: 84px;
  padding: 8px;
  border-color: #9b8059;
  box-shadow: inset 0 0 0 2px #c7a06c;
}
.compact .clue-tabletop svg {
  max-height: 66px;
  max-width: 80px;
}
@media (max-width: 760px) {
  .illustrated-clue {
    width: min(245px, 100%);
  }
  .clue-tabletop {
    min-height: 178px;
    padding: 16px 28px;
  }
  .clue-art .clue-tabletop svg {
    max-height: 172px;
  }
  .illustrated-clue.compact {
    width: 88px;
  }
  .compact .clue-tabletop {
    min-height: 76px;
    height: 76px;
    padding: 8px;
  }
  .compact .clue-tabletop svg {
    max-width: 70px;
    max-height: 58px;
  }
}

.medicine-clue:not(.compact) {
  width: min(530px, 100%);
}
.clue-art.medicine-clue .clue-tabletop {
  padding: 12px;
  min-height: 0;
}
.clue-art.medicine-clue .clue-tabletop > svg {
  width: 100%;
  max-height: none;
  image-rendering: pixelated;
}
.clue-art.medicine-clue.compact .clue-tabletop {
  padding: 4px;
}
.clue-art.medicine-clue.compact .clue-tabletop > svg {
  max-width: 100%;
  max-height: 66px;
}
.clue-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font: 11px system-ui;
  grid-column: 2;
}
.clue-tags em {
  font-style: normal;
  padding: 3px 7px;
  border: 1px solid #809378;
  border-radius: 4px;
  color: #f1dfb0;
  background: #253b30;
}
.evidence-card .clue-art.compact {
  grid-row: 1/7;
}
.evidence-card.is-related {
  border-left: 4px solid #a9c49a !important;
}
.evidence-card .related-label {
  grid-column: 2;
  color: #c9e2b7;
  font-weight: 600;
}
.comparison-tray {
  padding: 14px;
  background: #20362b;
  border: 1px solid #bbaa7d;
  border-radius: 6px;
  margin: 14px 0;
}
.comparison-tray > strong {
  font: 16px 'Jua';
  color: #f6dda4;
}
.comparison-tray > div {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0;
}
.comparison-tray > div > span {
  flex: 1;
  min-width: 0;
  padding: 9px;
  background: #334d39;
  font: 13px system-ui;
  line-height: 1.5;
  border-radius: 4px;
}
.comparison-tray > small {
  display: block;
  font: 12px system-ui;
  line-height: 1.6;
  color: #ccd6c0;
}
.comparison-tray .compare-controls button {
  flex: 1;
  min-height: 44px;
  font: 13px system-ui;
  white-space: normal;
}
.deduction-origins {
  margin-top: 12px;
  font: 13px system-ui;
}
.deduction-origins summary {
  min-height: 44px;
  cursor: pointer;
  color: #efdaaa;
  padding: 10px 0;
}
.deduction-origins div {
  padding: 10px 12px;
  margin: 8px 0;
  background: #253d2e;
  border-left: 2px solid #9bac88;
}
.deduction-origins small {
  display: block;
  color: #bacbb0;
  margin-top: 4px;
}
.deduction-origins p {
  font-size: 13px !important;
  margin: 8px 0;
}
.connection-group {
  border: 1px solid #63775c;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}
.connection-group h2 {
  margin: 0 0 12px;
}
.connection-group h2 small {
  font: 11px system-ui;
  color: #bccbad;
}
.connection-records {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}
.connection-records button {
  padding: 10px 12px;
  text-align: left;
  min-height: 44px;
  background: #304a37;
  border: 1px solid #698060;
}
.connection-records button strong {
  display: block;
  font: 15px 'Jua';
  margin: 5px 0;
  color: #f5dfac;
}
.connection-records button small {
  font: 11px system-ui;
  color: #c4d0b7;
}
.connection-thread {
  text-align: center;
  font-size: 16px;
  color: #bbaa7d;
}
@media (max-width: 760px) {
  .comparison-tray {
    padding: 11px;
  }
  .comparison-tray > div > span {
    font-size: 12px;
    padding: 7px;
  }
  .comparison-tray .compare-controls {
    gap: 7px;
  }
}
.notebook-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}
.notebook-tabs button {
  font: 13px system-ui;
  min-height: 44px;
  white-space: normal;
  box-shadow: none;
  background: #314b38;
  color: #e2e8d6;
  border: 1px solid #829273;
}
.notebook-tabs button[aria-pressed='true'],
.notebook-filters button[aria-pressed='true'] {
  background: #d5c18b;
  color: #23372b;
  border-color: #e8d3a0;
}
.notebook-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.notebook-filters button {
  font: 12px system-ui;
  min-height: 44px;
  padding: 6px 10px;
  box-shadow: none;
  background: #314b38;
  color: #e2e8d6;
  border: 1px solid #829273;
}

.evidence-event {
  margin: 0 auto 18px;
  width: min(550px, 100%);
  overflow: hidden;
  border: 1px solid #9c9d76;
  border-radius: 6px;
  background: #1e3329;
}
.evidence-event img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1672/941;
  object-fit: contain;
  image-rendering: pixelated;
  background: #172820;
}
.evidence-event figcaption {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.evidence-event figcaption > small {
  font: 11px/1.5 system-ui;
  color: #bfccb0;
}
.evidence-event figcaption > strong {
  font: 21px/1.4 'Jua';
  color: #f7dfaa;
}
.event-location {
  font: 12px/1.5 system-ui;
  color: #e9d29b;
}
.evidence-event figcaption p {
  margin: 2px 0;
  font: 14px/1.65 system-ui;
}
.event-limit {
  display: block;
  border-top: 1px solid #50654e;
  padding-top: 8px;
  font: 12px/1.6 system-ui;
  color: #c8d3bc;
}
.evidence-event.compact {
  width: 100px;
  margin: 0;
  grid-row: 1/7;
  align-self: start;
}
.evidence-original {
  margin: 10px 0 16px;
  border: 1px solid #607559;
  border-radius: 5px;
  padding: 0 12px;
}
.evidence-original summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font: 13px/1.5 system-ui;
  color: #ead7a7;
}
.evidence-original .clue-art {
  margin-top: 8px;
}
.event-related {
  border-top: 1px solid #617254;
  margin: 16px 0;
  padding-top: 10px;
}
.event-related h2 {
  font: 16px 'Jua';
  margin: 4px 0 10px;
}
.event-related ul {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.event-related li {
  padding: 8px 12px;
  background: #304936;
  border-left: 2px solid #c1b583;
}
.event-related strong,
.event-related small {
  display: block;
  font: 13px/1.6 system-ui;
}
.event-related small {
  font-size: 11px;
  color: #c9d6b9;
}
@media (max-width: 760px) {
  .evidence-event.compact {
    width: 88px;
  }
  .evidence-event figcaption {
    padding: 12px;
  }
  .evidence-event figcaption > strong {
    font-size: 18px;
  }
  .evidence-event figcaption p {
    font-size: 13px;
  }
}

/* A stable topic palette and numbered receipts keep compared evidence together. */
[data-topic='departure'] {
  --group-color: #edcb82;
  --group-wash: #353827;
}
[data-topic='medicine'] {
  --group-color: #91d7c4;
  --group-wash: #25433d;
}
[data-topic='whereabouts'] {
  --group-color: #c3b7ed;
  --group-wash: #353849;
}
[data-topic='checkup'] {
  --group-color: #efb3a6;
  --group-wash: #453833;
}
[data-topic='preparation'] {
  --group-color: #b6c8d8;
  --group-wash: #2d3e43;
}
.notebook-bundle,
.notebook-topic-group {
  margin: 14px 0 22px;
  border: 2px solid var(--group-color, #abbc93);
  border-radius: 8px;
  overflow: hidden;
  background: var(--group-wash, #304735);
}
.notebook-bundle > header {
  padding: 16px 16px 12px;
}
.bundle-label {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 4px;
  background: var(--group-color);
  color: #172d28;
  font: 12px/1.5 system-ui;
  font-weight: 700;
}
.notebook-bundle h2 {
  margin: 12px 0;
  font: 20px/1.4 'Jua';
  color: var(--group-color);
}
.overlay-card .bundle-note {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--group-color);
  border-radius: 3px;
  color: #243a2b;
  background: repeating-linear-gradient(transparent 0 27px, #66755b26 27px 28px), #eee2bf;
  font: 14px/1.8 system-ui;
}
.bundle-note b {
  display: block;
  font: 11px/1.5 system-ui;
  color: #586447;
  margin-bottom: 5px;
}
.bundle-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.bundle-tools small {
  font: 11px/1.5 system-ui;
  color: #dae3d2;
}
.overlay-card .bundle-result {
  background: #20382d;
  border: 1px solid var(--group-color);
  color: var(--group-color);
  font: 12px/1.5 system-ui;
  min-height: 44px;
  padding: 8px 10px;
}
.bundle-result[aria-pressed='true'] {
  outline: 2px solid #f3d492;
  outline-offset: 2px;
}
.notebook-bundle .bundle-pair {
  padding: 12px;
  border-top: 1px solid var(--group-color);
  gap: 12px;
}
.overlay-card .notebook-bundle .evidence-card,
.overlay-card .notebook-topic-group .evidence-card {
  border-color: var(--group-color) !important;
  background: #20382ecc !important;
}
.overlay-card .bundle-pair .evidence-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px !important;
}
.bundle-pair .clue-art.compact,
.bundle-pair .evidence-event.compact {
  width: 100%;
  height: 145px;
  margin: 0 0 3px;
  align-self: stretch;
  grid-row: auto;
  overflow: hidden;
}
.bundle-pair .evidence-event.compact img {
  height: 145px;
  aspect-ratio: auto;
  object-fit: contain;
}
.bundle-pair .clue-art.compact > svg {
  height: 145px;
  width: 100%;
}
.bundle-pair .compact .clue-tabletop {
  height: 145px;
  min-height: 145px;
  padding: 10px;
}
.bundle-pair .compact .clue-tabletop svg {
  max-height: 125px;
  max-width: 100%;
}
.bundle-pair .medicine-clue.compact .clue-tabletop > svg {
  max-height: 125px;
}
.record-bundles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 2;
}
.record-bundles em {
  font: 10px/1.5 system-ui;
  font-style: normal;
  background: var(--group-color);
  color: #172d28;
  border-radius: 3px;
  padding: 3px 6px;
  font-weight: 700;
}
.notebook-topic-group > h2 {
  padding: 13px 14px;
  margin: 0;
  color: var(--group-color);
  border-bottom: 1px solid var(--group-color);
  font: 18px/1.5 'Jua';
}
.notebook-topic-group > h2 small {
  font: 11px system-ui;
  color: #d0dac9;
  margin-left: 6px;
}
.notebook-topic-group > .evidence-grid {
  padding: 12px;
}
.topic-dot,
.notebook-filters button[data-topic]:not([data-topic=''])::before {
  display: inline-block;
  content: '';
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--group-color);
}
.selected-scene {
  margin: 12px 0;
  border: 1px solid #75865e;
  border-radius: 4px;
  padding: 0 12px;
}
.selected-scene summary {
  min-height: 44px;
  cursor: pointer;
  padding: 12px 0;
  font: 13px/1.5 system-ui;
  color: #e7d7ab;
}
.overlay-card .notebook-bundle .evidence-card[aria-pressed='true'],
.overlay-card .notebook-topic-group .evidence-card[aria-pressed='true'] {
  border-color: #f3d492 !important;
  outline: 2px solid #f3d492;
  outline-offset: 2px;
  background: #435c42 !important;
}
@media (max-width: 760px) {
  .notebook-bundle > header {
    padding: 12px;
  }
  .notebook-bundle h2 {
    font-size: 18px;
  }
  .notebook-bundle .bundle-pair {
    padding: 10px;
  }
  .bundle-tools {
    align-items: flex-start;
  }
  .bundle-note {
    font-size: 13px !important;
  }
  .bundle-tools .bundle-result {
    width: 100%;
  }
  .notebook-topic-group > h2 small {
    display: block;
    margin: 4px 0 0;
  }
  .notebook-topic-group > .evidence-grid {
    padding: 10px;
  }
  .overlay-card .bundle-pair .evidence-card {
    padding: 10px !important;
  }
}

/* Illustrated notebook: subjects are physical spreads, with automatic notes. */
.overlay-card:has(.notebook-spread) {
  width: min(1160px, 100%);
  padding: 20px;
  background: #25362c;
  border: 1px solid #8a9273;
}
.notebook-intro {
  margin: 8px 0;
  font: 13px/1.6 system-ui;
  color: #d7dec6;
}
.notebook-contents {
  margin: 8px 0;
  color: #eee1bd;
  font: 13px/1.5 system-ui;
}
.notebook-contents summary,
.notebook-extra summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
}
.notebook-contents ol {
  list-style: none;
  padding: 0 !important;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.notebook-contents a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 55px;
  color: #eae1bf;
  text-decoration: none;
  border-bottom: 2px solid #728266;
  padding: 8px 4px;
}
.notebook-contents a[aria-current='page'] {
  border-color: #eed1a0;
  color: #ffe5b6;
}
.notebook-contents small {
  color: #b9c9ad;
  font-size: 11px;
}
.book-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
}
.overlay-card .book-navigation button {
  min-height: 44px;
  background: #344c39;
  color: #eedfbb;
  border: 1px solid #7c8c6f;
  font: 13px system-ui;
  box-shadow: none;
  white-space: normal;
}
.book-navigation > span {
  font: 13px/1.5 system-ui;
  color: #e6d6ae;
  text-align: center;
}
.notebook-spread {
  --book-height: clamp(430px, calc(100dvh - 240px), 720px);
  height: var(--book-height);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: #eee2c6 url('assets/notebook/open-notebook-v1.png') center/100% 100% no-repeat;
  border-radius: 8px;
  isolation: isolate;
  box-shadow: 0 6px 15px #111b1499;
}
.notebook-paper {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(var(--book-height) * 0.085) 12% calc(var(--book-height) * 0.085);
  position: relative;
  color: #354338;
  --ink: #5d5935;
  overflow-wrap: anywhere;
}
.notebook-paper header {
  flex: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.paper-content {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 7px 12px 10px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9b9471 transparent;
}
.paper-content:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.paper-content::-webkit-scrollbar {
  width: 7px;
}
.paper-content::-webkit-scrollbar-thumb {
  background: #9b9471;
  border-radius: 5px;
}
.notebook-paper h2 {
  font: 28px/1.4 'Jua';
  margin: 6px 0;
  color: var(--ink);
}
.notebook-paper h3 {
  color: #314236;
  font: 17px/1.45 'Jua';
  margin: 8px 0;
}
.paper-kicker {
  font: 10px/1.5 system-ui;
  letter-spacing: 0.1em;
  color: #737457;
}
.paper-count {
  font: 12px system-ui;
  color: #626c54;
}
.notebook-spread[data-topic='medicine'] .notebook-paper {
  --ink: #286a57;
}
.notebook-spread[data-topic='whereabouts'] .notebook-paper {
  --ink: #675281;
}
.notebook-spread[data-topic='checkup'] .notebook-paper {
  --ink: #935844;
}
.notebook-spread[data-topic='preparation'] .notebook-paper {
  --ink: #466477;
}
.notebook-scraps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
  align-items: start;
  width: 100%;
  max-width: 360px;
  margin: 8px auto;
}
.overlay-card .notebook-scrap {
  display: block;
  min-width: 0;
  width: 100%;
  text-align: left;
  color: #314236;
  background: #faf2df;
  padding: 8px 8px 7px;
  box-shadow: 1px 3px 4px #675b3833;
  border: 1px solid #c8bd9c;
  border-radius: 0;
  position: relative;
}
.notebook-scrap:nth-child(3n + 1) {
  transform: rotate(-1deg);
}
.notebook-scrap:nth-child(3n + 2) {
  transform: rotate(1deg);
}
.notebook-scrap::before {
  content: '';
  position: absolute;
  left: 33%;
  top: -6px;
  width: 34%;
  height: 13px;
  background: #d8cf9faa;
  z-index: 2;
  transform: rotate(-3deg);
}
.scrap-art {
  display: block;
}
.scrap-title {
  display: block;
  font: 15px/1.5 'Jua';
  color: #314236;
  margin: 8px 0 3px;
}
.scrap-art > .clue-art,
.scrap-art > .evidence-event,
.thought-evidence .clue-art,
.thought-evidence .evidence-event {
  margin: 0 !important;
  width: 100% !important;
  max-width: none;
  grid-row: auto;
  border: 1px solid #afaa83;
  background: #e4d8b8;
  border-radius: 0;
}
.scrap-art svg,
.scrap-art img {
  width: 100%;
  height: 90px;
  display: block;
  object-fit: contain;
}
.scrap-art .clue-tabletop {
  height: 90px;
  padding: 0;
  background: #dec997;
}
.overlay-card .notebook-scrap:hover,
.overlay-card .notebook-scrap:focus-visible {
  background: #fff7e4;
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.photo-content {
  scrollbar-gutter: auto;
}
.photo-navigation {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #626c54;
  font: 12px system-ui;
}
.overlay-card .photo-navigation button {
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  background: transparent;
  color: var(--ink);
  border: 1px solid #a59e79;
  font: 18px 'Jua';
  box-shadow: none;
}
.overlay-card .notebook-paper p {
  color: #344633;
}
.overlay-card .notebook-question {
  font: 19px/1.7 'Poor Story' !important;
  color: var(--ink);
  padding: 0 0 12px;
  margin: 0 0 16px;
  border-bottom: 1px dashed #a59e79;
}
.notebook-thought {
  margin: 0 0 20px;
  border-left: 3px solid var(--ink);
  background: #f7edd5b8;
  padding: 12px 13px;
  position: relative;
}
.notebook-thought p {
  font: 18px/1.65 'Poor Story';
  margin: 8px 0;
  color: #344633;
}
.thought-status {
  font: 11px/1.5 system-ui;
  color: var(--ink);
  display: block;
  margin-bottom: 10px;
}
.thought-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}
.overlay-card .thought-photo {
  display: block;
  min-width: 0;
  text-align: left;
  padding: 0;
  background: transparent;
  color: #56624b;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.thought-photo-art {
  display: block;
}
.thought-evidence svg,
.thought-evidence img,
.thought-evidence .clue-tabletop {
  height: 65px;
  width: 100%;
  object-fit: contain;
  padding: 0;
}
.thought-photo-title {
  display: block;
  font: 10px/1.5 system-ui;
  color: #56624b;
  margin-top: 5px;
}
.overlay-card .thought-photo:hover,
.overlay-card .thought-photo:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.thought-thread {
  font: 24px 'Jua';
  color: var(--ink);
  text-align: center;
}
.overlay-card .thought-confirm {
  font: 12px/1.5 system-ui;
  background: transparent;
  color: var(--ink);
  border: 1px dashed var(--ink);
  box-shadow: none;
  min-height: 44px;
  padding: 7px 9px;
  width: 100%;
}
.overlay-card .thought-confirm:hover,
.overlay-card .thought-confirm:focus-visible {
  background: #efe1ba;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.overlay-card .notebook-paper .blank-page {
  font: 18px/1.8 'Poor Story';
  color: #74745c;
  grid-column: 1/-1;
  padding: 20px 0;
}
.overlay-card .paper-footnote {
  font: 11px/1.7 system-ui !important;
  color: #686d53;
  border-top: 1px solid #b1a985;
  padding-top: 12px;
}
.paper-number {
  display: block;
  flex: none;
  text-align: center;
  font: 12px system-ui;
  color: #787151;
  margin-top: 10px;
}
.page-references {
  margin-top: 20px;
  font: 12px/1.6 system-ui;
}
.page-references summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  color: var(--ink);
}
.page-references .notebook-scraps {
  margin-top: 10px;
}
.notebook-extra {
  font: 13px/1.6 system-ui;
  color: #dce2cd;
  margin-top: 12px;
}
.overlay-card:has(.notebook-spread) > h1 {
  font-size: 26px;
}
@media (max-width: 760px) {
  .overlay-card:has(.notebook-spread) {
    padding: 12px;
    width: 100%;
  }
  .notebook-spread {
    --book-height: clamp(400px, 64dvh, 620px);
    display: block;
    height: auto;
    background: none;
    box-shadow: none;
  }
  .notebook-paper {
    height: var(--book-height);
    padding: calc(var(--book-height) * 0.085) 12%;
    background: #eee2c6 url('assets/notebook/open-notebook-v1.png') left center/200% 100% no-repeat;
  }
  .thinking-paper {
    background-position: right center;
    margin-top: 6px;
  }
  .notebook-paper h2 {
    font-size: 24px;
  }
  .notebook-contents ol {
    grid-template-columns: 1fr 1fr;
  }
  .book-navigation > span {
    font-size: 11px;
    max-width: 95px;
  }
  .overlay-card .book-navigation button {
    font-size: 11px;
    padding: 8px;
    max-width: 100px;
  }
  .notebook-intro {
    font-size: 12px;
  }
  .notebook-scraps {
    gap: 16px 10px;
  }
  .paper-content {
    padding-left: 4px;
    padding-right: 4px;
  }
  .scrap-art svg,
  .scrap-art img,
  .scrap-art .clue-tabletop {
    height: 75px;
  }
  .scrap-title {
    font-size: 13px;
  }
  .notebook-thought p {
    font-size: 18px !important;
  }
}
.notebook-record-popup {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 20px;
  border: 1px solid #b4b992;
  border-radius: 9px;
  background: #263d30;
  color: #eee5ce;
  box-shadow: 0 20px 60px #07110cb3;
  overflow: auto;
  overscroll-behavior: contain;
}
.notebook-record-popup::backdrop {
  background: #09130de0;
}
.notebook-record-popup header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  justify-content: space-between;
}
.notebook-record-popup header > div {
  min-width: 0;
}
.notebook-record-popup h2 {
  font: 23px/1.5 'Jua';
  margin: 7px 0 0;
  color: #ead5a8;
  overflow-wrap: anywhere;
}
.notebook-record-popup small {
  font: 12px/1.6 system-ui;
  color: #b9c9ae;
}
.notebook-record-popup .record-popup-close {
  flex: none;
  min-height: 44px;
  padding: 8px 12px;
  background: #3c5743;
  color: #f0e5c9;
  border: 1px solid #93a080;
  border-radius: 5px;
  font: 13px system-ui;
}
.notebook-record-popup .clue-art.compact,
.notebook-record-popup .evidence-event.compact {
  width: min(460px, 100%);
  margin: 20px auto;
  grid-row: auto;
}
.notebook-record-popup .record-popup-body p {
  color: #eee5ce;
  font: 16px/1.85 system-ui;
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  .notebook-record-popup {
    padding: 16px;
  }
  .notebook-record-popup h2 {
    font-size: 19px;
  }
  .notebook-record-popup header {
    gap: 8px;
  }
  .notebook-record-popup .record-popup-body p {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .notebook-spread {
    animation: page-ink 0.18s ease-out;
  }
  @keyframes page-ink {
    from {
      opacity: 0.75;
      transform: translateY(4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Location guide and lower-right survival HUD. */
main {
  grid-template-rows: auto auto auto 1fr;
}
.game-column {
  grid-row: 1/5;
}
.investigation-panel {
  grid-row: 1;
}
.people-panel {
  grid-row: 2;
}
.log-panel {
  grid-row: 3;
}
.map-top {
  align-items: center;
  gap: 10px;
}
.map-top #modeLabel {
  margin-left: auto;
  color: #aebea6;
  font: 11px system-ui;
}
#mapButton {
  flex-shrink: 0;
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid #a6b58a;
  background: #476046;
  color: #f6edcd;
  border-radius: 5px;
  font: 13px system-ui;
}
#mapButton:hover,
#mapButton:focus-visible {
  background: #5a7857;
  outline: 2px solid #e4ce91;
}
#mapButton[hidden] {
  display: none;
}
.status-panel {
  position: absolute;
  left: 12px;
  top: 12px;
  right: auto;
  bottom: auto;
  z-index: 3;
  width: 180px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  color: #f5f0dd;
  text-shadow:
    -1px -1px 1px #13291f,
    1px -1px 1px #13291f,
    -1px 1px 1px #13291f,
    1px 1px 2px #13291f;
}
.status-panel .meter {
  width: 100%;
  margin: 0;
}
.status-panel .meter > div:first-child {
  font: 12px system-ui;
  flex-wrap: nowrap;
}
.status-panel .meter b {
  font-size: 12px;
}
.status-panel .status-tags {
  display: none;
}
.status-panel .status-tags span {
  font: 9px system-ui;
  padding: 3px 5px;
}
.location-map-dialog {
  width: min(850px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.map-current {
  font: 14px system-ui;
  line-height: 1.5;
  color: #f4e2ae;
}
.map-current span {
  display: block;
  font-size: 11px;
  color: #a9bfac;
  margin-top: 3px;
}
.location-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: start;
}
.location-map-figure {
  margin: 0;
  min-width: 0;
}
.location-map-figure svg {
  display: block;
  width: 100%;
  max-height: min(360px, 45dvh);
  background: #24352f;
  border: 1px solid #7f9879;
  border-radius: 8px;
}
.map-floor {
  fill: #dfc795;
  stroke: #ccb586;
  stroke-width: 1;
}
.map-blocked {
  fill: #536357;
}
.map-furniture {
  fill: #8b7960;
  stroke: #5e5748;
  stroke-width: 5;
  rx: 8;
}
.map-door {
  fill: #a4c4b2;
  stroke: #314f47;
  stroke-width: 4;
}
.map-place-pin circle {
  fill: #f4e7c6;
  stroke: #655b46;
  stroke-width: 4;
}
.map-place-pin text,
.map-exit-pin text {
  fill: #243b2d;
  font: bold 28px system-ui;
}
.map-exit-pin circle {
  fill: #b7db85;
  stroke: #244d32;
  stroke-width: 5;
}
.map-hero circle:first-child {
  fill: #173d46;
  stroke: #eefcff;
  stroke-width: 5;
}
.map-hero circle:nth-child(2) {
  fill: #78dce1;
}
.map-hero text {
  fill: #193f46;
  stroke: #f9f1d9;
  stroke-width: 7;
  paint-order: stroke;
  font: bold 31px system-ui;
}
.location-map-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  font: 11px system-ui;
  margin-top: 10px;
  color: #d0d6c0;
}
.map-hero-key {
  color: #8ae0e5;
}
.map-door-key {
  color: #b5d3bf;
}
.location-map-legend h2 {
  font: 17px 'Jua';
  margin: 4px 0 10px;
  color: #ead3a1;
}
.location-map-legend ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 10px;
}
.location-map-legend li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font: 12px system-ui;
  line-height: 1.45;
}
.location-map-legend small {
  display: block;
  color: #b4c6b7;
  font-size: 11px;
  margin-top: 2px;
}
.location-map-legend .map-lock-reason {
  color: #e2bf92;
}
.map-exit-key,
.map-place-key {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #b7db85;
  color: #243b2d;
  font: bold 12px system-ui;
}
.map-place-key {
  background: #f4e7c6;
}
.map-connections {
  font: 12px system-ui;
  text-align: center;
  border-top: 1px solid #536c5a;
  padding-top: 14px;
  color: #c6d5b8;
}
@media (max-width: 760px) {
  .status-panel {
    width: 140px;
    left: 10px;
    top: 10px;
    right: auto;
    bottom: auto;
    gap: 6px;
    padding: 0;
    grid-template-columns: 1fr;
  }
  .status-panel .status-tags {
    display: none;
  }
  .status-panel .meter > div:first-child,
  .status-panel .meter b {
    font-size: 10px;
  }
  .status-panel .track {
    height: 4px;
    margin-top: 3px;
  }
  .map-top {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .map-top #modeLabel {
    display: none;
  }
  #mapButton {
    margin-left: auto;
    min-height: 36px;
  }
  #mapButton kbd {
    display: none;
  }
  .location-map-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .location-map-figure svg {
    max-height: 340px;
  }
  .location-map-legend ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    margin-bottom: 14px;
  }
  .location-map-legend li {
    font-size: 11px;
  }
  .location-map-legend h2 {
    font-size: 16px;
  }
  .location-map-dialog .map-current {
    font-size: 13px;
  }
  .location-map-dialog .buttons {
    position: sticky;
    bottom: -18px;
    background: #20343b;
    padding: 10px 0 0;
    margin-top: 10px;
  }
}

/* Illustrated action dock; dialogue floats over the live room. */
.app {
  padding-bottom: calc(var(--controls-height, 104px) + 32px);
}
.controls {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  z-index: 4;
  margin: 0;
  padding: 9px;
  background: linear-gradient(#344b3bd9, #1b302bd9);
  border: 1px solid #7c8e70;
  border-radius: 16px;
  box-shadow: 0 6px 22px #09171370;
}
.action-pad {
  grid-auto-rows: 80px;
  gap: 8px;
}
.controls .action-pad button {
  position: relative;
  border: 2px solid #7b9674;
  border-radius: 12px;
  background: linear-gradient(#57785d, #294939 62%, #1c3329);
  box-shadow:
    inset 0 2px 0 #9eaf8d70,
    0 4px 0 #101e19;
  color: #f4ecd4;
  font: 12px system-ui;
  line-height: 1.25;
}
.controls .action-pad button[data-action='interact'] {
  background: linear-gradient(#dec68e, #ad8855);
  border-color: #e9d49e;
  color: #25372b;
}
.controls .action-pad button:hover,
.controls .action-pad button:focus-visible {
  filter: brightness(1.15);
  outline: 2px solid #f4d690;
  outline-offset: 2px;
}
.controls .action-pad button:active {
  transform: translateY(2px);
}
.controls .action-pad button.graphic-action {
  padding: 3px 4px 7px;
}
.action-icon {
  display: block;
  width: 50px;
  height: 50px;
  margin: 0 auto 2px;
  background-image: url('assets/ui/action-icons.png');
  background-size: 200% 200%;
  background-repeat: no-repeat;
  image-rendering: auto;
  filter: drop-shadow(0 2px 1px #10251b66);
}
.icon-notebook {
  background-position: 0 0;
}
.icon-inspect {
  background-position: 100% 0;
}
.icon-talk {
  background-position: 0 100%;
}
.icon-more {
  background-position: 100% 100%;
}
.action-label {
  display: block;
  white-space: nowrap;
}
.graphic-action kbd {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 9px;
  margin: 0;
}
.controls.expanded .action-pad button[data-action],
body.has-urge .controls .action-pad button[data-action='inject'],
body.has-urge .controls .action-pad button[data-action='bite'] {
  order: 4;
}
.overlay:has(.person-dialogue) {
  --dialogue-top-space: max(18px, env(safe-area-inset-top));
  --dialogue-bottom-space: calc(var(--controls-height, 104px) + 32px + env(safe-area-inset-bottom));
  align-items: flex-end;
  background: linear-gradient(0deg, #07171350, transparent 70%);
  padding: var(--dialogue-top-space)
    max(20px, env(safe-area-inset-left), env(safe-area-inset-right)) var(--dialogue-bottom-space);
}
.overlay-card.person-dialogue {
  width: min(920px, 100%);
  min-height: 0;
  max-height: min(
    52vh,
    430px,
    calc(100vh - var(--dialogue-top-space) - var(--dialogue-bottom-space))
  );
  max-height: min(
    52dvh,
    430px,
    calc(100dvh - var(--dialogue-top-space) - var(--dialogue-bottom-space))
  );
  padding: 18px 22px;
  background: #101e24d9;
  border: 2px solid #b8a880;
  border-radius: 12px;
  box-shadow: 0 10px 35px #07101766;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.person-dialogue h1 {
  font: 21px 'Jua';
  color: #f3dca5;
  margin: 0 0 10px;
}
.person-dialogue .dialogue-scene {
  gap: 18px;
  padding: 0;
  align-items: flex-start;
}
.person-dialogue .dialogue-portrait {
  flex-basis: 106px;
  width: 106px;
  height: 106px;
  border: 1px solid #c2b18190;
  background-color: #1f353d80;
  border-radius: 8px;
}
.person-dialogue .dialogue-sprite-portrait {
  background-size: 614.4% 409.6%;
  background-position: 9.33% 7.75%;
}
.person-dialogue .dialogue-copy p {
  font: 16px system-ui;
  line-height: 1.7;
  color: #f5f0dc;
  margin: 5px 0 0;
}
.person-dialogue .dialogue-kicker {
  color: #90c9d3;
  font: 11px system-ui;
}
.person-dialogue .buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}
.person-dialogue .buttons button {
  font: 14px system-ui;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  padding: 8px 12px;
  min-height: 44px;
  background: #d5c18ee8;
  border: 1px solid #e2ce98;
  color: #26382d;
}
.person-dialogue .buttons button.secondary {
  background: #314b46cc;
  color: #e3e8d7;
  border-color: #8fa69a;
}
.person-dialogue .buttons button:disabled {
  opacity: 0.45;
}
.person-dialogue .case-reasons:empty {
  display: none;
}
.person-dialogue .case-reasons {
  margin: 8px 0;
  padding-left: 18px;
  font: 11px system-ui;
  line-height: 1.45;
}
.person-dialogue .case-reasons li {
  margin-bottom: 5px;
}
.person-dialogue .clue-receipt {
  font: 11px system-ui !important;
  margin: 8px 0;
  padding-top: 8px;
}
.dialogue-records {
  margin-top: 8px;
}
.dialogue-records > summary {
  cursor: pointer;
  color: #dac68f;
  font: 12px system-ui;
  min-height: 32px;
  padding: 8px 0;
}
.dialogue-records .evidence-event {
  max-width: 580px;
  margin: 12px auto;
}

@media (max-width: 760px) {
  .app,
  .app:has(.controls.expanded),
  body.has-urge .app {
    padding-bottom: calc(var(--controls-height, 104px) + 40px);
  }
  .controls {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0;
    gap: 6px;
  }
  .action-pad {
    grid-auto-rows: 74px;
    gap: 7px;
  }
  .controls .action-pad button {
    font-size: 11px;
  }
  .action-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
  }
  .controls .action-pad button.graphic-action {
    padding: 3px 2px 6px;
  }
  .overlay:has(.person-dialogue) {
    --dialogue-top-space: max(10px, env(safe-area-inset-top));
    --dialogue-bottom-space: calc(
      var(--controls-height, 96px) + 12px + env(safe-area-inset-bottom)
    );
    padding-inline: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
  }
  .overlay-card.person-dialogue {
    padding: 12px 13px;
    max-height: min(56vh, calc(100vh - var(--dialogue-top-space) - var(--dialogue-bottom-space)));
    max-height: min(56dvh, calc(100dvh - var(--dialogue-top-space) - var(--dialogue-bottom-space)));
    border-radius: 10px;
  }
  .person-dialogue h1 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .person-dialogue .dialogue-portrait {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }
  .person-dialogue .dialogue-scene {
    gap: 12px;
  }
  .person-dialogue .dialogue-copy p {
    font-size: 16px;
    line-height: 1.6;
  }
  .person-dialogue .dialogue-kicker {
    font-size: 10px;
  }
  .person-dialogue .buttons {
    gap: 6px;
  }
  .person-dialogue .buttons button {
    font-size: 14px;
    padding: 7px 9px;
    min-height: 44px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .overlay-card.person-dialogue {
    max-height: min(65vh, calc(100vh - var(--dialogue-top-space) - var(--dialogue-bottom-space)));
    max-height: min(65dvh, calc(100dvh - var(--dialogue-top-space) - var(--dialogue-bottom-space)));
  }
  .person-dialogue .dialogue-portrait {
    flex-basis: 66px;
    width: 66px;
    height: 66px;
  }
  .person-dialogue h1 {
    font-size: 16px;
    margin-bottom: 6px;
  }
  .controls {
    padding: 5px;
  }
  .action-pad {
    grid-auto-rows: 60px;
  }
  .action-icon {
    width: 34px;
    height: 34px;
  }
}

/* Keep the four main illustrated controls in place when more actions open. */
.controls.expanded .action-pad button[data-action='interact'] {
  order: 0;
}
.controls.expanded .action-pad button[data-action='talk'] {
  order: 1;
}
.controls.expanded .action-pad button[data-action='notebook'] {
  order: 2;
}
.controls .action-pad button[data-action='work'] {
  grid-column: auto;
}

.person-dialogue .dialogue-copy h1 {
  font: 19px 'Jua';
  color: #a4dce5;
  margin: 0 0 7px;
}
.person-dialogue .dialogue-kicker {
  display: none;
}
@media (max-width: 760px) {
  .person-dialogue .dialogue-copy h1 {
    font-size: 16px;
    margin-bottom: 5px;
  }
}

/* Keep the notebook close control visible while reading long pages. */
.notebook-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0 12px;
  margin-bottom: 12px;
  background: #263d30;
  border-bottom: 1px solid #718068;
}
.overlay-card .notebook-topbar h1 {
  min-width: 0;
  font: 25px 'Jua';
  margin: 0;
  color: #f5deaa;
  flex: 1;
}
.overlay-card .notebook-compare {
  flex: none;
  min-height: 44px;
  padding: 8px 14px;
  font: 14px system-ui;
}
.notebook-guide {
  margin: 6px 0;
  font: 13px/1.6 system-ui;
}
.notebook-guide summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.notebook-guide p {
  margin: 0 0 10px;
}
.key-hint {
  font-size: 12px;
}
.overlay-card .notebook-close {
  flex: none;
  min-height: 44px;
  padding: 8px 14px;
  background: #3c5743;
  color: #f3e7c8;
  border: 1px solid #a5b389;
  border-radius: 6px;
  font: 14px system-ui;
}
.overlay-card .notebook-close:hover,
.overlay-card .notebook-close:focus-visible {
  background: #527251;
  outline: 2px solid #f5d790;
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .notebook-topbar {
    gap: 8px;
    padding: 5px 0 10px;
  }
  .overlay-card .notebook-topbar h1 {
    font-size: 20px;
  }
  .overlay-card .notebook-close {
    font-size: 12px;
    padding: 8px 11px;
  }
}

/* Pencil sketches and stepped pixel silhouettes on the investigator's paper. */
.overlay-card.location-map-dialog {
  background: #e9ddbd url('assets/ui/sketch-map-paper.png') center/cover;
  border: 3px solid #8b7753;
  border-radius: 3px;
  color: #514935;
  box-shadow:
    5px 6px 0 #423b30,
    0 20px 60px #07130c80;
}
.location-map-dialog h1 {
  font: 30px 'Poor Story';
  font-weight: bold;
  color: #554932;
  letter-spacing: 0.02em;
}
.location-map-dialog .map-current {
  color: #514a35;
  font: 20px 'Poor Story';
}
.location-map-dialog .map-current span {
  color: #71674d;
  font: 14px 'Poor Story';
}
.location-map-figure svg {
  background: #eadcba url('assets/ui/sketch-map-paper.png') center/100% 100%;
  border: 2px dashed #8d7d5d;
  border-radius: 2px;
  shape-rendering: crispEdges;
}
.map-paper-texture {
  image-rendering: pixelated;
}
.map-floor {
  fill: #f3e6c222;
  stroke: #9b987526;
  stroke-width: 1;
}
.map-wall {
  fill: url(#map-pencil-hatch);
  stroke: #7e7155;
  stroke-width: 2;
}
.map-obstacle {
  fill: #9f8e6333;
  stroke: none;
}
.map-furniture-sketch {
  fill: none;
  stroke: #65543d;
  stroke-width: 3.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.map-furniture-sketch .map-furniture {
  fill: #c4b38b;
  stroke: #65543d;
  stroke-width: 4;
}
.map-furniture-sketch .map-sketch-cloth {
  fill: #dccab3;
}
.map-furniture-sketch .map-sketch-leaf {
  fill: #adbc8e;
  stroke: #687754;
}
.map-furniture-sketch .map-sketch-light {
  stroke: #968365;
  stroke-width: 2.5;
  opacity: 0.7;
}
.map-door {
  fill: #b5c0a5;
  stroke: #627659;
  stroke-width: 4;
  stroke-dasharray: 8 4;
}
.map-place-pin path {
  fill: #f5e7bf;
  stroke: #806d4e;
  stroke-width: 4;
}
.map-exit-pin path {
  fill: #c6d6a0;
  stroke: #586f49;
  stroke-width: 5;
}
.map-place-pin text,
.map-exit-pin text {
  font: bold 31px 'Poor Story';
  fill: #504832;
  shape-rendering: auto;
}
.map-hero path {
  fill: #e4f1e4;
  stroke: #386f78;
  stroke-width: 5;
}
.map-hero rect {
  fill: #64aeb7;
  stroke: none;
}
.map-hero text {
  font: bold 35px 'Poor Story';
  fill: #386f78;
  stroke: #f5e9c8;
  stroke-width: 6;
  shape-rendering: auto;
}
.location-map-figure figcaption {
  font: 15px 'Poor Story';
  color: #655b42;
}
.map-hero-key {
  color: #376f78;
}
.map-door-key {
  color: #647649;
}
.location-map-legend h2 {
  font: bold 22px 'Poor Story';
  color: #63563a;
  border-bottom: 1px dashed #a3926b;
  padding-bottom: 5px;
}
.location-map-legend li {
  font: 17px/1.3 'Poor Story';
  color: #4f4a35;
}
.location-map-legend small {
  font: 14px/1.4 'Poor Story';
  color: #766746;
}
.location-map-legend .map-lock-reason {
  color: #92553f;
}
.map-exit-key,
.map-place-key {
  font: bold 17px 'Poor Story';
  border: 1px solid #736347;
  border-radius: 3px;
  box-shadow: 1px 2px 0 #a89976;
  background: #c6d6a0;
  color: #504832;
  transform: rotate(-3deg);
}
.map-place-key {
  background: #f5e7bf;
  transform: rotate(2deg);
}
.location-map-dialog .map-connections {
  font: 17px 'Poor Story';
  color: #62573e;
  border-color: #a29471;
}
.location-map-dialog .buttons button {
  background: #627656;
  color: #f6ecd0;
  border: 2px solid #40583f;
  border-radius: 3px;
  box-shadow: 2px 3px 0 #897959;
  font: 17px 'Poor Story';
}
@media (max-width: 760px) {
  .location-map-dialog h1 {
    font-size: 26px;
  }
  .location-map-dialog .map-current {
    font-size: 17px;
  }
  .location-map-dialog .map-current span {
    font-size: 12px;
  }
  .location-map-legend li {
    font-size: 15px;
  }
  .location-map-legend small {
    font-size: 12px;
  }
  .location-map-legend h2 {
    font-size: 19px;
  }
  .location-map-figure figcaption {
    font-size: 13px;
  }
  .location-map-dialog .map-connections {
    font-size: 15px;
  }
  .location-map-dialog .buttons {
    background: #eadcba;
  }
  .location-map-dialog .buttons button {
    font-size: 16px;
  }
}

@media (max-width: 760px) {
  .overlay-card.location-map-dialog {
    padding-top: 32px;
  }
  .location-map-dialog h1 {
    margin-bottom: 12px;
  }
}

@media (max-width: 760px) {
  .location-map-dialog .map-connections {
    display: none;
  }
}

/* Urgent actions float above the normal dock without resizing the room. */
.overlay-sound {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.sound-settings {
  position: relative;
  font: 13px system-ui;
}
.sound-settings summary {
  cursor: pointer;
  padding: 12px 8px;
  min-height: 44px;
}
.sound-panel {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 6;
  width: 220px;
  padding: 12px;
  background: #263d30;
  border: 1px solid #a5b389;
  border-radius: 6px;
  display: grid;
  gap: 12px;
}
.sound-panel label {
  display: grid;
  gap: 6px;
}
.sound-panel button {
  min-height: 44px;
  padding: 8px 14px;
  background: #3c5743;
  color: #f3e7c8;
  border: 1px solid #a5b389;
  border-radius: 6px;
  font: 14px system-ui;
}
.sound-panel input {
  width: 100%;
  min-height: 44px;
}
.sound-panel small {
  color: #d7dec6;
}
@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }
}
@media (max-width: 380px) {
  .topbar .brand strong {
    font-size: 16px;
  }
  .topbar .shift {
    padding: 5px;
  }
  .topbar .shift span {
    font-size: 9px;
  }
  .topbar .sound-settings summary {
    padding: 12px 4px;
    font-size: 11px;
  }
  .topbar #helpButton {
    font-size: 11px;
    padding: 5px;
  }
}
body.has-urge .controls:not(.expanded) .action-pad button[data-action='inject'],
body.has-urge .controls:not(.expanded) .action-pad button[data-action='resist'],
body.has-urge .controls:not(.expanded) .action-pad button[data-action='hide'],
body.has-urge .controls:not(.expanded) .action-pad button[data-action='bite'] {
  position: absolute;
  bottom: calc(100% + 10px);
  width: calc((100% - 28px) / 2);
  height: 48px;
  min-height: 48px;
  z-index: 1;
  font-size: 13px;
}
body.has-urge .controls:not(.expanded) .action-pad button[data-action='inject'] {
  left: 10px;
  bottom: calc(100% + 66px);
  background: #416b53;
}
body.has-urge .controls:not(.expanded) .action-pad button[data-action='resist'] {
  right: 10px;
  bottom: calc(100% + 66px);
}
body.has-urge .controls:not(.expanded) .action-pad button[data-action='hide'] {
  left: 10px;
}
body.has-urge .controls:not(.expanded) .action-pad button[data-action='bite'] {
  right: 10px;
  background: #714b49;
}
.controls.expanded {
  max-height: 45dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.evidence-result-header {
  position: sticky;
  top: -24px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  background: #293b33;
}
.evidence-result-header h1 {
  margin: 0;
  min-width: 0;
}
.overlay-card .evidence-result-header button {
  flex: none;
  min-height: 44px;
  font: 13px system-ui;
  padding: 8px 12px;
}
@media (max-width: 760px) {
  .evidence-result-header {
    top: -18px;
  }
  .evidence-result-header h1 {
    font-size: 20px;
  }
}
.ward-portrait {
  flex: 0 0 106px;
  width: 106px;
  height: 106px;
  object-fit: contain;
  background: #263e3b;
  border: 1px solid #a3b29b;
  border-radius: 8px;
}
.ward-arrival img {
  display: block;
  width: 100%;
  max-height: 35dvh;
  object-fit: contain;
  border-radius: 6px;
}
.resolution-progress {
  color: #d8c18e !important;
  font: 13px system-ui !important;
}
.npc-greeting {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  box-sizing: border-box;
  width: max-content;
  max-width: min(240px, calc(100% - 16px));
  padding: 9px 12px;
  background: #f5ead0;
  color: #2d4336;
  border: 2px solid #64744d;
  border-radius: 9px;
  box-shadow: 2px 3px 0 #182c2870;
  font:
    15px/1.4 'Jua',
    sans-serif;
  text-align: left;
}
.npc-greeting[hidden] {
  display: none;
}
.npc-greeting::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--tail-x, 50%);
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #64744d;
}
.npc-greeting strong,
.npc-greeting span,
.npc-greeting small {
  display: block;
}
.npc-greeting strong {
  font: 11px/1.5 system-ui;
  color: #596647;
  margin-bottom: 2px;
}
.npc-greeting small {
  font: 11px/1.5 system-ui;
  color: #566247;
  margin-top: 4px;
}
.controls button.talk-ready,
.person-actions button.talk-ready {
  background: #475a35;
  border-color: #f3d38d;
  box-shadow: 0 0 0 2px #f3d38d55;
  color: #fff3cd;
}
@media (max-width: 760px) {
  .npc-greeting {
    font-size: 14px;
    padding: 8px 10px;
    max-width: min(220px, calc(100% - 16px));
  }
  .controls button.talk-ready .action-label {
    font-size: 11px;
  }
}
@media (max-width: 760px) {
  .ward-portrait {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }
}

.company-trust {
  border-top: 1px dashed #726c50;
  padding-top: 10px;
  margin: 10px 0;
  font-size: 12px;
}
.company-trust strong {
  color: #a6d5bd;
}
.company-trust p {
  line-height: 1.6;
  margin: 6px 0;
}
.ending-options {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.ending-options article {
  padding: 12px;
  background: #252b28;
  border: 1px solid #4b5f53;
  border-radius: 6px;
}
.ending-options p {
  margin: 6px 0;
  font-size: 13px;
}
.ending-options small {
  display: block;
  line-height: 1.6;
}
.ending-aftermath {
  border-top: 1px solid #64735d;
  margin-top: 22px;
  padding-top: 12px;
}
.ending-today h2,
.ending-aftermath h2 {
  font-size: 18px;
  color: #c7d8ac;
}
.ending-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ending-summary strong {
  overflow-wrap: anywhere;
}

.ending-summary > div {
  display: block;
}
.ending-summary small {
  margin-bottom: 8px;
}
.ending-summary strong {
  display: block;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Keep the investigation hint beside the map on every screen size. */
.map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#hintButton {
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid #c2b47a;
  background: #5b6241;
  color: #fff1c5;
  border-radius: 5px;
  font: 13px system-ui;
  cursor: pointer;
}
#hintButton:hover,
#hintButton:focus-visible {
  background: #747d50;
  outline: 2px solid #e4ce91;
}
#hintButton:disabled {
  opacity: 0.45;
  cursor: default;
}
#hintButton[hidden] {
  display: none;
}
.hint-context {
  color: #c9c7ac;
  font-size: 13px;
}
@media (max-width: 760px) {
  .map-tools {
    margin-left: auto;
  }
  .map-tools #mapButton {
    margin-left: 0;
  }
}

.ending-scene {
  margin: 0 0 20px;
  border: 2px solid #70654c;
  background: #202c29;
  border-radius: 10px;
  overflow: hidden;
}
.ending-scene img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  image-rendering: auto;
}
.ending-scene figcaption {
  padding: 8px 12px;
  color: #c8c4b3;
  font-size: 12px;
  text-align: center;
}

/* Read two collected papers and answer one concrete question. */
.overlay-card:has(.paper-comparison) {
  width: min(1040px, 100%);
}
.paper-question small,
.paper-free-note {
  color: #d7dec6;
  font: 13px/1.5 system-ui;
}
.overlay-card .paper-question h2 {
  font: 25px/1.4 'Jua';
  color: #f5deaa;
  margin: 6px 0 10px;
}
.overlay-card .paper-question p {
  font: 14px/1.5 system-ui;
  margin: 0 0 16px;
}
.comparison-papers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.comparison-paper {
  min-width: 0;
  padding: 20px;
  color: #314236;
  background: #eee2c6 url('assets/ui/sketch-map-paper.png') center/cover;
  border: 1px solid #b9a67f;
  border-radius: 3px;
  box-shadow: 2px 4px 0 #10241955;
}
.comparison-paper header {
  border-bottom: 1px solid #a79a75;
  margin-bottom: 14px;
  padding-bottom: 10px;
}
.comparison-paper small {
  color: #5c6451;
  font: 12px/1.5 system-ui;
}
.overlay-card .comparison-paper h3 {
  font: 21px/1.4 'Jua';
  margin: 6px 0;
  color: #354338;
}
.overlay-card .comparison-paper header p {
  font: 13px/1.5 system-ui;
  color: #5c6451;
  margin: 0;
}
.overlay-card .comparison-paper-text {
  font: 17px/1.8 system-ui;
  color: #314236;
  margin: 0;
  overflow-wrap: anywhere;
}
.comparison-paper details {
  margin-top: 16px;
  font: 13px system-ui;
}
.comparison-paper summary,
.paper-completed summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
}
.paper-verdict {
  position: sticky;
  bottom: -24px;
  z-index: 3;
  padding: 12px 0;
  margin-top: 18px;
  background: #263d30;
  border-top: 1px solid #718068;
  display: grid;
  gap: 8px;
  text-align: center;
}
.paper-verdict > span {
  font: 15px 'Jua';
  color: #f5deaa;
}
.paper-verdict > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.overlay-card .paper-verdict button {
  min-height: 48px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  font: 18px/1.5 'Jua';
  padding: 12px;
}
.paper-verdict small {
  font: 13px/1.6 system-ui;
  color: #d7dec6;
}
.paper-feedback {
  margin-top: 18px;
  border-left: 3px solid #d6bb7d;
  padding: 12px 16px;
  background: #344c39;
}
.paper-feedback.solved {
  border-color: #afcf97;
}
.paper-feedback:focus-visible {
  outline: 2px solid #f5deaa;
  outline-offset: 2px;
}
.paper-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.overlay-card .paper-tools button {
  min-height: 44px;
  font: 13px system-ui;
}
.paper-completed article {
  border-bottom: 1px solid #718068;
  padding-bottom: 10px;
}
@media (max-width: 760px) {
  .comparison-papers {
    gap: 10px;
  }
  .comparison-paper {
    padding: 12px 10px;
  }
  .overlay-card .paper-question h2 {
    font-size: 20px;
  }
  .overlay-card .comparison-paper h3 {
    font-size: 17px;
  }
  .overlay-card .comparison-paper header p,
  .comparison-paper small {
    font-size: 12px;
  }
  .overlay-card .comparison-paper-text {
    font-size: 15px;
    line-height: 1.65;
  }
  .paper-verdict {
    bottom: -12px;
  }
}

/* 챕터별 이야기와 조사 */
.app.opening {
  visibility: hidden;
}
.origin-dialog,
.chapters-dialog {
  width: min(1080px, 96vw);
}
.origin-kicker,
.origin-context {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.origin-kicker {
  margin: 12px 0;
  color: #e3d99f;
}
.origin-scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 1px solid #acaa82;
  border-radius: 8px;
  background: #182b26;
}
.origin-context {
  margin: 12px 0;
  color: #ded9bd;
}
.origin-objective {
  padding: 12px 14px;
  border-left: 3px solid #cbd399;
  background: #22352d;
  line-height: 1.6;
}
.origin-narrative {
  font-size: 17px;
  line-height: 1.8;
}
.origin-next-step {
  padding: 12px 14px;
  border: 1px solid #9ba77c;
  background: #2b4031;
  border-radius: 6px;
}
.origin-next-step strong {
  color: #f5deaa;
}
.overlay-card .origin-next-step p {
  margin: 6px 0 0;
  font: 15px/1.7 system-ui;
}
.origin-question .paper-verdict {
  position: static;
}
.origin-warning {
  padding: 14px;
  background: #62482d;
  border: 1px solid #d2b273;
  line-height: 1.7;
}
.origin-question h2 {
  font-size: 23px;
  margin: 16px 0 8px;
}
.origin-question .comparison-paper {
  min-height: 0;
}
.origin-question > small {
  display: block;
  padding-top: 10px;
  line-height: 1.6;
}
.origin-dialog .buttons {
  gap: 10px;
}
.origin-dialog .buttons button {
  min-height: 48px;
}
.origin-dialog [data-origin-action='judge-yes'],
.origin-dialog [data-origin-action='judge-no'] {
  min-width: 0;
  font-size: 19px;
}
.origin-records {
  margin-top: 18px;
  border-top: 1px solid #6b7864;
  padding-top: 12px;
}
.origin-records summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.origin-records article {
  padding: 14px;
  margin: 8px 0;
  background: #21352b;
  border-radius: 6px;
}
.origin-records article h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.origin-records article p {
  line-height: 1.7;
}
.origin-records small,
.origin-save {
  color: #ddd7bd;
  font-size: 12px;
}
.origin-supply {
  color: #e3d99f;
}
.chapter-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chapter-cards article {
  padding: 20px;
  border: 1px solid #67775e;
  border-radius: 8px;
  background: #20332a;
}
.chapter-cards article.current {
  border-color: #d2d996;
  background: #2a4232;
}
.chapter-cards h2 {
  font-size: 23px;
}
.chapter-cards p,
.chapter-overview > p {
  line-height: 1.7;
}
@media (max-width: 600px) {
  .origin-narrative {
    font-size: 15px;
  }
  .origin-question h2 {
    font-size: 19px;
  }
  .origin-dialog .buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .origin-dialog .buttons > button:last-child {
    grid-column: 1 / -1;
  }
  .origin-dialog [data-origin-action='judge-yes'],
  .origin-dialog [data-origin-action='judge-no'] {
    width: 100%;
  }
  .chapter-cards {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 800px) {
  .origin-chapter {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 8px 22px;
  }
  .origin-save,
  .origin-kicker {
    grid-column: 1 / -1;
  }
  .origin-scene {
    grid-column: 1;
    grid-row: 3 / span 4;
    align-self: start;
  }
  .origin-context {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
  }
  .origin-objective {
    grid-column: 2;
    grid-row: 4;
    margin: 0;
  }
  .origin-narrative {
    grid-column: 2;
    grid-row: 6;
    font-size: 16px;
  }
  .origin-next-step {
    grid-column: 2;
    grid-row: 5;
  }
  .origin-question,
  .origin-warning,
  .origin-feedback,
  .origin-records,
  .origin-supply {
    grid-column: 1 / -1;
  }
}
.origin-dialog .buttons [data-origin-action='next-chapter'] {
  grid-column: 1 / -1;
  width: 100%;
}

/* 두 장의 이야기를 시작하고 마치는 공통 화면 */
.game-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 24px;
  color: #e8ddc8;
  background: #202a29;
}
.game-loading strong {
  font:
    38px 'Jua',
    sans-serif;
  color: #f5d79c;
}
.overlay-card.title-dialog {
  width: min(940px, 100%);
  padding: 28px;
  background: #263632;
  color: #f1e9d8;
  border: 2px solid #aa946e;
}
.title-dialog > h1 {
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -0.025em;
  margin-bottom: 18px;
  color: #ffe0a4;
}
.title-story {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  align-items: center;
}
.title-hero {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #1b2824;
  aspect-ratio: 4 / 3;
}
.title-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.title-hero > span {
  position: absolute;
  inset: auto 0 0;
  padding: 46px 20px 20px;
  background: linear-gradient(transparent, rgba(17, 30, 27, 0.94));
  color: #fff3d6;
  line-height: 1.4;
}
.title-hero b {
  font:
    25px 'Jua',
    sans-serif;
}
.title-dialog .title-kicker {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #c5d3b5;
  margin: 0 0 12px;
}
.title-dialog .title-hook {
  font:
    30px/1.18 'Jua',
    sans-serif;
  color: #ffe3b4;
  margin: 0 0 16px;
}
.title-description p {
  color: #eee4cf;
}
.title-dialog .title-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  list-style: none;
  margin-bottom: 0;
}
.title-facts li {
  font-size: 13px;
  padding: 4px 7px;
  border: 1px solid #708475;
  border-radius: 4px;
  color: #e8dfc9;
}
.title-checkpoint {
  padding: 14px 16px;
  margin-top: 18px;
  border-left: 3px solid #d9ba7a;
  background: #1b2926;
}
.title-checkpoint small,
.title-checkpoint strong {
  display: block;
}
.title-checkpoint small {
  color: #bfceb6;
  margin-bottom: 6px;
}
.title-checkpoint p {
  margin: 6px 0 0;
}
.title-dialog .title-invitation {
  margin: 18px 0 8px;
  color: #f1e3c6;
}
.title-guidance {
  display: flex;
  gap: 6px 18px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: #c6d0bf;
  font-size: 14px;
}
.title-dialog .title-save {
  font-size: 14px;
  color: #efcf92;
  margin: 8px 0;
}
.title-dialog .buttons {
  position: sticky;
  bottom: -28px;
  padding: 14px 0 4px;
  background: #263632;
}
.title-dialog .buttons > button {
  min-height: 48px;
  flex: 1 1 220px;
}
.game-credits {
  border-top: 1px solid #718173;
  padding-top: 12px;
  margin-top: 16px;
  font-size: 14px;
}
.game-credits summary {
  cursor: pointer;
  min-height: 32px;
}
.game-credits p {
  max-width: 70ch;
}
.credit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.game-credits a {
  color: inherit;
  text-underline-offset: 3px;
}
.ending-complete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'Jua', sans-serif;
}
.ending-complete span {
  font:
    14px 'Poor Story',
    sans-serif;
}
.case-review {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid #9e997e;
  border-radius: 6px;
}
.case-review h2 {
  font:
    22px 'Jua',
    sans-serif;
  margin: 0;
}
.case-review ul {
  list-style: none;
  padding: 0;
}
.case-review li {
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.case-review li small {
  margin-left: auto;
}
.case-review li.complete {
  font-weight: bold;
}
.ending-thanks {
  text-align: center;
  padding: 12px 0;
}
:focus-visible {
  outline: 3px solid #d39b43;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  .overlay-card.title-dialog {
    padding: 18px;
  }
  .title-story {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .title-hero {
    aspect-ratio: 2 / 1;
  }
  .title-hero img {
    object-position: 50% 40%;
  }
  .title-hero > span {
    padding: 30px 14px 12px;
    font-size: 14px;
  }
  .title-hero b {
    font-size: 20px;
  }
  .title-dialog .title-hook {
    font-size: 24px;
    margin-bottom: 10px;
  }
  .title-hook br {
    display: none;
  }
  .title-description > p:not(.title-hook):not(.title-kicker) {
    font-size: 15px;
    margin: 10px 0;
  }
  .title-dialog .title-kicker {
    margin-bottom: 6px;
  }
  .title-dialog .buttons {
    bottom: -18px;
  }
  .title-resume .title-description {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
