/* Face Not Recognised
 * Layout: a lamplit plate of the room on the left, the dead man's phone in the middle as the
 * only bright object, Francis's notebook on the right. One committed dark look (a house at
 * one in the morning), so there is no light theme. The phone is cold screen light (--screen)
 * and nothing else is; amber is tungsten lamplight and Francis's own thoughts (art/noir/STYLE.md).
 */
:root {
  color-scheme: dark;
  --night: #0b0c0d;
  --plum: #16191b;
  --plum-2: #22282b;
  --bone: #efe6d8;
  --ash: #979d9a;
  --amber: #dca25a;
  --screen: #86c2d2;
  --line: rgba(239, 230, 216, 0.14);
  --line-strong: rgba(239, 230, 216, 0.4);

  --os-bg: #000;
  --os-card: #141719;
  --os-card-2: #1f2427;
  --os-text: #f5f2f6;
  --os-dim: #8f979a;
  --os-sep: rgba(255, 255, 255, 0.09);
  --os-in: #262c30;
  --os-out: #2e6878;
  --os-red: #ff5a5f;
  --os-green: #3ecf8e;

  --display: "IM Fell DW Pica", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Spectral", "Iowan Old Style", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --z: 1; /* phone zoom, set by game.js */
}

html { box-sizing: border-box; height: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body {
  margin: 0; height: 100%;
  background: var(--night); color: var(--bone);
  font: 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

#app { height: 100%; position: relative; }

/* ---------- stage ---------- */
#stage {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(260px, 330px);
  gap: 28px;
  padding-block: 20px;
  padding-inline: max(20px, env(safe-area-inset-left, 0px));
}
.panel { min-width: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--plum-2) transparent; }
#room { display: flex; flex-direction: column; gap: 16px; padding-right: 4px; }
#phoneCol { display: flex; align-items: center; justify-content: center; min-height: 0; }
#notebook { padding-right: 4px; }

.eyebrow {
  margin: 0; font: 500 11px/1.2 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ash);
}

/* ---------- the room ---------- */
.room-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.room-clock { margin: 0; font: 500 13px/1 var(--ui); font-variant-numeric: tabular-nums; color: var(--amber); }

.plate { position: relative; border-radius: 3px; overflow: hidden; background: var(--plum); flex: none; }
.plate img { width: 100%; aspect-ratio: 1800 / 1005; object-fit: cover; }
.plate::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 80px 20px rgba(0, 0, 0, 0.55);
}
.hot {
  position: absolute; z-index: 1; border: 1px dashed transparent; background: transparent; border-radius: 4px;
  transition: border-color 0.2s, background-color 0.2s;
}
.hot span {
  position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -4px);
  white-space: nowrap; font: 500 12px/1 var(--ui); padding: 5px 8px; border-radius: 4px;
  background: rgba(10, 12, 13, 0.85); color: var(--bone); opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.hot:hover { border-color: rgba(233, 171, 94, 0.8); background: rgba(233, 171, 94, 0.08); }
.hot:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; background: rgba(233, 171, 94, 0.08); }
.hot:hover span, .hot:focus-visible span { opacity: 1; }
.hot.below span { bottom: auto; top: 100%; transform: translate(-50%, 4px); }

.looks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.looks::before { content: "Look at"; font: 500 11px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ash); margin-right: 4px; }
.chip {
  border: 1px solid var(--line-strong); background: transparent; border-radius: 999px;
  padding: 6px 14px; font: 17px/1.2 var(--display); color: var(--bone);
  transition: border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--amber); color: var(--amber); }
.chip.seen { color: var(--ash); }
.chip:disabled { opacity: 0.45; cursor: default; }
.chip:disabled:hover { border-color: var(--line-strong); color: var(--bone); }

.aim, .actions {
  border: 1px solid rgba(233, 171, 94, 0.45); border-radius: 6px; padding: 14px 16px;
  background: linear-gradient(180deg, rgba(233, 171, 94, 0.08), rgba(233, 171, 94, 0.02));
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.aim p, .actions p { margin: 0 0 2px; width: 100%; font-style: italic; color: var(--bone); }
.aim .chip { border-color: rgba(233, 171, 94, 0.5); }
.btn {
  border-radius: 6px; padding: 10px 16px; font: 18px/1.2 var(--display);
  border: 1px solid var(--amber); background: var(--amber); color: #1a1008;
}
.btn.ghost { background: transparent; color: var(--bone); border-color: var(--line-strong); }
a.btn { text-decoration: none; display: inline-block; }
.actions.new { animation: glow 2.4s ease-out; }
.btn.ghost:hover { border-color: var(--bone); }
.btn:hover { filter: brightness(1.06); }

.banners { display: flex; flex-direction: column; gap: 8px; }
.banner {
  font: 14px/1.4 var(--ui); background: var(--plum); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline;
  animation: drop 0.4s ease-out;
}
.banner b { font-weight: 600; font-size: 12px; color: var(--ash); letter-spacing: 0.02em; }
.banner small { grid-column: 1 / -1; font-size: 11px; color: var(--ash); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.log li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px;
  font-size: 16px; line-height: 1.55; color: var(--bone);
  animation: drop 0.5s ease-out;
}
.log time { font: 500 12px/1.9 var(--ui); font-variant-numeric: tabular-nums; color: var(--amber); }
.log p { margin: 0; font-style: italic; text-wrap: pretty; }
.log li.plain p { font-style: normal; }
.log img { grid-column: 2; border-radius: 3px; margin-top: 6px; max-height: 220px; width: 100%; object-fit: cover; }
.log li:not(:first-child) { opacity: 0.72; }

/* ---------- notebook ---------- */
#notebook header { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
#notebook h2 { margin: 4px 0 2px; font: 30px/1.1 var(--display); font-weight: 400; text-wrap: balance; }
.count { margin: 0; font: 500 13px/1 var(--ui); color: var(--ash); font-variant-numeric: tabular-nums; }
.clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: clue; }
.clues li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; }
.clues li::before {
  counter-increment: clue; content: counter(clue); grid-row: span 2;
  font: 500 12px/1.9 var(--ui); color: var(--ash); font-variant-numeric: tabular-nums;
}
.clues h3 { margin: 0; font: 20px/1.3 var(--display); font-weight: 400; color: var(--amber); }
.clues p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--bone); text-wrap: pretty; }
.clues li.blank h3 { color: var(--ash); letter-spacing: 0.3em; }
.clues li.fresh { animation: glow 2.4s ease-out; }
@keyframes glow { from { background: rgba(233, 171, 94, 0.14); } to { background: transparent; } }

/* ---------- the phone ---------- */
#phoneFit { zoom: var(--z); }
#phone {
  width: 390px; height: 844px; padding: 11px; border-radius: 56px;
  background: linear-gradient(145deg, #1b1d1f, #050606 40%, #101213);
  box-shadow: 0 0 0 1px #2a2e30, 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 120px -30px rgba(134, 194, 210, 0.18);
}
#screen {
  position: relative; width: 100%; height: 100%; border-radius: 46px; overflow: hidden;
  background: var(--os-bg); color: var(--os-text); font: 15px/1.35 var(--ui);
  isolation: isolate;
}
.status {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0; height: 50px;
  display: flex; align-items: center; justify-content: space-between; padding: 8px 30px 0 34px;
  font: 600 15px/1 var(--ui); font-variant-numeric: tabular-nums; pointer-events: none;
}
.status .icons { display: flex; gap: 6px; align-items: center; }
.status svg { display: block; }
.status::after { /* the camera cut-out */
  content: ""; position: absolute; left: 50%; top: 11px; width: 118px; height: 33px; margin-left: -59px;
  border-radius: 20px; background: #000;
}
.view { position: absolute; inset: 0; overflow: hidden; }
.homebar {
  position: absolute; z-index: 6; left: 50%; bottom: 0; width: 160px; height: 26px; margin-left: -80px;
  background: transparent; border: 0; padding: 0; display: grid; place-items: center;
}
.homebar span { width: 134px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.85); }

/* a view: app bar + scrolling body */
.v { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--os-bg); animation: slide 0.22s ease-out; }
.v.fade { animation: fadein 0.3s ease-out; }
@keyframes slide { from { transform: translateX(22px); opacity: 0.4; } }
@keyframes fadein { from { opacity: 0; } }
.appbar {
  flex: none; padding: 54px 12px 6px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: rgba(9, 11, 12, 0.92); border-bottom: 1px solid var(--os-sep);
}
.appbar h1 { margin: 0; font: 600 16px/1.2 var(--ui); text-align: center; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { justify-self: start; border: 0; background: none; color: var(--screen); font: 400 16px/1 var(--ui); padding: 6px 4px; display: flex; align-items: center; gap: 2px; }
.back svg { margin-top: 1px; }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding-bottom: 34px; }
.scroll::-webkit-scrollbar { display: none; }
.bigtitle { margin: 6px 16px 10px; font: 700 32px/1.1 var(--ui); letter-spacing: -0.01em; }
.seg { display: flex; margin: 0 16px 12px; padding: 2px; border-radius: 9px; background: var(--os-card-2); }
.seg button { flex: 1; border: 0; background: none; color: var(--os-text); font: 500 13px/1 var(--ui); padding: 8px 6px; border-radius: 7px; }
.seg button[aria-pressed="true"] { background: #3f474b; }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  padding: 10px 16px; border: 0; background: none; width: 100%; text-align: left; color: inherit;
  position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: 1px solid var(--os-sep); }
.row.noav + .row.noav::before { left: 16px; }
button.row:active { background: var(--os-card-2); }
.row:focus-visible { outline-offset: -3px; }
.row .name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .when { font-size: 13px; color: var(--os-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .sub { grid-column: 2 / -1; font-size: 14px; color: var(--os-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row.noav { grid-template-columns: minmax(0, 1fr) auto; }
.row.noav .sub { grid-column: 1 / -1; }
.row .av { grid-row: span 2; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--screen); position: absolute; left: 4px; top: 50%; margin-top: -5px; }

.av { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #343b3f; display: grid; place-items: center; font: 600 18px/1 var(--ui); color: #d5dcdf; flex: none; }
.av.sm { width: 28px; height: 28px; font-size: 12px; }

/* lock screen */
.lock { background: #000; }
.lock .wall { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.lock::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.05) 35%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.8)); }
.lock > * { position: relative; z-index: 1; }
.lock-top { text-align: center; padding-top: 70px; text-shadow: 0 1px 12px rgba(0,0,0,.5); }
.lock-date { font: 600 18px/1.2 var(--ui); }
.lock-time { font: 300 88px/1 var(--ui); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.notifs { margin-top: auto; padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }
.notif {
  border: 0; text-align: left; width: 100%; color: var(--os-text);
  background: rgba(28, 32, 35, 0.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: 20px; padding: 11px 14px; display: grid; grid-template-columns: 32px 1fr auto; gap: 1px 10px; align-items: center;
}
.notif .ic { grid-row: span 2; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.notif b { font-size: 15px; }
.notif .when { font-size: 12px; color: rgba(245,242,246,.65); }
.notif p { margin: 0; grid-column: 2 / -1; font-size: 15px; }
.notif.new { animation: notif 0.5s cubic-bezier(.2,1.4,.4,1); }
@keyframes notif { from { transform: translateY(24px) scale(.96); opacity: 0; } }
.lock.buzz { animation: buzz 0.35s linear 2; }
@keyframes buzz { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.lock-foot { padding: 14px 0 44px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lock-foot button {
  border: 0; background: rgba(28,32,35,.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: 999px; padding: 10px 18px; color: var(--os-text); font: 500 14px/1 var(--ui); display: flex; gap: 8px; align-items: center;
}

/* home */
.home { background: #000; }
.home .wall { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(14px) brightness(.45) saturate(1.2); }
.home > * { position: relative; }
.home-body { padding: 62px 20px 0; display: flex; flex-direction: column; gap: 22px; flex: 1; }
.widget { background: rgba(24, 28, 31, 0.66); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 22px; padding: 14px 16px; }
.widget h2 { margin: 0; font: 600 12px/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--screen); }
.widget .d { font: 600 20px/1.3 var(--ui); margin: 4px 0 8px; }
.widget ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.widget li { display: grid; grid-template-columns: 48px 1fr; font-size: 14px; }
.widget li span { color: var(--os-dim); font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 10px; }
.app { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 500 12px/1 var(--ui); color: var(--os-text); }
.app .ic { width: 62px; height: 62px; border-radius: 15px; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.35); position: relative; }
.app .badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #d92d3a; font: 600 13px/22px var(--ui); color: #fff; }
.dock { margin: auto 12px 26px; padding: 12px 10px 10px; border-radius: 30px; background: rgba(34, 40, 44, 0.5); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: grid; grid-template-columns: repeat(4, 1fr); }
.dock .app { gap: 5px; }

/* icon colours */
.ic-messages { background: linear-gradient(160deg, #6fb3c6, #2e6878); }
.ic-photos { background: linear-gradient(160deg, #fff4e6, #f1d9c2); }
.ic-notes { background: linear-gradient(160deg, #ffd27a, #e9a23b); }
.ic-mail { background: linear-gradient(160deg, #4c6bd8, #25347e); }
.ic-phone { background: linear-gradient(160deg, #53d9a0, #1f8e5f); }
.ic-health { background: linear-gradient(160deg, #fff, #efe8ee); }
.ic-search { background: linear-gradient(160deg, #3a3f8f, #151838); }
.ic-settings { background: linear-gradient(160deg, #9d97a3, #5c5761); }

/* messages */
.thread { padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 3px; }
.sep { text-align: center; font-size: 11.5px; color: var(--os-dim); margin: 14px 0 6px; }
.sep b { font-weight: 600; }
.bub { max-width: 78%; padding: 8px 13px; border-radius: 19px; font-size: 16px; line-height: 1.32; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.them { align-self: flex-start; background: var(--os-in); border-bottom-left-radius: 6px; }
.bub.me { align-self: flex-end; background: var(--os-out); color: #fff; border-bottom-right-radius: 6px; }
.bub.live { animation: notif 0.5s cubic-bezier(.2,1.4,.4,1); }
.st { align-self: flex-end; font-size: 11.5px; color: var(--os-dim); margin: 1px 4px 4px; }
.st.bad { color: var(--os-red); display: flex; gap: 4px; align-items: center; }
.th-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.th-head .av { width: 34px; height: 34px; font-size: 14px; }
.th-head small { font-size: 11px; color: var(--os-text); }
.composer { flex: none; padding: 8px 12px 34px; border-top: 1px solid var(--os-sep); display: flex; gap: 8px; align-items: flex-end; background: rgba(9,11,12,.96); }
.composer .field { flex: 1; border: 1px solid #353c40; border-radius: 19px; padding: 8px 14px; font-size: 15px; color: var(--os-dim); min-height: 36px; }
.composer .field.draft { color: var(--os-text); }
.composer .field small { display: block; font-size: 11px; color: var(--screen); margin-bottom: 2px; }

/* photos */
.pcount { margin: 14px 16px; text-align: center; font-size: 13px; color: var(--os-dim); }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.pgrid button { border: 0; padding: 0; background: #111; aspect-ratio: 1; overflow: hidden; }
.pgrid img { width: 100%; height: 100%; object-fit: cover; }
.albums { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; padding: 4px 16px; }
.album { border: 0; background: none; padding: 0; text-align: left; color: var(--os-text); display: flex; flex-direction: column; gap: 6px; }
.album .cover { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--os-card-2); display: grid; place-items: center; }
.album .cover img { width: 100%; height: 100%; object-fit: cover; }
.album .cover.locked { background: linear-gradient(160deg, #262c30, #121517); color: var(--os-dim); }
.album b { font-size: 15px; }
.album small { font-size: 13px; color: var(--os-dim); margin-top: -4px; }
.viewer { background: #000; }
.viewer .meta { position: absolute; z-index: 2; left: 0; right: 0; top: 0; padding: 54px 12px 10px; background: linear-gradient(180deg, rgba(0,0,0,.8), transparent); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.viewer .meta div { text-align: center; }
.viewer .meta b { display: block; font-size: 15px; }
.viewer .meta small { font-size: 12px; color: var(--os-dim); }
.viewer .ph { position: absolute; inset: 0; display: grid; place-items: center; }
.viewer .ph img { max-height: 100%; width: 100%; object-fit: contain; }
.viewer .foot { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 30px 16px 40px; background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.viewer .foot p { margin: 0; font-size: 13px; color: var(--os-text); text-align: center; flex: 1; }
.viewer .foot p small { display: block; color: var(--os-dim); }
.nav { border: 0; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; color: #fff; }
.nav:disabled { opacity: .25; cursor: default; }

/* notes, mail, calls */
.note { padding: 8px 20px 30px; }
.note .when { text-align: center; font-size: 12px; color: var(--os-dim); margin-bottom: 14px; }
.note h2 { margin: 0 0 10px; font: 700 24px/1.2 var(--ui); }
.note .body { white-space: pre-wrap; font-size: 16px; line-height: 1.5; }
.mailhead { padding: 10px 16px 14px; border-bottom: 1px solid var(--os-sep); display: grid; gap: 4px; }
.mailhead b { font-size: 16px; }
.mailhead h2 { margin: 6px 0 0; font: 700 21px/1.25 var(--ui); }
.mailhead small { font-size: 13px; color: var(--os-dim); }
.mailhead .opened { color: var(--screen); }
.mailbody { padding: 14px 16px 30px; white-space: pre-wrap; font-size: 16px; line-height: 1.5; }
.call .name.missed { color: var(--os-red); }
.call .sub { -webkit-line-clamp: 1; }
.vm { padding: 12px 16px; border-bottom: 1px solid var(--os-sep); }
.vm button { border: 0; background: none; width: 100%; padding: 0; display: grid; grid-template-columns: 1fr auto; text-align: left; color: var(--os-text); gap: 2px 8px; }
.vm button b { font-size: 16px; }
.vm button small { font-size: 13px; color: var(--os-dim); }
.vm .tr { margin-top: 10px; font-size: 15px; line-height: 1.45; background: var(--os-card); border-radius: 12px; padding: 12px 14px; }
.vm .tr small { display: block; font-size: 11px; color: var(--os-dim); margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.hist .sub { -webkit-line-clamp: 1; }
.dayhead { margin: 16px 16px 4px; font: 600 13px/1 var(--ui); color: var(--os-dim); text-transform: uppercase; letter-spacing: .04em; }

/* health */
.hcard { margin: 0 16px 12px; background: var(--os-card); border-radius: 14px; padding: 12px 14px; }
.hcard h3 { margin: 0 0 4px; font: 600 13px/1.2 var(--ui); color: var(--screen); display: flex; gap: 6px; align-items: center; }
.hcard .big { font: 700 26px/1.1 var(--ui); font-variant-numeric: tabular-nums; }
.hcard .big small { font-size: 14px; font-weight: 500; color: var(--os-dim); margin-left: 4px; }
.hcard p { margin: 2px 0 0; font-size: 13px; color: var(--os-dim); }
.chart { width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart text { font: 10px var(--ui); fill: var(--os-dim); }
.chart .grid-l { stroke: var(--os-sep); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--screen); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: url(#hrfill); }
.chart .end { fill: var(--screen); stroke: var(--os-card); stroke-width: 2; }
.chart .nodata { fill: url(#hatch); }
.chart .mark { fill: rgba(62, 207, 142, 0.18); stroke: var(--os-green); stroke-width: 1; }
.chart .mark-t { fill: var(--os-green); font-weight: 600; }
.chart .nodata-t { fill: var(--os-text); font-weight: 600; }

/* settings */
.group { margin: 0 16px 22px; background: var(--os-card); border-radius: 12px; overflow: hidden; }
.group .row { padding: 12px 14px; grid-template-columns: auto minmax(0, 1fr) auto; }
.group .row + .row::before { left: 54px; }
.group .row.noav + .row.noav::before { left: 14px; }
.group .row .name { font-weight: 400; font-size: 16px; white-space: normal; }
.group .row .val { color: var(--os-dim); font-size: 15px; text-align: right; white-space: nowrap; display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.group .row.stack { grid-template-columns: 1fr; gap: 3px; }
.group .row.stack .val { justify-content: flex-start; text-align: left; color: var(--os-text); }
.group .row.stack .name { font-size: 13px; color: var(--os-dim); }
.gic { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; }
.me-row .av { width: 60px; height: 60px; }
.me-row .name { font-size: 20px !important; font-weight: 500 !important; }
.caption { margin: -14px 28px 22px; font-size: 13px; color: var(--os-dim); }
.danger { color: var(--os-red) !important; }

/* overlays inside the phone */
.overlay { position: absolute; z-index: 4; inset: 0; }
.scan { position: absolute; inset: 0; background: rgba(5, 6, 7, 0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; animation: fadein .2s; }
.scanner { width: 118px; height: 118px; position: relative; color: var(--os-text); }
.scanner svg { width: 100%; height: 100%; }
.scan.looking .scanner { animation: pulse 1s ease-in-out infinite; }
.scan.fail .scanner { color: var(--screen); animation: shake .45s; }
.scan.ok .scanner { color: var(--os-green); }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.scan h2 { margin: 0; font: 600 19px/1.2 var(--ui); }
.scan p { margin: -10px 0 0; font-size: 14px; color: var(--os-dim); text-align: center; max-width: 250px; }
.scan .btns { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; width: 220px; }
.pill { border: 0; border-radius: 999px; padding: 12px 18px; font: 600 15px/1 var(--ui); background: rgba(255,255,255,.14); color: var(--os-text); }
.pill.primary { background: var(--screen); color: #fff; }
.pill.red { background: var(--os-red); color: #fff; }

.pass { background: rgba(6, 7, 8, 0.985); position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding-top: 110px; gap: 18px; animation: fadein .2s; }
.pass h2 { margin: 0; font: 500 19px/1.2 var(--ui); }
.dots { display: flex; gap: 16px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--os-text); }
.dots i.on { background: var(--os-text); }
.dots.bad { animation: shake .45s; }
.pass .wrong { margin: -6px 0 0; min-height: 18px; font-size: 14px; color: var(--os-red); }
.keys { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 22px; margin-top: 18px; }
.keys button { width: 78px; height: 78px; border-radius: 50%; border: 0; background: rgba(255,255,255,.13); color: var(--os-text); font: 400 32px/1 var(--ui); }
.keys button:active { background: rgba(255,255,255,.3); }
.keys .blank { visibility: hidden; }
.pass .under { margin-top: auto; margin-bottom: 44px; display: flex; justify-content: space-between; width: 280px; }
.pass .under button { border: 0; background: none; color: var(--os-text); font: 400 16px/1 var(--ui); padding: 8px; }

.sheet { position: absolute; inset: 0; background: rgba(0,0,0,.5); display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 10px 30px; gap: 8px; animation: fadein .2s; }
.sheet .card { background: rgba(32, 37, 40, 0.96); border-radius: 16px; overflow: hidden; text-align: center; }
.sheet .card p { margin: 0; padding: 16px 20px; font-size: 13px; color: var(--os-dim); border-bottom: 1px solid var(--os-sep); }
.sheet .card button { width: 100%; border: 0; background: none; padding: 16px; font: 400 19px/1 var(--ui); color: var(--screen); }
.sheet .card button + button { border-top: 1px solid var(--os-sep); }
.sheet .card .red { color: var(--os-red); }
.sheet .card.cancel button { font-weight: 600; }

.erasing { background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.erasing .bar { width: 170px; height: 5px; border-radius: 3px; background: #333; overflow: hidden; }
.erasing .bar i { display: block; height: 100%; width: 0; background: #fff; animation: fill 4.2s ease-in forwards; }
@keyframes fill { to { width: 100%; } }
.hello { background: #f7f4f1; color: #16121a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; }
.hello h1 { margin: 0; font: 200 64px/1 var(--ui); letter-spacing: -0.02em; animation: fadein 1s; }
.hello .pill { background: #16121a; color: #f7f4f1; }

/* ---------- intro and ending ---------- */
.curtain { position: fixed; inset: 0; z-index: 20; background: #050406; color: var(--bone); overflow-y: auto; }
.card-full { min-height: 100%; position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.card-full .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: kenburns 14s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }
.card-full::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(5,4,6,.15) 0%, rgba(5,4,6,.35) 45%, rgba(5,4,6,.92) 78%, #050406 100%); }
.card-text { position: relative; z-index: 2; padding: 0 max(20px, 6vw) max(36px, 7vh); max-width: 820px; display: flex; flex-direction: column; gap: 16px; animation: rise .8s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card-text blockquote { margin: 0; font: clamp(21px, 2.3vw, 30px)/1.42 var(--display); text-wrap: pretty; }
.card-text cite { font: 500 11px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ash); font-style: normal; }
.card-text .after { margin: 0; font: italic clamp(17px, 1.6vw, 20px)/1.5 var(--body); color: var(--amber); }
.card-text .btnrow { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.skip { border: 0; background: none; color: var(--ash); font: 500 13px/1 var(--ui); padding: 10px 4px; letter-spacing: .04em; }
.skip:hover { color: var(--bone); }
.pips { display: flex; gap: 6px; margin-left: auto; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.pips i.on { background: var(--amber); }
.title-card h1 { margin: 0; font: clamp(46px, 7vw, 92px)/0.98 var(--display); font-weight: 400; letter-spacing: -0.01em; text-wrap: balance; }
.title-card h1 em { color: var(--screen); font-style: italic; }
.title-card .lede { margin: 0; font-size: clamp(17px, 1.7vw, 21px); line-height: 1.5; max-width: 38em; color: var(--bone); }
.title-card .small { margin: 0; font: 13px/1.5 var(--ui); color: var(--ash); max-width: 46em; }

.end-wrap { position: relative; z-index: 2; max-width: 720px; margin: 0 auto; padding: 0 20px 60px; display: flex; flex-direction: column; gap: 18px; }
.end-hero { position: relative; height: min(52vh, 460px); }
.end-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.end-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,4,6,0) 40%, #050406); }
.end-wrap h1 { margin: -40px 0 0; font: clamp(40px, 5.5vw, 64px)/1 var(--display); font-weight: 400; }
.end-wrap blockquote { margin: 0; font: clamp(20px, 2vw, 25px)/1.45 var(--display); color: var(--amber); text-wrap: pretty; }
.end-wrap blockquote cite { display: block; margin-top: 6px; font: 500 11px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ash); font-style: normal; }
.end-wrap p { margin: 0; font-size: 18px; line-height: 1.6; text-wrap: pretty; }
.end-found { border-top: 1px solid var(--line); padding-top: 16px; font: 14px/1.6 var(--ui); color: var(--ash); }
.end-found b { color: var(--bone); font-weight: 600; }
.end-found ul { margin: 6px 0 0; padding-left: 18px; }
.end-found .missed { margin-top: 8px; font: 14px/1.6 var(--ui); color: var(--ash); }
.end-btns { display: flex; gap: 12px; flex-wrap: wrap; }

#toast {
  position: fixed; z-index: 15; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  width: min(440px, calc(100% - 24px)); pointer-events: none;
  background: rgba(20, 23, 25, 0.95); border: 1px solid rgba(233, 171, 94, 0.4); border-radius: 12px;
  padding: 10px 14px; font-style: italic; font-size: 15px; line-height: 1.45; color: var(--bone);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: drop .3s ease-out;
  display: flex; flex-direction: column; gap: 4px;
}
#toast b { font-style: normal; font: 600 11px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
#toast small { font: 500 12.5px/1.3 var(--ui); font-style: normal; color: var(--screen); }

#tabs { display: none; }

/* ---------- medium: notebook under the room ---------- */
@media (max-width: 1180px) {
  #stage { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) minmax(0, 40%); gap: 20px 24px; }
  #room { grid-area: 1 / 1; }
  #notebook { grid-area: 2 / 1; border-top: 1px solid var(--line); padding-top: 14px; }
  #phoneCol { grid-area: 1 / 2 / 3 / 3; }
  .room-head { order: 0; } .banners { order: 1; } .aim { order: 2; } .actions { order: 3; }
  .plate { order: 4; width: 100%; max-width: 62vh; } .looks { order: 5; } .log { order: 6; }
}

/* ---------- small: one view at a time ---------- */
@media (max-width: 820px) {
  #stage { display: block; padding: 0; height: calc(100% - 56px - env(safe-area-inset-bottom, 0px)); }
  #stage > * { display: none; height: 100%; }
  #app[data-tab="room"] #room,
  #app[data-tab="notebook"] #notebook { display: flex; flex-direction: column; padding: 16px 16px 28px; }
  #app[data-tab="notebook"] #notebook { display: block; }
  #app[data-tab="phone"] #phoneCol { display: block; }
  #phoneFit { zoom: 1; height: 100%; }
  #phone { width: 100%; height: 100%; padding: 0; border-radius: 0; background: #000; box-shadow: none; }
  #screen { border-radius: 0; }
  .status::after { display: none; }
  #tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: calc(56px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #0d0f10; border-top: 1px solid var(--line);
  }
  #tabs button { border: 0; background: none; color: var(--ash); font: 500 13px/1 var(--ui); position: relative; }
  #tabs button[aria-current="true"] { color: var(--amber); }
  #tabs i { position: absolute; top: 7px; left: calc(50% + 34px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--screen); color: #0b0c0d; font: 700 11px/17px var(--ui); font-style: normal; display: none; }
  #tabs button.ping i { display: block; }
  .chip { min-height: 44px; }
  .skip { padding: 14px 10px; }
  .back { min-height: 44px; padding: 10px 8px; }
  .seg button { padding: 14px 6px; }
  .nav { width: 44px; height: 44px; }
  .pill { padding: 15px 18px; }
  .pass .under button { min-height: 44px; min-width: 64px; }
  .homebar { height: 44px; }
  .lock-foot button { padding: 13px 20px; }
  .vm button { padding: 6px 0; }
  .plate { max-width: none; }
  .card-text { padding-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
