@import url("https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg-base: #0b0f16;
  --bg-glow-1: rgba(24, 194, 156, 0.28);
  --bg-glow-2: rgba(43, 140, 255, 0.24);
  --bg-grid: rgba(226, 231, 244, 0.12);
  --surface: #151923;
  --surface-2: #1b2130;
  --input: #111825;
  --text: #eef2f7;
  --muted: #9aa6bd;
  --accent: #18c29c;
  --accent-2: #38d6b2;
  --border: #222a3b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Sora", system-ui, sans-serif;
  color: var(--text);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(1400px 900px at 12% -15%, var(--bg-glow-1), transparent 55%),
    radial-gradient(1000px 800px at 88% 8%, var(--bg-glow-2), transparent 60%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0) 40%),
    radial-gradient(120% 120% at 50% 0%, transparent 40%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(0deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 56px 56px, 56px 56px;
  background-attachment: fixed;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(21, 25, 35, 0.82);
  backdrop-filter: blur(10px);
}

h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.15;
}

h2 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 1.05rem;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.brand-badge {
  padding: 8px 12px;
  border: 1px solid #2d3649;
  border-radius: 999px;
  color: #b8c8e3;
  background: rgba(25, 33, 47, 0.7);
  letter-spacing: 0.08em;
  font-size: 11px;
}

.app {
  width: min(1200px, 96vw);
  margin: 16px auto 30px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.feature-card {
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.badge-soft {
  border: 1px solid #2a3550;
  background: rgba(56, 214, 178, 0.08);
  color: #a6d8cc;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mini-btn {
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.audio-mode {
  display: grid;
  gap: 6px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.toggle-line input {
  width: 14px;
  height: 14px;
}

.hint {
  color: #8fb7a8;
  font-size: 11px;
}

.cards-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preview-card {
  grid-column: 1 / -1;
}

.full-width {
  grid-column: 1 / -1;
}

.player-wrap {
  margin-top: 8px;
  width: 100%;
  border: 1px solid #2a3348;
  border-radius: 12px;
  overflow: hidden;
  background: #090d16;
}

#streamPreview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05070c;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.7);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  width: min(980px, 94vw);
  margin: 5vh auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.modal-close {
  padding: 6px 10px;
}

select, input, button {
  border-radius: 10px;
  border: 1px solid #2a3348;
  background: var(--input);
  color: var(--text);
  padding: 10px 11px;
  font: 500 13px/1.2 "Sora", system-ui, sans-serif;
}

select:disabled {
  opacity: 0.55;
}

select:focus, input:focus {
  outline: none;
  border-color: #2f9f86;
  box-shadow: 0 0 0 3px rgba(24, 194, 156, 0.16);
}

input { width: 100%; }

.row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-state {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid #36435e;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.stream-state.running {
  background: rgba(24, 194, 156, 0.18);
  border-color: rgba(24, 194, 156, 0.55);
  color: #8df0d7;
}

.stream-state.stopped {
  background: rgba(255, 94, 87, 0.16);
  border-color: rgba(255, 94, 87, 0.52);
  color: #ffb1ac;
}

.stream-state.unknown {
  background: rgba(154, 166, 189, 0.16);
  border-color: rgba(154, 166, 189, 0.5);
  color: #c5cfdf;
}

button {
  cursor: pointer;
  transition: background .2s ease, transform .1s ease, border-color .2s ease;
}

button:hover {
  background: #1c2638;
  border-color: #36435e;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: linear-gradient(180deg, #1eb694, #169578);
  border-color: #1baa8b;
  color: #f3fffb;
}

button.primary:hover {
  background: linear-gradient(180deg, #29caa4, #1ba684);
}

button.action-go {
  background: linear-gradient(180deg, #1eb694, #169578);
  border-color: #1baa8b;
  color: #f3fffb;
}

button.action-go:hover {
  background: linear-gradient(180deg, #29caa4, #1ba684);
}

button.action-stop {
  background: linear-gradient(180deg, #db5f5b, #b84743);
  border-color: #cc5954;
  color: #fff4f4;
}

button.action-stop:hover {
  background: linear-gradient(180deg, #ea726e, #c6524e);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.log {
  margin: 10px 0 0;
  padding: 11px;
  background: #0f1522;
  border: 1px solid #273148;
  border-radius: 10px;
  color: #c4d5ec;
  white-space: pre-wrap;
  min-height: 90px;
  max-height: 250px;
  overflow: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.log.tall { min-height: 190px; }

#pubLog,
#mtxLog {
  font-size: 10px;
  line-height: 1.3;
  white-space: pre;
  overflow: auto;
}

#networkInputs { margin-top: 10px; }

@media (max-width: 940px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .preview-card {
    grid-column: auto;
  }
}
