/* Lake County Dispatch — red / black glass. */
:root {
  --bg: #070709;
  --bg-2: #12080b;
  --panel: rgba(22, 12, 16, 0.58);
  --panel-strong: rgba(16, 8, 10, 0.72);
  --red: #ff2d3a;
  --red-deep: #b10d1c;
  --red-glow: rgba(255, 45, 58, 0.42);
  --text: #f5f2f3;
  --muted: rgba(245, 242, 243, 0.62);
  --faint: rgba(245, 242, 243, 0.4);
  --line: rgba(255, 255, 255, 0.1);
  --font: "Segoe UI Variable Text", "Segoe UI", "SF Pro Display", "Helvetica Neue",
    ui-sans-serif, system-ui, sans-serif;
  --radius: 28px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(160, 16, 32, 0.28), transparent 60%),
    radial-gradient(700px 500px at 110% 85%, rgba(90, 8, 16, 0.35), transparent 55%),
    radial-gradient(600px 400px at -10% 70%, rgba(70, 8, 18, 0.3), transparent 50%),
    linear-gradient(180deg, #0c0a0c 0%, var(--bg) 45%, #0a0608 100%);
}

.bg .glow-core {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 28rem;
  height: 28rem;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 45, 58, 0.2) 0%, rgba(255, 45, 58, 0.05) 38%, transparent 68%);
  filter: blur(8px);
}

.bg .grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.65rem 1.2rem 1.5rem;
}

.shell {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
}

.masthead {
  text-align: center;
  padding: 0.4rem 0.5rem 0.2rem;
}

.kicker {
  margin: 0 0 0.7rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.85rem, 7.2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.05;
  text-wrap: balance;
}

.credit {
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(255, 45, 58, 0.05) inset,
    0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}

.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.35rem 1.35rem 1.5rem;
  gap: 0.35rem;
}

.meta-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.75rem;
  margin-bottom: 0.85rem;
  gap: 0.75rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.7rem 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pill .dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #5a5a60;
  box-shadow: none;
}

.pill[data-state="live"] {
  color: var(--text);
  border-color: rgba(255, 45, 58, 0.45);
  background: rgba(255, 45, 58, 0.12);
}

.pill[data-state="live"] .dot {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  animation: pulse 1.6s ease-in-out infinite;
}

.pill[data-state="reconnect"] {
  color: #ffd0d3;
  border-color: rgba(255, 45, 58, 0.3);
}

.pill[data-state="reconnect"] .dot {
  background: var(--red);
  opacity: 0.7;
  animation: pulse 0.9s ease-in-out infinite;
}

.listeners {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.listeners[hidden] {
  display: none;
}

.play-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  width: 11.25rem;
  height: 11.25rem;
  margin: 0.35rem 0 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 80, 90, 0.2), transparent 52%),
    linear-gradient(180deg, rgba(48, 18, 22, 0.78), rgba(8, 6, 8, 0.86));
  box-shadow:
    0 0 0 1px rgba(255, 45, 58, 0.38),
    0 0 0 10px rgba(255, 45, 58, 0.06),
    0 16px 40px rgba(0, 0, 0, 0.45),
    0 0 60px rgba(255, 45, 58, 0.16);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.play-btn:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 0 1px rgba(255, 45, 58, 0.4),
    0 18px 44px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(255, 45, 58, 0.2);
}

.play-btn:active {
  transform: scale(0.98);
}

.play-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 5px;
}

.play-btn[data-state="live"] {
  border-color: rgba(255, 45, 58, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 45, 58, 0.4),
    0 16px 40px rgba(0, 0, 0, 0.45),
    0 0 70px rgba(255, 45, 58, 0.38);
}

.play-btn svg {
  display: block;
  flex: none;
  width: 3.1rem;
  height: 3.1rem;
  fill: currentColor;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.play-btn .icon-stop,
.play-btn[data-state="live"] .icon-play,
.play-btn[data-state="reconnect"] .icon-play {
  display: none;
}

.play-btn[data-state="live"] .icon-stop,
.play-btn[data-state="reconnect"] .icon-stop {
  display: block;
}

.elapsed {
  margin: 0.45rem 0 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
}

.elapsed-label {
  margin: 0.35rem 0 1.1rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.now-talking {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.55rem;
  margin: 0.1rem 0 0.85rem;
  padding: 0 0.4rem;
  min-height: 2.35rem;
  box-sizing: border-box;
}

.now-talking[hidden] {
  display: none;
}

.now-talking-dot {
  width: 0.48rem;
  height: 0.48rem;
  margin-top: 0.55rem;
  flex: none;
  border-radius: 50%;
  background: #5a5a60;
  box-shadow: none;
}

.now-talking[data-state="talking"] .now-talking-dot {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  animation: pulse 1.6s ease-in-out infinite;
}

.now-talking-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  min-width: 0;
  max-width: 22rem;
  text-align: center;
}

.now-talking-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.now-talking[data-state="monitoring"] .now-talking-label,
.now-talking[data-state="unavailable"] .now-talking-label {
  display: none;
}

.now-talking[data-state="talking"] .now-talking-label {
  color: rgba(255, 180, 184, 0.85);
}

.now-talking-title {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.now-talking[data-state="talking"] .now-talking-title {
  color: #ff9ea4;
  text-shadow: 0 0 16px var(--red-glow);
}

.now-talking[data-state="unavailable"] .now-talking-dot {
  background: #5a5a60;
  box-shadow: none;
  animation: none;
}

.now-talking[data-state="unavailable"] .now-talking-title {
  color: var(--faint);
  font-weight: 600;
  text-shadow: none;
}

.volume {
  width: 100%;
  padding: 0.85rem 0.2rem 0.15rem;
  border-top: 1px solid var(--line);
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.volume label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.volume .vol-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  color: var(--muted);
}

.volume input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--text);
  border: 0;
  box-shadow: 0 0 0 3px rgba(255, 45, 58, 0.18), 0 0 12px var(--red-glow);
  cursor: pointer;
}

.volume input[type="range"]::-moz-range-thumb {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--text);
  border: 0;
  box-shadow: 0 0 0 3px rgba(255, 45, 58, 0.18);
  cursor: pointer;
}

.volume input[type="range"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.volume .hint {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--faint);
}

.volume .hint[hidden] {
  display: none;
}

.tags {
  padding: 1.15rem 1.15rem 1.05rem;
}

.tags-heading {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}

.tags-sub {
  margin: 0.45rem 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
}

.tags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tag-row {
  position: relative;
  margin: 0;
  padding: 0.75rem 0.85rem 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tag-row-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  min-width: 0;
}

.tag-dot {
  width: 0.42rem;
  height: 0.42rem;
  flex: none;
  border-radius: 50%;
  background: #5a5a60;
}

.tag-name {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
  min-width: 0;
}

.tag-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 1.7rem;
  padding: 0.08rem 0.36rem 0.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.tag-detail {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--faint);
  white-space: nowrap;
}

.tag-desc {
  margin: 0.22rem 0 0 0.87rem;
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--muted);
}

.tag-live {
  display: none;
  margin: 0.3rem 0 0 0.87rem;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff9ea4;
}

.tag-row.is-talking {
  border-color: rgba(255, 45, 58, 0.5);
  background: rgba(255, 45, 58, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 45, 58, 0.12) inset, 0 0 22px rgba(255, 45, 58, 0.12);
}

.tag-row.is-talking .tag-dot {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  animation: pulse 1.6s ease-in-out infinite;
}

.tag-row.is-talking .tag-name {
  color: #ff9ea4;
  text-shadow: 0 0 16px var(--red-glow);
}

.tag-row.is-talking .tag-unit {
  border-color: rgba(255, 45, 58, 0.45);
  background: rgba(255, 45, 58, 0.16);
  color: #ffd6d9;
}

.tag-row.is-talking .tag-live {
  display: block;
}

.banner {
  padding: 0.95rem 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 45, 58, 0.28);
  background: rgba(48, 10, 16, 0.62);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffd6d9;
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.banner[hidden] {
  display: none;
}

.banner strong {
  display: block;
  margin: 0 0 0.25rem;
  color: var(--text);
  font-weight: 650;
}

.foot {
  margin-top: auto;
  padding-top: 1.25rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.foot p {
  margin: 0;
}

.forget-btn {
  margin-top: 0.6rem;
  background: none;
  border: 0;
  color: var(--faint);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
}

.forget-btn[hidden],
.lock[hidden],
.player[hidden],
.lock-error[hidden],
.now-talking[hidden],
.tags[hidden] {
  display: none;
}

.lock form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lock-title {
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--text);
}

.lock-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.lock input {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.lock input:focus {
  border-color: rgba(255, 45, 58, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 45, 58, 0.18);
}

.lock-btn {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: #fff;
  font: inherit;
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--red-glow);
}

.lock-btn:disabled {
  opacity: 0.6;
}

.lock-error {
  margin: 0;
  color: #ffb3b8;
  font-size: 0.88rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .pill .dot,
  .now-talking-dot,
  .tag-dot,
  .play-btn {
    animation: none;
    transition: none;
  }
}

@media (min-width: 860px) {
  .app {
    justify-content: center;
    padding: 3.5rem 2rem;
  }

  .shell {
    max-width: 40rem;
    flex: none;
  }

  .foot {
    margin-top: 0;
    padding-top: 1.5rem;
  }

  .player {
    padding: 1.8rem 2rem 1.85rem;
  }

  .play-btn {
    width: 13.5rem;
    height: 13.5rem;
  }

  .play-btn svg {
    width: 3.5rem;
    height: 3.5rem;
  }

  .elapsed {
    font-size: 2.35rem;
  }
}
