:root {
  color-scheme: dark;
  --bg: #070a0f;
  --panel: #10141c;
  --line: #2a303a;
  --line-strong: #3a424f;
  --text: #f3f6fb;
  --muted: #aeb5c0;
  --dim: #69717f;
  --blue: #2676ff;
  --violet: #7d82ff;
  --red: #ff2c3f;
}

body.light-theme {
  color-scheme: light;
  --bg: #edf1f5;
  --panel: #ffffff;
  --line: #d6dde6;
  --line-strong: #c6cfda;
  --text: #111827;
  --muted: #526071;
  --dim: #7b8796;
  --blue: #1868db;
  --violet: #4f46e5;
  --red: #ef3340;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.access-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(7, 10, 15, 0.78);
  padding: 22px;
}

.access-panel {
  width: min(340px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

.access-panel h2 {
  margin: 0;
  font-size: 1.3rem;
}

.access-panel p {
  margin: 8px 0 16px;
  color: var(--muted);
}

.access-panel input,
.access-panel button {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  font: inherit;
}

.access-panel input {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  padding: 0 12px;
}

.access-panel button {
  margin-top: 10px;
  border: 0;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

button,
input,
select {
  font: inherit;
}

.phone-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 0;
}

.live-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100vw;
  max-width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}

.live-header {
  border-bottom: 1px solid var(--line-strong);
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

h1 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.top-toggles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.mini-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.pill-select,
.copy-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
}

.pill-select {
  min-width: 0;
  gap: 8px;
  padding: 0 11px;
}

.pill-select span {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
}

.pill-select.accent {
  color: var(--violet);
}

select {
  width: 116px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

select option {
  color: #111827;
}

select::-webkit-calendar-picker-indicator {
  opacity: 0.7;
}

.copy-button {
  flex: 0 0 auto;
  width: 52px;
  justify-content: center;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.search-row {
  margin-top: 12px;
}

.search-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.search-row input::placeholder {
  color: var(--dim);
}

.transcript-feed {
  overflow-y: auto;
  padding: 16px max(14px, env(safe-area-inset-right)) 22px max(14px, env(safe-area-inset-left));
}

.empty-state {
  display: grid;
  gap: 8px;
  min-height: 100%;
  align-content: center;
  color: var(--dim);
  text-align: center;
}

.empty-state strong {
  color: var(--muted);
  font-size: 1.08rem;
}

.empty-state span {
  line-height: 1.5;
}

.segment {
  margin-bottom: 28px;
}

.segment p {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.segment .source {
  color: var(--muted);
}

.segment .translated {
  margin-top: 7px;
  color: var(--violet);
}

.segment.pending {
  color: var(--dim);
  font-size: 1rem;
  font-weight: 800;
}

.segment.dimmed {
  opacity: 0.28;
}

.segment.match {
  opacity: 1;
}

mark {
  border-radius: 4px;
  background: rgba(255, 211, 77, 0.22);
  color: inherit;
  padding: 0 2px;
}

.live-footer {
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  background: var(--panel);
}

time {
  display: block;
  color: var(--text);
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.cost-line,
.voice-line,
.system-line {
  margin: 3px 18px 0;
  color: var(--dim);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.rate-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.rate-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--dim);
  font-size: 0.68rem;
  font-weight: 800;
}

.voice-line {
  min-height: 17px;
}

canvas {
  display: block;
  width: 100%;
  height: 42px;
  margin-top: 8px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center;
  gap: 18px;
  padding: 8px 44px 0;
}

.round-button,
.record-button {
  border: 0;
  cursor: pointer;
}

.round-button {
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text);
}

.round-button span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--line) 48%, transparent);
  position: relative;
  color: var(--blue);
}

.icon-x::before,
.icon-x::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
}

.icon-x::before {
  transform: rotate(45deg);
}

.icon-x::after {
  transform: rotate(-45deg);
}

.icon-pause::before,
.icon-pause::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: var(--blue);
}

.icon-pause::before {
  transform: translateX(-6px);
}

.icon-pause::after {
  transform: translateX(6px);
}

.icon-play::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 20px solid var(--blue);
  transform: translateX(3px);
}

.round-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.record-button {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(#ff624f, var(--red));
  box-shadow: 0 16px 35px rgba(255, 44, 63, 0.28);
}

.record-button span {
  width: 27px;
  height: 27px;
  border-radius: 10px;
  background: #fff;
}

.record-button:not(.recording) span {
  border-radius: 50%;
}

@media (min-width: 700px) {
  .phone-shell {
    padding: 24px;
  }

  .live-screen {
    width: min(100%, 760px);
    height: calc(100dvh - 48px);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  }

  .live-header {
    padding: 22px 24px 14px;
  }

  .transcript-feed {
    padding: 22px 24px 28px;
  }

  .segment p {
    font-size: 1.26rem;
  }
}

@media (min-width: 1024px) {
  .phone-shell {
    padding: 28px;
  }

  .live-screen {
    width: min(100%, 1040px);
    height: calc(100dvh - 56px);
    border-radius: 22px;
  }

  .live-header {
    padding: 24px 30px 16px;
  }

  .title-row {
    align-items: center;
  }

  h1 {
    font-size: 1.7rem;
  }

  .toolbar {
    max-width: 760px;
  }

  .pill-select {
    min-width: 210px;
  }

  select {
    width: 155px;
  }

  .copy-button {
    width: 74px;
  }

  .search-row {
    max-width: 760px;
  }

  .transcript-feed {
    padding: 28px 38px 34px;
  }

  .segment {
    max-width: 820px;
    margin-bottom: 30px;
  }

  .segment p {
    font-size: 1.34rem;
  }

  .live-footer {
    padding-top: 12px;
  }

  .control-row {
    max-width: 520px;
    margin: 0 auto;
    padding-inline: 0;
  }
}

@media (max-width: 390px) {
  .live-header {
    padding-inline: 12px;
  }

  .toolbar {
    gap: 7px;
  }

  .pill-select {
    padding: 0 9px;
  }

  select {
    width: 104px;
    font-size: 0.86rem;
  }

  .control-row {
    padding-inline: 26px;
  }
}
