:root {
  --bg: #07090d;
  --ice: #f0f3f7;
  --muted: #8e98a8;
  --blue: #4666d8;
  --blue2: #6884ff;
  --line: rgba(240, 243, 247, 0.24);
  --panel: rgba(6, 8, 12, 0.86);
  --panel-strong: rgba(8, 11, 17, 0.96);
  --success: #b9f6d2;
  --danger: #ffc1c1;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ice);
  font-family: var(--sans);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(4, 6, 10, 0.78), rgba(4, 6, 10, 0.92)),
    url("./assets/background.webp") center / cover fixed;
}

body::after {
  position: fixed;
  z-index: 100;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  content: "";
  opacity: 0.045;
  pointer-events: none;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue2);
  outline-offset: 2px;
}

.utility-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 11, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--ice);
  text-decoration: none;
}

.brand strong {
  font: 400 31px/1 var(--serif);
  letter-spacing: -0.04em;
}

.kicker,
.eyebrow,
.badge,
.nav-button,
.label,
.meta,
.status,
.table th {
  font: 700 9px/1.4 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.brand span,
.muted,
.help {
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(104, 132, 255, 0.45);
  background: rgba(70, 102, 216, 0.13);
  color: #cbd7ff;
}

.badge::before {
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue2);
  box-shadow: 0 0 10px rgba(104, 132, 255, 0.9);
  content: "";
}

.link-button,
.action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(4, 6, 10, 0.52);
  color: var(--ice);
  cursor: pointer;
  font: 700 9px/1 var(--mono);
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.action:hover,
.link-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.action.primary {
  border-color: var(--ice);
  background: var(--ice);
  color: var(--bg);
}

.action.danger {
  border-color: rgba(255, 120, 120, 0.35);
  color: var(--danger);
}

.action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.shell {
  display: grid;
  width: min(1500px, 100%);
  min-height: calc(100vh - 66px);
  margin: 0 auto;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 66px;
  height: calc(100vh - 66px);
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: rgba(5, 7, 11, 0.62);
  backdrop-filter: blur(14px);
}

.sidebar-title {
  margin: 0 10px 18px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-button {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border: 1px solid transparent;
  background: transparent;
  color: #aab3c1;
  cursor: pointer;
  text-align: left;
}

.nav-button::after {
  content: "↗";
  opacity: 0;
}

.nav-button:hover,
.nav-button.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ice);
}

.nav-button.active::after {
  opacity: 0.7;
}

.sidebar-note {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  color: #6f7a8c;
  font: 700 8px/1.7 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.content {
  min-width: 0;
  padding: 45px clamp(24px, 5vw, 70px) 90px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.page-head h1,
.panel-title {
  margin: 8px 0 0;
  font: 400 clamp(48px, 6vw, 86px) / 0.9 var(--serif);
  letter-spacing: -0.05em;
}

.page-head p {
  max-width: 580px;
  margin: 16px 0 0;
  color: #aab3c1;
  font-size: 14px;
  line-height: 1.65;
}

.api-key-dock {
  width: min(430px, 100%);
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.api-key-row {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.api-key-row input {
  min-width: 0;
  flex: 1;
}

.panel {
  display: none;
  animation: panel-in 0.35s ease both;
}

.panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.card h2,
.card h3 {
  margin: 8px 0 12px;
  font: 400 31px/1.05 var(--serif);
  letter-spacing: -0.035em;
}

.card p {
  color: #aab3c1;
  font-size: 13px;
  line-height: 1.65;
}

.card-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field + .field {
  margin-top: 15px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  background: rgba(3, 5, 9, 0.72);
  color: var(--ice);
}

input,
select {
  height: 43px;
  padding: 0 12px;
}

textarea {
  min-height: 116px;
  padding: 12px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #606b7d;
}

.scope-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #abb5c4;
  font-size: 12px;
}

.check input {
  width: 15px;
  height: 15px;
}

.one-time-key {
  margin-top: 16px;
  padding: 17px;
  border: 1px solid rgba(104, 132, 255, 0.5);
  background: rgba(70, 102, 216, 0.1);
}

.secret {
  overflow: auto;
  margin: 10px 0;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #030509;
  font: 12px/1.6 var(--mono);
  word-break: break-all;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th,
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: #7f8a9b;
}

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

.table button {
  min-height: 30px;
  padding: 0 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #aeb9c9;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #667083;
  content: "";
}

.status.completed::before,
.status.active::before {
  background: var(--success);
  box-shadow: 0 0 9px rgba(185, 246, 210, 0.5);
}

.status.running::before,
.status.queued::before {
  background: #cbd8ff;
  box-shadow: 0 0 9px rgba(104, 132, 255, 0.7);
}

.status.failed::before,
.status.revoked::before,
.status.canceled::before {
  background: #ff9e9e;
}

.result-box,
.execution-box,
pre {
  overflow: auto;
  max-width: 100%;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #030509;
  color: #c5cfde;
  font: 11px/1.7 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.execution-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.execution-list li {
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #b1bbc9;
  font-size: 13px;
}

.execution-list li::before {
  margin-right: 9px;
  color: var(--success);
  content: "✓";
}

.progress {
  height: 9px;
  margin: 18px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #030509;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue2));
}

.metric {
  font: 400 42px/1 var(--serif);
  letter-spacing: -0.04em;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 4px;
}

.price strong {
  font: 400 39px/1 var(--serif);
}

.price s {
  color: #737d8d;
}

.empty {
  padding: 32px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: #7f8a9b;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 44px));
  padding: 16px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: var(--panel-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  color: #d6deea;
  font-size: 13px;
  line-height: 1.5;
}

.toast[hidden],
[hidden] {
  display: none !important;
}

.toast strong {
  display: block;
  margin-bottom: 5px;
  color: var(--danger);
}

.request-id {
  display: block;
  margin-top: 8px;
  color: #7f8a9b;
  font: 9px var(--mono);
}

.sandbox-banner {
  margin-bottom: 18px;
  padding: 12px 15px;
  border: 1px solid rgba(104, 132, 255, 0.34);
  background: rgba(70, 102, 216, 0.09);
  color: #bdc9ed;
  font-size: 12px;
  line-height: 1.55;
}

.presale-banner {
  width: fit-content;
  margin: 20px 0 14px;
  padding: 10px 13px;
  border: 1px solid rgba(104, 132, 255, 0.7);
  background: rgba(70, 102, 216, 0.18);
  color: #d8e0ff;
  font: 700 10px/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.relic-name {
  color: #ced8f5;
  font: 700 10px/1.5 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.presale-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(104, 132, 255, 0.72);
  background: var(--panel-strong);
  color: var(--ice);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.72);
}

.presale-dialog::backdrop {
  background: rgba(1, 3, 7, 0.82);
  backdrop-filter: blur(8px);
}

.presale-dialog-card {
  padding: clamp(24px, 5vw, 42px);
}

.presale-dialog-card h2 {
  margin: 12px 0 18px;
  font: 400 clamp(36px, 6vw, 58px) / 0.95 var(--serif);
  letter-spacing: -0.045em;
}

.presale-dialog-card p {
  color: #b8c1d0;
  font-size: 14px;
  line-height: 1.7;
}

.presale-selection {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(70, 102, 216, 0.1);
  color: #d8e0ff;
  font: 700 11px/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.presale-ack {
  margin-top: 20px;
  line-height: 1.55;
}

.presale-ack + .presale-ack {
  margin-top: 12px;
}

.presale-ack a,
.receipt-legal a {
  color: var(--accent);
}

.receipt-legal {
  margin: 22px 0 0;
  font-size: 12px;
}

.founder-page {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.founder-head {
  align-items: start;
}

.founder-head > div:first-child {
  max-width: 780px;
}

.founder-truth {
  margin-top: 18px;
}

.checkout-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.checkout-receipt {
  width: min(760px, 100%);
  padding: clamp(28px, 6vw, 58px);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.56);
}

.checkout-receipt h1 {
  margin: 12px 0 20px;
  font: 400 clamp(48px, 8vw, 88px) / 0.88 var(--serif);
  letter-spacing: -0.055em;
}

.checkout-receipt p,
.checkout-receipt li {
  color: #b8c1d0;
  font-size: 15px;
  line-height: 1.75;
}

.relic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 0;
  list-style: none;
}

.relic-list li {
  padding: 9px 12px;
  border: 1px solid rgba(104, 132, 255, 0.4);
  color: #d8e0ff;
  font: 700 10px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

code {
  color: #ced8f5;
  font-family: var(--mono);
}

summary {
  cursor: pointer;
  color: #bec8d7;
  font: 700 9px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .utility-header {
    padding: 0 17px;
  }

  .brand span {
    display: none;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 30;
    top: 66px;
    width: 100%;
    height: auto;
    overflow-x: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-title,
  .sidebar-note {
    display: none;
  }

  .nav {
    display: flex;
    width: max-content;
  }

  .nav-button {
    min-height: 38px;
  }

  .content {
    padding: 34px 18px 70px;
  }

  .page-head {
    display: grid;
  }

  .api-key-dock {
    width: 100%;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-actions .link-button {
    display: none;
  }

  .page-head h1,
  .panel-title {
    font-size: 50px;
  }

  .scope-grid {
    grid-template-columns: 1fr;
  }

  .api-key-row {
    display: grid;
  }
}

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