:root {
  color-scheme: dark;
  --bg: #07110f;
  --bg-raised: #0b1714;
  --surface: rgba(17, 31, 27, 0.9);
  --surface-2: #14251f;
  --surface-3: #1a3028;
  --line: rgba(206, 232, 218, 0.1);
  --line-strong: rgba(206, 232, 218, 0.2);
  --text: #edf5ef;
  --muted: #8ca097;
  --lime: #b9f457;
  --lime-soft: rgba(185, 244, 87, 0.11);
  --cyan: #7bdaca;
  --amber: #efbd69;
  --red: #ef8377;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(53, 114, 91, 0.2), transparent 35%),
    linear-gradient(155deg, #091410 0%, var(--bg) 58%, #050c0a 100%);
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(80px); opacity: 0.18; pointer-events: none; }
.ambient-a { top: 18%; right: -160px; width: 360px; height: 360px; background: #5bac8d; }
.ambient-b { bottom: -170px; left: -120px; width: 320px; height: 320px; background: #86ad32; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(150deg, rgba(20, 37, 31, 0.96), rgba(8, 19, 16, 0.97));
  box-shadow: var(--shadow);
}
.brand-mark { position: relative; width: 50px; height: 50px; margin-bottom: 28px; border: 1px solid rgba(185, 244, 87, 0.45); border-radius: 50%; }
.brand-mark::before, .brand-mark::after, .wordmark-ball::before, .wordmark-ball::after { content: ""; position: absolute; background: var(--lime); opacity: 0.65; }
.brand-mark::before { left: 24px; top: 4px; width: 1px; height: 40px; transform: rotate(24deg); }
.brand-mark::after { left: 7px; top: 24px; width: 36px; height: 1px; transform: rotate(-14deg); }
.brand-mark i { position: absolute; border: 1px solid rgba(185, 244, 87, 0.46); border-radius: 50%; }
.brand-mark i:first-child { inset: 8px -1px; }
.brand-mark i:nth-child(2) { inset: -1px 8px; }
.brand-mark i:last-child { inset: 18px; background: var(--lime); border: 0; box-shadow: 0 0 16px var(--lime); }
.eyebrow { margin: 0 0 12px; color: var(--lime); font-size: 10px; font-weight: 750; letter-spacing: 0.18em; }
.login-card h1, .hero h1 { margin: 0; font: 500 48px/0.98 Georgia, "Noto Serif SC", serif; letter-spacing: -0.045em; }
.login-card h1 span, .hero h1 span { color: var(--lime); }
.login-copy { margin: 20px 0 28px; color: var(--muted); font-size: 13px; line-height: 1.75; }
label { display: block; margin: 16px 0 7px; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }
input {
  width: 100%; padding: 13px 14px; color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 12px; background: rgba(4, 12, 10, 0.62);
}
input:focus { border-color: rgba(185, 244, 87, 0.7); }
.primary-button {
  display: flex; width: 100%; justify-content: space-between; margin-top: 22px; padding: 13px 15px;
  border: 1px solid var(--lime); border-radius: 12px; color: #14200e; background: var(--lime); font-weight: 800;
}
.primary-button:disabled { opacity: 0.55; cursor: wait; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 11px; }
.security-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #687a72; font-size: 9px; text-align: center; letter-spacing: 0.06em; }

.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  height: 68px; padding: 0 max(22px, calc((100vw - 1040px) / 2)); border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 15, 0.8); backdrop-filter: blur(18px);
}
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--text); font-size: 11px; letter-spacing: 0.11em; text-decoration: none; }
.wordmark b { color: var(--lime); }
.wordmark-ball { position: relative; width: 28px; height: 28px; border: 1px solid rgba(185, 244, 87, 0.55); border-radius: 50%; overflow: hidden; }
.wordmark-ball::before { top: 13px; left: 3px; width: 22px; height: 1px; transform: rotate(-12deg); }
.wordmark-ball::after { top: 3px; left: 13px; width: 1px; height: 22px; transform: rotate(23deg); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.sync-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 9px currentColor; }
.sync-state.ready i { background: var(--lime); }
.sync-state.error i { background: var(--red); }
.icon-button, .text-button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; }
.icon-button { font-size: 17px; line-height: 1; }

.page-wrap { width: min(100% - 34px, 1040px); min-height: calc(100vh - 136px); margin: 0 auto; padding: 52px 0 72px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 34px; min-height: 185px; }
.hero h1 { font-size: clamp(38px, 6vw, 66px); }
.hero-copy { max-width: 600px; margin: 20px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.hero-orbit { position: relative; flex: 0 0 114px; display: grid; width: 114px; height: 114px; place-items: center; }
.orbit-ring { position: absolute; inset: 0; border: 1px solid rgba(185, 244, 87, 0.28); border-radius: 50%; animation: orbit 12s linear infinite; }
.orbit-ring::after { content: ""; position: absolute; top: 10px; left: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 13px var(--lime); }
.orbit-ring-inner { inset: 15px; border-color: var(--line-strong); animation-direction: reverse; animation-duration: 18s; }
.orbit-ring-inner::after { top: auto; right: 3px; bottom: 18px; left: auto; width: 4px; height: 4px; background: var(--cyan); }
.hero-orbit strong { color: var(--lime); font: 600 31px Georgia, serif; }
.hero-orbit span { position: absolute; bottom: 29px; color: var(--muted); font-size: 7px; letter-spacing: 0.13em; }
@keyframes orbit { to { transform: rotate(360deg); } }

.boundary-banner { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin: 26px 0 22px; padding: 14px 16px; border: 1px solid rgba(239, 189, 105, 0.24); border-radius: 14px; background: rgba(239, 189, 105, 0.06); }
.boundary-banner span { padding: 5px 8px; border-radius: 7px; color: #1b160b; background: var(--amber); font-size: 9px; font-weight: 850; letter-spacing: 0.07em; }
.boundary-banner p { margin: 0; color: #cdbd9f; font-size: 11px; line-height: 1.55; }

.section-nav { position: sticky; top: 78px; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 0 26px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11, 23, 20, 0.87); backdrop-filter: blur(16px); }
.nav-item { padding: 10px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; }
.nav-item.active { color: var(--text); background: var(--surface-3); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18); }
.view { display: none; }
.view.active { display: block; animation: rise 0.25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 2px 14px; }
.section-heading h2 { margin: 0; font: 500 25px Georgia, "Noto Serif SC", serif; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.tag { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.tag.live { border-color: rgba(185, 244, 87, 0.3); color: var(--lime); background: var(--lime-soft); }
.tag.wait { border-color: rgba(239, 189, 105, 0.25); color: var(--amber); }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.metric-card, .panel, .route-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(20, 37, 31, 0.86), rgba(10, 23, 19, 0.92)); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12); }
.metric-card { min-width: 0; padding: 17px; border-radius: 16px; }
.metric-card small { display: block; color: var(--muted); font-size: 9px; letter-spacing: 0.09em; text-transform: uppercase; }
.metric-card strong { display: block; margin: 9px 0 7px; overflow-wrap: anywhere; font: 600 28px/1 Georgia, serif; }
.metric-card span { color: var(--muted); font-size: 9px; line-height: 1.4; }
.metric-card.accent strong { color: var(--lime); }
.panel { margin-bottom: 12px; padding: 18px; border-radius: 17px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading h3 { margin: 0; font-size: 13px; }
.muted { color: var(--muted); font-size: 10px; line-height: 1.6; }

.route-stack { display: grid; gap: 12px; }
.route-card { position: relative; overflow: hidden; padding: 20px; border-radius: 18px; }
.route-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--lime); opacity: 0.6; }
.route-card:nth-child(2)::before { background: var(--amber); }
.route-card:nth-child(3)::before { background: var(--cyan); }
.route-top { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.route-rank { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--lime); font: 600 15px Georgia, serif; }
.route-title h3 { margin: 0 0 4px; font-size: 14px; }
.route-title p { margin: 0; color: var(--muted); font-size: 9px; overflow-wrap: anywhere; }
.route-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 17px; }
.route-stat { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 14, 11, 0.34); }
.route-stat small { display: block; color: var(--muted); font-size: 8px; letter-spacing: 0.07em; }
.route-stat strong { display: block; margin-top: 7px; font: 600 18px Georgia, serif; }
.route-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.route-detail > div { padding: 13px; border-top: 1px solid var(--line); }
.route-detail h4 { margin: 0 0 8px; color: var(--muted); font-size: 9px; letter-spacing: 0.07em; }
.route-detail p { margin: 4px 0; font-size: 10px; line-height: 1.5; }
.positive { color: var(--lime); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }

.progress-list { display: grid; gap: 14px; }
.progress-row { display: grid; grid-template-columns: 128px 1fr auto; gap: 12px; align-items: center; }
.progress-row label { margin: 0; color: var(--text); font-size: 10px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #78a53a, var(--lime)); }
.progress-row span { min-width: 54px; color: var(--muted); font: 600 10px Georgia, serif; text-align: right; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: rgba(5, 13, 11, 0.35); font-size: 8px; letter-spacing: 0.08em; }
tbody tr:last-child td { border-bottom: 0; }
.audit-list { display: grid; gap: 9px; }
.audit-row { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(80px, 0.6fr)); gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.audit-row:last-child { border-bottom: 0; }
.audit-game strong { display: block; margin-bottom: 4px; }
.audit-game span, .audit-cell small { color: var(--muted); font-size: 8px; }
.audit-cell strong { display: block; margin-top: 3px; overflow-wrap: anywhere; }
.hash { display: block; overflow-wrap: anywhere; color: var(--cyan); font: 9px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-state { padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.75; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); font: 500 18px Georgia, serif; }
.loading-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.loading-grid i { display: block; height: 112px; border-radius: 16px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px max(22px, calc((100vw - 1040px) / 2)); border-top: 1px solid var(--line); color: #617169; font-size: 9px; letter-spacing: 0.05em; }

@media (max-width: 760px) {
  .topbar { padding: 0 17px; }
  .sync-state { display: none; }
  .page-wrap { width: min(100% - 26px, 1040px); padding-top: 34px; }
  .hero { min-height: 158px; }
  .hero-orbit { display: none; }
  .boundary-banner { grid-template-columns: 1fr; }
  .boundary-banner span { width: max-content; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-body { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .route-detail { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr 1fr; }
  .audit-game { grid-column: 1 / -1; }
  .progress-row { grid-template-columns: 100px 1fr; }
  .progress-row span { grid-column: 2; }
}

@media (max-width: 470px) {
  .login-screen { padding: 14px; }
  .login-card { padding: 30px 24px; border-radius: 22px; }
  .login-card h1 { font-size: 42px; }
  .wordmark { font-size: 9px; }
  .text-button { display: none; }
  .hero h1 { font-size: 39px; }
  .section-nav { top: 76px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; }
  .metric-card strong { font-size: 23px; }
  .route-card { padding: 16px; }
  .route-top { grid-template-columns: 34px minmax(0, 1fr); }
  .route-top > .tag { grid-column: 2; width: max-content; }
  .route-rank { width: 34px; height: 34px; }
  .route-body { grid-template-columns: 1fr 1fr; }
  .route-stat:last-child { grid-column: 1 / -1; }
  footer { display: grid; padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
