:root {
  --ink: #222;
  --ink-soft: #333;
  --muted: #666;
  --line: #ccc;
  --paper: #f2f2f2;
  --white: #ffffff;
  --brand: #0a6b5f;
  --brand-deep: #08554c;
  --brand-soft: #e8f2f0;
  --teal-bright: #1a9a85;
  --alert: #b42318;
  --alert-bg: #fef3f2;
  --ok: #0a6b5f;
  --warn: #a85a00;
  --hero-a: #2a2a2a;
  --hero-b: #2a2a2a;
  --hero-c: #2a2a2a;
  --serif: "Source Serif 4", "Times New Roman", serif;
  --sans: Manrope, "Segoe UI", sans-serif;
  --radius: 2px;
  --shadow: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-deep); }

img, svg { display: block; max-width: 100%; }

.wrap {
  width: min(1080px, calc(100% - 2.25rem));
  margin-inline: auto;
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo img {
  width: 1.7rem;
  height: 1.7rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav a:hover { color: var(--ink); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.lang button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.55rem;
  color: var(--muted);
  cursor: pointer;
}

.lang button.active {
  background: var(--ink);
  color: var(--white);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius);
  padding: 0.55rem 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover { background: var(--brand-deep); color: var(--white); filter: none; }
.btn-outline {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost {
  background: transparent;
  border-color: #888;
  color: var(--white);
}
.btn-ghost:hover { border-color: #bbb; color: #fff; filter: none; }

.hero {
  color: var(--white);
  padding: 2.5rem 0 2.2rem;
  background: var(--hero-a);
  position: relative;
  overflow: hidden;
}

.hero::after { display: none; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: end;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ab;
  margin-bottom: 0.55rem;
}

.hero h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 0.7rem;
  font-weight: 700;
}

.hero .lead {
  color: #ccc;
  font-size: 1rem;
  max-width: 34rem;
  margin-bottom: 1.2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }

.hero-panel {
  border: 1px solid #444;
  border-radius: var(--radius);
  background: #1a1a1a;
  padding: 0.65rem;
}

.hero-panel canvas {
  width: 100%;
  height: auto;
  min-height: 160px;
  border-radius: 0;
  background: #111;
  display: block;
}

.hero-caption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #888;
}

section { padding: 2.2rem 0; }

.section-head {
  max-width: 36rem;
  margin-bottom: 1.8rem;
}

.section-head h2 {
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  letter-spacing: -0.025em;
  margin-bottom: 0.4rem;
}

.section-head p { color: var(--muted); }

.band-white {
  background: var(--white);
  border-block: 1px solid var(--line);
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.feature h3 {
  font-size: 1.02rem;
  margin-bottom: 0.4rem;
  letter-spacing: -0.015em;
}

.feature p { color: var(--muted); font-size: 0.94rem; }

.media-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.1rem;
  align-items: stretch;
}

.diagram {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0.85rem;
  overflow: hidden;
}

.diagram svg { width: 100%; height: auto; }

.audio-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  justify-content: center;
}

.audio-card h3 { font-size: 1.02rem; }
.audio-card p { color: var(--muted); font-size: 0.92rem; }
.audio-card audio { width: 100%; }

.faq-list { display: grid; gap: 0.6rem; max-width: 46rem; }

details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0.9rem 1.05rem;
}

summary {
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--brand); font-size: 1.15rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { margin-top: 0.7rem; color: var(--muted); font-size: 0.95rem; }

.prose {
  max-width: 42rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.prose h1, .prose h2, .prose h3 {
  font-family: var(--sans);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.prose h1 { font-size: 1.85rem; margin-bottom: 0.8rem; }
.prose h2 { font-size: 1.25rem; margin: 1.6rem 0 0.55rem; }
.prose p, .prose li { margin-bottom: 0.75rem; }
.prose ul { padding-left: 1.2rem; margin-bottom: 0.9rem; }
.prose code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  background: var(--brand-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

.page-hero {
  padding: 1.6rem 0 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.page-hero h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}

.page-hero p { color: var(--muted); max-width: 40rem; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin: 1.4rem 0 1.8rem;
}

.status-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 1rem 1.05rem;
}

.status-card .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.status-card .value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.status-card .ok { color: var(--ok); }
.status-card .warn { color: var(--warn); }

.incident {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 1rem 1.1rem;
  margin-bottom: 0.7rem;
}

.incident time {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.site-foot {
  background: #222;
  color: #aaa;
  padding: 1.8rem 0 1.4rem;
  font-size: 0.88rem;
  margin-top: auto;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.7rem;
}

.brand-foot {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.45rem;
}

.foot-grid h4 {
  color: #fff;
  font-size: 0.82rem;
  margin-bottom: 0.65rem;
}

.foot-grid a {
  display: block;
  margin-bottom: 0.35rem;
  color: rgba(255,255,255,.58);
}

.foot-grid a:hover { color: #fff; }

.legal {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: rgba(255,255,255,.42);
  font-size: 0.8rem;
}

/* Gate modal */
.gate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}

.gate-backdrop.open { display: flex; }

.gate {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.15rem 1.1rem;
  box-shadow: none;
}

.gate h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.gate .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.05rem; }

.field { display: grid; gap: 0.3rem; margin-bottom: 0.8rem; }

.field label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid rgba(13, 124, 111, 0.3);
  border-color: var(--brand);
}

.gate-actions { display: flex; gap: 0.55rem; margin-top: 0.25rem; }
.gate-actions .btn { flex: 1; }

.gate-err {
  display: none;
  margin-top: 0.7rem;
  font-size: 0.88rem;
  color: var(--alert);
  background: var(--alert-bg);
  border: 1px solid #f0c0bc;
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
}

.gate-err.show { display: block; }

/* Auth page */
.auth-page {
  min-height: calc(100vh - 8rem);
  display: grid;
  place-items: center;
  padding: 2rem 0 3rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.2rem 1.15rem;
  box-shadow: none;
}

.auth-card .logo { margin-bottom: 1rem; }

/* App shell */
.app-body {
  background: #222;
  color: #ddd;
  min-height: 100vh;
}

.app-body .top {
  background: #2a2a2a;
  border-bottom-color: #444;
}

.app-body .logo { color: #fff; }
.app-body .nav a { color: #aaa; }
.app-body .nav a:hover,
.app-body .nav a.active { color: #fff; }
.app-body .lang { background: transparent; border-color: #555; }
.app-body .lang button { color: #aaa; }
.app-body .lang button.active { background: var(--brand); color: #fff; }

.app-bar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.86rem;
  color: rgba(255,255,255,.6);
}

.pill {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
}

.app-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: 1.3rem 0 2.4rem;
}

.app-nav {
  display: grid;
  gap: 0.2rem;
  align-content: start;
}

.app-nav button {
  text-align: left;
  font: inherit;
  color: #bbb;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}

.app-nav button:hover,
.app-nav button.active {
  background: #333;
  color: #fff;
}

.app-panel {
  border: 1px solid #444;
  border-radius: var(--radius);
  background: #2a2a2a;
  padding: 1rem;
}

.app-panel[hidden] { display: none; }

.app-panel h1 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.app-panel > .lead {
  color: rgba(255,255,255,.55);
  margin-bottom: 1rem;
  font-size: 0.94rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.stat {
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem;
  background: #222;
}

.stat b {
  display: block;
  font-size: 1.25rem;
  color: #9fd;
  letter-spacing: 0;
}

.stat span {
  font-size: 0.8rem;
  color: #999;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.3rem;
  border-bottom: 1px solid #444;
}

.data-table th {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
  font-weight: 600;
}

.status-on { color: #8c8; }
.status-warn { color: #da8; }

.stream-box {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 10rem;
  color: #ccc;
}

.stream-box .ok { color: #8c8; }
.stream-box .dim { color: #777; }

.note-box {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: #aaa;
  border-left: 3px solid var(--brand);
  padding-left: 0.7rem;
}

.not-found {
  min-height: 55vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 3rem 0;
}

.not-found .code {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.og-media {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.2rem 0;
  background: var(--ink);
}

.og-media img { width: 100%; height: auto; }

.glossary dt {
  font-family: var(--sans);
  font-weight: 700;
  margin-top: 0.9rem;
}

.glossary dd {
  color: var(--muted);
  margin-left: 0;
  margin-bottom: 0.35rem;
}

@media (max-width: 900px) {
  .nav { display: none; }
  .hero-grid,
  .feature-row,
  .media-split,
  .foot-grid,
  .status-grid,
  .app-grid,
  .stat-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { padding-top: 2.8rem; }
  .top-actions .btn-outline { display: none; }
}
