:root {
  --bg: #f3efe6;
  --bg-2: #e8e1d3;
  --ink: #17140f;
  --muted: #6b6256;
  --panel: rgba(255, 252, 246, 0.88);
  --line: rgba(23, 20, 15, 0.12);
  --accent: #0f6e56;
  --accent-2: #c45c26;
  --danger: #a11d2e;
  --ok: #0f6e56;
  --warn: #9a6b12;
  --shadow: 0 18px 50px rgba(40, 28, 10, 0.08);
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 110, 86, 0.14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 92, 38, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
}

a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 0.86rem; }
button, input, select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.rail {
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(255,252,246,0.55);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.brand strong { display: block; font-size: 1.05rem; }
.brand small { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }
.brand-mark {
  width: 14px; height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(15,110,86,0.12);
}
.brand-mark.lg { width: 18px; height: 48px; }

.rail nav { display: grid; gap: 0.35rem; }
.rail nav a {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
}
.rail nav a.active,
.rail nav a:hover {
  background: var(--ink);
  color: #fff8ee;
}

.rail-foot { margin-top: auto; }
.stage { padding: 1.4rem 1.6rem 2.5rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}
.top-meta {
  display: flex;
  gap: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(23,20,15,0.06);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}
.live-pill i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.live-pill.on {
  background: rgba(161, 29, 46, 0.12);
  color: var(--danger);
}
.live-pill.on i {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(161,29,46,0.15);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  50% { transform: scale(0.85); opacity: 0.7; }
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.2rem;
}
.hero-strip h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  letter-spacing: -0.03em;
}
.hero-strip p { margin: 0; color: var(--muted); max-width: 42rem; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 0.6rem;
  min-width: 280px;
}
.status-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow);
}
.status-grid span { display: block; color: var(--muted); font-size: 0.75rem; }
.status-grid strong { font-size: 1.15rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.route-box.in {
  border-color: rgba(15, 110, 86, 0.35);
  box-shadow: 0 0 0 1px rgba(15, 110, 86, 0.08), var(--shadow);
}
.route-box.out {
  border-color: rgba(196, 92, 38, 0.35);
  box-shadow: 0 0 0 1px rgba(196, 92, 38, 0.08), var(--shadow);
}

.panel > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}
.panel h2 { margin: 0; font-size: 1.05rem; }

.kv { display: grid; gap: 0.85rem; }
.kv > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.6rem;
  align-items: center;
}
.kv span { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }
.kv code {
  overflow: auto;
  white-space: nowrap;
  background: rgba(23,20,15,0.05);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
}
code.block {
  display: block;
  background: rgba(23,20,15,0.05);
  padding: 0.8rem;
  border-radius: 12px;
  margin: 0.8rem 0;
  overflow: auto;
}

.hint { color: var(--muted); font-size: 0.88rem; }
.text-link { color: var(--accent); font-weight: 600; }

.preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #120f0c;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}
#preview {
  width: 100%;
  height: 100%;
  display: block;
  background: #120f0c;
}
.preview-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  color: #f4efe4;
  background: rgba(18, 15, 12, 0.72);
  font-size: 0.95rem;
  pointer-events: none;
}
.preview-status.ok { display: none; }
.preview-status.bad { background: rgba(161, 29, 46, 0.72); }

.switcher-actions { gap: 0.75rem; }
.switcher-actions form { margin: 0; }
.intro-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #120f0c;
  border-radius: 14px;
  border: 1px solid var(--line);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.dest-table, .dest-cards { display: grid; gap: 0.75rem; }
.dest-row, .dest-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(255,255,255,0.45);
}
.dest-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.dest-name { display: grid; gap: 0.15rem; }
.dest-name small { color: var(--muted); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 0.4rem;
  background: #b7aea0;
}
.dot.on { background: var(--ok); }

.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(23,20,15,0.06);
  font-size: 0.72rem;
  font-style: normal;
  margin-left: 0.25rem;
}
.tag.ok { background: rgba(15,110,86,0.12); color: var(--ok); }
.tag.warn { background: rgba(154,107,18,0.14); color: var(--warn); }

.dest-card { display: grid; gap: 0.7rem; }
.dest-card-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
label { display: grid; gap: 0.35rem; font-size: 0.86rem; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: auto;
  color: var(--ink);
}
.check input { width: auto; }

button, .copy {
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  background: rgba(23,20,15,0.08);
  color: var(--ink);
  font-weight: 600;
}
button.primary { background: var(--ink); color: #fff8ee; }
button.danger { background: rgba(161,29,46,0.12); color: var(--danger); }
button.ghost { width: 100%; background: transparent; border: 1px solid var(--line); }
.copy { padding: 0.45rem 0.7rem; font-size: 0.8rem; }

.stack { display: grid; gap: 0.8rem; }
.alert {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 500;
}
.alert.bad { background: rgba(161,29,46,0.12); color: var(--danger); }
.alert.ok { background: rgba(15,110,86,0.12); color: var(--ok); }

.log-box {
  max-height: 280px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  display: grid;
  gap: 0.45rem;
}
.log {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(23,20,15,0.03);
}
.log.error { color: var(--danger); }
.log.warning { color: var(--warn); }
.log time { color: var(--muted); }

.guide ol, .guide ul { line-height: 1.55; color: var(--ink); }
.platform-list { display: grid; gap: 0.55rem; padding-left: 1.1rem; }
.warn-panel { border-color: rgba(196,92,38,0.35); }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}
.auth-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(120deg, rgba(15,110,86,0.18), transparent 40%),
    linear-gradient(300deg, rgba(196,92,38,0.16), transparent 35%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2317140f' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  z-index: 0;
}
.auth-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(255,252,246,0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 1.2rem; }
.auth-brand h1 { margin: 0.7rem 0 0.25rem; letter-spacing: -0.03em; }
.auth-brand p { margin: 0; color: var(--muted); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { grid-template-columns: repeat(4, 1fr); }
  .rail-foot { margin-top: 0; }
  .hero-strip, .grid-2, .dest-card-head, .dest-row { grid-template-columns: 1fr; display: grid; }
  .log { grid-template-columns: 1fr; }
}
