:root {
  --bg: #141417;
  --surface: #1c1c21;
  --surface-2: #24242b;
  --border: rgba(244, 241, 234, 0.09);
  --border-strong: rgba(244, 241, 234, 0.16);
  --text: #f4f1ea;
  --muted: #a1a1aa;
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.ambient-glow {
  position: fixed;
  top: -180px;
  right: -120px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, rgba(20, 20, 23, 0) 68%);
  pointer-events: none;
  z-index: 0;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1140px, 92vw);
  margin: 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(20, 20, 23, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--amber);
}

.brand-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 0.92rem;
  color: var(--muted);
}

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

.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--surface-2);
  color: var(--amber);
}

/* HERO */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.85fr;
  gap: 40px;
  align-items: center;
  padding: 52px 0 34px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 0.76rem;
  color: var(--text);
  margin-bottom: 20px;
}

.led-dot, .led-mini {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.led-dot.amber, .led-mini.amber {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.85);
}

.led-dot.green, .led-mini.green {
  background: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
}

.led-dot.red, .led-mini.red {
  background: var(--red);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.9);
  animation: pulse-red 1.2s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.9); }
}

.hero-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}

.accent {
  color: var(--amber);
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1.03rem;
  max-width: 58ch;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

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

.btn-primary {
  background: var(--amber);
  color: #141417;
}

.btn-primary:hover {
  background: #fbbf24;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: rgba(245, 158, 11, 0.45);
}

.countdown-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.countdown-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.countdown-bar .divider {
  width: 1px;
  height: 30px;
  background: var(--border-strong);
}

.label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.countdown-item .value {
  font-size: 0.96rem;
  font-weight: 600;
}

.danger-soft {
  color: #fca5a5;
}

/* AVATAR CARD */
.avatar-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
}

.avatar-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #1d1d22;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.led-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 20, 23, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  font-size: 0.72rem;
}

.avatar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 4px 4px;
}

.avatar-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.avatar-role {
  font-size: 0.82rem;
  color: var(--muted);
}

.host-chip {
  font-size: 0.72rem;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.28);
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 56px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chip.green-soft {
  background: var(--green-soft);
  color: var(--green);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-fill.amber {
  background: var(--amber);
}

.progress-fill.green {
  background: var(--green);
}

.kpi-foot {
  font-size: 0.8rem;
  color: var(--muted);
}

/* SECTIONS */
.section {
  margin-bottom: 64px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-kicker {
  display: block;
  font-size: 0.74rem;
  color: var(--amber);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.section-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--muted);
  max-width: 52ch;
  font-size: 0.94rem;
}

/* PROJECT CARDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.project-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tag-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.tag-badge.live {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.28);
}

.project-card h3 {
  font-size: 1.08rem;
  font-weight: 600;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--muted);
  flex: 1;
}

.project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.project-link {
  color: var(--amber);
  font-weight: 600;
}

/* SPLIT LEDGER & LOGS */
.split-section {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-group {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}

.filter-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.filter-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ledger-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-strong);
}

.ledger-table td {
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ledger-table td:first-child,
.ledger-table td:last-child {
  white-space: nowrap;
}

.ledger-table tr:last-child td {
  border-bottom: 0;
}

.right {
  text-align: right;
}

.amt-pos {
  color: var(--green);
  font-weight: 600;
}

.amt-neg {
  color: #fca5a5;
  font-weight: 600;
}

.cat-pill {
  display: inline-block;
  font-size: 0.73rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

/* LOGS */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.log-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--amber);
  margin-bottom: 8px;
}

.log-entry h3 {
  font-size: 0.98rem;
  margin-bottom: 8px;
}

.log-entry p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
}

/* RULES */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.rule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.rule-num {
  font-size: 0.74rem;
  color: var(--amber);
  margin-bottom: 8px;
}

.rule-card h3 {
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.rule-card p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* FOOTER */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-left a, .link-btn {
  color: var(--amber);
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.footer-left a:hover, .link-btn:hover {
  text-decoration: underline;
}

.footer-links {
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* MODAL */
.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: min(640px, 95vw);
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-box.modal-wide {
  width: min(1000px, 95vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
}

.sheet-img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.legal-copy h4 {
  margin: 14px 0 6px;
  color: var(--amber);
}

.legal-copy h4:first-child {
  margin-top: 0;
}

.legal-copy p {
  font-size: 0.92rem;
  color: var(--muted);
}

.legal-copy a {
  color: var(--amber);
  text-decoration: underline;
}

/* RESPONSIVE */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 32px;
  }
  .avatar-card {
    max-width: 360px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cards-grid,
  .split-section,
  .rules-grid {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .countdown-bar .divider {
    display: none;
  }
}
