/* Look: OpenAI-style white, black pill buttons, light gray surfaces, no shadows. The only
   color is the blue "talking now" wave. Gray text stays at 4.5:1 or better on white. */
:root {
  --bg: #ffffff; --fg: #0d0d0d; --sub: #5d5d5d; --faint: #6e6e6e; --surface: #f4f4f4;
  --line: #e5e5e5; --live: #1a73e8; --held: #e8f0fe; --danger: #c2261d;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); }
body {
  margin: 0; font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -0.2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.screen {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: max(56px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 24px;
}
.sub { margin: 0; color: var(--sub); font-size: 16px; }
.center { text-align: center; }
.err { margin: 0; color: var(--danger); font-size: 16px; min-height: 0; }
.err:empty { display: none; }
.plain { margin: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.bottom.center { align-items: center; }

.field { display: flex; flex-direction: column; gap: 10px; }
.field > span { font-size: 15px; color: var(--sub); }
input:not([type=checkbox]) {
  height: 52px; border: 0; border-radius: 16px; background: var(--surface); padding: 0 18px; font-size: 17px;
}
input:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.primary, .secondary {
  height: 54px; border-radius: 27px; font-size: 17px; font-weight: 600; width: 100%;
}
.primary { border: 0; background: var(--fg); color: #fff; }
.primary:disabled { background: var(--line); color: #8f8f8f; }
.secondary { border: 1px solid var(--line); background: var(--bg); }
.link { border: 0; background: none; padding: 10px 0; text-align: left; font-size: 16px; text-decoration: underline; text-underline-offset: 3px; }
.link.quiet { color: var(--sub); text-decoration: none; }
.link.danger { color: var(--danger); text-decoration: none; font-weight: 600; text-align: center; }
.pill { height: 40px; border: 0; border-radius: 20px; background: var(--surface); padding: 0 14px; font-size: 15px; font-weight: 600; }
.icon-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 20px; background: var(--surface); display: flex; align-items: center; justify-content: center; }

/* language list: one card, plain radio circles */
.list { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.list button {
  width: 100%; height: 58px; border: 0; border-top: 1px solid #efefef; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-size: 17px;
}
.list button:first-child { border-top: 0; }
.list button { min-height: 58px; height: auto; padding: 10px 18px; text-align: left; }
.list .lang-name { display: flex; flex-direction: column; gap: 2px; }
.list .hint { font-size: 14px; color: var(--sub); }
.list .num { width: 24px; height: 24px; flex: none; box-sizing: border-box; border-radius: 12px; border: 1.5px solid #c4c4c4;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.list [aria-pressed=true] .num { background: var(--fg); border-color: var(--fg); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { height: 40px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); padding: 0 16px; font-size: 16px; }
.chips [aria-pressed=true] { background: var(--fg); color: #fff; border-color: var(--fg); }

/* read this out loud */
.reading { margin: 0; font-size: 26px; line-height: 1.4; color: #ababab; }
.reading .read { color: var(--fg); transition: color .3s; }
.ring { position: relative; width: 96px; height: 96px; }
.ring > svg { position: absolute; inset: 0; }
.ring-btn { position: absolute; left: 10px; top: 10px; width: 76px; height: 76px; border-radius: 38px; border: 0; background: var(--fg); display: flex; align-items: center; justify-content: center; }
.stop-square { width: 22px; height: 22px; border-radius: 5px; background: #fff; }

/* invite */
.qr-box { align-self: center; padding: 18px; border: 1px solid var(--line); border-radius: 24px; }
#qr svg { display: block; width: 220px; height: 220px; }

/* at the table */
.table { height: 100dvh; min-height: 0; gap: 14px; padding-top: max(48px, env(safe-area-inset-top)); }
.banner { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 15px; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; padding-bottom: 4px; }
.transcript::before { content: ''; flex: 1 0 auto; } /* pushes lines to the bottom until they fill the screen */
.line { display: flex; flex-direction: column; gap: 4px; }
.line .who { font-size: 14px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.line .tr { font-size: 20px; line-height: 1.35; color: var(--faint); }
.line .src { font-size: 15px; line-height: 1.4; color: var(--faint); }
.line.untranslated .src { font-size: 18px; }
.line.newest .who { color: var(--fg); font-weight: 600; font-size: 15px; }
.line.newest .tr { font-size: 30px; line-height: 1.25; color: var(--fg); font-weight: 500; letter-spacing: -0.3px; }
.line.newest.untranslated .src { font-size: 20px; }
.live-row { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.wave { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.wave i { width: 3px; border-radius: 2px; background: var(--live); animation: wave 0.9s ease-in-out infinite; }
.wave i:nth-child(1) { height: 5px; animation-delay: -0.4s; } .wave i:nth-child(2) { height: 10px; animation-delay: -0.2s; }
.wave i:nth-child(3) { height: 14px; } .wave i:nth-child(4) { height: 9px; animation-delay: -0.3s; }
.wave i:nth-child(5) { height: 5px; animation-delay: -0.1s; }
@keyframes wave { 50% { transform: scaleY(0.45); } }
@media (prefers-reduced-motion: reduce) { .wave i { animation: none; } }
.controls { display: flex; align-items: center; justify-content: space-between; }
.round-btn { width: 56px; height: 56px; border: 0; border-radius: 28px; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mic { width: 76px; height: 76px; border-radius: 38px; border: 0; background: var(--fg); color: #fff; display: flex; align-items: center; justify-content: center; }
.mic .mic-off { display: none; }
.muted .mic { background: var(--bg); color: var(--fg); border: 2px solid var(--fg); }
.muted .mic .mic-on { display: none; } .muted .mic .mic-off { display: block; }
.sound .snd-off { display: none; }
.sound-off .sound { background: var(--bg); border: 2px solid var(--fg); }
.sound-off .sound .snd-on { display: none; } .sound-off .sound .snd-off { display: block; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 5; background: var(--bg); overflow-y: auto; }
.group-box { background: var(--surface); border-radius: 20px; padding: 4px 0; }
.setting { width: 100%; min-height: 54px; border: 0; background: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; font-size: 17px; text-align: left; }
.setting .value { color: var(--faint); font-size: 16px; }
.setting select { max-width: 55%; border: 0; background: none; color: var(--faint); font-size: 16px; text-align: right; }
.switch { width: 22px; height: 22px; accent-color: var(--fg); }
#people > div { height: 44px; display: flex; align-items: center; justify-content: space-between; }
#people .value { color: var(--faint); font-size: 16px; }
.advanced { color: var(--sub); font-size: 15px; }
.advanced summary { padding: 6px 0; }
#tuning label { display: block; margin: 8px 0; }
#tuning input[type=number] { height: 40px; width: 100%; }

/* face to face */
.stranger { display: flex; flex-direction: column; }
.stranger .half { flex: 1; padding: 26px 22px 30px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.stranger .theirs { background: var(--surface); transform: rotate(180deg); }
.stranger .mid { height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stranger .mid .lang-pair { margin-right: auto; display: flex; align-items: center; gap: 4px; min-width: 0; }
.stranger .mid .select-pill { display: flex; align-items: center; min-width: 0; }
.stranger .mid .select-pill select { max-width: 30vw; }
.stranger .mid .pair-arrow { color: var(--muted, #888); flex: none; }
.select-pill select { border: 0; background: none; font-weight: 600; font-size: 15px; }
.big-text { margin: 0; font-size: 30px; line-height: 1.3; font-weight: 500; overflow-y: auto; }
.stranger .heard { margin: 0; font-size: 17px; line-height: 1.35; color: var(--muted, #6e6e6e); overflow-y: auto; max-height: 30%; }
.stranger .heard:empty { display: none; }
.hold-row { display: flex; align-items: center; gap: 14px; }
.hold {
  width: 64px; height: 64px; border-radius: 32px; border: 0; background: var(--fg); flex: none;
  display: flex; align-items: center; justify-content: center;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
}
/* held: the button grows and pulses, that half turns light blue and says it's listening */
.hold { position: relative; transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease; }
.hold.active { background: var(--live); transform: scale(1.3); }
.hold.active::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--live); animation: holdPulse 1.1s ease-out infinite; }
@keyframes holdPulse { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
.stranger .half { transition: background 0.12s ease; }
.stranger[data-held=guest] .theirs, .stranger[data-held=me] .mine { background: var(--held); }
.stranger[data-held=guest] .theirs .hold-row .sub, .stranger[data-held=me] .mine .hold-row .sub { color: var(--live); font-weight: 600; font-size: 17px; }
.stranger[data-held=guest] #holdMe, .stranger[data-held=me] #holdThem { opacity: 0.25; }
.stranger[data-held=guest] .theirs .hold-row, .stranger[data-held=me] .mine .hold-row { gap: 34px; padding-left: 10px; }
.hold-row { transition: gap 0.12s ease, padding 0.12s ease; }
#outLoud[aria-pressed=true] .slash { display: none; }
#outLoud[aria-pressed=false] .waves { display: none; }

/* start: the one tap a web page needs before it may play sound */
.resume { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.start-btn { width: 132px; height: 132px; border-radius: 66px; border: 0; background: var(--fg); display: flex; align-items: center; justify-content: center; }
.start-title { margin: 4px 0 0; font-size: 24px; font-weight: 600; }
.start-sub { max-width: 260px; }

/* top of the table: group name, and where the sound is going */
.table-top { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 40px; justify-content: center; }
.group-name { margin: 0; font-size: 15px; font-weight: 600; color: var(--sub); }
.sound-row { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--sub); }
.sound-row.warn { color: var(--fg); }
.secondary.small { width: 220px; height: 48px; font-size: 16px; }
.sheet.stranger { max-width: 480px; margin: 0 auto; } /* phone-width on a big screen too */
.alone { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 8px; margin: auto 0; }
.alone #aloneQr svg { display: block; width: 200px; height: 200px; }
.alone-title { margin: 0; font-size: 22px; font-weight: 600; }
.banner.row-between { padding: 4px 6px 4px 14px; }
.banner.practice { padding: 4px 6px 12px 14px; }
.banner.practice #practiceText { color: var(--sub); }
.banner.practice .chips { gap: 6px; }
.banner.practice .chips button { height: 32px; padding: 0 14px; font-size: 15px; border-color: transparent; background: var(--bg); }
.banner.practice .chips [aria-pressed=true] { background: var(--fg); }
.transcript:has(.alone:not([hidden]))::before { display: none; }
#voiceOnlyHint { margin: 8px 4px 0; }

/* no double-tap zoom (taps on buttons zoomed the page on iPhone); pinch zoom still works */
html, body, button { touch-action: manipulation; }

/* Translator row in Settings, and the line everyone sees when someone switches it */
.engine-box { display: flex; flex-direction: column; gap: 8px; }
.engine-box .small-note { margin: 0 18px; font-size: 14px; }
.setting .chev { display: flex; align-items: center; gap: 6px; }
.notice { align-self: center; margin: 4px auto; width: fit-content; max-width: 90%; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 15px; text-align: center; }
#engineList button { justify-content: flex-start; gap: 14px; }
#engineList .lang-name > span:first-child { font-weight: 600; }
@media (max-width: 340px) { .stranger .mid .pair-arrow { display: none; } }
/* Room mode names need their own line on narrow phones. */
.setting.routing-setting { flex-direction: column; align-items: stretch; gap: 8px; }
.routing-setting select { width: 100%; max-width: 100%; text-align: left; }
