:root {
  color-scheme: light;
  --ink: #202a24;
  --muted: #5f6d63;
  --green: #176846;
  --soft-green: #e5f3ea;
  --line: #dbe2db;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --cell-height: clamp(42px, 6.1vh, 57px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f3;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, textarea:focus-visible {
  outline: 2px solid #188655;
  outline-offset: 2px;
}

.page { width: min(100% - 96px, 1360px); margin: 0 auto; }
.entry { min-height: 100svh; display: grid; align-items: center; padding: clamp(18px, 5vw, 68px); }
.entry-book { width: min(100%, 1120px); margin-inline: auto; background: #fbfcf8; border: 1px solid #cbd8cb; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 45px #233e2c14; }
.entry-bar { display: flex; align-items: center; gap: 9px; padding: 12px 18px; background: #185c3e; color: white; font-size: 13px; font-weight: 650; }
.entry-content { display: grid; grid-template-columns: minmax(220px, .85fr) minmax(0, 1.45fr); align-items: center; gap: clamp(18px, 4vw, 55px); padding: clamp(22px, 5vw, 64px); }
.entry-copy { min-width: 0; }
.entry-time { color: var(--green); font: 600 12px var(--mono); }
.entry-time span { padding-inline: 4px; }
#entry-title { margin: 9px 0 16px; font-size: clamp(39px, 5.7vw, 72px); letter-spacing: -.08em; line-height: 1.04; }
.entry-break { display: block; }
.entry-description { margin: 0 0 10px; color: #4f6256; font-size: 14px; line-height: 1.7; }
.entry-rumor { margin: 0 0 18px; color: #4f6256; font-size: 13px; line-height: 1.65; }
.entry-actions { display: grid; justify-items: start; gap: 8px; }
.entry-actions button { min-width: 142px; min-height: 42px; justify-content: space-between; text-align: left; }
.entry-actions .primary-button { display: inline-flex; align-items: center; gap: 12px; }
.entry-progress { margin: -2px 0 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.entry-picture { min-width: 0; padding: 7px; background: #283b32; box-shadow: 5px 5px #d6e0d5; }
.entry-picture canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
@media (max-width: 700px) {
  .entry-content { grid-template-columns: minmax(0, 1fr); }
  .entry-picture { grid-row: 1; }
  .entry-break { display: inline; }
}
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 96px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  grid-template-columns: repeat(2, 8px);
  grid-auto-rows: 8px;
  gap: 3px;
  border-radius: 10px;
  background: var(--green);
}
.brand-mark i { border-radius: 1px; background: #e3f2e7; }
.brand-mark i:last-child { background: #85c69d; transform: translate(2px, 2px); }
h1 { font-size: clamp(22px, 2.3vw, 31px); letter-spacing: -.055em; margin: 0; line-height: 1.1; }
h1 span { color: var(--green); }
.site-actions { display: flex; gap: 11px; align-items: center; flex-shrink: 0; }
.plain-button, .outline-button, .tool-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.plain-button:hover, .tool-button:enabled:hover { background: #eaf0eb; }
.outline-button { background: white; border-color: #cddacf; color: var(--green); }
.outline-button:hover { background: #e8f3eb; }
.question-icon { display: grid; width: 15px; height: 15px; place-items: center; border: 1px solid; border-radius: 50%; font-size: 10px; }

.workbook {
  border: 1px solid #cfd9d0;
  border-radius: 12px;
  background: white;
  overflow: hidden;
  box-shadow: 0 14px 36px #1b3a2510, 0 2px 8px #1b3a250a;
}
.filebar {
  min-height: 47px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 17px;
  background: #185c3e;
  color: #fff;
}
.file-icon { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #a4cbb5; border-radius: 4px; font-size: 17px; line-height: 1; }
.filename { font-size: 14px; font-weight: 650; }
.file-tag { padding: 2px 6px; border: 1px solid #75a48a; border-radius: 4px; font-size: 10px; color: #e4f1e7; }
.save-status { margin-left: auto; font-size: 11px; color: #edf6ef; white-space: nowrap; }
.work-area { display: grid; grid-template-columns: minmax(0, 1fr) 292px; }
.sheet { min-width: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; row-gap: 3px; padding: 6px 10px; min-height: 49px; border-bottom: 1px solid var(--line); background: #fafbf9; }
.tool-group { display: flex; gap: 5px; }
.toolbar-end { margin-inline-start: auto; }
.tool-button { padding: 5px 8px; }
.tool-button:disabled { color: #657168; }
.tool-button.stairs-button { min-height: 40px; padding: 6px 11px; border-color: var(--green); background: var(--green); color: #fff; }
.tool-button.stairs-button:enabled:hover { background: #125438; }
.stairs-icon { width: 22px; height: 22px; image-rendering: pixelated; }
.tool-count { font: 11px var(--mono); color: var(--green); background: var(--soft-green); border-radius: 4px; padding: 2px 4px; }
.tool-icon { font-size: 19px; line-height: 1; font-weight: 500; }
.reset-button { color: var(--muted); }
.pause-button { color: var(--green); }
.pause-symbol { width: 9px; height: 11px; border-inline: 3px solid currentColor; }
.formula { display: flex; align-items: stretch; min-height: 34px; border-bottom: 1px solid var(--line); }
.address, .fx { display: grid; place-items: center; width: 66px; flex: none; border-right: 1px solid var(--line); font: 12px var(--mono); }
.fx { width: 39px; font: italic 16px Georgia, serif; color: var(--green); }
.formula-value { padding: 8px 11px; color: #506058; font: 12px var(--mono); overflow-wrap: anywhere; }
.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; background: #f7f9f7; }
.board {
  display: grid;
  grid-template-columns: 35px repeat(12, minmax(35px, 1fr));
  grid-template-rows: 25px repeat(9, var(--cell-height));
  min-width: 455px;
  isolation: isolate;
}
.axis {
  display: grid;
  place-items: center;
  border: solid var(--line);
  border-width: 0 1px 1px 0;
  background: #f2f5f1;
  color: #55635c;
  font: 11px var(--mono);
}
.axis.active { color: #125736; background: #dcece0; font-weight: bold; }
.corner { background: linear-gradient(135deg, transparent 48%, #c5d3c7 50%, #c5d3c7 76%, transparent 78%) 12px 8px / 10px 10px no-repeat #f2f5f1; }
.row-axis { position: sticky; left: 0; z-index: 2; }
.cell {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: solid var(--line);
  border-width: 0 1px 1px 0;
  background: #f6f8f5;
  color: #56675b;
  cursor: default;
}
.cell:focus-visible { outline-offset: -3px; z-index: 3; }
.cell.open { background: #fff; }
.cell.reachable { cursor: pointer; background: #edf6ee; }
.cell.reachable::after { content: ""; position: absolute; inset: 4px; border: 1px dashed #8ab19a; border-radius: 3px; pointer-events: none; }
.cell.reachable:hover { background: #d8ecdf; }
.cell.current { border: 2px solid #1b8051; background: #d9efe0; z-index: 1; }
.cell.current::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 6px; height: 6px; border: 1px solid #fff; background: #1b8051; }
.cell.wall { background: repeating-linear-gradient(135deg, #dde5de 0 5px, #e4ebe5 5px 9px); }
.cell.exit { background: #e3f0e7; }
.cell.reachable.exit:hover { background: #cbe6d3; }
.cell.key { background: #fff1bc; box-shadow: inset 0 0 0 1px #be872e; }
.cell.reachable.key:hover { background: #ffe79b; }
.cell.hideout { background: #def0ec; }
.cell.station { background: #e9eff9; }
.cell.chair { background: #e9e4df; }
.cell.fish-station:not(.danger) { background: #e4f2f4; }
.cell.test-room:not(.danger):not(.current) { background: #eef3f9; }
.cell.door-open:not(.danger):not(.current) { background: #e2effa; }
.cell.door-closed:not(.current):not(.manager) { background: repeating-linear-gradient(135deg, #dce0e5 0 5px, #e7e9ed 5px 9px); }
.cell.door-preview-open { outline: 2px solid #426eaf; outline-offset: -3px; }
.cell.door-preview-closed { outline: 2px dashed #636d7a; outline-offset: -3px; }
.cell.lab-emergency-exit { outline: 2px dashed #9d592c; outline-offset: -3px; }
.cell.handoff-primary-next { box-shadow: inset 0 0 0 2px #a44541; }
.cell.handoff-deputy-next { outline: 2px dashed #694b91; outline-offset: -4px; }
.cell.crowd:not(.current):not(.manager) { background: #faecd4; }
.cell.crowd-next { outline: 2px dashed #a27736; outline-offset: -3px; }
.cell.admin-cart { background: #f7e4b9; color: #70460e; cursor: help; }
.world-pace { display: inline-flex; align-self: center; width: clamp(18px, 4vw, 36px); height: 4px; background: #dae5da; border-radius: 2px; overflow: hidden; flex: none; }
#world-beat { display: block; width: 100%; background: var(--green); transform: scaleX(0); transform-origin: left; }
.cell.lobby-hide:not(.current):not(.danger):not(.reachable):not(.manager) { background: #fff; }
.cell.cleaner:not(.current) { background: #dceaf3; }
.lobby-sheet .cell.crowd:not(.danger):not(.current):not(.manager) { background: #fff; }
.cell.lobby-destination::before { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; background: #315196; transform: rotate(45deg); box-shadow: 0 0 0 1px #fff; pointer-events: none; }
.cell.exit.lobby-destination::before { background: #18734a; }
.cell.gate-locked { background: #eeeae5; }
.cell.manager.deputy { background: #f0d4e0; box-shadow: inset 0 0 0 2px #924665; }
.cell.meeting-preview { outline: 2px dashed #aa7a33; outline-offset: -3px; }
.cell.display-spot:not(.current) { box-shadow: inset 0 0 0 1px #557da6; }
.lobby-map { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border: 1px solid #dbe6de; }
.lobby-map span { min-height: 27px; display: grid; place-items: center; border: solid #dbe6de; border-width: 0 1px 1px 0; }
.lobby-map .wall { background: #e7ece7; }
#game-cutscene { display: block; width: 100%; height: auto; image-rendering: pixelated; background: #192d28; }
#cutscene-caption { min-height: 3em; }
#cutscene-caption.caught-caption { min-height: 0; font-size: 15px; font-weight: 650; color: #8b332d; }
.cell.fish-station:not(.current):not(.manager) .sprite { animation: dip-number 2.8s ease-in-out infinite; }
@keyframes dip-number { 0%, 75%, 100% { transform: translateY(0); } 85% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .cell.fish-station:not(.current):not(.manager) .sprite { animation: none; } }
.cell.note::before { content: ""; position: absolute; top: 0; right: 0; border-block-start: 7px solid #a74844; border-inline-start: 7px solid transparent; }
.cell.danger { background: repeating-linear-gradient(135deg, #fce7df 0 6px, #f9dcd3 6px 8px); }
.cell.manager { background: #f5c7bc; box-shadow: inset 0 0 0 2px #ad4e43; }
.cell.paste-target, .cell.trajectory, .cell.bait { box-shadow: inset 0 0 0 2px #5d75ae; background: #e3edff; }
.cell.paste-target { cursor: copy; }
.cell.bait .sprite { opacity: .68; }
.cell.current { background: #d9efe0; }
.cell.current.danger:not(.hideout) { border-color: #ad4e43; }
.cell.current.hideout { background: #cde9e4; border-color: #218074; }
.cell.paperwork:not(.danger) { background: #fff4db; }
.cell.coworker { box-shadow: inset 0 0 0 1px #855fc1; }
.cell.footprint::before { content: "••"; position: absolute; inset: 2px 2px auto auto; color: #6947a3; font: 700 13px var(--mono); line-height: 1; pointer-events: none; }
.cell.signal-target { outline: 2px solid #7443b5; outline-offset: -3px; cursor: pointer; }
.cell.folded-note::before { border-block-start-color: #a23f77; animation: note-twitch 1.2s ease-in-out infinite; }
@keyframes note-twitch { 0%, 70%, 100% { transform: translateX(0); } 80% { transform: translateX(-3px); } 90% { transform: translateX(1px); } }
@media (prefers-reduced-motion: reduce) { .cell.folded-note::before { animation: none; } }
.sprite { width: min(27px, 79%); height: auto; image-rendering: pixelated; pointer-events: none; }
.conversation-marker {
  position: absolute;
  z-index: 1;
  top: 5px;
  right: 5px;
  width: 3px;
  height: 12px;
  color: #be302b;
  filter: drop-shadow(1px 0 #fffdf3) drop-shadow(-1px 0 #fffdf3) drop-shadow(0 1px #fffdf3);
  pointer-events: none;
  animation: conversation-hop 1.65s steps(1, end) infinite;
}
.conversation-marker::before, .conversation-marker::after { content: ""; position: absolute; left: 0; width: 100%; background: currentColor; }
.conversation-marker::before { top: 0; height: 7px; }
.conversation-marker::after { bottom: 0; height: 3px; }
@keyframes conversation-hop {
  0%, 25%, 100% { transform: translateY(0); }
  7%, 19% { transform: translateY(-2px); }
  13% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) { .conversation-marker { animation: none; } }
.cell-tooltip {
  position: fixed;
  z-index: 5;
  max-width: calc(100vw - 16px);
  padding: 5px 8px;
  border: 1px solid #496f59;
  border-radius: 4px;
  background: #214735;
  color: #fffdf3;
  box-shadow: 2px 2px #20493633;
  font: 12px/1.35 var(--mono);
  pointer-events: none;
}
.board { position: relative; }
.rolling-cup { position: absolute; top: 0; left: 0; z-index: 4; width: 18px; height: 18px; pointer-events: none; image-rendering: pixelated; }
.scene { display: flex; justify-content: space-between; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 7px 12px; min-height: 51px; background: #eef3fa; border-top: 1px solid #d7dfea; }
.scene p { margin: 0; font-size: 12px; color: #314766; line-height: 1.45; }
.scene p.scene-warning { color: #8b332d; font-weight: 650; }
.scene.is-idle { min-height: 0; padding: 0; border: 0; }
.scene-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.scene-actions:empty { display: none; }
.scene-actions button { padding: 5px 8px; min-height: 30px; }
.scene-actions button[aria-pressed="true"] { background: #d8e7fc; border-color: #536da4; color: #263e69; }
.inventory { display: flex; align-items: center; gap: 5px 14px; flex-wrap: wrap; padding: 4px 12px; background: #f5f8ef; border-top: 1px solid #d9e4d4; }
.inventory-item { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.inventory-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.inventory-label, .inventory-detail { color: #4a5d50; font-size: 12px; }
.inventory-detail { flex-basis: 100%; margin: 0 0 3px; }
.inventory-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: #fffdf4; border: 1px solid #c8d7c4; border-radius: 4px; }
.inventory-button:hover, .inventory-button[aria-expanded="true"] { background: #e9f1de; border-color: #719679; }
.item-sprite { display: block; image-rendering: pixelated; }
.primary-button:disabled { opacity: .5; }
.sheet-footer { display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin-top: auto; padding: 0 12px; background: #f6f8f5; border-top: 1px solid var(--line); }
.sheet-tabs { display: flex; align-self: stretch; overflow-x: auto; }
.sheet-tabs .sheet-tab { flex: none; }
.sheet-tab { display: flex; align-items: center; padding: 0 13px; color: var(--muted); font-size: 12px; }
.sheet-tab.active { border-bottom: 3px solid var(--green); background: white; color: var(--green); font-weight: 700; }
.turn { color: var(--muted); font-size: 11px; }

.sidebar { min-width: 0; border-left: 1px solid var(--line); background: #fbfcfa; }
.sidebar-heading { display: flex; align-items: center; gap: 7px; min-height: 49px; border-bottom: 1px solid var(--line); padding: 0 17px; font-size: 12px; font-weight: 700; }
.live-dot, .ready-dot { width: 7px; height: 7px; border-radius: 50%; background: #298050; display: inline-block; flex-shrink: 0; }
.progress { padding: 18px 17px; }
.mission { padding: 15px 13px; border: 1px solid #d4e3d7; border-radius: 8px; background: #f0f7f0; }
.mission-label { color: var(--green); font-size: 10px; font-weight: 750; }
h2 { margin: 4px 0 7px; line-height: 1.2; font-size: 20px; letter-spacing: -.035em; }
.mission p { margin: 0; color: #4a5d50; font-size: 12px; line-height: 1.55; }
.mission .route-hint { margin-top: 10px; padding-top: 8px; border-top: 1px solid #d4e3d7; }
.checklist { display: grid; gap: 8px; margin-top: 15px; }
.floor-tasks { display: contents; }
.task { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.check { display: inline-grid; width: 14px; height: 14px; place-items: center; border: 1px solid #8ca594; border-radius: 3px; background: #fff; }
.task.done .check { background: var(--green); color: #fff; border-color: var(--green); }
.task.done .check::before { content: "✓"; font-size: 10px; }
.task code { color: var(--green); font: 11px var(--mono); }
.patrol-info { display: grid; gap: 7px; font-size: 11px; color: #4a5d50; padding: 13px 0; border-bottom: 1px solid var(--line); }
.patrol-info strong { color: #8b332d; font-size: 12px; }
.patrol-info span { display: flex; align-items: center; gap: 5px; }
.patrol-info i { display: inline-grid; place-items: center; width: 14px; height: 14px; flex: none; border-radius: 3px; font: 10px var(--mono); }
.legend-danger { background: #f8d9cf; border: 1px solid #cd9185; }
.legend-crowd { border: 2px dashed #a27736; background: #faf7ea; }
.legend-hide { background: #def0ec; border: 1px solid #88b6aa; }
.legend-coworker { background: #eee2fa; border: 1px solid #a486c9; color: #603c95; }
#coworker-status { color: #603c95; }
.rumors { grid-column: 1 / -1; margin-top: 12px; }
.rumors h3 { margin: 0 0 6px; font-size: 12px; }
.rumor-card { border: 1px solid #dcd5e6; border-radius: 6px; background: #f5f2f8; color: #493d60; }
.rumor-card[data-progress="active"] { border-color: #c5b5db; }
.rumor-card[data-progress="done"] { border-color: #c6d6c9; background: #f3f7f1; }
.rumor-title { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 22px; align-items: center; gap: 6px; min-height: 46px; padding: 7px 8px; cursor: pointer; list-style: none; }
.rumor-title::-webkit-details-marker { display: none; }
.rumor-tap { display: block; grid-area: 1 / 4; image-rendering: pixelated; }
.rumor-card[open] .rumor-tap { visibility: hidden; }
.rumor-card[open] .rumor-title::after { content: ""; grid-area: 1 / 4; justify-self: center; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(1px) rotate(225deg); }
.rumor-title:focus-visible { outline: 2px solid #766090; outline-offset: -3px; border-radius: 5px; }
.rumor-icon { display: block; image-rendering: pixelated; }
.rumor-name { font-size: 12px; font-weight: 650; }
.rumor-kind { display: inline-block; color: #694d88; font-size: 10px; margin-inline-end: 2px; }
.rumor-status { font-size: 10px; white-space: nowrap; }
.rumor-card-body { border-top: 1px solid #e0d9e8; padding: 8px 10px 4px; font-size: 12px; }
.rumor-progress-label { display: flex; justify-content: space-between; gap: 8px; }
#lights-count { font-family: var(--mono); }
.rumor-progress { display: block; width: 100%; height: 7px; margin-top: 5px; accent-color: #776096; }
.rumor-card-body p { margin: 7px 0 1px; line-height: 1.5; }
.rumor-notes.plain-button { margin-left: -5px; padding: 4px; color: inherit; font-size: 11px; }
.cell.rumor-door { box-shadow: inset 0 -2px #8171ad; }
.cell.rumor-door.current { box-shadow: inset 0 0 0 2px var(--green), inset 0 -5px #8171ad; }
.cell.cleaner-room-door:not(.current):not(.danger):not(.crowd):not(.manager) { background: #ede7f7; }
.cell.cleaner-room-door:not(.current).reachable:hover { background: #e2d7f1; }
.rumor-map { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid var(--line); gap: 1px; background: var(--line); }
.rumor-cell { display: grid; place-items: center; min-width: 0; min-height: 37px; padding: 2px; border: 0; background: #f8faf7; }
.rumor-cell.wall { background: repeating-linear-gradient(135deg, #e1e7df 0 5px, #d7e1d7 5px 9px); }
.rumor-cell.room-object { background: #ebe9f7; color: #423360; }
.rumor-cell.reachable { outline: 1px dashed #588d6d; outline-offset: -3px; }
.rumor-cell.current { background: #d5ede0; box-shadow: inset 0 0 0 2px var(--green); color: #19543c; font-weight: 700; }
.replay-step { margin: 0 0 6px; color: var(--green); }
.replay-clue { padding: 10px 12px; border-left: 3px solid #719582; background: #edf4ee; }
.replay-choices { display: grid; gap: 8px; }
.replay-choices button { text-align: left; }
#rumor-message { min-height: 2.8em; }
#room-reply { white-space: pre-line; }
.messages h3 { margin: 15px 0 9px; font-size: 12px; }
.event-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.event { border-radius: 5px; border-left: 2px solid #b9cebf; padding: 6px 8px; background: #f2f5f1; color: #43534a; font-size: 11px; line-height: 1.5; }
.event:first-child { border-color: #377750; }
.event.warning { border-color: #b47d26; background: #f9f1e1; }
.event-turn { font: 10px var(--mono); color: var(--muted); margin-right: 6px; }
.statusbar { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); color: #485b4e; background: #edf4ed; font-size: 11px; }
.statusbar > span:first-child { display: flex; align-items: center; gap: 7px; }
.controls-hint { white-space: nowrap; }
.controls-hint span { margin: 0 3px; }
.page-footer { text-align: right; margin: 15px 1px 20px; font-size: 11px; color: #53645a; }
#version { font-family: var(--mono); }

dialog { width: min(450px, 100% - 28px); max-height: 90vh; padding: 26px; border: 1px solid #c9d9ce; border-radius: 12px; color: var(--ink); box-shadow: 0 18px 58px #172d2640; }
dialog::backdrop { background: #122c2060; }
#pause-dialog { width: min(250px, 100% - 28px); padding: 22px; text-align: center; background: #fafbf9; }
#pause-title { margin: 0 0 14px; font-size: 20px; }
#pause-dialog button { min-height: 40px; }
body:has(#pause-dialog[open]) .board * { animation-play-state: paused; }
.dialog-close { position: absolute; top: 10px; right: 12px; }
.dialog-close button { background: transparent; border: 0; color: var(--muted); font-size: 24px; }
dialog h2 { margin: 0 28px 12px 0; font-size: 24px; }
dialog p, dialog li { color: #495b51; font-size: 13px; line-height: 1.65; }
dialog ul { padding-left: 20px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 15px; }
.item-closeup { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: start; gap: 14px; padding: 13px; border: 1px solid #d9e4dc; border-radius: 7px; background: #f5f8f4; animation: dialogue-open 180ms ease-out both; }
.item-closeup-art { position: relative; display: grid; place-items: center; min-height: 120px; border: 1px solid #d0dfd3; border-radius: 5px; background: linear-gradient(#dbe7dd 1px, transparent 1px) 0 0 / 12px 12px, linear-gradient(90deg, #dbe7dd 1px, transparent 1px) 0 0 / 12px 12px, #eaf1ea; }
.item-closeup-art img { display: block; image-rendering: pixelated; filter: drop-shadow(3px 4px 0 #314b3e26); }
.item-closeup-stamp { position: absolute; right: 6px; bottom: 6px; color: #465e50; font: 650 11px var(--mono); }
.item-closeup-copy h2 { margin: 3px 18px 5px 0; font-size: 21px; }
.item-closeup .item-closeup-status { margin: 0; color: var(--green); font-size: 11px; font-weight: 650; }
.item-closeup-detail { margin: 0; }
.item-closeup .item-closeup-quip { margin: 10px 0 0; padding: 6px 8px; border-left: 2px solid #88ac95; background: #fff; color: #254b38; }
.item-locked .item-closeup-status { color: #765626; }
.item-locked .item-closeup-quip { border-left-color: #aa8cb4; }
@media (max-width: 480px) {
  .item-closeup { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .item-closeup-art { min-height: 104px; }
}
@media (prefers-reduced-motion: reduce) { .item-closeup { animation: none; } }
.dialogue-transcript { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.typed-line { display: block; }
.typed-line + .dialogue-transcript + .typed-line:not(:empty) { margin-top: 6px; }
.typing-dialogue { cursor: pointer; }
.typed-line.typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-inline-start: 2px; vertical-align: -.12em; background: var(--green); animation: typing-caret .8s step-end infinite; }
@keyframes typing-caret { 50% { opacity: 0; } }
#room-reply { min-height: 4.9em; }
div[data-speech] .typed-line { color: #495b51; font-size: 13px; line-height: 1.65; }
.dialogue-panel { display: grid; gap: 9px; margin: 0; padding: 11px; border: 1px solid #d9e4dc; border-radius: 7px; background: #f5f8f4; color: #354a3e; font-size: 13px; line-height: 1.65; animation: dialogue-open 180ms ease-out both; }
.dialogue-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 9px; align-items: start; }
.dialogue-caption-row { grid-template-columns: minmax(0, 1fr); }
.dialogue-speaker { display: block; margin-bottom: 2px; color: #254b38; font-size: 12px; line-height: 1.25; }
.dialogue-identity { display: block; margin-bottom: 4px; color: #53675a; font-size: 11px; line-height: 1.35; }
.dialogue-caption-row .dialogue-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; }
.dialogue-caption-row .dialogue-identity { margin-bottom: 2px; }
.dialogue-thought .dialogue-speaker { color: #58656b; }
.dialogue-portrait { position: relative; display: block; width: 46px; height: 46px; padding: 1px; border-radius: 4px; box-shadow: inset 0 0 0 1px #354a3e20; }
.dialogue-portrait canvas { display: block; width: 44px; height: 44px; image-rendering: pixelated; }
.dialogue-mouth { position: absolute; top: 25px; left: 19px; width: 8px; height: 2px; background: #69403c; }
.dialogue-row.is-speaking:not(.dialogue-thought) .dialogue-mouth { animation: dialogue-mouth .34s steps(1, end) infinite; }
@keyframes dialogue-open { from { opacity: .45; transform: translateY(5px); } }
@keyframes dialogue-mouth { 25%, 65% { height: 5px; } }
@media (prefers-reduced-motion: reduce) { .dialogue-panel, .dialogue-row.is-speaking .dialogue-mouth { animation: none; } }
dialog .intro-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.intro-title ~ #cutscene-caption, .intro-title ~ #cutscene-actions { min-height: 44px; margin: 10px 0 0; }
.intro-title ~ #cutscene-actions { align-items: center; }
.intro-toolbar { display: flex; justify-content: flex-end; margin: -12px 0 4px; min-height: 32px; }
.intro-toolbar .plain-button, .intro-direct { color: var(--muted); font-weight: 550; }
.intro-toolbar .plain-button { align-self: center; padding-block: 5px; font-size: 12px; }
dialog .guide-progress { margin: 0 0 6px; color: var(--green); font: 600 12px/1.4 var(--mono); }
#guide-instruction { margin: 6px 0 12px; }
.guide-workbook { border: 1px solid var(--line); border-radius: 6px; }
.guide-toolbar { padding: 6px 8px 6px 30px; border-bottom: 1px solid var(--line); background: #f4f7f3; }
.guide-toolbar .stairs-button:disabled { opacity: .53; }
.guide-cells { display: grid; grid-template-columns: 22px repeat(8, minmax(0, 1fr)); grid-template-rows: 23px clamp(40px, 11vw, 62px); }
.guide-cell { min-width: 0; }
.guide-target { position: relative; z-index: 2; }
.guide-target::before { content: ""; position: absolute; left: -19px; top: calc(50% - 8px); width: 18px; height: 16px; background: #be651c; clip-path: polygon(0 35%, 50% 35%, 50% 0, 67% 0, 67% 17%, 84% 17%, 84% 34%, 100% 34%, 100% 66%, 84% 66%, 84% 83%, 67% 83%, 67% 100%, 50% 100%, 50% 65%, 0 65%); pointer-events: none; }
.guide-cell.guide-target { box-shadow: inset 0 0 0 2px #34784f; }
.guide-cell.guide-target::before { top: 0; }
.guide-floors { padding: 10px; }
.guide-floors h3 { margin: 0; font-size: 16px; }
.guide-floors ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; list-style: none; padding: 0; margin: 8px 0; }
.guide-floors li { padding: 3px 6px; border: 1px solid var(--line); background: #f4f7f3; }
@media (max-width: 480px) {
  .guide-cell.guide-target::before { top: -5px; left: -17px; width: 16px; height: 14px; }
}
.floor-list { display: grid; gap: 8px; }
.fishing-targets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.fishing-targets [aria-pressed="true"] { background: #e2f2f5; border-color: #39788a; }
.fishing-water { position: relative; height: 96px; overflow: hidden; border: 1px solid #b8d2d8; border-radius: 7px; background: #f3faf9; }
.fishing-water span { position: absolute; inset: 45% 0 0; border-top: 2px solid #398ca0; background: repeating-linear-gradient(0deg, #d6edf0 0 16px, #cbe4ea 16px 17px); }
.fishing-water i { position: absolute; top: 25%; left: calc(50% - 7px); width: 14px; height: 24px; border-radius: 6px; background: linear-gradient(#b14c38 0 50%, #fffdfa 50%); border: 1px solid #884735; transition: transform 120ms ease; }
.fishing-water[data-phase="waiting"] i { transform: translateY(5px); }
.fishing-water[data-phase="bite"] i { transform: translateY(25px); background: #5595ab; border-color: #387487; }
.fishing-water[data-phase="missed"] i { transform: translateY(-52px); }
.fishing-status { min-height: 2.8em; }
#fish-hold { touch-action: none; user-select: none; -webkit-touch-callout: none; min-width: 116px; }
.floor-choice { justify-content: space-between; text-align: left; min-height: 42px; }
.floor-choice span { font-weight: 400; font-size: 12px; color: var(--muted); }
.floor-choice:disabled { opacity: .62; }
.task-list { margin: 12px 0; }
.task-list dt { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; color: var(--ink); font-size: 14px; }
.task-list dt span { font-size: 12px; color: var(--green); }
.task-list dd { margin: 5px 0 15px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.pull-track { padding: 8px; background: #eee7f6; border: 1px solid #d4c4e5; border-radius: 6px; }
#pull-note { touch-action: none; user-select: none; cursor: grab; color: #603c95; border-color: #b797d4; }
#pull-note:active { cursor: grabbing; }
.primary-button { border: 1px solid var(--green); border-radius: 6px; background: var(--green); color: white; padding: 8px 12px; font-size: 13px; font-weight: 650; }
.primary-button:hover { background: #125438; }
textarea { width: 100%; min-height: 140px; resize: vertical; border: 1px solid #a9bdb0; border-radius: 6px; padding: 10px; color: var(--ink); background: #f9fcf9; font-size: 13px; line-height: 1.6; }

@media (max-width: 1050px) {
  .page { width: min(100% - 44px, 1360px); }
  .work-area { grid-template-columns: minmax(0, 1fr) 238px; }
  .progress { padding: 12px; }
}
@media (max-width: 760px) {
  :root { --cell-height: 39px; }
  .page { width: calc(100% - 24px); }
  .site-header { min-height: 69px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 7px; }
  .site-actions { gap: 3px; }
  .site-actions button { padding: 5px 6px; font-size: 11px; gap: 4px; }
  .question-icon { display: none; }
  .workbook { display: grid; grid-template-columns: minmax(0, 1fr); }
  .work-area { display: contents; }
  .board { grid-template-columns: 26px repeat(12, minmax(26px, 1fr)); min-width: 338px; }
  .inventory-button { width: 44px; height: 44px; }
  .sidebar { order: 1; border-left: 0; border-top: 1px solid var(--line); }
  .sidebar-heading { min-height: 35px; }
  .progress { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .patrol-info { align-content: start; padding: 8px 0; }
  .messages { grid-column: 1 / -1; }
  .messages h3 { margin-top: 0; }
  .filebar { padding-inline: 9px; gap: 6px; }
  .filename { font-size: 12px; }
  .statusbar { padding-inline: 8px; }
  .sheet-tab { padding-inline: 6px; white-space: nowrap; }
  .turn { white-space: nowrap; }
}
@media (max-width: 400px) {
  .toolbar { padding-inline: 6px; }
  .toolbar .tool-group { gap: 2px; }
  .toolbar .tool-button { min-height: 34px; gap: 4px; padding-inline: 5px; font-size: 12px; }
  .toolbar .stairs-button { min-height: 44px; padding-inline: 9px; font-size: 13px; }
  .controls-hint { display: none; }
  .file-tag { display: none; }
  h1 { font-size: 19px; }
}
