:root {
  color-scheme: light;
  --background: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #22a559;
  --red: #d92d20;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.09);
}

.access-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(245,245,247,.88); backdrop-filter: blur(24px); }
.access-gate[hidden] { display: none; }
.access-card { width: min(100%, 430px); padding: 42px; text-align: center; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 24px 80px rgba(0,0,0,.12); }
.access-card h1 { margin: 14px 0 8px; font-size: clamp(28px, 5vw, 40px); letter-spacing: -.045em; }
.access-card .access-mark { display: grid; width: 48px; height: 48px; margin: 0 auto 24px; place-items: center; border-radius: 14px; }
.access-field { display: grid; gap: 8px; margin: 28px 0 14px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 650; }
.access-field input { width: 100%; height: 50px; padding: 0 15px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 13px; outline: none; font: inherit; font-size: 16px; }
.access-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,113,227,.1); }
.access-input-wrap { position: relative; display: block; }
.access-input-wrap input { padding-right: 52px; }
.invite-visibility-button { position: absolute; top: 5px; right: 5px; display: grid; width: 40px; height: 40px; place-items: center; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.invite-visibility-button:hover { color: var(--text); background: rgba(0,0,0,.045); }
.invite-visibility-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.eye-icon { grid-area: 1 / 1; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eye-icon-visible { display: none; }
.invite-visibility-button[aria-pressed="true"] .eye-icon-visible { display: block; }
.invite-visibility-button[aria-pressed="true"] .eye-icon-hidden { display: none; }
.access-error { margin: 0 0 14px; color: var(--red); font-size: 13px; }
.access-card .primary-button { width: 100%; }
.access-browse { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; margin-top: 14px; padding: 10px 18px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; transition: color .18s, background .18s; }
.access-browse span { font-size: 15px; }
.access-browse:hover { color: var(--text); background: #f5f5f7; }
.access-browse:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.access-browse:active { background: #ededf0; }
.invitation-validity { display: flex; align-items: flex-start; justify-content: center; gap: 7px; margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.invitation-validity[hidden] { display: none; }
.invitation-validity svg { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.invitation-validity.is-expiring { color: #985b13; }
.access-card { max-height: calc(100dvh - 48px); overflow-y: auto; padding: 32px; }
.trial-entry[hidden], .trial-badge[hidden], .trial-setup-note[hidden] { display: none; }
.trial-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted); font-size: 12px; }
.trial-divider::before, .trial-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.trial-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 50px; padding: 12px 16px; color: #0064c9; background: #eef6ff; border: 1px solid #cfe4fb; border-radius: 13px; font-size: 14px; font-weight: 650; cursor: pointer; }
.trial-button:hover:not(:disabled) { background: #e1efff; border-color: #a9cdf4; }
.trial-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.trial-button:disabled { color: var(--muted); background: #f5f5f7; border-color: var(--line); cursor: default; }
.trial-entry p, .trial-setup-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.trial-badge { flex: 0 0 auto; display: inline-flex; align-items: center; border: 1px solid #cfe4fb; border-radius: 8px; padding: 5px 9px; color: #0064c9; background: #eef6ff; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.trial-badge.is-ending { color: #985b13; background: #fff7e8; border-color: #efdbb7; }
@media (max-width: 620px) {
  .access-card { padding: 26px 24px; }
  .access-card .access-mark { margin-bottom: 18px; }
  .trial-badge { margin-left: auto; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, #ffffff 0, transparent 44%),
    var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr;
  padding: 32px clamp(20px, 5vw, 64px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: linear-gradient(145deg, #a8632d, #6d351d);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.25);
}

.screen {
  display: none;
  place-items: center;
  padding: 32px 0;
  opacity: 0;
}

.screen.is-active {
  display: grid;
  animation: screen-in 480ms cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  width: min(100%, 680px);
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.intro {
  margin: 15px auto 34px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.settings {
  overflow: hidden;
  margin: 0 0 28px;
  text-align: left;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.setting-row {
  min-height: 74px;
  display: grid;
  grid-template-columns: 38px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 18px;
}

.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-icon { color: var(--muted); font-size: 16px; font-weight: 700; text-align: center; }
.setting-copy { display: grid; gap: 3px; }
.setting-label { font-size: 16px; font-weight: 600; }
.setting-hint { color: var(--muted); font-size: 13px; }

select {
  max-width: 210px;
  padding: 8px 28px 8px 10px;
  color: var(--text);
  background-color: transparent;
  border: 0;
  outline: none;
  text-align: right;
}

.status-dot-label, .live-status div {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 165, 89, 0.12);
}

.primary-button, .pause-button, .stop-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 650;
  transition: transform 160ms ease, background 160ms ease, opacity 250ms ease;
}

.primary-button { color: white; background: var(--blue); }
.primary-button:hover { background: var(--blue-hover); }
.primary-button:active, .pause-button:active, .stop-button:active { transform: scale(.985); }
.primary-button:disabled, .primary-button:disabled:hover, .primary-button:disabled:active { background: var(--blue); cursor: not-allowed; opacity: .5; transform: none; }
.primary-button:focus-visible, .pause-button:focus-visible, .stop-button:focus-visible, select:focus-visible { outline: 3px solid rgba(0, 113, 227, .25); outline-offset: 3px; }
.meeting-save-notice { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 16px; padding: 13px 15px; color: var(--muted); background: rgba(34,165,89,.07); border: 1px solid rgba(34,165,89,.13); border-radius: 14px; font-size: 13px; text-align: left; }
.meeting-save-notice[hidden] { display: none; }
.meeting-save-notice.is-error { background: rgba(217,45,32,.06); border-color: rgba(217,45,32,.12); }
.save-check { display: grid; width: 23px; height: 23px; place-items: center; color: white; background: var(--green); border-radius: 50%; font-weight: 750; }
.meeting-save-notice.is-error .save-check { background: var(--red); }
.meeting-save-notice a { color: var(--blue); font-weight: 650; text-decoration: none; }
.meeting-save-notice a:hover { text-decoration: underline; }

.check-panel { min-height: 520px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.audio-visual { height: 80px; display: flex; align-items: center; gap: 7px; margin-bottom: 25px; }
.audio-visual span {
  width: 7px;
  height: calc(10px + (var(--audio-level, 0) * 54px));
  border-radius: 10px;
  background: var(--blue);
  transition: height 70ms linear;
}
.audio-visual span:nth-child(1), .audio-visual span:nth-child(5) { transform: scaleY(.55); }
.audio-visual span:nth-child(2), .audio-visual span:nth-child(4) { transform: scaleY(.78); }
.audio-visual.is-waiting span { animation: waiting-wave .9s ease-in-out infinite alternate; }
.audio-visual.is-waiting span:nth-child(2), .audio-visual.is-waiting span:nth-child(4) { animation-delay: -.3s; }
@keyframes waiting-wave { to { height: 32px; } }

.countdown {
  margin-top: 2px;
  font-size: clamp(72px, 15vw, 108px);
  font-weight: 250;
  line-height: 1;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.success-mark { display: none; width: 82px; height: 82px; margin-bottom: 24px; color: var(--green); }
.success-mark svg { width: 100%; height: 100%; }
.check-panel.is-passed .audio-visual, .check-panel.is-passed .countdown { display: none; }
.check-panel.is-passed .success-mark { display: block; animation: success-in 520ms cubic-bezier(.2,1.4,.4,1) both; }
.check-panel.is-passed .eyebrow { color: var(--green); }
@keyframes success-in { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: scale(1); } }

.continue-button { display: none; margin-top: 12px; opacity: 0; }
.check-panel.is-ready .continue-button { display: block; animation: button-in 420ms ease forwards; }
@keyframes button-in { to { opacity: 1; } }

.live-panel { width: min(100%, 1040px); min-height: 650px; text-align: left; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.live-topbar { min-height: 46px; display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 6px 8px; background: rgba(0,0,0,.025); border: 1px solid var(--line); border-radius: 14px; }
.live-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 680; letter-spacing: -.02em; white-space: nowrap; }
.live-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.live-session-status { display: flex; align-items: center; gap: 10px; margin-left: auto; white-space: nowrap; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; color: var(--red); background: rgba(217,45,32,.08); border-radius: 999px; font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.live-pill span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.5s infinite; }
.live-pill #live-state-label { width: auto; height: auto; border-radius: 0; background: transparent; animation: none; }
.live-pill.is-paused { color: #9b6900; background: rgba(230,162,60,.13); }
.live-pill.is-paused > span:first-child { animation: none; }
.meeting-warning { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 10px; padding: 9px 14px; color: #704900; background: #fff4d6; border: 1px solid rgba(155,105,0,.18); border-radius: 12px; font-size: 13px; }
.meeting-warning[hidden] { display: none; }
.meeting-warning strong { white-space: nowrap; font-size: 15px; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .35; } }
.timer { font-size: 18px; font-weight: 520; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.connection-status { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
#connection-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #e6a23c; box-shadow: 0 0 0 4px rgba(230,162,60,.12); }
.connection-status.is-connected .connection-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(34,165,89,.12); }
.connection-status.is-error .connection-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(217,45,32,.1); }
.retry-button { display: none; margin-left: auto; padding: 7px 12px; color: var(--blue); background: rgba(0,113,227,.08); border: 0; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 650; }
.retry-button:hover { background: rgba(0,113,227,.13); }
.connection-status.is-error .retry-button { display: inline-block; }
.caption-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.caption-stage { min-height: 300px; max-height: 390px; overflow-y: auto; padding: 26px; background: rgba(0,0,0,.025); border: 1px solid var(--line); border-radius: 22px; scroll-behavior: smooth; }
.translation-stage { background: rgba(0,113,227,.035); border-color: rgba(0,113,227,.12); }
.caption-language { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--muted); font-size: 13px; font-weight: 650; }
.caption-language span { display: grid; min-width: 27px; height: 27px; place-items: center; padding: 0 5px; color: var(--blue); background: rgba(0,113,227,.09); border-radius: 8px; font-size: 11px; }
.caption-placeholder { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 22px; color: var(--muted); text-align: center; }
.caption-placeholder[hidden] { display: none; }
.caption-placeholder p { margin: 0; }
.listening-rings { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 9px rgba(0,113,227,.09), 0 0 0 18px rgba(0,113,227,.04); animation: pulse 1.5s infinite; }
.transcript-history { display: grid; gap: 12px; }
.transcript-line, .transcript-current { margin: 0; font-size: clamp(19px, 2.2vw, 26px); line-height: 1.42; letter-spacing: -.025em; }
.transcript-line { color: var(--text); }
.caption-entry { display: grid; gap: 7px; padding: 12px 16px; border-left: 3px solid transparent; border-radius: 0 14px 14px 0; }
.caption-entry.is-original { background: rgba(0,113,227,.06); border-left-color: var(--blue); }
.caption-entry.is-translation { background: rgba(125,73,190,.07); border-left-color: #7d49be; }
.caption-role { width: fit-content; padding: 3px 7px; border-radius: 6px; font-size: 9px; font-weight: 780; letter-spacing: .08em; }
.is-original .caption-role { color: var(--blue); background: rgba(0,113,227,.1); }
.is-translation .caption-role { color: #7d49be; background: rgba(125,73,190,.1); }
.transcript-current { margin-top: 16px; padding: 14px 16px; color: var(--muted); border-left: 3px solid transparent; border-radius: 0 14px 14px 0; }
.transcript-current:empty { display: none; }
.transcript-current:not(:empty)::before { content: attr(data-label); display: block; width: fit-content; margin-bottom: 7px; padding: 3px 7px; border-radius: 6px; font-size: 9px; font-weight: 780; letter-spacing: .08em; }
.transcript-current.is-original { color: var(--text); background: rgba(0,113,227,.04); border-left-color: var(--blue); }
.transcript-current.is-original::before { color: var(--blue); background: rgba(0,113,227,.1); }
.transcript-current.is-translation { color: var(--text); background: rgba(125,73,190,.05); border-left-color: #7d49be; }
.transcript-current.is-translation::before { color: #7d49be; background: rgba(125,73,190,.1); }
.live-status { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 22px 0; color: var(--muted); }
.translation-next { font-size: 13px; }
.meeting-controls { display: flex; align-items: center; gap: 6px; padding-left: 4px; border-left: 1px solid var(--line); }
.meeting-controls .pause-button,
.meeting-controls .stop-button { width: auto; min-height: 34px; padding: 0 11px; border-radius: 10px; font-size: 12px; }
.pause-button { color: var(--text); background: rgba(0,0,0,.055); }
.pause-button:hover { background: rgba(0,0,0,.085); }
body.is-paused .pause-button { color: #8a5d00; background: rgba(230,162,60,.14); }
.pause-icon { display: inline-block; width: 12px; height: 12px; margin-right: 7px; background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%); }
body.is-paused .pause-icon { width: 0; height: 0; margin-right: 9px; background: none; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid currentColor; }
.stop-button { color: var(--red); background: rgba(217,45,32,.08); }
.stop-button:hover { background: rgba(217,45,32,.13); }
.stop-icon { display: inline-block; width: 11px; height: 11px; margin-right: 7px; border-radius: 2px; background: currentColor; }

/* Immersive live mode keeps captions high and uses almost the full display. */
body.is-live { overflow: hidden; }
body.is-live .app-shell {
  display: block;
  min-height: 100vh;
  padding: 12px 18px 18px;
}
body.is-live .brand { display: none; }
body.is-live #live-screen {
  width: 100%;
  height: calc(100vh - 30px);
  padding: 0;
  place-items: stretch;
}
body.is-live .live-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3vw, 40px);
  border-radius: 24px;
}
body.is-live .live-topbar { margin-bottom: 10px; }
body.is-live .caption-grid {
  min-height: 0;
  flex: 1;
}
body.is-live .caption-stage {
  min-height: 0;
  max-height: none;
  height: 100%;
}
body.is-live .transcript-line,
body.is-live .transcript-current {
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.38;
}
body.is-live .live-status { margin: 10px 0 0; }

@media (max-width: 620px) {
  .app-shell { padding: 20px 16px 24px; }
  .screen { padding: 20px 0 0; }
  .panel { padding: 32px 22px; border-radius: 26px; }
  .setting-row { grid-template-columns: 32px 1fr; }
  .setting-row select, .setting-row .status-dot-label { grid-column: 2; justify-self: start; text-align: left; padding-left: 0; }
  .check-panel, .live-panel { min-height: 490px; }
  .caption-stage { padding: 22px; min-height: 240px; }
  .caption-grid { grid-template-columns: 1fr; }
  .caption-stage { max-height: 300px; }
  .live-status { align-items: flex-start; flex-direction: column; gap: 10px; }
  .connection-status { align-items: flex-start; }
  .live-topbar { flex-wrap: wrap; gap: 8px 10px; }
  .meeting-warning { align-items: flex-start; justify-content: space-between; text-align: left; }
  .live-brand { flex: 1; }
  .live-session-status { order: 2; width: 100%; justify-content: flex-end; }
  .connection-status { order: 3; width: 100%; justify-content: flex-start; padding: 2px 3px 0; }
  body.is-live { overflow: auto; }
  body.is-live .app-shell { padding: 8px; }
  body.is-live #live-screen { height: auto; min-height: calc(100vh - 16px); }
  body.is-live .live-panel { min-height: calc(100vh - 16px); padding: 22px 16px; border-radius: 20px; }
  body.is-live .caption-grid { flex: none; }
  body.is-live .caption-stage { min-height: 260px; max-height: 340px; }
}

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

/* Keep the public setup page compact, with the brand inside its card. */
#setup-screen { padding: 0; }
.setup-panel { width: min(100%, 600px); padding: 36px 40px; border-radius: 28px; }
.setup-brand { justify-content: center; gap: 10px; margin-bottom: 24px; font-size: 19px; }
.setup-brand .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
.setup-panel h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.12; }
.setup-panel .intro { max-width: 390px; margin: 12px auto 26px; font-size: 15px; line-height: 1.6; }
.setup-panel .settings { margin-bottom: 20px; border-radius: 18px; }
.setup-panel .setting-row { min-height: 66px; padding: 10px 14px; gap: 10px; grid-template-columns: 24px minmax(0, 1fr) auto; }
.setup-panel .setting-label { font-size: 14px; }
.setup-panel .setting-hint { font-size: 12px; }
.setup-panel select { max-width: 190px; font-size: 14px; }
.setup-panel .primary-button { min-height: 52px; border-radius: 14px; }
.setup-panel .meeting-save-notice { grid-template-columns: auto minmax(0, 1fr); }
.setup-panel #meeting-save-message { overflow-wrap: anywhere; }
.setup-panel .meeting-save-notice a, .setup-panel #retry-save-button { grid-column: 2; justify-self: start; }
@media (max-width: 620px) {
  .setup-panel { padding: 26px 18px; border-radius: 24px; }
  .setup-brand { margin-bottom: 20px; }
  .setup-panel .intro { margin-bottom: 22px; font-size: 14px; }
  .setup-panel .setting-row { grid-template-columns: 20px minmax(0, .9fr) minmax(0, 1.1fr); gap: 8px; padding: 12px 10px; }
  .setup-panel .setting-hint { display: none; }
  .setup-panel .setting-row select, .setup-panel .setting-row .status-dot-label { grid-column: 3; justify-self: end; text-align: right; }
  .setup-panel select { min-width: 0; width: 100%; padding: 8px 0; font-size: 13px; }
}
