/* Stack Overboard: the few things that aren't drawn on the canvas. */

:root {
  --ink: #192147;
  --pale: #e3f3f2;
  --foam: #f4fbf9;
  --glow: #ffd36a;
  --text: #f2fbf8;
  --serif: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Roboto Mono', ui-monospace, Menlo, monospace;
  --fleet-black: #192147;
  --fleet-black-75: #515774;
  --fleet-black-50: #8b8fa2;
  --fleet-green: #009a7d;
}

* { box-sizing: border-box; }
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.game-mode #stage, #ribbon, #ribbon canvas, #skin button { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#stage { -webkit-touch-callout: none; }
img, canvas { -webkit-user-drag: none; }
html, body { margin: 0; padding: 0; background: var(--pale); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
body.game-mode { overflow: hidden; background: #02060b; touch-action: none; overscroll-behavior: none; }
button { font: inherit; }

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }

/* ── Intro ─────────────────────────────────────────────────────────────── */
#intro-scroll { display: none; height: 340vh; width: 1px; }
#intro-text { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#intro-title { position: absolute; left: 0; right: 0; top: 15vh; text-align: center; will-change: transform, opacity; }
#intro-title h1 {
  font-family: var(--sans); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(48px, 9vw, 120px); line-height: 0.95;
  margin: 0; color: var(--ink); letter-spacing: -0.01em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
#intro-title .byline, #credits .byline { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }
#intro-title .byline img { height: 34px; width: auto; display: block; }
#intro-title .byline a { pointer-events: auto; }
#intro-title .byline .conf { margin: 0 0 0 6px; padding-left: 14px; border-left: 1px solid rgba(25, 33, 71, 0.25); font-size: 11px; }
#credits .conf { margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; opacity: 0.7; }
.intro-foot { position: absolute; left: 0; right: 0; bottom: 46px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.howto { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.7; letter-spacing: 0.04em; opacity: 0.7; }
.scroll-cue { margin-top: 0; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.65; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scroll-cue i { width: 12px; height: 12px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.4; } 50% { transform: translateY(8px) rotate(45deg); opacity: 1; } }
.intro-line {
  position: absolute; left: 50%; top: 22vh; width: min(760px, calc(100vw - 32px)); transform: translateX(-50%);
  margin: 0; text-align: center; font-family: var(--sans); font-weight: 500; font-size: clamp(20px, 2.6vw, 30px); line-height: 1.35; letter-spacing: -0.01em;
  color: var(--ink); opacity: 0; text-shadow: 0 1px 12px rgba(255, 255, 255, 0.9);
}
.intro-line { left: 0; right: 0; margin: 0 auto; }
#sound-hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 3; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink); opacity: 0.5; transition: opacity 1s; pointer-events: none; }
#sound-hint.gone { opacity: 0; }
body.game-mode #sound-hint { display: none; }

/* ── HUD ───────────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity 1.5s; }
#hud.show { opacity: 1; }
#skin {
  position: absolute; right: 32px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 12px; opacity: 0; transition: opacity 1.2s; pointer-events: none;
}
#skin.show { opacity: 1; pointer-events: auto; }
#held { position: absolute; right: 260px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; opacity: 0; transition: opacity 0.6s; pointer-events: none; }
#held.show { opacity: 1; pointer-events: auto; }
#held canvas { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(5, 11, 18, 0.55); cursor: default; }
#held.keep canvas { cursor: pointer; border-color: rgba(255, 236, 190, 0.45); }
#held span { font: 500 11px var(--mono, monospace); letter-spacing: 0.04em; color: rgba(244, 237, 228, 0.75); max-width: 140px; text-align: right; }
#skin button {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.35); cursor: pointer; position: relative;
  box-shadow: 0 0 0 0 transparent; transition: transform 0.15s, box-shadow 0.4s; opacity: 0.78;
}
#skin button[data-c="W"] { background: #eef6fa; }
#skin button[data-c="R"] { background: #c8353f; }
#skin button[data-c="B"] { background: #3fc6d8; }
#skin button[data-c="G"] { background: #ffd36a; }
#skin button:hover { opacity: 1; transform: scale(1.08); }
#skin button[data-c="W"] { --c: 238, 246, 250; }
#skin button[data-c="R"] { --c: 230, 70, 80; }
#skin button[data-c="B"] { --c: 63, 198, 216; }
#skin button[data-c="G"] { --c: 255, 211, 106; }
#skin button.pulse { animation: pulse 0.7s ease-out; }
#skin button.echo { animation: echo 0.8s ease-out; }
/* A press: the orb jumps, flashes, and throws a bright ring of its own color. */
@keyframes pulse {
  0% { transform: scale(1.7); opacity: 1; filter: brightness(1.8); box-shadow: 0 0 0 0 rgba(var(--c), 0.95), 0 0 26px 10px rgba(var(--c), 0.9); }
  60% { filter: brightness(1.2); box-shadow: 0 0 0 18px rgba(var(--c), 0), 0 0 18px 4px rgba(var(--c), 0.5); }
  100% { transform: scale(1); opacity: 0.78; filter: none; box-shadow: 0 0 0 22px rgba(var(--c), 0), 0 0 0 0 rgba(var(--c), 0); }
}
/* What you've played so far, written out next to the orbs. */
#skin-seq { position: absolute; right: 0; bottom: calc(100% + 10px); display: flex; align-items: center; gap: 6px; white-space: nowrap; font: 500 12px var(--mono, monospace); letter-spacing: 0.04em; color: rgba(244, 237, 228, 0.85); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
#skin-seq.show { opacity: 1; }
#skin-seq i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
#skin-seq b { font-weight: 600; color: #fff; }
@keyframes echo { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8); opacity: 1; } 100% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); } }


/* ── Words: one big black band along the bottom, like Loom ────────── */
:root { --ribbon-h: 176px; }
#ribbon {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: #000;
  height: var(--ribbon-h); padding: 0 250px max(0px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center;
  transform: translateY(100%); transition: transform 0.45s cubic-bezier(.2, .7, .2, 1);
}
#ribbon.show, body.ribbon-fixed #ribbon { transform: none; }
#speech { display: flex; align-items: center; gap: 22px; max-width: 980px; cursor: pointer; }
#portrait {
  width: 104px; height: 104px; flex: 0 0 auto; border-radius: 50%; border: 2px solid transparent;
  opacity: 0; transform: scale(0.92); transition: opacity 0.35s, transform 0.35s; display: none;
}
#portrait.show { opacity: 1; transform: none; display: block; }
#ribbon-line {
  margin: 0; max-width: 46ch; text-align: left; font-family: var(--sans); font-weight: 500;
  font-size: clamp(19px, 1.9vw, 26px); line-height: 1.45; letter-spacing: 0.002em;
  opacity: 0; transition: opacity 0.35s ease;
}
#ribbon-line.in { opacity: 1; }
#ribbon-line .unsaid { opacity: 0; }
/* In scenes: a bigger close-up of whoever is talking, above the ribbon on the left. */
#portrait-big {
  --speaker: #fff; --pb: clamp(200px, 24vw, 340px);
  position: fixed; left: 24px; bottom: calc(var(--ribbon-h) + 20px); z-index: 6;
  width: min(var(--pb), calc((100vh - var(--ribbon-h)) * 0.6)); aspect-ratio: 1 / 1;
  border-radius: 18px; overflow: hidden; background: #02060b;
  border: 1.5px solid color-mix(in srgb, var(--speaker) 55%, transparent);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 34px color-mix(in srgb, var(--speaker) 16%, transparent);
  opacity: 0; transform: translateY(14px) scale(0.96); transition: opacity 0.45s ease, transform 0.5s cubic-bezier(.2, .7, .2, 1), border-color 0.4s;
  pointer-events: none;
}
#portrait-big.show { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
#portrait-big canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 900px) {
  #portrait-big { --pb: clamp(140px, 40vw, 220px); left: 12px; bottom: calc(var(--ribbon-h) + 12px); border-radius: 14px; }
}
#inspect { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); width: 200px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; opacity: 0; pointer-events: none; transition: opacity 0.4s; }
#inspect.show { opacity: 1; pointer-events: auto; }
#inspect-canvas { width: 104px; height: 104px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.22); background: #050b12; cursor: pointer; transition: border-color 0.2s; }
#inspect-canvas:hover { border-color: rgba(255, 255, 255, 0.6); }
#inspect-label { margin: 0; min-height: 1.4em; font: 500 14px/1.35 var(--sans); color: #fff; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ribbon-choices { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.ribbon-choices button { border: 1px solid rgba(255, 154, 118, 0.6); background: transparent; color: #ff9a76; border-radius: 999px; padding: 10px 20px; font: 500 18px var(--sans); cursor: pointer; }
.ribbon-choices button:hover { background: rgba(255, 154, 118, 0.12); }
body.ribbon-fixed #stage { height: calc(100vh - var(--ribbon-h)); }
/* Phones: the ribbon stacks in three rows, so nothing sits on top of anything else. Along the top,
   what's picked (left) and what's held (right); the words in the middle; and along the bottom,
   under your thumb, the four skin colors and Say. What you've played is written just above the ribbon. */
@media (max-width: 900px) {
  :root { --ribbon-h: 250px; }
  #ribbon { padding: 78px 16px calc(72px + env(safe-area-inset-bottom)); align-items: flex-start; }
  #inspect { left: 16px; top: 10px; transform: none; flex-direction: row; align-items: center; width: auto; max-width: calc(100% - 92px); }
  #inspect-canvas { width: 58px; height: 58px; flex: 0 0 auto; }
  #inspect-label { font-size: 13px; max-width: none; min-width: 0; }
  #held { right: 16px; top: 21px; transform: none; }
  #held span { display: none; }
  #held canvas { width: 36px; height: 36px; }
  #portrait { width: 56px; height: 56px; }
  #speech { gap: 12px; }
  #ribbon-line { font-size: 17px; line-height: 1.4; }
  #skin { left: 16px; right: auto; top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); transform: none; gap: 14px; }
  #skin button { width: 44px; height: 44px; }
  #skin-seq { position: fixed; left: 16px; right: 16px; bottom: calc(var(--ribbon-h) + 10px); flex-wrap: wrap; white-space: normal; font-size: 11px; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
  #say-btn { bottom: calc(22px + env(safe-area-inset-bottom)); }
}
@media (max-width: 340px) { #skin { gap: 10px; } #skin button { width: 42px; height: 42px; } }
/* Phones on their side (and other short screens): one slim band. The picture of what's picked
   on the left, the words in the middle, the colors top right with Say under them. */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --ribbon-h: 128px; }
  #ribbon { padding: 12px 232px 12px 88px; padding-bottom: max(12px, env(safe-area-inset-bottom)); align-items: center; }
  #inspect { left: 16px; top: 12px; transform: none; width: auto; }
  #inspect-canvas { width: 56px; height: 56px; }
  #inspect-label { display: none; }
  #held { left: 26px; right: auto; top: auto; bottom: 12px; transform: none; }
  #held span { display: none; }
  #held canvas { width: 36px; height: 36px; }
  #portrait { width: 48px; height: 48px; }
  #speech { gap: 12px; }
  #ribbon-line { font-size: 16px; line-height: 1.4; }
  #skin { left: auto; right: 16px; top: 14px; bottom: auto; transform: none; gap: 10px; }
  #skin button { width: 42px; height: 42px; }
  #skin-seq { position: fixed; left: auto; right: 16px; bottom: calc(var(--ribbon-h) + 8px); font-size: 11px; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
  #say-btn { bottom: 12px; }
  #portrait-big { --pb: 160px; }
}
#card { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at center, rgba(2, 6, 11, 0.55), rgba(2, 6, 11, 0.85)); opacity: 0; transition: opacity 1.4s; pointer-events: none; padding: 0 24px; text-align: center; }
#card.show { opacity: 1; }
#card .card-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(242, 251, 248, 0.6); }
#card .card-line { font-family: var(--sans); font-weight: 500; font-size: clamp(22px, 3vw, 36px); color: var(--text); max-width: 760px; line-height: 1.3; letter-spacing: -0.01em; }
#resume-title { position: fixed; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 1.4s; }
#resume-title.show { opacity: 1; }
#resume-title h1 { font-family: var(--sans); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(36px, 6vw, 72px); color: var(--text); margin: 0; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
#fade { position: fixed; inset: 0; background: #02060b; opacity: 0; z-index: 7; pointer-events: none; }

/* ── Journal: a book held open by tentacles ──────────────────────────── */
#journal { position: fixed; inset: 0; z-index: 10; background: radial-gradient(ellipse at 50% 40%, #13202c 0%, #070d14 60%, #02050a 100%); opacity: 0; pointer-events: none; transition: opacity 0.6s; color: #e9efe9; }
#journal.show { opacity: 1; pointer-events: auto; }
.j-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.j-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; padding: max(28px, 5vh) 16px 24px; }
.j-head { width: min(900px, 100%); display: flex; align-items: center; justify-content: center; position: relative; }
.j-head h2 { margin: 0; font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; font-size: clamp(28px, 4vw, 40px); color: #f4ede4; letter-spacing: 0.01em; }
.j-close { position: absolute; right: 0; top: 50%; transform: translateY(-50%); border: none; background: none; font-size: 34px; line-height: 1; cursor: pointer; color: rgba(244, 237, 228, 0.6); }
.j-close:hover { color: #fff; }
.j-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 14px 0 6px; max-width: min(900px, 100%); }
.j-tabs button { border: none; background: none; padding: 6px 2px; font-size: 13px; letter-spacing: 0.06em; cursor: pointer; color: rgba(233, 239, 233, 0.5); border-bottom: 1.5px solid transparent; }
.j-tabs button:hover { color: rgba(233, 239, 233, 0.85); }
.j-tabs button.on { color: #f4ede4; border-bottom-color: var(--fleet-green); }
.j-body { width: min(900px, 100%); flex: 1; overflow-y: auto; padding: 22px 8px 40px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.j-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 28px 22px; }
.j-card { text-align: center; }
.j-portrait { width: 132px; height: 132px; display: block; margin: 0 auto 10px; border-radius: 50%; background: radial-gradient(circle at 50% 45%, rgba(120, 180, 190, 0.28), rgba(20, 40, 55, 0) 70%); }
.j-name { margin: 0; font-family: var(--sans); font-weight: 600; font-size: 17px; color: #f4ede4; }
.j-line { margin: 4px auto 0; font-size: 13px; line-height: 1.5; color: rgba(233, 239, 233, 0.72); max-width: 260px; }
.j-gen .j-name::after { content: ' \2726'; font-size: 12px; color: rgba(244, 211, 160, 0.8); }
.j-meta { margin: 6px 0 0; font-size: 11px; letter-spacing: 0.04em; color: rgba(244, 211, 160, 0.7); }
.j-dots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 10px; }
.j-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 0 10px rgba(255, 255, 255, 0.15); }
.j-empty, .j-small { font-size: 13px; color: rgba(233, 239, 233, 0.6); line-height: 1.6; text-align: center; }
.j-now, .j-world { max-width: 620px; margin: 0 auto; text-align: center; }
.j-now .j-kicker, .j-world .j-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(233, 239, 233, 0.45); margin: 0 0 10px; }
.j-world .j-kicker { margin-top: 26px; }
.j-big { font-family: var(--sans); font-weight: 500; font-size: clamp(24px, 3vw, 32px); line-height: 1.35; margin: 0 0 22px; color: #f4ede4; }
.j-fact { margin: 5px 0; font-size: 14px; color: rgba(233, 239, 233, 0.75); }
.j-world .j-line { max-width: none; margin: 8px 0; font-size: 14px; }
.j-event { margin: 4px 0; font-size: 13px; color: rgba(233, 239, 233, 0.6); }
.j-btn { margin-top: 26px; border: 1px solid rgba(244, 237, 228, 0.4); background: transparent; border-radius: 999px; padding: 10px 18px; cursor: pointer; color: #f4ede4; }
.j-btn:hover { background: rgba(244, 237, 228, 0.1); }
.j-map { text-align: center; }
.j-mapcanvas { width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto 10px; }
.j-mcp { margin-top: 28px; }
.j-mcp code, #credits code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: rgba(255, 255, 255, 0.08); color: #f4ede4; padding: 3px 8px; border-radius: 6px; word-break: break-all; }

/* ── Credits ───────────────────────────────────────────────────────────── */
#credits { position: fixed; inset: 0; z-index: 11; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text); opacity: 0; pointer-events: none; transition: opacity 2.5s; padding: 24px; }
#credits.show { opacity: 1; pointer-events: auto; }
#credits .c-inner { max-width: 680px; }
#credits h1 { font-family: var(--sans); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(44px, 7vw, 84px); margin: 0; }
#credits .c-ending { font-family: var(--sans); font-size: 20px; margin: 10px 0 30px; opacity: 0.85; }
#credits .byline img { height: 30px; }
#credits .c-tally { margin-top: 30px; font-size: 14px; line-height: 1.6; opacity: 0.8; }
#credits .c-mcp { margin-top: 18px; font-size: 13px; line-height: 1.8; opacity: 0.75; }
#credits code { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.c-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.c-buttons button { border: 1.5px solid rgba(242, 251, 248, 0.6); background: transparent; color: var(--text); border-radius: 999px; padding: 10px 20px; cursor: pointer; letter-spacing: 0.06em; }
.c-buttons button:hover { background: rgba(242, 251, 248, 0.15); }

@media (max-width: 600px) {
  #say { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue i { animation: none; }
}

/* Text you might want to copy stays selectable. */
.j-mcp code, #credits code { -webkit-user-select: text; user-select: text; }

/* Naming your squid: on the first page, and in the memories screen. */
.name-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 7vh; pointer-events: auto; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink, #192147); opacity: 0.85; }
.name-pick input, .j-namerow input { -webkit-user-select: text; user-select: text; font: 500 18px/1.2 var(--sans); text-align: center; padding: 8px 14px; border-radius: 999px; outline: none; min-width: 240px; max-width: 80vw; }
.name-pick input { border: 1px solid rgba(25, 33, 71, 0.25); background: rgba(255, 255, 255, 0.7); color: #192147; text-transform: none; letter-spacing: 0; }
.name-pick input:focus { border-color: var(--fleet-green, #009A7D); }
.j-namerow { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.j-namerow input { border: 1px solid rgba(244, 237, 228, 0.18); background: rgba(255, 255, 255, 0.04); color: #f4ede4; }
.j-namerow input:focus { border-color: var(--fleet-green, #009A7D); }
.j-namerow .j-namemsg { font-size: 12px; color: rgba(233, 239, 233, 0.6); min-width: 8em; }

/* Chat: the line you type into, and the little Say button in the ribbon. */
#chat-box { position: fixed; left: 50%; bottom: calc(var(--ribbon-h) + 18px); transform: translateX(-50%); z-index: 7; opacity: 0; pointer-events: none; transition: opacity 0.2s; width: min(560px, calc(100vw - 32px)); }
#chat-box.show { opacity: 1; pointer-events: auto; }
#chat-input { width: 100%; box-sizing: border-box; -webkit-user-select: text; user-select: text; font: 500 17px/1.3 var(--sans); padding: 12px 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(2, 6, 11, 0.85); color: #f4ede4; outline: none; }
#chat-input:focus { border-color: var(--fleet-green, #009A7D); }
#say-btn { position: absolute; right: 18px; bottom: calc(14px + env(safe-area-inset-bottom)); border: 1px solid rgba(255, 255, 255, 0.22); background: transparent; color: rgba(244, 237, 228, 0.7); border-radius: 999px; padding: 6px 14px; font: 500 12px var(--mono, monospace); letter-spacing: 0.08em; cursor: pointer; touch-action: none; }
#say-btn:hover { color: #f4ede4; border-color: rgba(255, 255, 255, 0.5); }

.j-section { margin: 26px 0 10px; text-align: center; }
.j-body .j-map, .j-body .j-world { margin-top: 26px; }

/* Skip ahead (bottom left of the first page), for anyone whose progress was lost. */
#cheat { position: fixed; left: 16px; bottom: 14px; z-index: 4; opacity: 0.45; transition: opacity 0.3s; font: 500 11px var(--mono, monospace); letter-spacing: 0.06em; color: rgba(25, 33, 71, 0.55); display: flex; align-items: center; gap: 6px; pointer-events: auto; }
#cheat select { font: inherit; color: inherit; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(25, 33, 71, 0.2); border-radius: 6px; padding: 3px 6px; -webkit-user-select: auto; user-select: auto; }
body.game-mode #cheat { display: none; }

.name-pick input.saved { border-color: var(--fleet-green, #009A7D); background: rgba(232, 255, 248, 0.85); }
.name-ok { display: block; min-height: 1.3em; margin-top: 2px; font: 500 12px var(--sans); letter-spacing: 0; text-transform: none; color: var(--fleet-green, #009A7D); }

/* The map: a window onto a long strip, moved by dragging, the wheel, or the arrows. */
.j-mapview { position: relative; width: 100%; margin: 0 auto 10px; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, rgba(150, 200, 230, 0.05), rgba(2, 6, 12, 0.35)); box-shadow: inset 0 0 0 1px rgba(244, 237, 228, 0.07), inset 0 0 40px rgba(0, 0, 0, 0.45); }
.j-mapview .j-mapcanvas { width: 100%; max-width: none; display: block; margin: 0; cursor: grab; touch-action: pan-y; }
.j-mapview .j-mapcanvas:active { cursor: grabbing; }
.j-maparrow { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 46px; border: none; border-radius: 10px; background: rgba(6, 12, 18, 0.6); color: rgba(244, 237, 228, 0.75); font-size: 24px; line-height: 1; cursor: pointer; transition: opacity 0.2s, background 0.2s; }
.j-maparrow:hover { background: rgba(6, 12, 18, 0.85); color: #fff; }
.j-maparrow:disabled { opacity: 0; pointer-events: none; }
.j-maparrow.j-west { left: 6px; }
.j-maparrow.j-east { right: 6px; }
.j-maplegend { max-width: 640px; margin: 0 auto; }

/* Your name, labelled, in the memories screen. */
.j-namerow .j-namelabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(233, 239, 233, 0.5); white-space: nowrap; }

/* The blood you keep: one quiet line. */
.j-blood { margin: 10px 0 0; font-size: 12px; letter-spacing: 0.04em; color: rgba(214, 120, 120, 0.6); }

/* Cards you can click: skin-words (to hear them) and living things (for a closer look). */
.j-card.j-click { cursor: pointer; border-radius: 16px; padding: 8px 4px 10px; transition: background 0.2s; outline: none; }
.j-card.j-click:hover, .j-card.j-click:focus-visible { background: rgba(255, 255, 255, 0.04); }
.j-card.j-click:hover .j-portrait { background: radial-gradient(circle at 50% 45%, rgba(140, 210, 220, 0.36), rgba(20, 40, 55, 0) 70%); }
.j-dot { transition: transform 0.25s, box-shadow 0.25s, filter 0.25s; }
.j-dot.lit { transform: scale(1.35); filter: brightness(1.35); box-shadow: 0 0 14px 4px var(--glow, #fff), 0 0 2px 1px rgba(255, 255, 255, 0.9); }
.j-card.playing .j-name { color: #fff; }

/* Narrowing the living things down by group. */
.j-filter { margin: -6px 0 22px; }
.j-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; }
.j-subchips { margin-top: 6px; }
.j-chip { border: none; background: none; padding: 4px 10px; border-radius: 999px; font-size: 12px; letter-spacing: 0.03em; cursor: pointer; color: rgba(233, 239, 233, 0.5); }
.j-chip span { margin-left: 5px; font-size: 10px; color: rgba(233, 239, 233, 0.32); }
.j-chip:hover { color: rgba(233, 239, 233, 0.9); }
.j-chip.on { color: #f4ede4; background: rgba(244, 237, 228, 0.09); }
.j-subchips .j-chip { font-size: 11px; }

/* A close look at one living thing. */
.j-detail { max-width: 760px; margin: 0 auto; }
.j-back { border: none; background: none; padding: 4px 0; margin-bottom: 8px; cursor: pointer; font-size: 12px; letter-spacing: 0.05em; color: rgba(233, 239, 233, 0.55); }
.j-back:hover { color: #f4ede4; }
.j-dtop { display: flex; gap: 28px; align-items: center; }
.j-dpic { flex: 0 0 auto; }
.j-bigportrait { width: 260px; height: 260px; display: block; border-radius: 50%; cursor: zoom-in; background: radial-gradient(circle at 50% 45%, rgba(120, 180, 190, 0.3), rgba(20, 40, 55, 0) 70%); }
.j-dside { flex: 1; min-width: 0; }
.j-dpath { margin: 0 0 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(233, 239, 233, 0.45); }
.j-dname { margin: 0 0 6px; font-family: var(--sans); font-weight: 600; font-size: clamp(24px, 3.4vw, 32px); color: #f4ede4; letter-spacing: -0.01em; }
.j-dlike { margin: 0 0 10px; font-size: 13px; font-style: italic; color: rgba(233, 239, 233, 0.6); }
.j-dline { margin: 0 0 10px; font-size: 15px; line-height: 1.55; color: rgba(233, 239, 233, 0.85); }
.j-dwhen .j-meta { margin: 2px 0; }
.j-dbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.j-pill { border: 1px solid rgba(244, 237, 228, 0.3); background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; color: #f4ede4; transition: background 0.2s, border-color 0.2s; }
.j-pill:hover { background: rgba(244, 237, 228, 0.08); }
.j-pill.playing { border-color: rgba(191, 248, 234, 0.8); box-shadow: 0 0 14px rgba(191, 248, 234, 0.25); }
.j-dknow { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 28px; margin-top: 26px; }
.j-dsec .j-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(233, 239, 233, 0.42); margin: 14px 0 4px; }
.j-dtext { margin: 0; font-size: 14px; line-height: 1.6; color: rgba(233, 239, 233, 0.78); }

/* The picture in a close look: hover for a quiet "look closer"; on touch screens, a small magnifier. */
.j-zoom { position: relative; cursor: zoom-in; border-radius: 50%; outline: none; align-self: center; }
.j-zoom .j-bigportrait { transition: transform 0.35s ease, filter 0.35s; }
.j-zoomhint { position: absolute; left: 50%; bottom: 10px; transform: translate(-50%, 4px); padding: 4px 10px; border-radius: 999px; background: rgba(6, 12, 18, 0.72); color: rgba(244, 237, 228, 0.85); font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.j-zoomicon { position: absolute; right: 18px; bottom: 18px; width: 32px; height: 32px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: rgba(6, 12, 18, 0.7); color: rgba(244, 237, 228, 0.85); box-shadow: 0 0 0 1px rgba(244, 237, 228, 0.18); pointer-events: none; }
@media (hover: hover) {
  .j-zoom:hover .j-bigportrait { transform: scale(1.03); filter: brightness(1.08); }
  .j-zoom:hover .j-zoomhint { opacity: 1; transform: translate(-50%, 0); }
}
.j-zoom:focus-visible .j-zoomhint { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .j-zoomicon { display: flex; } }
.j-pill.on { border-color: rgba(255, 214, 140, 0.6); }

/* Where I first met it: the map, small. */
.j-dwhere { margin-top: 18px; }
.j-dwhere .j-mapview { border-radius: 12px; }
.j-wherecap { margin: 4px auto 0; }

/* The fine print, folded away. */
.j-morewrap { margin-top: 6px; }
.j-more { border: none; background: none; padding: 4px 10px; cursor: pointer; font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(233, 239, 233, 0.4); border-radius: 999px; }
.j-more::after { content: ' +'; }
.j-more[aria-expanded="true"]::after { content: ' \2212'; }
.j-more:hover { color: rgba(233, 239, 233, 0.85); background: rgba(255, 255, 255, 0.04); }
.j-moreinner { margin-top: 6px; }
.j-stats { color: rgba(233, 239, 233, 0.6); font-size: 13px; letter-spacing: 0.02em; }

/* Squids: what I know about being one (the memories page). */
.j-squidfacts { max-width: 760px; margin: 40px auto 0; text-align: center; }
.j-squidfacts > .j-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(233, 239, 233, 0.45); margin: 0 0 4px; }
.j-sfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 28px; margin-top: 14px; text-align: left; }
.j-sfact h4 { margin: 12px 0 4px; font-family: var(--sans); font-weight: 600; font-size: 14px; color: #f4ede4; }
@media (max-width: 620px) { .j-sfacts { grid-template-columns: 1fr; } .j-zoomhint { display: none; } }

/* The big picture. */
.j-lightbox { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(2, 5, 10, 0.88); opacity: 0; transition: opacity 0.3s; cursor: zoom-out; }
.j-lightbox.show { opacity: 1; }
.j-lbcanvas { width: min(720px, 82vw, 82vh); height: min(720px, 82vw, 82vh); border-radius: 18px; }
.j-lbname { margin: 6px 0 0; font-family: var(--sans); font-weight: 600; font-size: 20px; color: #f4ede4; }

@media (max-width: 620px) {
  .j-head { padding: 0 36px; }
  .j-head h2 { font-size: 26px; }
  .j-namerow { flex-wrap: wrap; gap: 6px 10px; }
  .j-namerow input { min-width: 0; width: 62vw; }
  .j-namerow .j-namemsg { min-width: 0; width: 100%; text-align: center; }
  .j-dtop { flex-direction: column; gap: 14px; text-align: center; }
  .j-bigportrait { width: 220px; height: 220px; }
  .j-dbtns { justify-content: center; }
  .j-dknow { grid-template-columns: 1fr; }
}

/* ── A thought, waiting (only said if clicked) ─────────────────────────── */
#hint-btn { position: fixed; right: 18px; top: 14px; transform: scale(0.8); z-index: 6; display: flex; gap: 4px; align-items: center; justify-content: center; width: 46px; height: 30px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(5, 11, 18, 0.55); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.6s, transform 0.6s; }
#hint-btn.show { opacity: 0.85; pointer-events: auto; transform: scale(1); }
body.in-scene #hint-btn { opacity: 0; pointer-events: none; }
#hint-btn:hover { opacity: 1; border-color: rgba(255, 255, 255, 0.6); }
#hint-btn i { width: 5px; height: 5px; border-radius: 50%; background: #ff9a76; animation: hint-dot 1.8s ease-in-out infinite; }
#hint-btn i:nth-child(2) { animation-delay: 0.25s; }
#hint-btn i:nth-child(3) { animation-delay: 0.5s; }
@keyframes hint-dot { 0%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
body:not(.game-mode) #hint-btn { display: none; }

/* Hovering (nothing picked): just the picture, quieter */
#inspect.preview #inspect-canvas { opacity: 0.75; border-style: dashed; }

/* ── Skipping a cutscene ───────────────────────────────────────────────── */
#skip-btn { position: fixed; right: 18px; top: 16px; z-index: 40; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(5, 11, 18, 0.5); color: rgba(244, 237, 228, 0.8); font: 500 12px var(--mono, monospace); letter-spacing: 0.1em; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.5s; }
#skip-btn.show { opacity: 1; pointer-events: auto; }
#skip-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.65); }

#cheat:hover, #cheat:focus-within { opacity: 1; }

/* A skin color something nearby is asking for (the crooked rings) */
#skin button.beckon { animation: beckon 1.3s ease-in-out infinite; }
@keyframes beckon { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--c), 0); } 50% { box-shadow: 0 0 0 6px rgba(var(--c), 0.45), 0 0 18px 4px rgba(var(--c), 0.5); } }

.name-note { margin: 6px 0 0; font: 400 11px var(--mono); letter-spacing: 0.04em; color: var(--ink, #192147); opacity: 0.6; }

/* A line that really matters: the speaker fills the screen above the words (like Loom's close-ups). */
#portrait-big.full { left: 0; right: 0; top: 0; bottom: var(--ribbon-h); width: auto; aspect-ratio: auto; border-radius: 0; border: none; box-shadow: none; display: flex; justify-content: center; background: radial-gradient(ellipse at center, #0b1622 0%, #02060b 75%); }
#portrait-big.full canvas { height: 100%; width: auto; aspect-ratio: 1 / 1; max-width: 100%; }

/* Conversations and scenes play like cutscenes: letterbox bars, nothing to pick. */
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 4; pointer-events: none; transition: height 0.6s ease; }
body::before { top: 0; }
body::after { bottom: var(--ribbon-h, 0px); }
body.game-mode.in-scene::before { height: 7vh; }
body.game-mode.in-scene::after { height: 4vh; }

/* Phones: the journal's title never runs under its close button. */
@media (max-width: 620px) {
  #journal .j-head { padding: 0 40px; box-sizing: border-box; }
  #journal .j-head h2 { font-size: 24px; text-align: center; }
  #journal .j-close { right: 4px; }
}
