/* Black, minimal, in the spirit of the church's own site:
   white line logo, uppercase letter-spaced labels, a high-contrast serif for titles. */
:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #0c0c0c;
  --surface-2: #161616;
  --surface-3: #202020;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.18);
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.38);
  --live: #ff453a;
  --ok: #30d158;
  --fs: 24px;
  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-label: "Lato", "Open Sans", system-ui, sans-serif;
  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }

.label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.brand img { width: 32px; height: 32px; flex: none; }
.brand .label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  flex: none;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status[data-state="live"] { border-color: rgba(255, 69, 58, 0.55); }
.status[data-state="live"] .label { color: #fff; }
.status[data-state="live"] .dot { background: var(--live); box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.6); animation: ping 1.8s infinite; }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(255, 69, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); }
}

/* ---------- listener: sermon header ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 32px 0 24px; border-bottom: 1px solid var(--line); }
.hero h1 {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.hero .speaker { margin-top: 10px; color: var(--text-2); font-size: 15px; }

/* ---------- listener: transcript ---------- */
.feed { padding: 24px 0 calc(150px + var(--safe-b)); }
.seg {
  margin: 0 0 0.8em;
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--text-2);
  overflow-wrap: anywhere;
  transition: color 0.5s ease;
}
.seg.latest { color: var(--text); }
.seg.untranslated .t { color: var(--text-3); }
.seg .orig {
  display: none;
  margin-top: 4px;
  font-size: max(13px, 0.6em);
  line-height: 1.45;
  color: var(--text-3);
}
body.show-orig .seg .orig { display: block; }
.dots { display: inline-flex; gap: 5px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.interim { min-height: 1.5em; font-size: calc(var(--fs) * 0.72); color: var(--text-3); }

/* ---------- listener: empty / offline ---------- */
.idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14vh 12px 160px;
}
.idle img { width: 88px; height: 88px; opacity: 0.92; margin-bottom: 28px; }
.idle h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.15; }
.idle p { margin: 12px 0 0; color: var(--text-2); max-width: 340px; }
.idle .last { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); min-width: 220px; }
.idle .last .title { margin-top: 8px; font-family: var(--font-display); font-size: 20px; }

/* ---------- listener: bottom dock ---------- */
.dock {
  position: fixed;
  z-index: 10;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: rgba(24, 24, 24, 0.86);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.lang-pill {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  background: #fff;
  color: #000;
  border-radius: 16px;
}
.lang-pill .name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-pill svg { flex: none; }
.lang-pill select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  border: 0;
}
.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn[aria-pressed="true"] { background: var(--surface-3); color: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
@media (max-width: 360px) { .icon-btn { width: 42px; } .lang-pill { padding: 0 10px; gap: 6px; } }
.icon-btn .txt { font-family: var(--font-label); font-weight: 900; font-size: 13px; letter-spacing: 0.06em; }
.icon-btn small { font-size: 0.72em; }

.jump {
  position: fixed;
  z-index: 9;
  left: 50%;
  bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.jump .label { color: #000; }

/* ---------- broadcast console ---------- */
.console { max-width: 600px; margin: 0 auto; padding: 24px 20px 48px; }
.console h1 {
  margin: 8px 0 28px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.1;
}
.field { margin-bottom: 18px; }
.field > .label { display: block; margin-bottom: 8px; }
.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: #fff; }
.input[type="date"] { -webkit-appearance: none; appearance: none; }
.input.title-input { height: 60px; font-family: var(--font-display); font-size: 22px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; gap: 0; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  font-family: var(--font-label);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.btn:hover { border-color: #fff; }
.btn.primary { width: 100%; background: #fff; color: #000; border-color: #fff; margin-top: 10px; }
.btn.primary:hover { background: #e9e9e9; }
.btn.danger { border-color: rgba(255, 69, 58, 0.6); color: var(--live); }
.btn.danger:hover { border-color: var(--live); }
.btn:disabled { opacity: 0.5; cursor: default; }

.notice { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 69, 58, 0.12); color: #ff8a80; font-size: 14px; }
.hint { color: var(--text-3); font-size: 13px; margin-top: 16px; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin-bottom: 14px; }
.onair-title { font-family: var(--font-display); font-size: 26px; line-height: 1.15; margin: 10px 0 4px; overflow-wrap: anywhere; }
.onair-sub { color: var(--text-2); font-size: 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.big-num { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; }
.meter { height: 4px; margin-top: 18px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: #fff; transition: width 0.08s linear; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; gap: 8px; align-items: center; height: 32px; padding: 0 12px; background: var(--surface-3); border-radius: 999px; font-size: 14px; }
.chip b { font-weight: 700; font-variant-numeric: tabular-nums; }
.log { margin-top: 12px; font-size: 16px; line-height: 1.5; color: var(--text-2); max-height: 40vh; overflow-y: auto; }
.log p { margin: 0 0 8px; }
.log p:last-child { color: var(--text); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.actions .btn { padding: 0 12px; letter-spacing: 0.14em; white-space: nowrap; }

/* audio input picker */
select.input {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}
.link { background: none; border: 0; padding: 10px 0 0; color: var(--text-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  cursor: pointer;
}
.switch-row b { display: block; font-weight: 600; font-size: 15px; }
.switch-row small { display: block; margin-top: 2px; color: var(--text-3); font-size: 13px; line-height: 1.35; }
.switch-row input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.15s;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch-row input:checked { background: var(--ok); }
.switch-row input:checked::after { transform: translateX(18px); }
