/* ============================================================
   Flash Reader: "Try it" reader. Uses the tokens in styles.css.
   ============================================================ */

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------- setup ---------------- */
.try-setup { max-width: 720px; margin: 0 auto; padding-block: clamp(36px, 8vw, 96px) clamp(48px, 8vw, 104px); }
.try-setup h1 {
  font-family: var(--ff-serif); font-weight: 400;
  font-size: clamp(32px, 5.6vw, 54px); line-height: 1.08; letter-spacing: -0.018em;
  margin-top: 20px; text-wrap: balance;
}
.try-setup .sub { color: var(--text-dim); margin-top: 16px; max-width: 52ch; text-wrap: pretty; }

.paste { margin-top: clamp(28px, 5vw, 44px); }
.paste label { display: block; margin-bottom: 10px; }
.paste textarea {
  display: block; width: 100%; min-height: 168px; resize: vertical;
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--hair); border-radius: 12px;
  padding: 16px; font: 17px/1.55 var(--ff-serif);
}
.paste textarea::placeholder { color: var(--text-faint); }
.paste textarea:focus-visible { outline-offset: 0; border-color: transparent; }
.paste-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.paste-count { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.paste-note { color: var(--accent-text); font-size: 15px; margin-top: 12px; }
.paste-note:empty { margin-top: 0; }

.btn-primary {
  min-height: 46px; padding: 0 26px; flex: none;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff;
  font: 600 15px/1 var(--ff-ui); letter-spacing: -0.005em;
  transition: filter 160ms ease;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost {
  min-height: 40px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--hair-strong); border-radius: 999px;
  background: transparent; color: var(--text);
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  white-space: nowrap; transition: border-color 160ms ease;
}
.btn-ghost:hover { border-color: var(--text-faint); }

.samples { margin-top: clamp(28px, 5vw, 40px); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.chip {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 14px 16px; min-height: 64px; cursor: pointer;
  border: 1px solid var(--hair); border-radius: 12px;
  background: var(--surface-1); color: var(--text);
  transition: border-color 160ms ease;
}
.chip:hover { border-color: var(--hair-strong); }
.chip strong { font-family: var(--ff-serif); font-weight: 500; font-size: 18px; line-height: 1.2; }
@media (max-width: 560px) { .paste textarea { min-height: 128px; } }
.chip span { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }

/* ---------------- reader ---------------- */
.try-reader {
  max-width: 760px; margin: 0 auto;
  min-height: calc(100vh - 61px); min-height: calc(100svh - 61px);
  display: flex; flex-direction: column;
  padding: 18px var(--gutter) max(22px, env(safe-area-inset-bottom));
}
.r-progress { height: 2px; background: var(--hair); border-radius: 2px; overflow: hidden; }
.r-progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.r-meta {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 10px;
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint);
}
.r-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-meta span + span { flex: none; }

.r-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding-block: 12px; }

/* The Slot: blurred past / sharp current / blurred next, like the app. */
.r-slot {
  --word: clamp(46px, 13.5vw, 84px);
  width: 100%; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--ff-serif); font-weight: 400; font-size: var(--word);
  letter-spacing: -0.01em; line-height: 1;
}
.r-row {
  position: relative; height: calc(var(--word) * 1.72);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; white-space: nowrap;
}
.r-row.ghost { filter: blur(4px); opacity: 0.45; padding-inline: 12px; }
.r-row.cur { border-top: 1px solid var(--hair-strong); border-bottom: 1px solid var(--hair-strong); }

/* Only the focus letter is in flow, so text-align centre pins its centre
   to the slot's centre line; pre/post hang off either side of it. */
.r-anchor { position: relative; display: inline-block; }
.r-anchor .f { color: var(--accent-text); }
.r-anchor.plain .f { color: var(--text); }
.r-anchor .pre, .r-anchor .post { position: absolute; top: 0; }
.r-anchor .pre { right: 100%; }
.r-anchor .post { left: 100%; }

/* centre pins (cobalt) and the four corner ticks */
.r-row.cur::before, .r-row.cur::after {
  content: ""; position: absolute; left: 50%; width: 1px; height: 9px;
  transform: translateX(-50%); background: var(--accent-text); opacity: 0.85;
}
.r-row.cur::before { top: 0; }
.r-row.cur::after { bottom: 0; }
.tick { position: absolute; width: 14px; height: 1px; background: var(--text-faint); pointer-events: none; }
.tick.tl { left: 10px; top: 14px; }
.tick.tr { right: 10px; top: 14px; }
.tick.bl { left: 10px; bottom: 14px; }
.tick.br { right: 10px; bottom: 14px; }

/* controls: thumb-reachable at the bottom */
.r-controls { display: grid; gap: 18px; padding-top: 6px; }
.transport { display: flex; align-items: center; justify-content: center; gap: clamp(26px, 8vw, 40px); }
.t-btn {
  width: 50px; height: 50px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--hair); border-radius: 999px;
  background: var(--surface-1); color: var(--text);
  transition: border-color 160ms ease;
}
.t-btn:hover { border-color: var(--hair-strong); }
.t-btn svg { width: 18px; height: 18px; display: block; }
.t-btn.play { width: 66px; height: 66px; background: var(--accent); border-color: var(--accent); color: #fff; }
.t-btn.play svg { width: 22px; height: 22px; }
.t-btn.play .i-pause, .t-btn.play.is-playing .i-play { display: none; }
.t-btn.play.is-playing .i-pause { display: block; }

.pace-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.pace-row label, .mode-label {
  font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint);
}
.pace-row .wpm-value { min-width: 74px; }

input[type="range"].r-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; max-width: 300px; height: 32px; background: transparent; cursor: pointer;
}
input[type="range"].r-range::-webkit-slider-runnable-track { height: 2px; background: var(--hair-strong); border-radius: 2px; }
input[type="range"].r-range::-moz-range-track { height: 2px; background: var(--hair-strong); border-radius: 2px; }
input[type="range"].r-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"].r-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg);
}

.modes { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--hair); border-radius: 999px; background: var(--surface-1);
}
.segmented button {
  min-height: 36px; padding: 0 14px; cursor: pointer;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-dim);
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 160ms ease, background 160ms ease;
}
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.mode-desc { color: var(--text-dim); font-size: 13.5px; text-align: center; min-height: 1.5em; }

.r-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.key-hint { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); text-align: right; }
@media (hover: none) { .key-hint { display: none; } .r-foot { justify-content: center; } }

/* end card */
.r-end { text-align: center; max-width: 34ch; display: flex; flex-direction: column; align-items: center; }
.r-end h2 {
  font-family: var(--ff-serif); font-weight: 400;
  font-size: clamp(30px, 5.4vw, 46px); line-height: 1.1; letter-spacing: -0.015em;
  margin-top: 18px; text-wrap: balance;
}
.r-end h2:focus { outline: none; }
.r-end p.lead { color: var(--text-dim); margin-top: 14px; text-wrap: pretty; }
.r-end .cta-row { margin-top: 30px; }
.r-end-actions { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; justify-content: center; }

