:root {
  --bg: #14110f;
  --panel: #211c19;
  --line: #3a322d;
  --text: #f4efe9;
  --dim: #9a8f86;
  --faint: #5f5650;
  --accent: #f2b35c;
  --next: #ff8a65;
  --error: #e5484d;
  --warn: #d9a441;
  --scale: 1;
  /* One size for everything she reads, in every mode (spec Revision 2). */
  --read: calc(1.3rem * var(--scale));
  --title: calc(1.6rem * var(--scale));
  --tap: 56px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
button:disabled { opacity: .35; }
h1, h2 { line-height: 1.15; margin: 0; }
h2 { text-transform: uppercase; letter-spacing: .04em; font-size: 1rem; }
button, a, .presenter { -webkit-tap-highlight-color: transparent; }
img { display: block; }

/* Banner */
#banner:empty { display: none; }
.presenting #banner { display: none; }
.banner { position: sticky; top: 0; z-index: 10; padding: 12px 16px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.banner p { margin: 0; }
.banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.banner--error { background: #3b1416; border-color: var(--error); }
.banner--warn { background: #3a2c12; border-color: var(--warn); }

/* Home */
.home { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 18px; }
.warn { margin: 0; padding: 12px 14px; border-radius: 12px; background: #3a2c12; color: #ffe2a8; }
.home-head .sub { margin: 6px 0 0; color: var(--dim); }
.meta { margin: 6px 0 0; color: var(--faint); font-size: .9rem; }
.resume { width: 100%; justify-content: flex-start; border-color: var(--accent); }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mode-btn { flex-direction: column; min-height: 96px; gap: 4px; padding: 0 6px; text-align: center; }
.mode-num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.timed { display: flex; align-items: center; gap: 12px; min-height: var(--tap); }
.timed input { width: 26px; height: 26px; accent-color: var(--accent); }
.runs { margin: 0; padding-left: 20px; color: var(--dim); }
.start-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.start-item { width: 100%; justify-content: flex-start; text-align: left; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.home-actions { display: flex; gap: 10px; }
.home-actions .btn { flex: 1; }
.text-size { display: flex; align-items: center; gap: 10px; color: var(--dim); }
.fatal { padding: 32px 16px; }

/* Presenter */
.presenter {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.strip { display: flex; align-items: center; gap: 12px; min-height: var(--tap); color: var(--dim); }
.strip .count { font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.hold-hint { font-size: .7rem; color: var(--faint); }
.mode-chip { min-width: var(--tap); padding: 0; font-weight: 700; color: var(--accent); }
.sec-head { display: flex; align-items: center; gap: 14px; padding: 8px 0 12px; }
.sec-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.sec-head h1 { font-size: var(--title); text-transform: uppercase; }
.presenter--m1 .sec-head { flex-direction: column; text-align: center; }
.presenter--m1 .sec-img { width: min(62vw, 300px); height: auto; aspect-ratio: 1; border-radius: 20px; }
.body { overflow-y: auto; touch-action: pan-y; padding-bottom: 24px; }
.key { color: var(--accent); font-size: var(--read); font-weight: 700; margin: 10px 0; }
.presenter--m1 .key { text-align: center; }
.bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bullets li { font-size: var(--read); font-weight: 600; color: var(--text); }
.bullets .key { margin: 4px 0 0; }
.beat { font-size: var(--read); color: var(--dim); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 8px; }
.para { font-size: var(--read); line-height: 1.4; margin: 0 0 .8em; }
.para.key { color: var(--accent); font-weight: 700; }
.pause { color: var(--faint); font-size: var(--read); letter-spacing: .3em; text-transform: uppercase; text-align: center; margin: 0 0 .8em; }
.coming { color: var(--faint); font-size: var(--read); border-top: 1px dashed var(--line); padding-top: 10px; }

/* Her notes (Mode 3): her dots, sub-dots and pause marks. Size never varies. */
.notes p { font-size: var(--read); line-height: 1.35; margin: 0 0 .45em; }
.notes .n-heading { text-transform: uppercase; letter-spacing: .04em; color: var(--dim); font-weight: 700; margin-top: .3em; }
.notes .n-line.key { margin: .5em 0; }
.notes .n-bullet, .notes .n-sub { position: relative; padding-left: 1.1em; }
.notes .n-bullet::before { content: "•"; position: absolute; left: 0; color: var(--accent); }
.notes .n-sub { margin-left: 1.3em; }
.notes .n-sub::before { content: "◦"; position: absolute; left: 0; color: var(--dim); }
.notes .n-pause { color: var(--faint); margin: .1em 0 .55em; line-height: 1; }
.next { display: flex; align-items: center; gap: 12px; min-height: 72px; margin: 0 -16px; padding: 10px 16px 10px 100px; border-top: 1px solid var(--line); background: var(--panel); color: var(--dim); }
.next--now { border-top: 3px solid var(--next); color: var(--text); background: #2d201b; }
.next-label { font-size: .75rem; letter-spacing: .12em; color: var(--next); }
.next .thumb { width: 44px; height: 44px; }
.next-title { flex: 1; min-width: 0; font-size: calc(1.1rem * min(var(--scale), 1.15)); font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.back { position: fixed; left: 12px; bottom: calc(env(safe-area-inset-bottom) + 8px); width: 72px; height: 56px; font-size: 1.8rem; z-index: 2; }
.presenter > .end { grid-row: 2 / 4; display: grid; place-content: center; text-align: center; gap: 18px; }
.run-result { font-size: 1.4rem; color: var(--accent); }

/* Editor */
.editor { max-width: 640px; margin: 0 auto; padding: 0 16px 64px; display: grid; gap: 14px; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.save-state { color: var(--dim); font-size: .9rem; min-width: 5em; text-align: right; }
.save-state--failed { color: var(--error); }
.editor label { display: grid; gap: 6px; color: var(--dim); }
.field { width: 100%; min-height: var(--tap); padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
textarea.field { resize: none; overflow: hidden; line-height: 1.45; }
.beat-card, .notes-card { border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; gap: 10px; }
.para-row { display: grid; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.row-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-tools button, .row-tools select { min-height: 44px; padding: 0 12px; }
.row-tools select { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.editor .key-toggle { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 8px; min-height: 44px; color: var(--text); }
.key-toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.pause-row { color: var(--faint); letter-spacing: .3em; text-transform: uppercase; }
.notes-field { font-size: .95rem; white-space: pre-wrap; }
.notes-card h2 { color: var(--text); }
.sec-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sec-list a { width: 100%; justify-content: flex-start; }

/* Backup */
.backup { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 14px; }
.backup > button { width: 100%; }
.notice { margin: 0; padding: 12px; border-radius: 12px; background: var(--panel); }
.notice--error { background: #3b1416; }
.snapshots { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.snapshots li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
