/* Phone app. Mobile first; centered column on bigger screens. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0a0a0a; }
body { font-family: 'Inter', system-ui, sans-serif; color: #fff; overscroll-behavior: none; }
button { font: inherit; cursor: pointer; }
#app { height: 100dvh; }

/* ---------- splash ---------- */
.splash { position: relative; min-height: 100dvh; background: var(--bg); color: var(--fg); overflow-y: auto; }
.splash-in { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 56px 22px 40px; }
.splash .k { font: 600 12px 'IBM Plex Mono', monospace; letter-spacing: .3em; color: var(--accent); }
.splash h1 { font: 700 40px/1.05 'Space Grotesk', sans-serif; margin: 14px 0 12px; }
.splash p { color: var(--muted); line-height: 1.5; margin: 0 0 24px; }
.start { width: 100%; padding: 16px; border-radius: 14px; border: 0; background: #ff7a1a; color: #0a0a0a; font-weight: 700; font-size: 17px; }
.splash-list { margin-top: 22px; display: grid; gap: 8px; }
.sl { display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); font-family: var(--font); }
.sl b { color: var(--accent); min-width: 44px; font-family: var(--mono, monospace); text-shadow: var(--glow); }

/* ---------- year roll ---------- */
#roll { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; text-align: center; background: var(--bg, #000); color: var(--fg, #fff); pointer-events: none; clip-path: inset(0 0 100% 0); }
#roll.show { clip-path: inset(0); transition: clip-path .3s cubic-bezier(.7,0,.3,1); }
#roll.hide { clip-path: inset(100% 0 0 0); transition: clip-path .45s cubic-bezier(.7,0,.3,1); }
.roll-year { font: 700 30vw/1 var(--title-font); text-shadow: var(--glow); font-variant-numeric: tabular-nums; }
.roll-name { font: 400 18px var(--font); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
@media (min-width: 700px) { .roll-year { font-size: 160px; } }

/* ---------- era page ---------- */
.page { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font-family: var(--font); overflow: hidden; }
.page > :not(.fx) { position: relative; z-index: 1; }
.top { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.home { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 16px; }
.years { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.years::-webkit-scrollbar { display: none; }
.years button { flex: none; padding: 7px 10px; border-radius: 99px; border: 0; background: transparent; color: var(--muted); font: 600 13px var(--mono, monospace); }
.years button.on { background: var(--accent); color: var(--bg); }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: 640px; width: 100%; margin: 0 auto; padding: 14px 16px 0; overflow: hidden; }
.head .yr { font: 700 44px/1 var(--title-font); color: var(--accent); text-shadow: var(--glow); }
.head .nm { margin: 2px 0 0; font: 700 26px/1.1 var(--title-font); text-shadow: var(--glow); }
.head .who { font-size: 13px; color: var(--muted); margin-top: 3px; }
.head .blurb { font-size: 14px; line-height: 1.45; margin: 8px 0 10px; opacity: .92; }
.theme-amber .head .yr { font-size: 56px; }
.theme-amber .head .nm { font-size: 34px; }
.theme-amber .head .blurb, .theme-amber .head .who { font-size: 18px; line-height: 1.2; }
.area { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.nav { display: flex; gap: 8px; padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); max-width: 640px; width: 100%; margin: 0 auto; }
.nav button { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); font: 600 14px var(--font); }
.nav .next { flex: 1; background: var(--accent); color: var(--bg); border-color: transparent; }
.nav button:disabled { opacity: .35; }
.nav .prev:disabled { visibility: hidden; flex: 0; padding: 0; border: 0; }
.note { font-size: 12px; color: var(--muted); line-height: 1.4; margin: 0; }

/* ---------- chat ---------- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--panel-fg); overflow: hidden; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bub { max-width: 85%; padding: 9px 12px; border-radius: 14px; background: var(--bubble-bot); line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.msg.me .bub { background: var(--bubble-me); }
.bub.wait::after { content: '●●●'; letter-spacing: 2px; animation: dots 1s infinite; opacity: .6; }
@keyframes dots { 50% { opacity: .2; } }
.bub.err { color: #ff8a8a; }
.bub .prompt { font-weight: 700; }
.msg.me.quiet { display: none; }
.composer { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: inherit; font: 16px var(--font); outline: none; }
.composer input::placeholder { color: var(--muted); opacity: .8; }
.composer button { width: 44px; border-radius: 10px; border: 0; background: var(--accent); color: var(--bg); font-size: 18px; font-weight: 700; }
.composer button:disabled { opacity: .4; }
.hints { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.hints::-webkit-scrollbar { display: none; }
.hints button { flex: none; padding: 7px 11px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--fg); font: 13px var(--font); }
.llmlabel { font: 600 11px 'IBM Plex Mono', monospace; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }

/* terminals: no bubbles, glowing text */
.theme-amber .chat { background: #000; border-width: 2px; box-shadow: inset 0 0 30px rgba(0,0,0,.9); }
.theme-amber .bub { background: none; padding: 0; font-size: 21px; line-height: 1.15; text-shadow: var(--glow); max-width: 100%; }
.theme-amber .msg.me { justify-content: flex-start; }
.theme-amber .msg.me .bub::before { content: '> '; color: var(--muted); }
.theme-amber .msg.me .bub { color: var(--muted); }
.theme-amber .composer input { font-size: 20px; text-transform: uppercase; }
.theme-amber .hints button { font-size: 16px; }
/* 90s web chat */
/* 2011 phone */
.theme-gloss .chat { background: #dfe3e8; color: #111; }
.theme-gloss .bub { box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.6); }
.theme-gloss .msg.me .bub { color: #fff; }
.theme-gloss .composer { background: linear-gradient(#f4f5f7, #d0d5db); }
.theme-gloss .composer input { background: #fff; border-color: #a8b0ba; border-radius: 16px; color: #111; }
.theme-gloss .composer button { border-radius: 16px; background: linear-gradient(#6fc0ff, #1a7fe6); color: #fff; }
.theme-gloss .hints button { color: #f4f6f9; }
/* GPT-2 */
.theme-term .bub { font-family: 'IBM Plex Mono', monospace; font-size: 14px; border-radius: 6px; max-width: 100%; }
.theme-term .bub .prompt { color: #79c0ff; }
/* ChatGPT 2022: full-width rows */
.theme-chat22 .chat { background: #343541; border-radius: 8px; }
.theme-chat22 .msgs { padding: 0; gap: 0; }
.theme-chat22 .msg, .theme-chat22 .msg.me { justify-content: flex-start; }
.theme-chat22 .bub { max-width: 100%; width: 100%; border-radius: 0; padding: 14px; background: #343541; }
.theme-chat22 .msg.bot .bub { background: #444654; }
.theme-chat22 .composer { background: #40414f; }
.theme-chat22 .composer button { background: #19c37d; color: #fff; }
/* now */
.theme-now .chat { background: #141414; }
.theme-now .composer button { background: #ff7a1a; color: #0a0a0a; }
.theme-paper .chat, .theme-punch .chat { border-radius: 4px; }

/* ---------- PARRY mood meters ---------- */
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 16px; }
.meter span { display: block; color: var(--muted); }
.meter b { display: block; height: 8px; border: 1px solid var(--line); border-radius: 2px; }
.meter i { display: block; height: 100%; background: var(--fg); box-shadow: 0 0 8px var(--fg); transition: width .5s; }

/* ---------- Turing quiz ---------- */
.quiz { flex: 1; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 20px 18px; box-shadow: 0 10px 30px rgba(60,40,10,.15); }
.qn { font-size: 13px; color: var(--muted); letter-spacing: .15em; text-transform: uppercase; }
.quiz blockquote { margin: 14px 0 18px; font-size: 22px; line-height: 1.35; }
.qrow { display: flex; gap: 10px; }
.qbtn { flex: 1; padding: 14px; border-radius: 8px; border: 2px solid var(--fg); background: transparent; color: var(--fg); font: 18px var(--font); }
.qres { font-size: 20px; margin-bottom: 6px; }
.qres.ok { color: #2e7d32; } .qres.no { color: var(--accent); }
.qwhy { color: var(--muted); line-height: 1.45; }
.qscore { font-size: 64px; color: var(--accent); }

/* ---------- Logic Theorist ---------- */
.lt { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.ltpicks { display: grid; gap: 6px; }
.ltpicks button { text-align: left; padding: 10px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: 14px 'IBM Plex Mono', monospace; border-radius: 2px; }
.ltout { flex: 1; min-height: 120px; margin: 0; overflow-y: auto; padding: 12px; background: repeating-linear-gradient(#f3e9cc 0 22px, #e6f0d6 22px 44px); color: #3a2a12; font: 13px/22px 'IBM Plex Mono', monospace; white-space: pre-wrap; border-left: 6px dotted rgba(80,50,10,.3); border-right: 6px dotted rgba(80,50,10,.3); }

/* ---------- SHRDLU blocks ---------- */

/* ---------- Deep Blue chess ---------- */

/* ---------- info cards ---------- */
.facts { flex: 1; overflow-y: auto; display: grid; gap: 10px; align-content: start; padding-bottom: 6px; }
.fact { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); animation: fadeup .5s backwards; }
.fact b { font: 700 22px var(--title-font); color: var(--accent); text-shadow: var(--glow); }
.fact p { margin: 4px 0 0; line-height: 1.45; font-size: 15px; }
.theme-go .fact { background: rgba(217,169,86,.08); }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }

/* short phones: shrink the header */
@media (max-height: 700px) {
  .head .yr { font-size: 32px; } .head .nm { font-size: 22px; } .head .blurb { font-size: 13px; margin: 4px 0 6px; }
  .theme-amber .head .yr { font-size: 40px; }
  .blocks svg { max-height: 150px; }
}
.sl.theme-amber { font-size: 21px; }

/* ---------- keyboard open: the page shrinks to the visible area, so give the chat the room ---------- */
body.kb .head .who, body.kb .head .blurb, body.kb .hints, body.kb .llmlabel, body.kb .nav, body.kb .meters span { display: none; }
body.kb .head { display: flex; align-items: baseline; gap: 10px; }
body.kb .head .yr, body.kb .theme-amber .head .yr { font-size: 20px; }
body.kb .head .nm, body.kb .theme-amber .head .nm { font-size: 20px; margin: 0; }
body.kb .main { padding-top: 8px; }
body.kb .top { padding-top: 6px; padding-bottom: 6px; }
body.kb .blocks svg { max-height: 84px; width: auto; margin: 0 auto; }
body.kb .area { padding-bottom: 6px; }
body.kb .composer { padding-bottom: 8px; }
