/* RelayComms ride screen. Near-black for OLED battery and heat, large type that is
   readable at a glance in daylight, sage accent from the Forest palette. */
:root {
  --bg: #060B0A;
  --surface: #0E1614;
  --border: #1D2B27;
  --text: #E6EEEA;
  --muted: #8FA39C;
  --accent: #7FAEA4;
  --accent-ink: #06201B;
  --live: #2E6E64;
  --warn: #D8A657;
  --danger: #D0705F;
  --radius: 14px;
  --font: -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

.screen {
  min-height: 100%;
  max-width: 560px; margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}

h1 { margin: 6px 0 0; font-size: 30px; letter-spacing: -0.02em; }
.lede { margin: 0 0 6px; color: var(--muted); }

fieldset { border: 0; margin: 0; padding: 0; }
legend, .field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 15px; }
.field em { font-style: normal; opacity: .75; }

input {
  width: 100%; padding: 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  outline: none;
}
input:focus-visible { border-color: var(--accent); }
#code { text-transform: uppercase; letter-spacing: .28em; font-size: 22px; font-weight: 600; }
#code::placeholder { letter-spacing: normal; text-transform: none; font-size: 17px; font-weight: 400; color: #5C6F69; }

.btn {
  position: relative; overflow: hidden;
  width: 100%; min-height: 54px; padding: 12px 16px;
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { background: #14201D; }
.btn:focus-visible, .segbtn:focus-visible, .talk:focus-visible, .code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: #6E9C92; }
.btn[disabled] { opacity: .5; }
.btn.small { min-height: 48px; font-size: 15px; padding: 8px 10px; }
.btn.danger { color: var(--danger); }
.btn.danger .fill { position: absolute; inset: 0; width: 0; background: rgba(208, 112, 95, .28); }
.btn.danger.holding .fill { width: 100%; transition: width 1.2s linear; }
.btn.danger .lbl { position: relative; }

.or { text-align: center; color: var(--muted); font-size: 15px; margin: 4px 0 -2px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segbtn {
  min-height: 54px; font: inherit; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  touch-action: manipulation;
}
.segbtn[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.error { margin: 0; color: var(--danger); min-height: 1.45em; }
.error:empty { display: none; }

.notes { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.notes li + li { margin-top: 6px; }
.ver { margin: auto 0 0; color: #4E605B; font-size: 13px; }

/* Ride screen */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code {
  font: inherit; color: var(--muted); background: none; border: 0; padding: 8px 0;
  touch-action: manipulation;
}
.code b { color: var(--text); letter-spacing: .2em; margin-left: 6px; }
.pill {
  padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.pill.linked { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.pill.warn { color: #1F1605; background: var(--warn); border-color: var(--warn); }
.pill.bad { color: #210A06; background: var(--danger); border-color: var(--danger); }

.status { padding: 6px 0 2px; border-left: 4px solid transparent; padding-left: 12px; margin-left: -16px; }
.status.speaking { border-left-color: var(--accent); }
.big { font-size: clamp(28px, 8.4vw, 44px); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sub { margin-top: 8px; color: var(--muted); font-size: 18px; }
.sub.live { color: var(--accent); }

.talk {
  flex: 1 1 auto; min-height: 22vh; width: 100%;
  font: inherit; font-size: clamp(30px, 9vw, 46px); font-weight: 700; letter-spacing: -0.01em;
  color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 22px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.talk:active { background: #14201D; }
.talk.live { background: var(--live); border-color: var(--accent); }
.talk[disabled] { opacity: .55; }
.talk .t1, .talk .t2 { display: block; }
.talk .t2 { margin-top: 10px; font-size: 18px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.talk.live .t2 { color: #CFE3DD; }

.help { margin: -4px 0 0; color: var(--muted); font-size: 15px; min-height: 2.9em; }

/* Music card and sound settings */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card .btn { background: var(--bg); }
.card .help { margin: 0; min-height: 0; }
.mhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mtext { min-width: 0; }
.mtitle { font-size: 20px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.msub { margin-top: 3px; color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 0 14px; }
.msub span { white-space: nowrap; }
.chip { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--accent); border: 1px solid var(--live); }
.ytwrap { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; border-radius: 10px; overflow: hidden; background: #000; }
.ytwrap iframe, .ytwrap > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.kbox { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--live); }
.kline { margin: 0; font-size: 17px; font-weight: 700; color: var(--accent); }
.ytstatus { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.taphint { margin: 0; padding: 12px 14px; border-radius: 10px; font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--accent-ink); background: var(--accent); }
.ytwrap.needtap { outline: 3px solid var(--accent); outline-offset: 3px; animation: needtap 1.4s ease-in-out infinite; }
@keyframes needtap { 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .ytwrap.needtap { animation: none; } }
.ytfield > span { margin-bottom: 4px; }
.ytfield input { padding: 12px; font-size: 16px; background: var(--bg); }
.mctl { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.mrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filebtn { display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; }
.vh:focus-visible + .btn, .filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.slider { display: block; }
.slider > span { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; color: var(--muted); font-size: 15px; }
.slider output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 36px; padding: 0; margin: 0; background: none; border: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.check input { width: 24px; height: 24px; padding: 0; accent-color: var(--accent); flex: none; }

.foot { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.meta {
  margin: 0; color: #6B7F79; font-size: 13px; font-variant-numeric: tabular-nums;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px;
}
.meta .warnText { color: var(--warn); }

.unblock {
  position: fixed; inset: 0; z-index: 10;
  font: inherit; font-size: 28px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent); border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .btn.danger.holding .fill { transition: none; }
}
