:root {
  color-scheme: dark;
  --bg: #030604;
  --panel: rgba(7, 10, 8, 0.92);
  --panel-soft: rgba(9, 16, 11, 0.84);
  --line: rgba(182, 255, 204, 0.13);
  --line-strong: rgba(182, 255, 204, 0.34);
  --text: #f4fff7;
  --muted: rgba(226, 241, 230, 0.62);
  --faint: rgba(226, 241, 230, 0.38);
  --green: #88ff4d;
  --green-2: #21e982;
  --yellow: #ffd65a;
  --red: #ff5555;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Courier New", "Avenir Next", monospace;
  background:
    radial-gradient(circle at 12% -8%, rgba(136, 255, 77, 0.14), transparent 26rem),
    radial-gradient(circle at 86% 2%, rgba(33, 233, 130, 0.08), transparent 28rem),
    linear-gradient(180deg, #050906 0%, #010201 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.screen-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(136, 255, 77, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(136, 255, 77, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, black, transparent 92%);
}

.mission-shell {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.topbar,
.mission-hero,
.panel,
.metric-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(190px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 54px;
  height: 54px;
  padding: 7px;
  border: 1px solid rgba(136, 255, 77, 0.42);
  border-radius: 8px;
  background: rgba(6, 22, 10, 0.9);
  box-shadow: 0 0 30px rgba(136, 255, 77, 0.18);
}

.brand-mark span {
  border: 2px solid var(--green);
  border-radius: 50% 42% 48% 46%;
  box-shadow: inset 0 0 14px rgba(136, 255, 77, 0.18), 0 0 12px rgba(136, 255, 77, 0.22);
}

.brand-name {
  display: block;
  font-size: clamp(26px, 3vw, 48px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.9;
}

.brand-name span,
.metric-card strong,
.control-button.primary {
  color: var(--green);
  text-shadow: 0 0 22px rgba(136, 255, 77, 0.24);
}

.brand-subtitle,
.terminal-label,
.panel-label,
.metric-label,
.panel-note,
.empty-state {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.nav-tabs a,
.wallet-button,
.control-button,
.tiny-button,
.mode-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

.nav-tabs a {
  padding: 15px 22px;
}

.nav-tabs a:hover,
.nav-tabs a:focus-visible,
.nav-tabs .is-active,
.control-button.is-active,
.mode-button.is-active {
  border-color: rgba(136, 255, 77, 0.58);
  background: rgba(136, 255, 77, 0.08);
  color: var(--green);
}

.wallet-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
}

.status-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--faint);
}

.wallet-button.is-connected .status-led,
.state-badge.success::before {
  background: var(--green-2);
  box-shadow: 0 0 18px rgba(33, 233, 130, 0.72);
}

.wallet-button.is-connected {
  border-color: rgba(136, 255, 77, 0.58);
  color: var(--green);
}

.mission-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-top: 14px;
  padding: clamp(22px, 4vw, 42px);
  border-radius: 8px;
}

.mission-hero h1 {
  margin: 6px 0 0;
  font-size: clamp(58px, 7vw, 104px);
  line-height: 0.88;
  letter-spacing: 0.06em;
  text-shadow: 0 0 34px rgba(136, 255, 77, 0.18);
}

.mission-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.control-cluster,
.button-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.control-button {
  min-height: 42px;
  padding: 11px 18px;
}

.control-button:hover,
.tiny-button:hover,
.mode-button:hover,
.wallet-button:hover {
  transform: translateY(-1px);
}

.control-button.primary {
  border-color: rgba(136, 255, 77, 0.72);
  background: rgba(136, 255, 77, 0.14);
}

.control-button.danger {
  border-color: rgba(255, 85, 85, 0.45);
  background: rgba(255, 85, 85, 0.1);
  color: #ff9a9a;
}

.control-button.full {
  width: 100%;
  margin-top: 4px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 22px;
  border-radius: 8px;
}

.metric-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(136, 255, 77, 0.28);
  border-radius: 6px;
  color: var(--green);
  background: rgba(136, 255, 77, 0.06);
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.metric-card small,
.pool-stats small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.mission-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 12px;
  margin-top: 12px;
}

.secondary-grid {
  grid-template-columns: minmax(0, 1fr) minmax(430px, 0.86fr);
}

.panel {
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-label,
.metric-label {
  margin: 0;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.state-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.daemon-log {
  display: grid;
  align-content: start;
  min-height: 224px;
  max-height: 280px;
  overflow: auto;
  padding: 18px 20px;
  background:
    linear-gradient(rgba(136, 255, 77, 0.035) 1px, transparent 1px),
    rgba(0, 0, 0, 0.18);
  background-size: 100% 28px;
}

.log-line {
  display: grid;
  grid-template-columns: 76px 86px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  color: var(--green);
  font-size: 13px;
  line-height: 1.6;
}

.log-line span {
  color: var(--faint);
}

.log-line.warn,
.log-line.warn strong {
  color: var(--yellow);
}

.log-line.success,
.log-line.success strong {
  color: var(--green-2);
}

.countdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.countdown-row strong {
  color: var(--text);
  font-size: 30px;
}

.progress-track {
  height: 12px;
  margin: 0 20px 18px;
  overflow: hidden;
  border: 1px solid rgba(136, 255, 77, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  box-shadow: 0 0 20px rgba(136, 255, 77, 0.35);
  transform-origin: left;
  transition: transform 250ms linear;
}

.config-panel {
  padding-bottom: 16px;
}

.field-row {
  display: grid;
  gap: 8px;
  padding: 14px 18px 0;
}

.field-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-row input,
.field-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
}

.field-row input:focus,
.field-row select:focus {
  border-color: rgba(136, 255, 77, 0.58);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 16px 18px 6px;
}

.mode-button,
.tiny-button {
  min-height: 36px;
  padding: 8px 12px;
}

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.switch {
  position: relative;
  width: 48px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 160ms ease, background 160ms ease;
}

.switch.is-on {
  border-color: rgba(136, 255, 77, 0.58);
  background: rgba(136, 255, 77, 0.12);
}

.switch.is-on::after {
  transform: translateX(22px);
  background: var(--green);
}

.readiness-box {
  margin: 18px 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.readiness-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.readiness-head strong {
  color: var(--yellow);
}

.readiness-head strong.is-live {
  color: var(--green);
}

.readiness-list {
  display: grid;
  gap: 1px;
}

.readiness-item,
.readiness-empty {
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.readiness-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.readiness-item span {
  color: var(--yellow);
}

.readiness-item.is-ready span {
  color: var(--green);
}

#save-config {
  width: calc(100% - 36px);
  margin: 18px;
}

.pool-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pool-stats > div {
  min-height: 132px;
  padding: 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pool-stats strong {
  display: block;
  margin-top: 10px;
  font-size: 21px;
  overflow-wrap: anywhere;
}

.mini-table-head,
.holder-mini-row,
.ledger-head,
.ledger-row {
  display: grid;
  gap: 12px;
  align-items: center;
}

.holder-head,
.holder-mini-row {
  grid-template-columns: 46px minmax(0, 1fr) minmax(120px, auto);
}

.mini-table-head,
.ledger-head {
  padding: 14px 18px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-table-body {
  min-height: 206px;
}

.holder-mini-row,
.ledger-row {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 13px;
}

.holder-mini-row a,
.ledger-row a,
.ledger-status {
  color: var(--green);
  font-weight: 900;
}

.holder-mini-row strong {
  color: var(--text);
  text-align: right;
}

.panel-note {
  margin: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.ledger-panel {
  margin-top: 12px;
}

.ledger-head,
.ledger-row {
  grid-template-columns: 46px minmax(160px, 1.2fr) minmax(120px, 0.8fr) minmax(100px, 0.7fr) minmax(110px, 0.7fr) minmax(100px, 0.6fr);
}

.ledger-body {
  min-height: 230px;
}

.ledger-row strong {
  color: var(--text);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 148px;
  margin: 0;
  padding: 24px;
  text-align: center;
}

@media (max-width: 1180px) {
  .topbar,
  .mission-hero,
  .mission-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .mission-hero {
    display: grid;
  }

  .nav-tabs {
    justify-content: start;
    overflow-x: auto;
  }

  .metric-grid,
  .pool-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .mission-shell {
    width: min(100% - 18px, 1540px);
    padding-top: 9px;
  }

  .topbar,
  .mission-hero,
  .panel-head {
    padding: 14px;
  }

  .brand-name {
    font-size: 30px;
  }

  .mission-hero h1 {
    font-size: clamp(42px, 15vw, 68px);
  }

  .metric-grid,
  .pool-stats,
  .field-grid,
  .mode-row {
    grid-template-columns: 1fr;
  }

  .control-cluster,
  .button-pair {
    justify-content: stretch;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }

  .control-button,
  .tiny-button,
  .wallet-button,
  .nav-tabs a {
    width: 100%;
  }

  .holder-head,
  .ledger-head {
    display: none;
  }

  .holder-mini-row,
  .ledger-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .holder-mini-row strong,
  .ledger-row span:nth-child(n + 3),
  .ledger-row strong,
  .ledger-status {
    grid-column: 2;
    text-align: left;
  }

  .log-line {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
