/* The site is always dark, on every device, whatever the device's own light/dark setting. */
:root {
  --ink: #8fa8ff;
  --ink-2: #a9bcff;
  --ink-soft: #1e2540;
  --paper: #14161b;
  --card: #1c1f26;
  --text: #e9eaee;
  --muted: #a2a7b3;
  --line: #2c303a;
  --rule: #2b3550;
  --margin: #5a3434;
  --warn-bg: #3a2f12;
  --warn: #f3d27a;
  --bad: #ff8a80;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", "Chalkboard SE", cursive;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--text); background: var(--paper);
}
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 48px; outline: none; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { margin: 0 0 6px; font-size: 1.05rem; }
a { color: var(--ink); }
code { background: var(--ink-soft); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
[hidden] { display: none !important; }

/* header / footer */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); margin-right: auto; }
.logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand span { color: var(--ink); margin-left: -10px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 500; }
nav a:hover { color: var(--text); background: var(--ink-soft); }
nav a.on { color: var(--ink); background: var(--ink-soft); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 20px; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); }

/* buttons + fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary { color: #0e1222; }
.btn.primary:hover { background: var(--ink-2); }
.btn.danger { color: var(--bad); }
.btn.danger.primary, #dlg .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .88rem; border-radius: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; font-size: .92rem; }
input[type=text], input:not([type]), select, textarea, .copybox {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92rem; resize: vertical; min-height: 200px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
input[type=range] { width: 100%; accent-color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.check.small { font-size: .88rem; margin: 0 4px; }
.hint { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.right { text-align: right; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.row.between { justify-content: space-between; }
.warn { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.narrow { max-width: 780px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* segmented radio */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: .92rem; }
.seg input:checked + span { background: var(--ink-soft); border-color: var(--ink); color: var(--ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--ink); }

/* home */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 24px 0 40px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.ink { color: var(--ink); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 560px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.cta .btn { min-height: 48px; padding: 10px 22px; font-size: 1.02rem; }
.sheet {
  position: relative; background: #fffdf8; border-radius: 6px; padding: 34px 26px 30px 64px;
  box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 18px 40px rgba(31, 58, 138, .12); transform: rotate(1.2deg);
  min-height: 260px;
}
.sheet.lined {
  background-image: linear-gradient(to right, transparent 46px, #f0b8b8 46px, #f0b8b8 48px, transparent 48px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 39px, #c9d6ee 39px, #c9d6ee 40px);
  background-color: #fffdf8;
}
.hero-anim { min-width: 0; }
.sheet.small { min-height: 180px; max-width: 280px; margin: 0 auto 16px; transform: rotate(-1deg); opacity: .7; }
.scribble { font-family: var(--hand); color: #1d3fa6; font-size: 1.35rem; line-height: 40px; height: 40px; white-space: nowrap; overflow: hidden; }
.scribble.boxed { display: inline-block; border: 2px solid #1d3fa6; border-radius: 3px 6px 4px 7px; padding: 0 10px; line-height: 34px; height: 38px; margin-top: 2px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink-soft); color: var(--ink); margin-bottom: 10px; }
.step p { margin: 0; color: var(--muted); }

.step h2 { margin: 0 0 6px; font-size: 1.05rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.features div { padding: 4px 4px 0; }
.features h2 { font-size: 1.05rem; margin: 0 0 6px; }
.features p { margin: 0; color: var(--muted); }
.faq { margin-top: 44px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin: 10px 0 2px; }
.prose h2 { margin-top: 28px; }
.prose li { margin-bottom: 8px; }

/* create wizard */
.wizard { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .9rem; margin-right: 8px; }
.num { color: #0e1222; }
.templates { display: grid; gap: 10px; }
.tpl { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); }
.tpl:hover { border-color: var(--ink); background: var(--ink-soft); }
.tpl small { display: block; color: var(--muted); }
.pdf { flex: none; display: grid; place-items: center; width: 42px; height: 50px; border-radius: 4px 12px 4px 4px; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 700; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 12px;
}
.drop:hover, .drop.over { border-color: var(--ink); background: var(--ink-soft); }
.drop p { margin: 4px 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 12px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.progress { height: 10px; background: var(--ink-soft); border-radius: 999px; overflow: hidden; margin: 6px 0 12px; }
.bar { height: 100%; width: 3%; background: var(--ink); border-radius: 999px; transition: width .8s ease; }
.review { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 12px; background: #fff; }

/* account menu */
#user { display: flex; align-items: center; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 999px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--ink-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink) center / cover; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.uname { font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; display: flex; flex-direction: column; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu .who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button { text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--ink-soft); }
.signin { min-height: 62vh; display: grid; place-items: center; }
.signin .card { width: min(380px, 100%); text-align: center; padding: 34px 28px 22px; }
.signin h1 { margin: 14px 0 4px; }
.signin .hint { margin: 0 0 20px; }
.logo.big { display: inline-block; width: 60px; height: 60px; border-radius: 15px; }
.agree { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; margin-bottom: 14px; }
.agree input { width: 18px; height: 18px; accent-color: var(--ink); }
.agree.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.gwrap { position: relative; display: flex; justify-content: center; min-height: 46px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.gcover { position: absolute; inset: 0; display: none; cursor: not-allowed; }
.gwrap.locked .gbtn { opacity: .4; filter: grayscale(1); }
.gwrap.locked .gcover { display: block; }
input[type=email], input[type=password], input[type=number] {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper);
  color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.email-login { margin-top: 18px; text-align: left; }
.email-login summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.email-login summary::-webkit-details-marker { display: none; }
.email-login .or { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--muted); font-size: .82rem; }
.email-login .or::before, .email-login .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.email-login .elink { color: var(--muted); font-size: .9rem; font-weight: 500; padding: 4px 10px; border-radius: 8px; }
.email-login summary:hover .elink { color: var(--text); background: var(--ink-soft); }
.email-login[open] .elink { display: none; }
.eform { display: grid; gap: 14px; margin-top: 4px; animation: fadein .25s ease; }
.efield { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.pwbox { position: relative; display: block; }
.pwbox input { padding-right: 64px; }
.pwshow { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted);
  font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.pwshow:hover { color: var(--text); background: var(--ink-soft); }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.row.center { justify-content: center; }
body[data-route=signin] #user, body[data-route=agree] #user { visibility: hidden; }
.legal h2 { font-size: 1.05rem; margin-top: 24px; }
.legal li { margin-bottom: 6px; }
.foot .row { gap: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; word-break: break-word; }
.narrow > .card + .card { margin-top: 16px; }

/* admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile small { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tile b { font-size: 1.7rem; line-height: 1.2; }
.tile span { color: var(--muted); font-size: .85rem; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.chart { padding: 14px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; margin-top: 10px; }
.bars i { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; opacity: .85; min-height: 2px; }
.bars i:hover { opacity: 1; }
.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
.grid th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid td small { color: var(--muted); }
.grid tr.off td, .grid tr.off td b { color: var(--muted); }
.grid tr.bad td { color: var(--bad); }
.grid .mini { width: 70px; height: 50px; object-fit: cover; object-position: top left; border-radius: 6px; border: 1px solid var(--line); background: #fff; }

/* quick use: the sheet to copy */
.qsheet { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; margin: 6px 0 14px; overflow-x: auto; }
.qline { display: flex; align-items: flex-start; gap: 4px; min-height: 52px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.qn { width: 22px; flex: none; color: var(--muted); font-size: .75rem; align-self: center; }
.qc { display: inline-flex; flex-direction: column; align-items: center; min-width: 30px; }
.qc b { font-size: 1.55rem; font-weight: 500; line-height: 1.2; }
.qc small { font: .6rem system-ui, sans-serif; color: var(--muted); }
.qsentence { font: 1.2rem system-ui, sans-serif; align-self: center; }
.qnote { font: .9rem system-ui, sans-serif; align-self: center; margin-right: 8px; }
.qbar { display: inline-block; width: 70px; border-bottom: 2px solid var(--text); margin: 0 10px 18px; }

/* write */
.write { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .write { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 900px) { .panel { position: static; } }
.inks { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.inkdot input { position: absolute; opacity: 0; }
.inkdot span { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.inkdot input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.inkdot input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.more { margin: 4px 0 16px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.result { min-height: 400px; }
.empty, .working { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--ink-soft); border-top-color: var(--ink); animation: spin 1s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 18px; margin-top: 14px; }
.page { display: block; border-radius: 4px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: #fff; }
.page img { display: block; width: 100%; height: auto; }

/* profiles */
.plist { display: grid; gap: 14px; margin-bottom: 18px; }
.pcard { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 14px; }
@media (max-width: 560px) { .pcard { grid-template-columns: 1fr; } }
.pthumb { width: 100%; height: 110px; object-fit: cover; object-position: top left; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.pbody h3 { word-break: break-word; }
.wrap { margin-top: 10px; gap: 6px; }
.sub { margin-top: 32px; }

/* dialog + toast */
#dlg { border: 0; border-radius: 16px; padding: 22px; width: min(560px, 92vw); max-height: 90vh; background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
#dlg::backdrop { background: rgba(10, 14, 30, .45); }
#dlg .review { max-height: 60vh; object-fit: contain; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #1d1f24; color: #fff; padding: 11px 18px; border-radius: 10px; max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); transition: opacity .2s, transform .2s; z-index: 50; white-space: pre-line;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

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

/* explainer animations (explainer.js): drawn at 600x270, scaled to fit */
.explainer { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; }
.ex-frame { position: relative; overflow: hidden; border-radius: 12px; background: #1c1f26; }
.ex-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ex-scene { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 20px; opacity: 0; transition: opacity .45s; }
.ex-scene.on { opacity: 1; }
.ex-hand { font-family: 'Caveat', var(--hand); color: #1d3fa6; font-size: 27px; line-height: 32px; }
.ex-sheet { background: #fffdf8; border-radius: 6px; position: relative; background-image: repeating-linear-gradient(#fffdf8 0 31px, #c9d6ee 31px 32px); background-position: 0 16px; }
.ex-chars span { display: inline-block; width: 26px; text-align: center; opacity: 0; }
.on .ex-chars span { animation: ex-pop .25s forwards; }
@keyframes ex-pop { from { opacity: 0; transform: translateY(4px) scale(.7); } to { opacity: 1; transform: none; } }
.ex-pen { position: absolute; width: 12px; height: 60px; background: var(--ink); border-radius: 3px 3px 6px 6px; transform: rotate(28deg); transform-origin: bottom; opacity: 0; }
.on .ex-pen { animation: ex-penmove 2.6s ease-in-out forwards; }
@keyframes ex-penmove { 0% { opacity: 1; left: 22px; top: -8px; } 30% { left: 180px; top: -8px; } 33% { left: 22px; top: 24px; } 63% { left: 180px; top: 24px; } 66% { left: 22px; top: 56px; } 95% { left: 180px; top: 56px; opacity: 1; } 100% { opacity: 0; } }
.ex-phone { width: 150px; height: 240px; border-radius: 24px; border: 3px solid #3a4050; background: #0b0c10; position: relative; display: flex; align-items: center; justify-content: center; }
.ex-phone.ex-small { width: 110px; height: 180px; border-radius: 20px; opacity: 0; }
.on .ex-phone.ex-small { animation: ex-slide .4s 1.9s forwards; }
.ex-cam { color: var(--ink); font-size: 30px; }
.ex-finder { position: relative; }
.ex-corner { position: absolute; width: 18px; height: 18px; border: 3px solid var(--ink); }
.c1 { left: -8px; top: -8px; border-right: 0; border-bottom: 0; } .c2 { right: -8px; top: -8px; border-left: 0; border-bottom: 0; }
.c3 { left: -8px; bottom: -8px; border-right: 0; border-top: 0; } .c4 { right: -8px; bottom: -8px; border-left: 0; border-top: 0; }
.on .ex-corner { animation: ex-focus 1.2s ease-out forwards; }
@keyframes ex-focus { from { transform: scale(1.6); opacity: 0; } to { transform: none; opacity: 1; } }
.ex-shutter { position: absolute; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #e9eaee; }
.ex-flash { position: absolute; inset: 0; background: #fff; opacity: 0; border-radius: 20px; }
.on .ex-flash { animation: ex-flash .5s 1.5s; }
.on .ex-flash.late { animation-delay: 2.4s; }
@keyframes ex-flash { 0% { opacity: 0; } 20% { opacity: .95; } 100% { opacity: 0; } }
.ex-grid { display: grid; grid-template-columns: repeat(6, 46px); gap: 8px; }
.ex-tile { height: 52px; border-radius: 8px; background: #fffdf8; display: flex; align-items: center; justify-content: center; position: relative; opacity: 0; }
.ex-tile .ex-hand { font-size: 30px; }
.on .ex-tile { animation: ex-fly .45s cubic-bezier(.2, .8, .3, 1.2) forwards; }
@keyframes ex-fly { from { opacity: 0; transform: translate(-60px, -30px) rotate(-14deg) scale(.6); } to { opacity: 1; transform: none; } }
.ex-tick { position: absolute; right: -5px; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: #1d9e75; color: #fff; font-size: 11px; font-style: normal; display: flex; align-items: center; justify-content: center; }
.ex-box { border-radius: 10px; background: #14161b; border: 1px solid #2c303a; padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.8; color: #e9eaee; white-space: pre-wrap; }
.ex-caret { display: inline-block; width: 7px; height: 15px; background: var(--ink); vertical-align: -3px; animation: ex-blink .8s steps(1) infinite; }
@keyframes ex-blink { 50% { opacity: 0; } }
.ex-arrow { color: var(--ink); font-size: 28px; }
.ex-lbl { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ex-line { clip-path: inset(0 100% 0 0); padding-left: 12px; white-space: nowrap; font-family: 'Caveat', var(--hand); color: #1d3fa6; font-size: 27px; line-height: 32px; }
.on .ex-line { animation: ex-write 1.1s linear forwards; }
@keyframes ex-write { to { clip-path: inset(0 0 0 0); } }
.ex-src span { border-radius: 3px; transition: color .3s, background .3s; }
.ex-src span.hit { color: #0e1222; background: var(--ink); }
.ex-picked { display: grid; grid-template-columns: repeat(5, 38px); gap: 7px; }
.ex-chip { height: 40px; border-radius: 7px; background: #fffdf8; display: flex; align-items: center; justify-content: center; position: relative; opacity: 0; }
.ex-chip .ex-hand { font-size: 26px; }
.on .ex-chip { animation: ex-in .4s cubic-bezier(.2, .8, .3, 1.2) forwards; }
@keyframes ex-in { from { opacity: 0; transform: translateX(-50px) scale(.5); } to { opacity: 1; transform: none; } }
.ex-cnt { position: absolute; right: -6px; top: -6px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--ink); color: #0e1222; font-size: 11px; font-style: normal; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.ex-short .ex-row { font-family: 'Caveat', var(--hand); color: #1d3fa6; font-size: 26px; line-height: 32px; padding-left: 12px; letter-spacing: 9px; clip-path: inset(0 100% 0 0); white-space: nowrap; }
.on .ex-short .ex-row { animation: ex-write .9s linear forwards; }
.ex-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: #1d9e75; color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 10px; white-space: nowrap; opacity: 0; }
.on .ex-badge { animation: ex-badge .3s 2.6s forwards; }
@keyframes ex-badge { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.ex-dl { position: absolute; right: 10px; bottom: 10px; background: var(--ink); color: #0e1222; font-size: 12px; font-weight: 600; border-radius: 7px; padding: 5px 10px; opacity: 0; }
.on .ex-dl { animation: ex-slide .35s 3.6s forwards; }
@keyframes ex-slide { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.ex-cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.ex-cap b { font-size: 1.02rem; }
.ex-cap p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.ex-ctrl { display: flex; align-items: center; gap: 10px; flex: none; }
.ex-dots { display: flex; gap: 5px; }
.ex-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; }
.ex-dots i.done { background: var(--ink); }
.ex-dots i.on::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform-origin: left; animation: ex-prog var(--d) linear forwards; }
@keyframes ex-prog { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ex-replay { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 32px; height: 30px; cursor: pointer; font-size: 16px; }
.ex-replay:hover { border-color: var(--ink); }
.quick-explainer { margin: 0 0 18px; }
@media (max-width: 480px) { .ex-dots { display: none; } }

/* phones: a small header that scrolls away; the links sit on one row you can swipe */
@media (max-width: 640px) {
  .top { position: static; gap: 8px 12px; padding: 10px 14px; }
  .brand { font-size: 1.05rem; }
  .logo { width: 26px; height: 26px; }
  .uname { display: none; }
  nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; padding: 6px 10px; font-size: .95rem; }
  .panel { top: 0; }
}
.emptystate { margin-bottom: 18px; border-color: var(--ink); }
.emptystate h3 { margin: 0 0 6px; }
.emptystate p { margin: 0 0 14px; color: var(--muted); }
.scriptwarn { color: #e3a33b; }

.eta { color: var(--muted); font-size: .88rem; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.working .progress { width: min(320px, 90%); margin: 10px auto 2px; }

/* credits */
.cpill { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--ink-soft); color: var(--ink); font-variant-numeric: tabular-nums; }
.menu .who .credits { color: var(--ink); font-size: .85rem; font-weight: 600; margin-top: 4px; }
.creditcard { margin: 18px 0; }
.creditcard h2 { margin: 0 0 4px; }
.creditcard h3 { margin: 18px 0 4px; font-size: 1rem; }
.creditcard .bignum { font-size: 2.6rem; font-weight: 800; color: var(--ink); line-height: 1; }
.creditcard .row.nowrap { flex-wrap: nowrap; }
.creditcard .copybox { flex: 1; min-width: 0; }
.creditcard .small { font-size: .8rem; }
.creditcard .history { margin-top: 14px; }
.creditcard .history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
td.pos { color: #3fae6a; font-weight: 600; }
td.neg { color: var(--muted); }
.givebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; margin: 10px 0 14px; }
.givebar .amount { width: 90px; }
.givebar input[type=text] { flex: 1; min-width: 160px; }
@media (max-width: 640px) { .cpill { display: none; } }

/* growing handwriting */
.reco { margin-bottom: 18px; border-color: var(--ink); position: relative; }
.reco h3 { margin: 6px 0 6px; }
.reco p { margin: 0 0 8px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: #fff; }
.complete { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; font-size: .85rem; color: var(--muted); }
.cbar { flex: 1; max-width: 220px; height: 8px; border-radius: 999px; background: var(--ink-soft); overflow: hidden; }
.cbar > div { height: 100%; background: var(--ink); border-radius: 999px; }
.lettermap { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; margin: 6px 0 14px; }
.lettermap span { display: grid; place-items: center; height: 30px; border-radius: 6px; font-weight: 600; font-size: .95rem; }
.lettermap .ok { background: rgba(63, 174, 106, .22); color: #8fe0ad; }
.lettermap .some { background: rgba(227, 163, 59, .22); color: #f0c27a; }
.lettermap .none { background: var(--ink-soft); color: var(--muted); }

/* best text format */
.fmt { margin: -4px 0 14px; font-size: .9rem; }
.fmt summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.fmt p { margin: 8px 0; }
.fmt code { background: var(--ink-soft); padding: 1px 5px; border-radius: 5px; }
.fmtex { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0; white-space: pre-wrap; font-size: .85rem; }
