/* Radius WoL — visual language follows theradius.xyz:
   ink background, hairline grid, serif display type with an italic gradient
   second line, uppercase monospace labels and cyan signal accents. */

:root {
  --ink: #050505;
  --ink-2: #0b0c0c;
  --paper: #f3f0ea;
  --muted: #9b9b98;
  --dim: #777773;
  --line: #ffffff30;
  --line-soft: #ffffff14;
  --line-faint: #ffffff09;
  --cyan: #43f1d1;
  --mint: #70ffd6;
  --sky: #58d8ff;
  --blue: #3b6dff;
  --signal: #ff5b43;
  --amber: #ffc857;

  --serif: "Iowan Old Style", Baskerville, "Times New Roman", serif;
  --mono: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --radius: 4px;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Hairline grid + soft colour glows behind everything */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 28rem at 78% 18%, #43f1d10e, transparent 70%),
    radial-gradient(36rem 30rem at 92% 70%, #3b6dff14, transparent 70%),
    radial-gradient(30rem 22rem at 8% 92%, #58d8ff0b, transparent 70%),
    linear-gradient(var(--line-faint) 1px, transparent 1px) 0 0 / 96px 96px,
    linear-gradient(90deg, var(--line-faint) 1px, transparent 1px) 0 0 / 96px 96px,
    var(--ink);
}

a { color: var(--paper); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--cyan); text-decoration-color: var(--cyan); }
:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }

.mono, code { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.text-signal { color: var(--signal); }

.mono-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--line-soft);
  background: #050505b8;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--paper); }
.brand:hover { color: var(--paper); }
.brand-mark { color: var(--paper); }
.brand-word { font-family: var(--sans); font-weight: 800; letter-spacing: .02em; font-size: 17px; }
.brand-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--cyan);
  border: 1px solid #43f1d13d; padding: 1px 6px; border-radius: 2px;
}
.nav { display: flex; gap: 28px; margin: 0 auto; }
.nav a {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--paper); }
.nav a.is-active { color: var(--paper); border-bottom-color: var(--cyan); }
.nav-cta { margin: 0; }

.bracket-btn {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 4px 0;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.bracket-btn:hover { color: var(--cyan); }

/* ---------------------------------------------------------------- layout */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter) 64px; flex: 1; }
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px var(--gutter); border-top: 1px solid var(--line-soft);
}

.hero { padding: 64px 0 40px; }
.hero-tight { padding: 48px 0 28px; }
.crumb {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.display {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6.2vw, 76px);
  line-height: .98;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.display em {
  font-style: italic;
  background: linear-gradient(90deg, var(--mint), var(--sky) 55%, var(--blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.display-sm { font-size: clamp(32px, 4vw, 48px); }
.lede { max-width: 560px; color: #d9d6cf; font-size: 17px; margin: 0 0 32px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 18px; }
.section-label {
  display: flex; align-items: baseline; gap: 12px; margin: 0 0 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--paper);
}
.section-head .section-label { margin: 0; }
.section-num { color: var(--cyan); }

/* ---------------------------------------------------------------- dots + pills */
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot-live { background: var(--cyan); box-shadow: 0 0 10px #43f1d1a0; }
.dot-signal { background: var(--signal); box-shadow: 0 0 10px #ff5b4380; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px;
  border: 1px solid var(--line-soft); border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.status-pill.is-online, [data-state="online"] .status-pill { color: var(--cyan); border-color: #43f1d13d; background: #43f1d10e; }
.status-pill.is-online .dot, [data-state="online"] .status-pill .dot { background: var(--cyan); box-shadow: 0 0 10px #43f1d1; }
.status-pill.is-offline, [data-state="offline"] .status-pill { color: var(--signal); border-color: #ff5b4340; background: #ff5b430d; }
.status-pill.is-offline .dot, [data-state="offline"] .status-pill .dot { background: var(--signal); }
[data-state="waking"] .status-pill { color: var(--amber); border-color: #ffc85740; background: #ffc8570d; }
[data-state="waking"] .status-pill .dot { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
[data-state="unknown"] .status-pill .dot { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- stats */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; max-width: 760px;
  border: 1px solid var(--line-soft); border-radius: var(--radius); background: #ffffff06;
}
.stat { padding: 16px 18px; border-left: 1px solid var(--line-soft); }
.stat:first-child { border-left: 0; }
.stat dt { margin-bottom: 6px; }
.stat dd { margin: 0; font-family: var(--serif); font-size: 32px; line-height: 1; }
.stat dd.stat-small { font-family: var(--mono); font-size: 14px; padding-top: 10px; color: var(--muted); }
.stat dd[data-stat="online"] { color: var(--cyan); }
.stat dd[data-stat="offline"] { color: var(--signal); }

/* ---------------------------------------------------------------- server cards */
.server-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.server-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px; min-height: 248px;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff09, #ffffff03);
  transition: border-color .2s, box-shadow .2s;
}
.server-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border-top: 1px solid transparent;
}
.server-card[data-state="online"] { border-color: #43f1d129; }
.server-card[data-state="online"]::before { border-top-color: var(--cyan); box-shadow: 0 -8px 30px -18px var(--cyan); }
.server-card[data-state="offline"]::before { border-top-color: #ff5b4399; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.server-name { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; overflow-wrap: anywhere; }
.server-desc { margin: 0; color: var(--muted); font-size: 13.5px; }

.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 6px 0 0; }
.meta > div { min-width: 0; }
.meta > .meta-wide { grid-column: 1 / -1; }
.meta dt { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.meta dd { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }

.wake-form { display: none; align-items: center; gap: 12px; margin: auto 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.server-card[data-state="offline"] .wake-form { display: flex; }
.power-btn {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  color: var(--signal); background: #ff5b430d; border: 1px solid #ff5b4366;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.power-btn:hover { color: var(--ink); background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 24px #43f1d180; }
.power-btn:active { transform: scale(.96); }
.power-btn[disabled] { cursor: progress; opacity: .6; }
.server-card[data-state="offline"] .wake-label { color: var(--paper); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 40px; padding: 9px 16px; border-radius: var(--radius); cursor: pointer;
  font: 500 14px/1.2 var(--sans); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: transparent; color: var(--paper);
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { color: var(--paper); border-color: var(--paper); background: #ffffff0f; }
.btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-primary:hover { background: var(--cyan); border-color: var(--cyan); color: var(--ink); }
.btn-danger { border-color: #ff5b4366; color: var(--signal); }
.btn-danger:hover { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.actions { white-space: nowrap; }
.actions > * + * { margin-left: 6px; }

/* ---------------------------------------------------------------- panels + forms */
.panel {
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 24px;
  background: linear-gradient(180deg, #ffffff09, #ffffff03);
}
.panel-danger { border-color: #ff5b4333; }
.panel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.panel .muted { margin-top: 0; }
.panel-status { margin: 0 0 10px; }
.form-panel { max-width: 820px; }
.form-panel .section-label:not(:first-of-type) { margin-top: 28px; }

.form-grid { display: grid; gap: 4px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.field { margin-bottom: 14px; }
.field-label, .choice-list legend {
  display: block; margin-bottom: 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.input {
  width: 100%; min-height: 42px; padding: 10px 12px; border-radius: var(--radius);
  font: 15px/1.3 var(--sans); color: var(--paper);
  background: #ffffff06; border: 1px solid var(--line-soft);
  transition: border-color .15s, background .15s;
}
.input::placeholder { color: #ffffff40; }
.input:hover { border-color: var(--line); }
.input:focus { outline: none; border-color: var(--cyan); background: #43f1d108; box-shadow: 0 0 0 3px #43f1d11c; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
select.input option { background: var(--ink-2); }
.input-code { font-family: var(--mono); font-size: 26px; letter-spacing: .5em; text-align: center; }
.has-error .input { border-color: #ff5b4399; }
.field-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--dim); }
.field-error { margin: 6px 0 0; font-size: 13px; color: var(--signal); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--cyan); margin: 0; }
.choice-list { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
  font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-faint); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #ffffff05; }
.table th.right, .table td.right { text-align: right; }
.tag {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--line-soft); border-radius: 2px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.tag-accent { color: var(--cyan); border-color: #43f1d13d; }
.pager { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 18px; }

/* ---------------------------------------------------------------- flashes / toast / empty */
.flashes { display: grid; gap: 8px; margin: 20px 0 0; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-soft); background: #ffffff06; font-size: 14px;
}
.flash-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sky); flex: none; }
.flash-success { border-color: #43f1d13d; } .flash-success .flash-dot { background: var(--cyan); }
.flash-error { border-color: #ff5b4355; } .flash-error .flash-dot { background: var(--signal); }
.flash-error:not(:has(.flash-dot)) { color: #ffd2ca; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px; border-radius: var(--radius); border: 1px solid #43f1d13d;
  background: #0b0c0cf2; box-shadow: 0 10px 40px #000a; font-size: 14px;
}
.toast.is-error { border-color: #ff5b4366; }

.empty {
  padding: 48px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty p { margin: 0 0 14px; color: var(--muted); }

/* ---------------------------------------------------------------- auth */
.auth-main { display: flex; flex-direction: column; justify-content: center; }
.auth-main > .flashes { width: 100%; max-width: 440px; margin-left: auto; }
.auth-wrap {
  width: 100%; display: grid; grid-template-columns: 1.1fr minmax(320px, 440px); gap: clamp(32px, 6vw, 96px);
  align-items: center; padding: 56px 0;
}
.auth-wrap .flashes { grid-column: 1 / -1; }
.auth-card {
  padding: 32px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff0b, #ffffff04); box-shadow: 0 30px 80px -40px #43f1d129;
}
.auth-title { margin: 6px 0 8px; font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.05; }
.auth-card > .muted { margin: 0 0 22px; font-size: 14px; }
.auth-card form { margin-top: 8px; }
.auth-links { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.auth-links a { color: var(--muted); }
.flow { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 0; max-width: 360px; }
.flow li { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line-soft); font-size: 15px; }
.flow li .mono-label { color: var(--cyan); }

.qr-block { display: grid; justify-items: center; gap: 10px; margin: 18px 0 22px; }
.qr-block img { width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: var(--radius); }
.secret-key {
  font-size: 13px; letter-spacing: .08em; word-break: break-all; text-align: center;
  padding: 8px 12px; border: 1px dashed var(--line); border-radius: var(--radius); user-select: all;
}
.code-list {
  list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.code-list code {
  display: block; padding: 8px 10px; text-align: center; border: 1px solid var(--line-soft);
  border-radius: var(--radius); background: #ffffff06; user-select: all;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 12px 20px; }
  .nav { order: 3; width: 100%; margin: 0; gap: 20px; overflow-x: auto; }
  .nav-cta { margin-left: auto; }
  .auth-wrap { grid-template-columns: 1fr; padding: 32px 0; }
  .auth-aside { display: none; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .form-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 22px; }
  .hero { padding: 40px 0 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Equal account cards, with a single column on narrow screens. */
.account-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.account-panels > .panel {
  aspect-ratio: 1 / 1; min-width: 0; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: clamp(16px, 3vw, 32px);
}
.account-panels .btn { margin-top: auto; }
.account-panels .status-pill { max-width: 100%; white-space: normal; }
@media (max-width: 700px) {
  .account-panels { grid-template-columns: minmax(0, 1fr); }
}
