/* =====================================================================================================
   Windows: inventory, records, map, save terminal, storage, puzzles, settings, documents,
   game over, chapter cards, endings. Built like a small web app: header, tabs, body, footer with
   the keys that work here (number keys pick, Esc closes).
   ===================================================================================================== */
#ui {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}
#ui > * {
  pointer-events: auto;
}
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 3, 5, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gut);
  animation: bdin 0.18s ease-out;
}
@keyframes bdin {
  from {
    opacity: 0;
  }
}
.win {
  width: min(980px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: winin 0.2s ease-out;
}
.win.narrow {
  width: min(560px, 100%);
}
.win.mid {
  width: min(760px, 100%);
}
@keyframes winin {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}
.win-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
}
.win-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(79, 209, 197, 0.14);
  color: var(--info);
  flex: none;
  font-size: 18px;
}
.win-ico.amber {
  background: rgba(255, 176, 46, 0.15);
  color: var(--accent);
}
.win-ico.green {
  background: rgba(74, 222, 128, 0.14);
  color: var(--ok);
}
.win-ico.red {
  background: rgba(255, 79, 79, 0.14);
  color: var(--danger);
}
.win-ico.violet {
  background: rgba(179, 148, 255, 0.14);
  color: var(--violet);
}
.win-title {
  min-width: 0;
}
.win-title h2 {
  margin: 0;
  font-size: 1.08em;
  font-weight: 700;
  line-height: 1.35;
}
.win-title p {
  margin: 1px 0 0;
  color: var(--dim);
  font-size: 0.8em;
  line-height: 1.5;
}
.win-head .grow {
  flex: 1;
}
.xbtn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--dim);
  flex: none;
}
.xbtn:hover {
  background: var(--panel-3);
  color: var(--text);
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  appearance: none;
  border: none;
  background: none;
  padding: 9px 12px 10px;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font-weight: 700;
  font-size: 0.9em;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tabs button .badge {
  font-family: var(--mono);
  font-size: 0.75em;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0 6px;
}
.tabs button.on {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tabs button .tk {
  font-family: var(--mono);
  font-size: 0.7em;
  color: var(--faint);
}
.win-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.win-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.78em;
  color: var(--faint);
}
.win-foot .sp {
  flex: 1;
}
.win-foot .acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sec-title {
  font-size: 0.74em;
  color: var(--faint);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.muted {
  color: var(--dim);
}
.small {
  font-size: 0.84em;
}
.mono {
  font-family: var(--mono);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

/* ---- inventory ------------------------------------------------------------------------------------- */
.inv {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
}
@media (max-width: 720px) {
  .inv {
    grid-template-columns: 1fr;
  }
}
.slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.slots.s5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: radial-gradient(120% 120% at 50% 20%, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  transition:
    border-color 0.12s,
    background 0.12s;
  min-width: 0;
}
.slot:hover {
  border-color: var(--line-2);
}
.slot.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 176, 46, 0.18);
}
.slot.empty {
  cursor: default;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0 6px, transparent 6px 12px);
}
.slot .n {
  position: absolute;
  left: 7px;
  top: 5px;
  font-family: var(--mono);
  font-size: 0.68em;
  color: var(--faint);
}
.slot svg {
  width: 62%;
  height: 52%;
}
.slot .nm {
  font-size: 0.72em;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.slot .ct {
  position: absolute;
  right: 7px;
  bottom: 5px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82em;
}
.slot .ct.full {
  color: var(--ok);
}
.slot .eq {
  position: absolute;
  right: 6px;
  top: 5px;
  font-size: 0.6em;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  padding: 0 4px;
}
.detail {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}
.detail h3 {
  margin: 0;
  font-size: 1.05em;
}
.detail .dsc {
  color: var(--dim);
  font-size: 0.88em;
  line-height: 1.7;
}
.detail .stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.84em;
}
.detail .stats dt {
  color: var(--faint);
}
.detail .stats dd {
  margin: 0;
  font-family: var(--mono);
}
.detail .acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.hpline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.86em;
  color: var(--dim);
}
.hpline .bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.hpline .bar i {
  display: block;
  height: 100%;
}

/* lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
  appearance: none;
  color: var(--text);
}
.li:hover {
  border-color: var(--line-2);
}
.li.sel {
  border-color: var(--accent);
}
.li.new .t::after {
  content: "NEW";
  font-family: var(--mono);
  font-size: 0.65em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: 0.15em;
}
.li .i {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  flex: none;
  font-size: 16px;
}
.li .m {
  min-width: 0;
  flex: 1;
}
.li .t {
  font-weight: 700;
  font-size: 0.94em;
}
.li .s {
  color: var(--dim);
  font-size: 0.8em;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li .r {
  flex: none;
  display: flex;
  gap: 6px;
  align-items: center;
}
.li .k {
  font-family: var(--mono);
  font-size: 0.72em;
  color: var(--faint);
  width: 1.4em;
  text-align: center;
}
.empty-note {
  color: var(--faint);
  font-size: 0.88em;
  padding: 18px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* journal layout */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  min-height: 0;
}
@media (max-width: 720px) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* paper documents */
.paper {
  background: #ece6d8;
  color: #23201b;
  border-radius: 6px;
  padding: 22px 24px;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.95;
  font-size: 0.98em;
  box-shadow: inset 0 0 60px rgba(120, 90, 40, 0.25);
  position: relative;
}
.paper.white {
  background: #f3f4f2;
  box-shadow: inset 0 0 50px rgba(60, 70, 80, 0.15);
}
.paper.screen {
  background: #071412;
  color: #9ff0e3;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.9em;
  line-height: 1.8;
  box-shadow: inset 0 0 40px rgba(79, 209, 197, 0.12);
  border: 1px solid rgba(79, 209, 197, 0.25);
}
.paper h3 {
  margin: 0 0 10px;
  font-size: 1.1em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  padding-bottom: 6px;
}
.paper.screen h3 {
  border-color: rgba(79, 209, 197, 0.3);
}
.paper p {
  margin: 0 0 10px;
}
.paper .meta {
  font-family: var(--font);
  font-size: 0.75em;
  color: #6b6255;
  margin-bottom: 10px;
}
.paper.screen .meta {
  color: #4f9e92;
}
.paper .stamp {
  position: absolute;
  right: 18px;
  top: 14px;
  border: 2px solid #b02a2a;
  color: #b02a2a;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 0.8em;
  transform: rotate(8deg);
  opacity: 0.8;
}
.paper img.photo {
  display: block;
  max-width: 100%;
  border: 6px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin: 6px 0 12px;
}
.paper .redact {
  background: #23201b;
  color: transparent;
  border-radius: 2px;
  user-select: none;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.pager .pg {
  font-family: var(--mono);
  color: var(--dim);
  font-size: 0.85em;
}
.fic-note {
  font-size: 0.74em;
  color: var(--violet);
  margin-top: 10px;
}

/* map */
.mapwrap {
  position: relative;
  background: #070b10;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.mapwrap canvas {
  display: block;
  width: 100%;
  height: auto;
}
.maptools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.78em;
  color: var(--dim);
  margin-top: 10px;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}

/* objectives / hints */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.steps li {
  display: flex;
  gap: 12px;
  padding: 8px 4px;
  position: relative;
}
.steps li::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: -6px;
  width: 2px;
  background: var(--line);
}
.steps li:last-child::before {
  display: none;
}
.steps .dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 0.72em;
  font-weight: 700;
  flex: none;
  margin-left: 4px;
  font-family: var(--mono);
  color: var(--faint);
  background: var(--panel-solid);
  z-index: 1;
}
.steps li.done .dot {
  background: var(--info);
  border-color: var(--info);
  color: #062420;
}
.steps li.cur .dot {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 176, 46, 0.15);
}
.steps li.later {
  opacity: 0.45;
}
.steps .tt {
  font-weight: 700;
  font-size: 0.94em;
}
.steps .dd {
  color: var(--dim);
  font-size: 0.82em;
  margin-top: 2px;
  line-height: 1.6;
}
.chapters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.chapters div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.72em;
  color: var(--faint);
  min-width: 0;
}
.chapters div b {
  display: block;
  font-family: var(--mono);
}
.chapters div span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapters div.done {
  color: var(--info);
  border-color: rgba(79, 209, 197, 0.3);
}
.chapters div.cur {
  color: var(--accent);
  border-color: var(--accent);
}
@media (max-width: 720px) {
  .chapters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.hintbox {
  background: rgba(255, 176, 46, 0.07);
  border: 1px solid rgba(255, 176, 46, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9em;
  line-height: 1.7;
  margin-top: 12px;
}

/* save terminal */
.term-head {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.12), transparent);
}
.slotrow {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  width: 100%;
  text-align: left;
  appearance: none;
  color: var(--text);
}
.slotrow:hover {
  border-color: var(--line-2);
}
.slotrow.sel {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}
.slotrow .no {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--dim);
  text-align: center;
}
.slotrow .info .t {
  font-weight: 700;
  font-size: 0.92em;
}
.slotrow .info .s {
  color: var(--dim);
  font-size: 0.78em;
  margin-top: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.slotrow.emptyslot .info .t {
  color: var(--faint);
  font-weight: 500;
}
.slotrow.auto .no {
  color: var(--info);
  font-size: 0.72em;
}
.confirm {
  background: rgba(255, 176, 46, 0.08);
  border: 1px solid rgba(255, 176, 46, 0.35);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* settings */
.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child {
  border-bottom: none;
}
.set-row label {
  font-weight: 700;
  font-size: 0.92em;
}
.set-row label small {
  display: block;
  font-weight: 400;
  color: var(--faint);
  font-size: 0.82em;
  margin-top: 2px;
}
.set-row .ctl {
  display: flex;
  align-items: center;
  gap: 10px;
}
.set-row output {
  font-family: var(--mono);
  min-width: 3.2em;
  text-align: right;
  color: var(--dim);
  font-size: 0.86em;
}
input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  min-height: 32px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  flex-wrap: wrap;
}
.seg button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-size: 0.86em;
  font-weight: 700;
  color: var(--dim);
  cursor: pointer;
  min-height: 36px;
}
.seg button.on {
  background: var(--accent);
  color: var(--accent-ink);
}
@media (max-width: 560px) {
  .set-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* puzzles */
.pz-intro {
  color: var(--dim);
  line-height: 1.75;
  font-size: 0.92em;
  margin: 0 0 14px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.card {
  appearance: none;
  border: 1px solid var(--line-2);
  background: #e8e1cf;
  color: #23201b;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.6;
  position: relative;
  min-height: 96px;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.card .yr {
  font-family: var(--mono);
  font-size: 1.4em;
  font-weight: 700;
  display: block;
}
.card .k {
  position: absolute;
  right: 8px;
  top: 6px;
  font-family: var(--mono);
  font-size: 0.75em;
  color: #7b7262;
}
.card.used {
  opacity: 0.35;
  pointer-events: none;
}
.card.wrong {
  animation: shake 0.35s;
  box-shadow: 0 0 0 3px var(--danger);
}
.card.right {
  box-shadow: 0 0 0 3px var(--ok);
}
.card img {
  width: 100%;
  border-radius: 4px;
  display: block;
  margin-bottom: 6px;
  aspect-ratio: 1;
  object-fit: cover;
}
@keyframes shake {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
.orderline {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.orderline .ph {
  flex: 1;
  min-width: 90px;
  min-height: 56px;
  border: 2px dashed var(--line-2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--faint);
  text-align: center;
  padding: 6px;
  font-size: 0.9em;
}
.orderline .ph.fill {
  border-style: solid;
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255, 176, 46, 0.08);
}
.orderline .arrow {
  align-self: center;
  color: var(--faint);
}
.pz-msg {
  min-height: 1.6em;
  font-size: 0.92em;
  margin-top: 10px;
}
.pz-msg.bad {
  color: #ff9a9a;
}
.pz-msg.good {
  color: var(--ok);
}
.pz-msg.hint {
  color: var(--accent);
}
.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 460px;
}
.keypad button {
  aspect-ratio: 1.2;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-family: var(--serif);
  font-size: 1.9em;
  font-weight: 900;
  cursor: pointer;
  position: relative;
}
.keypad button .k {
  position: absolute;
  left: 8px;
  top: 4px;
  font-family: var(--mono);
  font-size: 0.4em;
  color: var(--faint);
}
.keypad button:active,
.keypad button.press {
  background: var(--accent);
  color: var(--accent-ink);
}
.lcd {
  font-family: var(--mono);
  background: #071412;
  color: #9ff0e3;
  border: 1px solid rgba(79, 209, 197, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  min-height: 52px;
  letter-spacing: 0.3em;
  font-size: 1.2em;
}
.lamps {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 10px 0;
}
.valve {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  border-radius: 14px;
  padding: 14px 18px;
  width: 140px;
  cursor: pointer;
  text-align: center;
}
.valve .lamp {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  margin: 0 auto 8px;
  background: #2a3138;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.6);
  transition: background 0.2s;
}
.valve.on .lamp {
  background: var(--ok);
  box-shadow:
    0 0 18px var(--ok),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}
.valve b {
  font-family: var(--mono);
  font-size: 1.4em;
  display: block;
}
.valve small {
  color: var(--dim);
  font-size: 0.75em;
}
.dial {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.dial button {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
}
.dial button.on {
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.15);
}
.dial button b {
  font-family: var(--mono);
  font-size: 1.2em;
  display: block;
}
.dial button small {
  color: var(--dim);
}
.wave {
  height: 46px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.wave i {
  flex: 1;
  background: var(--info);
  border-radius: 1px;
  opacity: 0.7;
}
.transcript {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 92px;
  line-height: 1.8;
  font-size: 0.92em;
}
.transcript .noise {
  color: var(--faint);
  letter-spacing: 0.2em;
}
.photo-q {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  cursor: crosshair;
}
.photo-q canvas {
  display: block;
  width: 100%;
  height: auto;
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
}
.choice:hover {
  border-color: var(--accent);
}
.choice .k {
  font-family: var(--mono);
  font-weight: 700;
  width: 1.8em;
  height: 1.8em;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  flex: none;
}
.choice b {
  display: block;
}
.choice small {
  color: var(--dim);
  font-size: 0.82em;
  line-height: 1.6;
}
.choice.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.choice.end-a {
  border-left: 4px solid var(--info);
}
.choice.end-b {
  border-left: 4px solid var(--accent);
}
.choice.end-c {
  border-left: 4px solid var(--violet);
}

/* full screens: game over, chapter card, ending, disclaimer */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gut);
  background: #000 center/cover no-repeat;
  overflow-y: auto;
  animation: bdin 0.6s ease-out;
}
.screen::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(100% 100% at 50% 50%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.9));
  pointer-events: none;
}
.screen > .inner {
  position: relative;
  width: min(720px, 100%);
  max-height: 100%;
}
.screen h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(30px, 6vw, 54px);
  margin: 0 0 6px;
  letter-spacing: 0.08em;
}
.screen .eyebrow {
  font-family: var(--mono);
  color: var(--info);
  letter-spacing: 0.3em;
  font-size: 0.8em;
}
.screen p {
  line-height: 1.9;
  color: #d9dfe5;
}
.screen .acts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.screen.dead h1 {
  color: #ff6b6b;
}
.screen .card-box {
  background: rgba(10, 14, 20, 0.8);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 22px;
  backdrop-filter: blur(6px);
}
.statgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.statgrid div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.statgrid small {
  display: block;
  color: var(--faint);
  font-size: 0.72em;
}
.statgrid b {
  font-family: var(--mono);
  font-size: 1.15em;
}
@media (max-width: 560px) {
  .statgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.credits {
  font-size: 0.8em;
  color: var(--dim);
  line-height: 1.8;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 12px;
}
.credits a,
.srcs a {
  color: var(--info);
  word-break: break-all;
}
.srcs {
  font-size: 0.86em;
  line-height: 1.75;
}
.srcs li {
  margin-bottom: 6px;
}
.loadbar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 16px;
}
.loadbar i {
  display: block;
  height: 100%;
  background: var(--info);
  transition: width 0.2s;
}
.fic-banner {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(179, 148, 255, 0.4);
  color: var(--violet);
  background: rgba(179, 148, 255, 0.1);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8em;
  font-weight: 700;
  margin-bottom: 10px;
}
@media (max-width: 520px) {
  .slot .nm {
    display: none;
  }
}

.win.stay {
  animation: none;
}
/* readability pass (windows) */
.win {
  font-size: 1.02em;
}
.win-title h2 {
  font-size: 1.15em;
}
.li .t {
  font-size: 1em;
}
.li .s {
  font-size: 0.84em;
  color: #b4bec9;
}
.paper {
  font-size: 1.04em;
}
.tabs button {
  font-size: 0.95em;
  padding: 10px 14px 11px;
}
