/* The Realm: implementation of the approved handoff (design-tokens.css v1.0). */
:root {
  color-scheme: dark;
  --realm-bg: #0b0d0e;
  --realm-surface: #17191c;
  --realm-border: #454b53;
  --realm-divider: #292e33;
  --realm-text: #f2f3f5;
  --realm-secondary: #b4bed0;
  --realm-muted: #8c98aa;
  --realm-sage: #9bc88b;
  --realm-error: #ff8a82;
  --realm-button: #f2f3f5;
  --realm-button-hover: #dfe8dc;
  --realm-button-text: #101214;
  --realm-radius: 6px;
  --realm-gutter: 4%;
  --realm-edge: clamp(16px, 1.6vw, 32px); /* header/footer sit closer to the window edge */
  --realm-max: 1600px;
  --realm-font-ui: 'Inter', Arial, Helvetica, sans-serif;
  --realm-font-display: 'Instrument Serif', 'Times New Roman', serif;
}

*, *::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(--realm-bg); color: var(--realm-text);
  font: 16px/1.5 var(--realm-font-ui);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--realm-sage); text-underline-offset: 3px; }
a:hover { color: #b7dcaa; }
:focus-visible { outline: 2px solid var(--realm-sage); outline-offset: 3px; }
code { font: 0.92em/1.4 ui-monospace, Consolas, monospace; background: var(--realm-surface); border: 1px solid var(--realm-divider); border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -64px; z-index: 10; padding: 10px 14px; border-radius: var(--realm-radius); background: var(--realm-button); color: var(--realm-button-text); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* --- header ---------------------------------------------------------------- */
.realm-header {
  min-height: 64px; padding: 10px var(--realm-edge);
  border-bottom: 1px solid var(--realm-divider);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  background: var(--realm-bg); position: relative; z-index: 2;
}
.realm-brand { display: inline-flex; align-items: center; gap: 16px; color: var(--realm-text); text-decoration: none; min-height: 44px; }
.realm-brand img { width: 52px; height: 52px; }
.realm-wordmark { font: 400 18px/1 var(--realm-font-display); letter-spacing: .22em; text-transform: uppercase; }
.realm-brand:hover { color: var(--realm-text); }
.realm-nav { display: flex; align-items: center; gap: 24px; font-size: 15px; }
.realm-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.realm-nav-guide { color: var(--realm-secondary); }
.realm-nav-guide:hover { color: var(--realm-text); }

/* --- main + artwork ---------------------------------------------------------- */
.realm-main { position: relative; isolation: isolate; flex: 1 0 auto; }
.realm-inner { max-width: var(--realm-max); margin: 0 auto; padding: 64px var(--realm-gutter); }

.page-register .realm-main::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background: var(--realm-bg) url('/static/realm-bg-1586.webp') left 62% / cover no-repeat;
}
/* Deepen the right side so the form keeps contrast whatever the crop. */
.page-register .realm-main::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgb(11 13 14 / 0) 40%, rgb(11 13 14 / .55) 58%, rgb(11 13 14 / .9) 70%);
}
.page-register .realm-main { display: flex; }
.page-register .realm-inner {
  flex: 1; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr);
  gap: 40px; align-items: center;
  padding-top: clamp(20px, 4vh, 56px); padding-bottom: clamp(20px, 4vh, 56px);
}
/* Desktop: the whole page is one screen; the art fills whatever height that leaves. */
@media (min-width: 900px) {
  .page-register .realm-intro { align-self: start; }
}

.realm-intro { text-shadow: 0 1px 3px rgb(0 0 0 / .9), 0 2px 18px rgb(0 0 0 / .85); }
.realm-eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--realm-secondary); }
.realm-intro h1 {
  margin: 12px 0 14px;
  font: 400 clamp(44px, min(5.2vw, 9vh), 84px)/1.05 var(--realm-font-display); letter-spacing: -.01em;
}
.realm-lede { margin: 0; font-size: clamp(18px, 1.6vw, 24px); line-height: 1.4; color: var(--realm-secondary); }

/* --- form ----------------------------------------------------------------- */
.realm-panel { width: 100%; max-width: 540px; justify-self: end; }
.realm-panel h2 { margin: 0 0 4px; font: 400 clamp(36px, min(3.4vw, 6.5vh), 52px)/1.1 var(--realm-font-display); }
.realm-sub { margin: 0; font-size: 17px; line-height: 1.5; color: var(--realm-secondary); }
.realm-form { margin-top: clamp(16px, 3vh, 28px); }
.realm-form > * + * { margin-top: clamp(12px, 2.2vh, 20px); }
.realm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.realm-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.realm-field label { font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--realm-text); }
.realm-hint { font-size: 13px; line-height: 1.4; color: var(--realm-muted); white-space: nowrap; }
.realm-control { position: relative; }
.realm-input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--realm-border); border-radius: var(--realm-radius);
  background: rgb(23 25 28 / .94); color: var(--realm-text);
  font: 400 16px/1.4 var(--realm-font-ui);
  transition: border-color .15s, box-shadow .15s;
}
.has-toggle .realm-input { padding-right: 52px; }
.realm-input::placeholder { color: var(--realm-muted); opacity: 1; }
.realm-input:hover { border-color: #5a616b; }
.realm-input:focus { outline: none; }
.realm-input:focus-visible { border-color: var(--realm-sage); box-shadow: 0 0 0 1px var(--realm-sage); }
.realm-input[aria-invalid='true'] { border-color: var(--realm-error); }
.realm-input[aria-invalid='true']:focus-visible { box-shadow: 0 0 0 1px var(--realm-error); }
.realm-eye {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: var(--realm-radius); background: transparent; color: var(--realm-muted); cursor: pointer;
}
.realm-eye:hover { color: var(--realm-text); }
.realm-eye:focus-visible { outline-offset: -2px; }
.realm-eye .eye-closed, .realm-eye[aria-pressed='true'] .eye-open { display: none; }
.realm-eye[aria-pressed='true'] .eye-closed { display: block; }

.realm-help { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--realm-muted); }
.realm-error { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--realm-error); }
.realm-error svg { flex: none; margin-top: 3px; }

.realm-check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.realm-form > .realm-check { margin-top: clamp(4px, 1vh, 12px); }
.realm-check input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 24px; height: 24px; border: 1px solid var(--realm-border); border-radius: 4px;
  background: var(--realm-surface); display: grid; place-items: center; cursor: pointer;
}
.realm-check input::after { content: ''; width: 12px; height: 7px; border: solid var(--realm-button-text); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.realm-check input:checked { background: var(--realm-sage); border-color: var(--realm-sage); }
.realm-check input:checked::after { opacity: 1; }
.realm-check input[aria-invalid='true'] { border-color: var(--realm-error); }
.realm-check label { font-size: 15px; color: var(--realm-secondary); cursor: pointer; padding: 10px 0; }
.realm-form > .realm-check + .realm-error { margin-top: 0; }

.realm-submit {
  width: 100%; min-height: 52px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: var(--realm-radius);
  background: var(--realm-button); color: var(--realm-button-text);
  font: 600 17px/1 var(--realm-font-ui); text-decoration: none; cursor: pointer;
  transition: background .15s;
}
.realm-submit:hover { background: var(--realm-button-hover); color: var(--realm-button-text); }
.realm-submit:focus-visible { outline-offset: 3px; }
.realm-submit[aria-busy='true'] { opacity: .7; cursor: progress; }
.realm-submit:disabled { cursor: not-allowed; }
.realm-alt { margin: clamp(12px, 2vh, 20px) 0 0; text-align: center; font-size: 15px; color: var(--realm-muted); }

.realm-alert {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 10px 14px;
  border: 1px solid rgb(255 138 130 / .5); border-left-width: 3px; border-radius: var(--realm-radius);
  background: rgb(255 138 130 / .08); color: var(--realm-error); font-size: 15px;
}
.realm-alert svg { flex: none; margin-top: 2px; }

.realm-success h2 { outline: none; }
.realm-success:focus { outline: none; }
.realm-success .realm-sub strong { color: var(--realm-text); font-weight: 600; }
.realm-success .realm-submit { margin-top: 28px; }

/* --- guide & rules pages -------------------------------------------------- */
.page-doc .realm-main::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 420px; z-index: -1;
  background: url('/static/realm-bg-1586.webp') left 40% / cover no-repeat;
  opacity: .35; mask-image: linear-gradient(#000 30%, transparent);
  -webkit-mask-image: linear-gradient(#000 30%, transparent);
}
.realm-doc { max-width: 760px; }
.realm-doc h1 { margin: 12px 0 20px; font: 400 clamp(40px, 5vw, 64px)/1.08 var(--realm-font-display); }
.realm-doc .realm-lede { margin-bottom: 28px; }
.realm-doc p, .realm-doc li { color: var(--realm-secondary); }
.realm-doc strong { color: var(--realm-text); font-weight: 600; }
.realm-doc-h { margin: 48px 0 12px; font: 400 32px/1.15 var(--realm-font-display); }

.realm-status {
  display: inline-flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--realm-divider); border-radius: var(--realm-radius);
  background: rgb(23 25 28 / .85); color: var(--realm-secondary);
}
.realm-status strong { color: var(--realm-text); }
.realm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--realm-error); flex: none; }
.realm-dot.is-up { background: var(--realm-sage); box-shadow: 0 0 0 4px rgb(155 200 139 / .18); }

.realm-steps { list-style: none; counter-reset: step; margin: 40px 0 0; padding: 0; }
.realm-steps > li { counter-increment: step; position: relative; padding: 0 0 32px 64px; scroll-margin-top: 24px; }
.realm-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--realm-sage); border-radius: 50%; color: var(--realm-sage);
  font: 400 22px/1 var(--realm-font-display);
}
.realm-steps h2 { margin: 4px 0 8px; font: 400 28px/1.2 var(--realm-font-display); color: var(--realm-text); }
.realm-steps p { margin: 0 0 10px; }
.realm-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 12px 12px 16px; border: 1px solid var(--realm-border); border-radius: var(--realm-radius); background: var(--realm-surface); }
.realm-copy code { flex: 1 1 auto; border: 0; padding: 0; background: none; font-size: 17px; color: var(--realm-text); }
.realm-copy-btn { min-height: 44px; padding: 0 18px; border: 1px solid var(--realm-border); border-radius: var(--realm-radius); background: transparent; color: var(--realm-text); font: 500 15px var(--realm-font-ui); cursor: pointer; }
.realm-copy-btn:hover { border-color: var(--realm-sage); }
.realm-notes, .realm-rules { padding-left: 22px; }
.realm-notes li, .realm-rules li { margin: 10px 0; }

/* --- connection guide: one screen on desktop ------------------------------ */
.page-guide .realm-main { display: flex; }
.page-guide .realm-main::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background: var(--realm-bg) url('/static/realm-bg-1586.webp') left 62% / cover no-repeat;
}
.page-guide .realm-main::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgb(11 13 14 / .55) 0%, rgb(11 13 14 / .35) 40%, rgb(11 13 14 / .8) 100%),
              linear-gradient(90deg, rgb(11 13 14 / .2) 30%, rgb(11 13 14 / .75) 75%);
}
.page-guide .realm-inner {
  flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: center;
  gap: clamp(18px, 3.5vh, 40px);
  padding-top: clamp(20px, 4vh, 56px); padding-bottom: clamp(20px, 4vh, 56px);
}
.guide-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; text-shadow: 0 1px 3px rgb(0 0 0 / .9), 0 2px 18px rgb(0 0 0 / .85); }
.guide-head h1 { margin: 8px 0 0; font: 400 clamp(40px, min(4.6vw, 8vh), 72px)/1.05 var(--realm-font-display); }
.guide-head .realm-status { text-shadow: none; }

.guide-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.guide-card {
  counter-increment: step; position: relative;
  padding: clamp(18px, 2.6vh, 28px) 24px;
  border: 1px solid var(--realm-divider); border-radius: 10px;
  background: rgb(15 17 19 / .84); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  scroll-margin-top: 24px;
}
.guide-card::before {
  content: counter(step); width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 12px;
  border: 1px solid var(--realm-sage); border-radius: 50%; color: var(--realm-sage);
  font: 400 20px/1 var(--realm-font-display);
}
.guide-card h2 { margin: 0 0 8px; font: 400 clamp(24px, 3.2vh, 28px)/1.15 var(--realm-font-display); }
.guide-card p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; color: var(--realm-secondary); }
.guide-card p:last-child { margin-bottom: 0; }
.guide-card strong { color: var(--realm-text); font-weight: 600; }
.guide-card .realm-copy { margin-top: 12px; padding: 8px 8px 8px 14px; gap: 8px; }
.guide-card .realm-copy code { font-size: 15px; }
.guide-card .realm-copy-btn { min-height: 40px; padding: 0 14px; }

.guide-notes h2 { margin: 0 0 10px; font: 400 24px/1.2 var(--realm-font-display); }
.guide-notes ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.guide-notes li { padding-left: 14px; border-left: 2px solid rgb(155 200 139 / .55); font-size: 14.5px; line-height: 1.5; color: var(--realm-secondary); }

/* rules page: five cards, a lede beside the heading, a closing line + button */
.guide-steps--rules { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.guide-steps--rules .guide-card { padding-left: 20px; padding-right: 20px; }
.guide-lede { margin: 0; max-width: 420px; font-size: 17px; line-height: 1.5; color: var(--realm-secondary); text-align: right; }
.guide-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.guide-foot p { margin: 0; color: var(--realm-secondary); }
.guide-cta { width: auto; padding: 0 24px; }

@media (max-width: 1199px) and (min-width: 900px) {
  .guide-steps--rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1099px) and (min-width: 900px) {
  .guide-steps, .guide-notes ul { gap: 14px; }
  .guide-card { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 899px) {
  .page-guide .realm-main::before { inset: 0 0 auto 0; height: 320px; mask-image: linear-gradient(#000 40%, transparent); -webkit-mask-image: linear-gradient(#000 40%, transparent); }
  .page-guide .realm-main::after { inset: 0 0 auto 0; height: 320px; background: rgb(11 13 14 / .5); }
  .page-guide .realm-inner { padding: 36px 24px 40px; justify-content: flex-start; }
  .guide-steps, .guide-notes ul, .guide-steps--rules { grid-template-columns: 1fr; gap: 14px; }
  .guide-lede { text-align: left; }
  .guide-cta { width: 100%; }
}

/* --- footer ---------------------------------------------------------------- */
.realm-footer {
  min-height: 56px; padding: 14px var(--realm-edge);
  border-top: 1px solid var(--realm-divider);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  color: var(--realm-muted); font-size: 14px; background: var(--realm-bg);
}
.realm-footer .realm-wordmark { color: var(--realm-text); font-size: 16px; }

/* --- responsive --------------------------------------------------------------- */
@media (max-width: 1199px) and (min-width: 900px) {
  .page-register .realm-inner { grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr); gap: 32px; }
  .realm-intro h1 { font-size: clamp(44px, min(5vw, 8vh), 56px); }
}
@media (max-width: 899px) {
  .page-register .realm-main::before {
    inset: 0 0 auto 0; height: 300px;
    background-image: url('/static/realm-bg-960.webp');
    background-size: auto 440px; background-position: left 42%;
    mask-image: linear-gradient(#000 60%, transparent); -webkit-mask-image: linear-gradient(#000 60%, transparent);
  }
  /* Darken the banner behind the hero copy; the portal glow is brightest here. */
  .page-register .realm-main::after {
    inset: 0 0 auto 0; height: 300px;
    background: linear-gradient(180deg, rgb(11 13 14 / .55) 0%, rgb(11 13 14 / .35) 55%, rgb(11 13 14 / .9) 100%);
  }
  .page-register .realm-inner { display: block; padding: 0 24px 40px; }
  .realm-intro { min-height: 260px; padding-top: 36px; max-width: 520px; margin: 0 auto; }
  .realm-intro h1 { font-size: 42px; max-width: 360px; }
  .realm-lede { font-size: 16px; }
  .realm-eyebrow { font-size: 11px; }
  .realm-panel { margin: 8px auto 0; max-width: 520px; padding-top: 0; }
  .realm-panel h2 { font-size: 40px; }
  .realm-sub { font-size: 16px; }
  .realm-form { margin-top: 24px; }
  .page-doc .realm-inner { padding: 40px 24px 48px; }
}
@media (max-width: 479px) {
  :root { --realm-gutter: 24px; }
  .realm-brand { gap: 12px; }
  .realm-brand img { width: 42px; height: 42px; }
  .realm-wordmark { font-size: 15px; }
  .realm-intro h1 { font-size: 38px; }
  .realm-row { grid-template-columns: 1fr; }
  .realm-steps > li { padding-left: 52px; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .realm-eyebrow { display: none; }
  .realm-intro h1, .guide-head h1 { margin-top: 0; }
  .realm-input { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .realm-submit { min-height: 46px; }
  .realm-footer { min-height: 48px; padding-top: 10px; padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
