/* Plain on purpose: system font, white and grey, one blue. Dark mode follows the device. */
:root {
  --bg: #ffffff; --panel: #f5f6f8; --line: #dcdfe4; --fg: #1d2127; --muted: #5f6772;
  --accent: #2563eb; --accent-fg: #ffffff; --good: #15803d; --good-bg: #e7f6ec; --bad: #b42318; --bad-bg: #fdecea;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c; --panel: #1f2228; --line: #343841; --fg: #e8eaed; --muted: #a0a7b1;
    --accent: #6b9cff; --accent-fg: #0b1220; --good: #5fd08a; --good-bg: #173322; --bad: #ff8a80; --bad-bg: #3a1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); }
.wrap { max-width: 1160px; margin: 0 auto; padding-block: 12px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 21px; margin: 0; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 17px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-block: 6px 8px; }
.lang { display: flex; align-items: center; gap: 8px; }
select, input, textarea, button { font: inherit; color: inherit; }
select, input[type=text], textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
.lang select { width: auto; }
textarea { min-height: 70px; resize: vertical; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 8px 14px; min-height: 40px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.sm { padding: 4px 10px; min-height: 32px; font-size: 14px; }
button.link { border: none; background: none; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-selected=true] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }

.banner { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 5px 13px; min-height: 34px; font-size: 14px; }
.chip[aria-pressed=true] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

.blocks { display: grid; gap: 6px; }
.block { border: 1px solid var(--line); border-radius: 8px; }
.block.off { opacity: .55; }
.block-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; }
.block-head input[type=checkbox] { width: 20px; height: 20px; }
.block-title { min-width: 0; }
.block-title b { font-weight: 600; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.block-body { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; background: var(--panel); border-radius: 0 0 8px 8px; }
.who { font-size: 12px; color: var(--muted); display: block; }
.verse { border-left: 3px solid var(--line); padding-left: 10px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 540px) { .grid2 { grid-template-columns: 1fr; } }
.share code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; word-break: break-all; }

.practice { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }

.outline { display: grid; gap: 3px; font-size: 14px; }
.outline div { display: flex; gap: 6px; }
.outline .done { color: var(--good); }
.outline .now { font-weight: 600; }
.convo { display: grid; gap: 8px; min-width: 0; }
.bubble { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); max-width: 88%; }
.bubble.them { background: var(--panel); justify-self: start; }
.bubble.me { justify-self: end; }
.big { font-size: clamp(19px, 1.2vw + 13px, 26px); line-height: 1.4; }
.heard { min-height: 48px; border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; }
.heard .interim { color: var(--muted); }
.idea { border-radius: 4px; padding: 1px 8px; font-size: 14px; border: 1px solid var(--line); }
.hit { background: var(--good-bg); color: var(--good); border-color: transparent; }
.miss { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.w-hit { color: var(--good); font-weight: 600; }
.w-miss { color: var(--bad); font-weight: 600; text-decoration: underline; }
.ok { color: var(--good); font-weight: 600; }
.no { color: var(--bad); font-weight: 600; }
.mic { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.listening .dot { background: var(--bad); }
@media (prefers-reduced-motion: no-preference) { .listening .dot { animation: pulse 1s infinite; } }
@keyframes pulse { 50% { opacity: .25; } }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.settings label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
footer { margin-top: 36px; display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- sizes: phone (< 700px), tablet (700-1023px), PC (1024px and up) ---------- */
.set-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "chips" "side" "main" "share"; }
.set-share { grid-area: share; align-self: start; }
.set-chips { grid-area: chips; }
.set-side { grid-area: side; align-content: start; }
.set-main { grid-area: main; min-width: 0; }
.phone-only { display: none; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.progress .bar span { display: block; height: 100%; background: var(--accent); }
.sayit-card { max-width: 760px; }

/* Phones: one column, thumb-sized controls, the main buttons pinned to the bottom of the screen */
@media (max-width: 699px) {
  h1 { font-size: 19px; }
  .top { margin-block: 2px 4px; }
  .tabs { margin-bottom: 12px; }
  .tabs a { flex: 1; text-align: center; padding: 11px 6px; }
  .phone-only { display: block; }
  .wide-only { display: none; }
  .set-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .set-chips .chip { flex: none; }
  .practice { grid-template-columns: minmax(0, 1fr); }
  .practice .outline { display: none; }
  .panel { padding: 12px; }
  .bubble { max-width: 94%; }
  .bottom-bar, .actions { position: sticky; bottom: 0; z-index: 5; background: var(--bg);
    padding-block: 10px max(10px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
  .bottom-bar { margin: 14px calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 0;
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .bottom-bar button { width: 100%; min-height: 48px; }
  .actions { background: var(--panel); margin: 0 -12px -12px; padding-left: 12px; padding-right: 12px; border-radius: 0 0 8px 8px; }
  .actions .primary { flex: 1 1 100%; min-height: 48px; }
  .block-head { padding: 10px; }
  footer { margin-top: 24px; }
}

/* Tablets: set summary beside the blocks once there's room; outline beside the conversation */
@media (min-width: 700px) {
  .set-layout { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "chips chips" "main side" "main share" "main ."; grid-template-rows: auto auto auto 1fr; }
  .practice { grid-template-columns: 220px minmax(0, 1fr); }
  .practice .outline { position: sticky; top: 12px; }
}

/* PC: a little larger text, roomier side panels, the conversation kept to a readable width */
@media (min-width: 1024px) {
  body { font-size: 17px; }
  .set-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
  .practice { grid-template-columns: 260px minmax(0, 760px); gap: 24px; }
  .tabs a { padding: 11px 18px; }
}

/* Touch screens (phones and tablets): every control at least a fingertip tall */
@media (pointer: coarse) {
  button, select { min-height: 44px; }
  button.sm, .chip { min-height: 40px; }
  button.link { min-height: 32px; }
  .block-head input[type=checkbox] { width: 24px; height: 24px; }
  input[type=text], textarea, select { font-size: 16px; }   /* stops iPhones zooming in on tap */
}
