/* Live Translate — "interpreter's booth": dark console, one on-air signal colour. */

:root {
  --font-display: 'Bricolage Grotesque', ui-sans-serif, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #0c0d10;
  --bg-raise: #15171c;
  --bg-sheet: #121419;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --ink: #f3efe6;
  --ink-2: #b4b2ab;
  --ink-3: #6f6e6a;
  --signal: #ff5a36;
  --signal-soft: rgba(255, 90, 54, .16);
  --signal-ink: #160602;
  --ok: #8fd6b4;
  --scrim: rgba(4, 5, 7, .62);
  --grain-opacity: .07;
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --gutter: 18px;
  --feed-max: 760px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f1eee7;
    --bg-raise: #e8e4da;
    --bg-sheet: #f7f5f0;
    --surface: rgba(20, 18, 14, .045);
    --surface-2: rgba(20, 18, 14, .08);
    --line: rgba(20, 18, 14, .1);
    --line-strong: rgba(20, 18, 14, .2);
    --ink: #15140f;
    --ink-2: #4c4a43;
    --ink-3: #8b887e;
    --signal: #e8431f;
    --signal-soft: rgba(232, 67, 31, .12);
    --signal-ink: #fff6f2;
    --ok: #1f7a55;
    --scrim: rgba(30, 26, 18, .35);
    --grain-opacity: .05;
    --shadow: 0 24px 60px rgba(40, 30, 10, .18);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f1eee7;
  --bg-raise: #e8e4da;
  --bg-sheet: #f7f5f0;
  --surface: rgba(20, 18, 14, .045);
  --surface-2: rgba(20, 18, 14, .08);
  --line: rgba(20, 18, 14, .1);
  --line-strong: rgba(20, 18, 14, .2);
  --ink: #15140f;
  --ink-2: #4c4a43;
  --ink-3: #8b887e;
  --signal: #e8431f;
  --signal-soft: rgba(232, 67, 31, .12);
  --signal-ink: #fff6f2;
  --ok: #1f7a55;
  --scrim: rgba(30, 26, 18, .35);
  --grain-opacity: .05;
  --shadow: 0 24px 60px rgba(40, 30, 10, .18);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Atmosphere: film grain + a glow that heats up while on air. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 60% at 50% 115%, var(--signal-soft), transparent 60%),
    radial-gradient(80% 50% at 0% 0%, var(--surface), transparent 70%);
  opacity: .35;
  transition: opacity .6s ease;
}

.is-live body::before {
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("/grain.svg?v=4");
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.mono {
  font-family: var(--font-mono);
}

.app {
  position: relative;
  z-index: 1;
  height: 100%;
}

/* ---------------------------------------------------------------- lock */

.lock {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 22px) calc(var(--gutter) + 10px) calc(var(--safe-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
}

.lock-top,
.lock-foot {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lock-top {
  display: flex;
  justify-content: space-between;
}

.lock-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: rise .7s cubic-bezier(.2, .8, .2, 1) both;
}

.lock-title {
  margin: 0 0 44px;
  font-size: clamp(44px, 13vw, 76px);
  line-height: .95;
  font-weight: 600;
  letter-spacing: -.035em;
}

.lock-title em {
  font-style: normal;
  color: var(--signal);
}

.lock-field {
  display: block;
}

.lock-field input {
  width: 100%;
  margin-top: 10px;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 2px solid var(--line-strong);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: .14em;
  outline: none;
  border-radius: 0;
  transition: border-color .2s ease;
}

.lock-field input:focus {
  border-color: var(--ink);
}

.lock-field input.is-error {
  border-color: var(--signal);
}

.lock-error {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--signal);
}

.lock-foot {
  text-align: center;
  margin: 0;
}

.btn-primary {
  margin-top: 26px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: transform .15s ease;
}

.btn-primary:active {
  transform: scale(.97);
}

/* --------------------------------------------------------------- shell */

.shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) calc(var(--gutter) + var(--safe-right)) 10px
    calc(var(--gutter) + var(--safe-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-2);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  display: inline-block;
  flex: none;
  transition: background .3s ease, box-shadow .3s ease;
}

.is-live .brand-dot {
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-soft);
  animation: blink 1.6s ease-in-out infinite;
}

.route {
  margin-left: auto;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  overflow: hidden;
}

.route-from {
  color: var(--ink-2);
}

.route-arrow {
  color: var(--signal);
}

.route-to {
  display: flex;
  gap: 6px;
  overflow: hidden;
  font-weight: 600;
}

.route-to b {
  font-weight: 600;
}

.is-muted {
  color: var(--ink-3);
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  transition: background .15s ease, transform .15s ease;
}

.icon-btn:active {
  transform: scale(.9);
  background: var(--surface-2);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------------------------------------------------------------- feed */

.feed {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.feed-inner {
  max-width: var(--feed-max);
  margin: 0 auto;
  padding: 8px calc(var(--gutter) + var(--safe-right)) 28px calc(var(--gutter) + var(--safe-left));
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.empty {
  margin: auto 0;
  padding: 40px 4px;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) both;
}

.empty-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.empty-title {
  margin: 0;
  font-size: clamp(40px, 11vw, 72px);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.035em;
}

.empty-title em {
  font-style: normal;
  color: var(--ink-3);
}

.empty-copy {
  max-width: 440px;
  margin: 22px 0 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
}

.empty-copy strong {
  color: var(--ink);
  font-weight: 600;
}

.inline-icon svg {
  width: 17px;
  height: 17px;
  vertical-align: -3px;
  color: var(--signal);
}

/* A transcript entry: meta rail, original, then one row per translation. */
.msg {
  position: relative;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--line);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}

.msg:last-child {
  border-bottom: 0;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-3);
}

.msg-kind svg {
  width: 15px;
  height: 15px;
  display: block;
}

.msg-meta time {
  margin-left: auto;
}

.msg-del {
  width: 30px;
  height: 30px;
  margin: -6px -8px -6px -2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  opacity: .7;
  transition: color .15s ease, background .15s ease, transform .15s ease, opacity .15s ease;
}

.msg-del svg {
  width: 16px;
  height: 16px;
}

.msg-del:active {
  transform: scale(.85);
  color: var(--signal);
  background: var(--signal-soft);
  opacity: 1;
}

.msg.is-removing {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .2s ease, transform .2s ease;
}

.tag {
  flex: none;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--ink-2);
}

.tag-src {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.msg.is-live .tag-src {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--signal-ink);
}

.src {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.src-text {
  flex: 1;
  margin: 0;
  font-size: 23px;
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg.is-live .src-text {
  color: var(--ink-2);
}

.msg.is-live .src-text::after {
  content: "";
  display: inline-block;
  width: .5em;
  height: .95em;
  margin-left: 3px;
  vertical-align: -.1em;
  background: var(--signal);
  animation: caret 1s steps(2) infinite;
}

.msg.is-live::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--gutter) + 4px);
  top: 22px;
  bottom: 20px;
  width: 3px;
  border-radius: 3px;
  background: var(--signal);
}

.tr-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.tr {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  animation: rise .4s cubic-bezier(.2, .8, .2, 1) both;
}

.tr + .tr {
  border-top: 1px dashed var(--line);
}

.tr .tag {
  margin-top: 2px;
}

.tr-text {
  flex: 1;
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tr.is-error .tag {
  border-color: var(--signal);
  color: var(--signal);
}

.tr.is-error .tr-text {
  font-size: 15px;
  color: var(--ink-2);
}

.tr-skeleton {
  flex: 1;
  height: 14px;
  margin-top: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}

.tr.is-pending:nth-child(2) .tr-skeleton {
  max-width: 72%;
}

.tr.is-pending:nth-child(3) .tr-skeleton {
  max-width: 84%;
}

/* Read-aloud button: speaker → spinner → live bars. */
.say {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}

.say:active {
  transform: scale(.88);
  background: var(--surface-2);
}

.say svg {
  width: 21px;
  height: 21px;
}

.say-icon {
  display: grid;
}

.say-bars {
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.say-bars i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  animation: bars .8s ease-in-out infinite;
}

.say-bars i:nth-child(2) {
  animation-delay: -.25s;
}

.say-bars i:nth-child(3) {
  animation-delay: -.5s;
}

.say.is-loading,
.say.is-playing {
  color: var(--signal);
  background: var(--signal-soft);
}

.say.is-loading .say-icon {
  opacity: .25;
}

.say.is-loading::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--signal);
  animation: spin .7s linear infinite;
}

.say.is-playing .say-icon {
  display: none;
}

.say.is-playing .say-bars {
  display: flex;
}

/* ---------------------------------------------------------------- dock */

.dock {
  position: relative;
  z-index: 5;
  padding: 8px calc(var(--gutter) + var(--safe-right)) calc(var(--safe-bottom) + 12px)
    calc(var(--gutter) + var(--safe-left));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}

.status {
  max-width: var(--feed-max);
  margin: 0 auto;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: height .25s ease;
  white-space: nowrap;
}

.status.is-live,
.status.is-connecting {
  height: 26px;
}

.status.is-live {
  color: var(--signal);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1.2s ease-in-out infinite;
}

.status-sep {
  opacity: .4;
}

.status-model {
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  letter-spacing: .04em;
}

/* Suggested replies: one scrollable row of chips above the composer. */
.replies {
  max-width: var(--feed-max);
  margin: 0 auto;
  display: none;
  gap: 8px;
  padding: 2px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.replies::-webkit-scrollbar {
  display: none;
}

.replies.is-shown {
  display: flex;
}

.reply {
  flex: none;
  max-width: 80%;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  animation: rise .25s ease both;
  transition: transform .15s ease, background .15s ease;
}

.reply:active {
  transform: scale(.96);
  background: var(--surface-2);
}

.dock-row {
  max-width: var(--feed-max);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.composer {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 56px;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: var(--bg-raise);
  transition: border-color .2s ease;
}

.composer:focus-within {
  border-color: var(--ink-3);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  padding: 10px 0;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 17px;
  line-height: 1.35;
}

.composer textarea::placeholder {
  color: var(--ink-3);
}

.send {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: transform .15s ease, background .15s ease;
}

.composer:focus-within .send {
  background: var(--ink);
  color: var(--bg);
}

.send:active {
  transform: scale(.9);
}

.send svg {
  width: 20px;
  height: 20px;
}

/* The mic: an on-air light. Ring scales with input level (--level 0..1). */
.mic {
  --level: 0;
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  margin-bottom: -6px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
}

.mic-core {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  transition: background .25s ease, color .25s ease, transform .15s ease;
}

.mic-core svg {
  width: 28px;
  height: 28px;
}

.mic:active .mic-core {
  transform: scale(.93);
}

.mic-ring,
.mic-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.mic-ring {
  z-index: 1;
  background: var(--signal);
  opacity: 0;
  transform: scale(calc(1 + var(--level) * .55));
  transition: transform .08s linear, opacity .25s ease;
}

.mic-halo {
  border: 1.5px dashed var(--ink-3);
  opacity: 0;
}

.mic.is-live .mic-core {
  background: var(--signal);
  color: var(--signal-ink);
}

.mic.is-live .mic-ring {
  opacity: .28;
}

.mic.is-connecting .mic-halo {
  opacity: 1;
  inset: -7px;
  animation: spin 2.4s linear infinite;
}

.mic.is-connecting .mic-core {
  background: var(--bg-raise);
  color: var(--ink);
}

/* --------------------------------------------------------------- sheets */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet {
  position: relative;
  max-height: calc(100dvh - var(--safe-top) - 36px);
  display: flex;
  flex-direction: column;
  background: var(--bg-sheet);
  border-top: 1px solid var(--line-strong);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow);
}

.sheet-layer.is-entering .scrim {
  animation: fade .25s ease both;
}

.sheet-layer.is-entering .sheet {
  animation: slide-up .38s cubic-bezier(.2, .9, .2, 1) both;
}

.sheet-grip {
  width: 38px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 4px 22px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.03em;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 22px calc(var(--safe-bottom) + 28px);
}

.group {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.group:last-of-type {
  border-bottom: 0;
}

.label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.count {
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--signal);
  color: var(--signal-ink);
  font-size: 10px;
  letter-spacing: 0;
  display: inline-grid;
  place-items: center;
}

.hint {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-2);
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}

.chip {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  font-size: 15px;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.chip:active {
  transform: scale(.96);
}

.chip b {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-3);
}

.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-wide {
  grid-column: 1 / -1;
}

.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip.is-on b {
  color: var(--signal);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.field > span {
  font-size: 14px;
  color: var(--ink-2);
}

.field select,
.key-form input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 22px) 22px, calc(100% - 16px) 22px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.field select:focus,
.key-form input:focus {
  border-color: var(--ink-3);
}

.key-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.key-state.is-set {
  color: var(--ok);
}

.key-state svg {
  width: 18px;
  height: 18px;
}

.key-form {
  display: flex;
  gap: 8px;
}

.key-form input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

.btn-small {
  flex: none;
  height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.segs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.seg {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}

.seg.is-on {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.group-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.link {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 16px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.link.danger {
  color: var(--signal);
}

.group .link.danger {
  margin-top: 8px;
}

.sheet-foot {
  margin: 14px 0 0;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* --------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 var(--gutter);
}

.toast {
  max-width: 520px;
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: var(--shadow);
  animation: drop .3s cubic-bezier(.2, .9, .2, 1) both;
  transition: opacity .35s ease, transform .35s ease;
}

.toast.has-action {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 8px;
}

.toast-action {
  border: 0;
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
}

.toast.is-error {
  background: var(--signal);
  color: var(--signal-ink);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

/* Phones: brand shrinks to its status dot so the language route has room. */
@media (max-width: 479px) {
  .brand-name {
    display: none;
  }
}

/* ------------------------------------------------------------ iPad / wide */

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
  }

  .src-text {
    font-size: 27px;
  }

  .tr-text {
    font-size: 20px;
  }

  .msg {
    display: grid;
    grid-template-columns: 92px 1fr;
    column-gap: 18px;
    padding: 28px 0 24px;
  }

  .msg-meta {
    grid-row: 1 / span 2;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 0;
  }

  .msg-meta time {
    margin-left: 0;
  }

  .tr-list {
    grid-column: 2;
  }

  .msg.is-live::before {
    left: -14px;
  }

  .mic {
    width: 76px;
    height: 76px;
  }

  /* Sheets become a right-hand panel. */
  .sheet-layer {
    flex-direction: row;
    justify-content: flex-end;
  }

  .sheet {
    width: 440px;
    max-height: none;
    height: 100%;
    border-top: 0;
    border-left: 1px solid var(--line-strong);
    border-radius: 0;
    padding-top: var(--safe-top);
  }

  .sheet-layer.is-entering .sheet {
    animation-name: slide-in;
  }

  .sheet-grip {
    display: none;
  }

  .sheet-head {
    padding-top: 18px;
  }
}

@media (min-width: 1100px) {
  :root {
    --feed-max: 860px;
  }
}

/* ------------------------------------------------------------ animation */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes slide-in {
  from {
    transform: translateX(100%);
  }
}

@keyframes blink {
  50% {
    opacity: .35;
  }
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -120% 0;
  }
}

@keyframes bars {
  0%,
  100% {
    transform: scaleY(.3);
  }
  50% {
    transform: scaleY(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
