/* Copyright (c) 2026 Peter Mayhew. All rights reserved. Not licensed for copying or reuse. */
/* Night station, cut paper. One committed look: dark green, tag yellow, signal orange. */
:root {
  --ink: #10232a; --night: #0c2b2b; --green: #123f3c; --paper: #eaf3ea; --soft: #bcd3cc;
  --tag: #f2c14e; --signal: #f08a3c;
  --display: "Arial Black", "Segoe UI Black", Impact, "Arial Rounded MT Bold", sans-serif;
  --text: Verdana, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); color: var(--paper); font: 18px/1.4 var(--text); -webkit-text-size-adjust: 100%; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 900; line-height: 1.1; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid #fff; outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.loading { padding: 40px; text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.ghost { min-height: 44px; padding: 6px 14px; border: 2px solid var(--soft); border-radius: 8px; background: transparent; font-size: 16px; }
.ghost:hover { background: rgba(255, 255, 255, .12); }
.big { min-height: 56px; padding: 10px 28px; border: 0; border-radius: 10px; background: var(--signal); color: var(--ink); font-family: var(--display); font-size: 22px; box-shadow: 4px 5px 0 rgba(0, 0, 0, .4); }
.big:hover { background: #ffa057; }

/* ---- title */
.titlescreen { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: max(5vh, 20px) 16px 24px; background: var(--green); }
.titleart { position: absolute; inset: 0; }
.titleart svg { width: 100%; height: 100%; }
.logo { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; font-size: clamp(34px, 7vw, 84px); line-height: 1; color: var(--ink); }
.word { display: flex; gap: .08em; }
.word > span { padding: .26em .2em .16em; background: var(--tag); border-radius: .28em .28em .05em .05em; box-shadow: 4px 6px 0 rgba(0, 0, 0, .4); }
.word > span:nth-child(odd) { transform: rotate(-4deg) translateY(.08em); }
.word > span:nth-child(even) { transform: rotate(3deg); }
.w1 > span { background: var(--paper); }
.w2 > span { background: var(--signal); }
.strap { position: relative; font-size: clamp(17px, 2.2vw, 26px); font-weight: 700; text-align: center; text-shadow: 0 2px 6px #000; }
.menu { position: relative; margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.menu .ghost { background: rgba(12, 43, 43, .88); }
.menu .big { font-size: 30px; padding: 12px 44px; }

/* ---- room */
.room { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--area, var(--night)); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)); background: var(--night); }
.title { flex: 1 1 240px; min-width: 0; }
.title h1 { font-size: 22px; }
.title p { color: var(--soft); font-size: 16px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.count { font-size: 15px; white-space: nowrap; }
.levels { display: flex; }
.levels button { min-height: 44px; padding: 4px 14px; border: 2px solid var(--tag); background: transparent; font-weight: 700; font-size: 16px; }
.levels .left { border-radius: 8px 0 0 8px; border-right: 0; }
.levels .right { border-radius: 0 8px 8px 0; }
.levels [aria-pressed="true"] { background: var(--tag); color: var(--ink); }
.frame { width: min(100%, calc((100vh - 220px) / .56), 1400px); min-width: min(100%, 560px); margin: 0 auto; overflow: hidden; position: relative; }
.stage { position: absolute; left: 0; top: 0; width: 1000px; height: 560px; transform-origin: 0 0; overflow: hidden; }
.layer, .layer svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.decor { position: absolute; width: 120px; height: 180px; pointer-events: none; transition: transform .7s ease-in-out; }
.art { display: block; overflow: visible; }
.decor .art, .thing .art { filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, .35)); }
.thing { position: absolute; padding: 0; border: 0; background: none; transform-origin: 50% 100%; transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); }
.thing:hover .art { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 5px #fff); }
.body { display: block; }
.mark { position: absolute; right: -22px; top: -16px; pointer-events: none; }
.tag { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%) rotate(-3deg) scale(var(--tagsize, 1)); transform-origin: 50% 80%; display: flex; align-items: center; gap: 4px; padding: 3px 11px 3px 9px; background: var(--tag); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px 4px 4px 14px; font: 900 15px/1.3 var(--display); white-space: nowrap; }
.tag.none { width: 34px; height: 20px; padding: 0; background: rgba(16, 35, 42, .7); border: 2px solid var(--paper); }
.thing[data-tag="TINY"] .tag { transform: translateX(-50%) rotate(-3deg) scale(calc(var(--tagsize, 1) * 2)); }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.thing[data-tag="BRIGHT"] .art { filter: drop-shadow(0 0 14px #fff3a8) drop-shadow(0 0 4px #fff); }
.thing[data-tag="BOUNCY"] .body { animation: hop .7s ease-in-out infinite alternate; }
.thing[data-tag="FLOATY"] .body { animation: hop 1.8s ease-in-out infinite alternate; }
.thing[data-tag="LOUD"] .body { animation: shake .24s linear infinite alternate; }
@keyframes hop { to { transform: translateY(-9px); } }
@keyframes shake { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
.clue, .secret { position: absolute; padding: 0; border: 0; background: none; }
.secret { animation: twinkle 1.2s ease-in-out infinite alternate; }
@keyframes twinkle { to { transform: scale(1.18) rotate(12deg); } }
.panel { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 10px max(18px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: var(--ink); }
.face { flex: none; height: 106px; }
.label { font-size: 14px; color: var(--soft); }
.hands { display: flex; gap: 10px; margin-top: 4px; }
.hand { width: 142px; min-height: 60px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 4px solid #5d7a80; border-radius: 24px 6px 6px 24px; background: var(--tag); color: var(--ink); font: 900 18px/1 var(--display); }
.hand.none { background: #1f3a42; color: var(--paper); border-style: dashed; font-weight: 400; }
.hand.on { border-color: #fff; border-style: solid; }
.line { flex: 1 1 300px; min-width: 0; min-height: 2.7em; font-size: 20px; }
.after:empty { display: none; }
.tray { display: none; }

/* A tall phone: the picture is small, so every thing also gets a big button. */
@media (max-width: 720px) and (orientation: portrait) {
  .frame { width: 100%; min-width: 0; }
  .bar { gap: 6px 8px; }
  .title { flex-basis: 60%; order: -1; }
  .tools { gap: 6px; }
  .tools .ghost, .bar > .ghost { padding: 4px 9px; font-size: 14px; }
  .levels button { padding: 4px 10px; font-size: 14px; }
  .face { display: none; }
  .panel { flex: none; padding-block: 8px; }
  .carry { flex: 1 1 100%; }
  .hand { flex: 1; width: auto; min-height: 52px; }
  .line { flex-basis: 100%; font-size: 17px; min-height: 4.1em; }
  .after, .after .big { width: 100%; }
  .tray { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); }
  .trayitem { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 10px; background: rgba(0, 0, 0, .3); font-size: 15px; }
  .traytag { display: flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 10px 3px 3px 10px; background: var(--tag); color: var(--ink); font: 900 13px/1.4 var(--display); }
  .traytag.none { background: none; color: var(--soft); font: 13px/1.4 var(--text); }
}
/* A phone on its side: picture on the left, words on the right. */
@media (max-height: 520px) and (orientation: landscape) {
  .room { display: grid; grid-template-columns: minmax(0, 1fr) 230px; grid-template-rows: auto 1fr; }
  .bar { grid-column: 1 / -1; padding-block: 4px; gap: 4px 8px; }
  .title h1 { font-size: 16px; }
  .title p { font-size: 13px; }
  .tools .ghost, .bar > .ghost { padding: 2px 8px; font-size: 13px; }
  .levels button { padding: 2px 8px; font-size: 13px; }
  .count { display: none; }
  .frame { width: min(100%, calc((100dvh - 62px) / .56)); min-width: 0; }
  .face { display: none; }
  .panel { flex-direction: column; align-items: stretch; flex-wrap: nowrap; padding: 8px 12px; gap: 8px; }
  .hand { width: auto; flex: 1; min-height: 48px; font-size: 13px; gap: 3px; border-width: 3px; }
  .line { flex: none; font-size: 15px; }
  .after .big { width: 100%; font-size: 18px; min-height: 48px; padding: 6px; }
}

/* ---- story, map and other pages */
.story { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 20px 16px; background: var(--ink); }
.picture { width: min(100%, 780px, 88vh); border: 8px solid var(--paper); box-shadow: 6px 8px 0 rgba(0, 0, 0, .5); line-height: 0; }
.picture svg { width: 100%; height: auto; }
.story .words { max-width: 34em; font-size: clamp(18px, 2.4vw, 23px); text-align: center; min-height: 4.2em; }
.page { max-width: 1040px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; }
.pagetop { display: flex; align-items: center; gap: 16px; }
.pagetop h1 { font-size: clamp(22px, 4vw, 36px); }
.page h2 { font-size: 22px; margin-bottom: 6px; }
.page.words { max-width: 720px; }
.page.words h2 { margin: 12px 0 -6px; }
.page.words .row { justify-content: flex-start; }
.floor { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px 16px; align-items: center; padding: 14px 18px; border-radius: 10px; }
.floor.shut { filter: saturate(.25) brightness(.7); }
.when { font-family: var(--display); font-size: 19px; color: #fff; }
.where h2 { margin: 0; color: #fff; }
.where p { font-size: 16px; color: #fff; }
.rooms { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.door { min-height: 62px; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.door.done { background: var(--tag); }
.door span { font-size: 14px; }
.door:disabled { background: #4b5a5a; color: #dfe9e4; border-style: dashed; }
.tally { color: var(--soft); }
.mishaps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.mishaps li { padding: 12px 14px; border: 2px dashed #4e6b6b; border-radius: 10px; color: var(--soft); display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.mishaps li.got { background: var(--paper); color: var(--ink); border: 2px solid var(--paper); }
.mishaps b { font-family: var(--display); }
.wardrobe { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.outfit { padding: 18px 6px 8px; border: 3px solid transparent; border-radius: 10px; background: var(--green); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; font-size: 14px; min-height: 150px; }
.outfit.on { border-color: var(--tag); }
.outfit:disabled { opacity: .75; background: #14302f; color: var(--soft); }
.outfitart .art { width: 74px; height: auto; }
.sheet { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 14px; padding: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 40px #000; }
.sheet[open] { display: flex; flex-direction: column; gap: 16px; }
.sheet::backdrop { background: rgba(6, 20, 20, .7); }
.sheet .ghost { border-color: var(--ink); color: var(--ink); }
.beat { font-size: 21px; }
.giftart { display: flex; justify-content: center; padding-top: 8px; }
.giftart .art { width: 100px; height: auto; }
.setting { display: flex; gap: 14px; align-items: center; min-height: 48px; cursor: pointer; }
.setting input { width: 28px; height: 28px; flex: none; accent-color: #123f3c; }
.setting span span { display: block; font-size: 15px; }

.calm *, .calm *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
