:root {
  --bg0: #0c100e;
  --bg1: #141a16;
  --ink: #e8f0e6;
  --muted: #8a9a88;
  --line: #2a352c;
  --accent: #c8f547;
  --accent-ink: #10140c;
  --danger: #ff6b4a;
  --ok: #5ddea0;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font);
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(200, 245, 71, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(93, 222, 160, 0.08), transparent 50%),
    linear-gradient(165deg, #0c100e 0%, #121812 45%, #0a0e0c 100%);
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  width: min(640px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

.hero {
  margin-bottom: 2rem;
  animation: rise 0.7s ease both;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.75rem, 10vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  margin: 0 0 1rem;
  color: var(--accent);
}

.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
  max-width: 18ch;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
  max-width: 36ch;
}

.panel {
  background: color-mix(in srgb, var(--bg1) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.35rem 1.25rem 1.5rem;
  backdrop-filter: blur(8px);
  animation: rise 0.8s ease 0.08s both;
}

.gate .hint {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.gate .hint.alt {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.tg-login {
  display: flex;
  justify-content: flex-start;
  min-height: 44px;
  margin: 0.5rem 0 0.25rem;
}

.gate strong {
  color: var(--ink);
}

.status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 520px) {
  .status-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.value {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

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

.badge.on {
  color: var(--ok);
}

.badge.off {
  color: var(--danger);
}

fieldset {
  border: none;
  margin: 0 0 1.35rem;
  padding: 0;
}

legend {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
  padding: 0;
}

.help {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

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

.help.highlight {
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--ink);
}

.callout {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 6%, #0a0e0b);
}

.callout-title {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.callout ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.callout li {
  margin-bottom: 0.35rem;
}

.callout strong {
  color: var(--ink);
}

.field-hint {
  display: block;
  margin: 0.2rem 0 0.15rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.field-hint.inline {
  display: inline;
  margin-left: 0.25rem;
}

.handles-label {
  margin-top: 0.35rem;
}

.lede em {
  font-style: normal;
  color: var(--accent);
}

code {
  font-size: 0.82em;
  color: var(--accent);
}

input,
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.8rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #0a0e0b;
  color: var(--ink);
  font: inherit;
}

input:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  cursor: pointer;
}

.check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

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

button[type="submit"] {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.9rem 1.2rem;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.15s ease, filter 0.15s ease;
}

button[type="submit"]:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.msg {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.msg.ok {
  color: var(--ok);
}

.msg.err,
.error {
  color: var(--danger);
}

.summary {
  margin: 1.25rem 0 0;
  padding: 0.9rem 1rem;
  background: #0a0e0b;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--muted);
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
