/* Nib — a 2013 nursery seen through a CRT. One bold thing: the glowing screen. Everything else quiet. */
:root {
  --bezel: #2b2521;        /* warm dark plastic */
  --bezel-2: #3a322d;
  --screen-a: #cfe5f5;     /* baby blue, top of the tube */
  --screen-b: #f6cdb3;     /* sunset peach, bottom */
  --ink: #2d2a45;          /* indigo ink on pastel */
  --muted: #595672;         /* 5.5:1 on the peach end of the tube */
  --brass: #b8893a;        /* the pen-nib badge */
  --brass-2: #8f6826;
  --paper: #f8f3ec;        /* the room around the set */
  --line: #d9d2c6;
  --bad: #a3332e;
  --ok: #2f6f4e;
  --scribble: 1;           /* 1 = newborn scrawl, 0 = clean type; set from the live loss */
  --maxw: 760px;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0; font-family: "Nunito", system-ui, sans-serif; font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brass-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 22px 0 10px; }
.top h1 { font: 700 22px/1 "Nunito", sans-serif; margin: 0; letter-spacing: -0.01em; }
.top h1 span { color: var(--muted); font-weight: 500; }
.top nav a { margin-left: 14px; font-size: 15px; }

/* status line: measured things only */
.status { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.status b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.status .dot { display: inline-block; width: 9px; height: 9px; padding: 0; border: 0; box-sizing: content-box; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.status .dot.nap { background: var(--bad); }
.status .dot.unborn { background: var(--muted); }

/* the set: bezel + tube */
.set { background: linear-gradient(180deg, var(--bezel-2), var(--bezel)); border-radius: 26px; padding: 22px 22px 18px;
       box-shadow: 0 30px 60px -30px rgba(43,37,33,.6), inset 0 1px 0 rgba(255,255,255,.08); }
.tube { position: relative; border-radius: 18px / 22px; overflow: hidden; min-height: 460px;
        background: radial-gradient(120% 90% at 50% 10%, var(--screen-a) 0%, #dcdff0 55%, var(--screen-b) 100%);
        box-shadow: inset 0 0 60px rgba(45,42,69,.25), inset 0 0 0 2px rgba(255,255,255,.35); }
.tube::after { /* scanlines + glass */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(45,42,69,.07) 0 1px, transparent 1px 3px),
              radial-gradient(90% 80% at 50% 50%, transparent 60%, rgba(45,42,69,.14) 100%);
  mix-blend-mode: multiply;
}
.tube > * { position: relative; z-index: 1; }
.bezel-foot { display: flex; justify-content: space-between; align-items: center; color: #b9ada2; font-size: 13px; padding: 12px 6px 0; }
.bezel-foot .led { width: 8px; height: 8px; border-radius: 50%; background: #d84f3c; box-shadow: 0 0 8px #d84f3c; display: inline-block; margin-right: 8px; }
.bezel-foot .led.on { background: #7fd68a; box-shadow: 0 0 8px #7fd68a; }

/* the mobile over the cot: flip phone, early tablet, a blank game disc. no logos. */
.mobile { position: absolute; top: 0; left: 0; right: 0; height: 120px; pointer-events: none; z-index: 0; opacity: .9; }
.mobile svg { width: 100%; height: 120px; overflow: visible; }
@media (prefers-reduced-motion: no-preference) {
  .mobile .arm { transform-origin: 50% 0; animation: sway 9s ease-in-out infinite alternate; }
  @keyframes sway { from { transform: rotate(-2.2deg); } to { transform: rotate(2.2deg); } }
}

/* chat */
.chat { padding: 110px 20px 16px; min-height: 460px; display: flex; flex-direction: column; }
.log { flex: 1; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 92%; }
.msg.you { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.7); border-radius: 14px; padding: 8px 12px; }
.msg.you .bubble { background: rgba(45,42,69,.08); border-color: rgba(45,42,69,.12); }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.avatar { width: 34px; height: 34px; flex: none; image-rendering: pixelated; }
.nib-text { white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: "Caveat", "Nunito", sans-serif; font-size: calc(17px + 6px * var(--scribble));
  letter-spacing: calc(0.06em * var(--scribble)); word-spacing: calc(0.12em * var(--scribble));
  filter: blur(calc(0.55px * var(--scribble))); color: color-mix(in oklab, var(--ink) calc(100% - 30% * var(--scribble)), #7b6fa0); }
.nib-text.clean { font-family: "Nunito", sans-serif; font-size: 17px; letter-spacing: 0; word-spacing: 0; filter: none; color: var(--ink); }
.nib-text .w { display: inline-block; transform: rotate(calc(var(--r, 0) * 1deg * var(--scribble))); }
.caret::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--brass); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret::after { animation: none; } }
form.ask { display: flex; gap: 8px; }
form.ask input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(45,42,69,.25); background: rgba(255,255,255,.75); color: var(--ink); }
form.ask input::placeholder { color: var(--muted); }
button { font: 600 15px "Nunito", sans-serif; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--brass-2); background: var(--brass); color: #fff; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button.quiet { background: transparent; color: var(--brass-2); }
.loadbar { height: 6px; border-radius: 3px; background: rgba(45,42,69,.12); overflow: hidden; margin: 8px 0 0; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--brass); transition: width .3s; }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.hint.err { color: var(--bad); }
.opts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.opts label { cursor: pointer; }

/* napping banner */
.nap { display: none; background: #f1e3d2; border: 1px solid #e3cdb3; color: #5a3f22; border-radius: 12px; padding: 10px 14px; margin: 14px 0; }
.nap.show { display: block; }

/* sections */
section { margin: 36px 0; }
h2 { font: 700 19px/1.3 "Nunito", sans-serif; margin: 0 0 8px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 12px; }

/* loss chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .curve { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .ck { fill: var(--brass); }
.chart text { font: 12px "Nunito", sans-serif; fill: var(--muted); }
.chart .val { fill: var(--ink); font-weight: 700; }

/* growth strip */
.strip { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.strip table { border-collapse: collapse; min-width: 100%; }
.strip th, .strip td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 180px; max-width: 260px; font-size: 14px; }
.strip th { position: sticky; top: 0; background: var(--paper); text-align: left; font-weight: 700; }
.strip th small { display: block; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.strip td.prompt { position: sticky; left: 0; background: var(--paper); font-weight: 700; min-width: 150px; }
.strip td .nib-text { font-size: calc(14px + 4px * var(--scribble)); white-space: normal; }
.strip td .nl { color: var(--muted); font-family: "Nunito", sans-serif; font-size: 12px; }
.strip .empty { padding: 24px; color: var(--muted); }

/* footer / disclaimers */
.disc { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.disc p { margin: 6px 0; }

/* other pages */
table.plain { border-collapse: collapse; width: 100%; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.ok { color: var(--ok); font-weight: 700; } .no { color: var(--bad); font-weight: 700; }
details summary { cursor: pointer; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; margin: 10px 0; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .set { padding: 12px 10px 10px; border-radius: 18px; }
  .chat { padding: 100px 12px 12px; }
  .msg { max-width: 100%; }
  .top { flex-direction: column; gap: 6px; }
  .top nav a { margin: 0 12px 0 0; }
}
