:root {
  --bg0: #120c17;
  --bg1: #1c1424;
  --ink: #f0ecf5;
  --muted: #9c8fab;
  --line: #362a42;
  --accent: #a06bff;
  --accent-dim: #6b3fc7;
  --danger: #e85d5d;
  --field: #100a16;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #3a1f52 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #29233a 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #150f1c);
  min-height: 100vh;
  transition: background 1.2s ease;
}

/* The whole screen flips green while the channel is live. */
body.is-live {
  background:
    radial-gradient(1200px 600px at 10% -10%, #1d5c34 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #16472b 0%, transparent 50%),
    linear-gradient(165deg, #05130b, #0b2216 55%, #041008);
}

.glow {
  position: fixed;
  inset: auto -20% -30% auto;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(160, 107, 255, 0.14), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.brand-header {
  margin-bottom: 24px;
}

h1 {
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 800;
  line-height: 1.05;
  margin: 4px 0 10px;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.penguin-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 18px;
}

.penguin {
  font-size: 3.4rem;
  display: inline-block;
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
  transition: filter 0.3s ease;
}

.penguin.is-dancing {
  animation: penguin-waddle 0.6s ease-in-out infinite;
}

.penguin.is-live {
  animation: penguin-hype 0.32s ease-in-out infinite;
  filter: drop-shadow(0 10px 22px rgba(66, 214, 130, 0.55));
}

@keyframes penguin-waddle {
  0%,
  100% {
    transform: rotate(-12deg) translateY(0);
  }
  50% {
    transform: rotate(12deg) translateY(-8px);
  }
}

@keyframes penguin-hype {
  0%,
  100% {
    transform: rotate(-16deg) scale(1.08) translateY(-2px);
  }
  50% {
    transform: rotate(16deg) scale(1.18) translateY(-10px);
  }
}

.panel {
  background: rgba(16, 10, 22, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

.text-input,
.select-input {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 16px;
}

.select-input {
  cursor: pointer;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(160, 107, 255, 0.18);
}

.text-input::placeholder {
  color: #5c4d6b;
  font-weight: 500;
}

.hint {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-secondary {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 9px 16px;
  border-radius: 12px;
  cursor: pointer;
  flex: 1;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 20px;
  cursor: pointer;
}

.checkbox-row input {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
}

.actions {
  margin-bottom: 16px;
}

.btn-primary {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #140a1e;
  background: linear-gradient(180deg, #bc8bff, var(--accent));
  box-shadow: 0 10px 28px rgba(160, 107, 255, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary.stopping {
  color: #fff;
  background: linear-gradient(180deg, #f07878, var(--danger));
  box-shadow: 0 10px 28px rgba(232, 93, 93, 0.22);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b6178;
  box-shadow: 0 0 0 3px rgba(107, 97, 120, 0.16);
}

.dot[data-state="monitoring"] {
  background: #e0b34a;
  box-shadow: 0 0 0 3px rgba(224, 179, 74, 0.18);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.dot[data-state="live"] {
  background: #ef4d6b;
  box-shadow: 0 0 0 4px rgba(239, 77, 107, 0.24);
  animation: pulse-dot 0.9s ease-in-out infinite;
}

.dot[data-state="error"] {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(232, 93, 93, 0.18);
}

.dot[data-state="idle"] {
  background: #6b6178;
  box-shadow: 0 0 0 3px rgba(107, 97, 120, 0.16);
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.status-text {
  min-width: 0;
}

.status-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.status-detail {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.log-panel h2 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log li {
  font-size: 0.85rem;
  line-height: 1.35;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #d6cbe0;
}

.log li:first-child {
  border-color: rgba(160, 107, 255, 0.35);
  color: var(--ink);
}

.foot-note {
  margin-top: 8px;
}

.foot-note p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.foot-note a {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .dot[data-state="monitoring"],
  .dot[data-state="live"],
  .penguin.is-dancing,
  .penguin.is-live {
    animation: none;
  }

  body {
    transition: none;
  }
}
