/* Scrolling Text — Apple-minimal, self-contained (shares the site's
   token values from app-style.css; tools with their own style.css do
   not get the shared sheet, so the tokens and the classes this page
   uses are duplicated here). */
:root {
  color-scheme: light;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  --canvas: #f5f5f7;
  --surface: #fff;
  --recessed: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #65656b;
  --line: rgb(0 0 0 / .06);
  --control-line: rgb(0 0 0 / .14);
  --selected: rgb(0 0 0 / .075);
  --accent: #0071e3;
  --accent-hover: #0065cc;
  --accent-ink: #fff;
  --motion: .2s cubic-bezier(.16, 1, .3, 1);
  color: var(--ink);
  background: var(--canvas);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #161618;
  --surface: #1e1e20;
  --recessed: #242426;
  --ink: #f5f5f7;
  --muted: #ababaf;
  --line: rgb(255 255 255 / .08);
  --control-line: rgb(255 255 255 / .19);
  --selected: rgb(255 255 255 / .10);
  --accent: #5aaaf9;
  --accent-hover: #7bbaff;
  --accent-ink: #101820;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; transition: background-color var(--motion), color var(--motion); }
main { width: min(560px, calc(100% - 32px)); margin: clamp(32px, 7vw, 80px) auto; }
h1 { font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 600; line-height: 1.12; letter-spacing: -.045em; margin: 16px 0 8px; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
p { color: var(--muted); margin: 0; }
a { color: var(--ink); text-underline-offset: .2em; }
.subtitle { color: var(--ink); font-size: 1.05rem; font-weight: 500; }
.lede { margin-top: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 14px; }
.badges span { color: var(--muted); }
.panel { display: grid; gap: 24px; margin-block-start: 32px; border: 1px solid var(--line); border-radius: 24px; padding: clamp(16px, 4vw, 32px); background: var(--surface); }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; }
button { display: inline-flex; justify-content: center; align-items: center; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; min-height: 44px; font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; text-decoration: none; cursor: pointer; transition: background-color var(--motion), transform var(--motion); }
button:not(:disabled):hover { background: var(--accent-hover); }
button:not(:disabled):active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; }
.msg { min-height: 1.4em; font-size: 14px; }
.brand-line { margin: 32px 0 0; text-align: center; font-size: 13px; color: var(--muted); letter-spacing: .02em; }

/* ---------- editor controls ---------- */
.field { display: grid; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label, .label { font-size: 14px; font-weight: 600; color: var(--ink); }
input[type="text"] { width: 100%; font: inherit; color: var(--ink); background: var(--recessed); border: 1px solid var(--control-line); border-radius: 10px; padding: 12px 14px; }
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hint { font-size: 13px; }
.value { color: var(--muted); font-weight: 500; }
input[type="color"] { width: 100%; height: 44px; padding: 2px; background: var(--recessed); border: 1px solid var(--control-line); border-radius: 10px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--control-line); padding: 0; cursor: pointer; }
.swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--control-line); border-radius: 10px; overflow: hidden; }
.seg { background: var(--surface); color: var(--ink); border: 0; border-radius: 0; min-height: 44px; }
.seg.selected { background: var(--ink); color: var(--surface); }
.seg:not(.selected):hover { background: var(--selected); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- full-screen display ---------- */
.display {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  overflow: hidden;
  display: flex; align-items: center;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  cursor: pointer;
  z-index: 50;
}
.track {
  display: flex; align-items: center;
  white-space: nowrap;
  will-change: transform;
}
/* Mirror mode flips each text run in place (text reads backwards) —
   for holding the phone up to a mirror. The track's translateX loop
   is untouched, so the scroll stays seamless. */
.track.mirror .scroll-text { transform: scaleX(-1); }
.scroll-text {
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  padding-right: var(--scroll-gap, 200px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
.tap-hint {
  position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%);
  color: #fff; background: rgb(0 0 0 / .45);
  font-size: 15px; font-weight: 500;
  padding: 8px 16px; border-radius: 999px;
  pointer-events: none;
  transition: opacity .6s ease;
  white-space: nowrap;
}
.tap-hint.fade { opacity: 0; }
.paused-tag {
  position: absolute; left: 50%; top: 8vh; transform: translateX(-50%);
  color: #fff; background: rgb(0 0 0 / .45);
  font-size: 15px; font-weight: 500;
  padding: 8px 16px; border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}
.wake-tag {
  position: absolute; left: 50%; bottom: calc(8vh + 52px); transform: translateX(-50%);
  color: #ffd60a; background: rgb(0 0 0 / .45);
  font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}
.exit {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / .45); color: #fff;
  font-size: 22px; line-height: 1;
  border: 1px solid rgb(255 255 255 / .25);
}
.exit:hover { background: rgb(0 0 0 / .65); }
