:root {
  --ink: #03070d;
  --panel: rgba(4, 18, 33, .94);
  --panel-2: rgba(6, 28, 49, .94);
  --line: rgba(83, 171, 255, .58);
  --blue: #18a6ff;
  --blue-hot: #40c9ff;
  --gold: #d2a15d;
  --gold-pale: #f1d09d;
  --text: #f7fbff;
  --muted: #b8c8d7;
  --danger: #ff6b74;
  --ok: #58e6b0;
  --radius: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: #02050a; }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; background: white; color: #05101b; border-radius: .5rem; }
.skip-link:focus { top: 1rem; }

.gateway-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink) url("./assets/gateway-original.png") center / cover no-repeat;
}
.gateway-shell::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(0, 7, 15, .24); }
.gateway-shell::after { content: ""; position: absolute; z-index: -1; inset: 18% 25% 2%; background: radial-gradient(circle at 50% 40%, rgba(0, 137, 255, .18), rgba(0, 7, 18, 0) 62%); }
.ambient-grid { position: absolute; z-index: -1; left: 27%; right: 27%; bottom: 6%; height: 35%; opacity: .34; background-image: linear-gradient(rgba(34, 136, 220, .34) 1px, transparent 1px), linear-gradient(90deg, rgba(34, 136, 220, .34) 1px, transparent 1px); background-size: 38px 38px; transform: perspective(440px) rotateX(66deg); transform-origin: bottom; mask-image: linear-gradient(to top, #000 40%, transparent); }

.masthead { position: absolute; z-index: 2; top: clamp(1rem, 3.8vh, 3rem); left: 50%; width: min(47vw, 760px); transform: translateX(-50%); text-align: center; text-shadow: 0 2px 12px #000; }
.brand-wordmark { margin: 0; color: #f8f6f3; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.4vw, 3.8rem); letter-spacing: .21em; line-height: .95; }
.brand-product { display: flex; align-items: center; gap: 1.2rem; margin: .65rem auto .15rem; color: #f8f6f3; font: 500 clamp(1rem, 1.8vw, 1.7rem)/1 Georgia, serif; letter-spacing: .46em; }
.brand-product::before, .brand-product::after { content: ""; flex: 1; height: 1px; background: var(--gold); }
.brand-purpose { margin: .75rem 0 0; color: #eef4f8; font-size: clamp(.62rem, .82vw, .82rem); letter-spacing: .34em; text-transform: uppercase; }

.rail { position: absolute; top: 6%; width: 21%; text-align: center; text-shadow: 0 2px 12px #000; }
.rail-left { left: 1.5%; }
.rail-right { right: 1.5%; }
.crest { display: grid; place-items: center; width: clamp(70px, 8vw, 130px); aspect-ratio: .82; margin: 0 auto 1.4rem; color: var(--gold-pale); font: 700 clamp(2.4rem, 4.7vw, 5.5rem)/1 Georgia, serif; background: rgba(2, 8, 14, .75); clip-path: polygon(50% 0, 95% 23%, 84% 78%, 50% 100%, 16% 78%, 5% 23%); border: 1px solid var(--gold); filter: drop-shadow(0 0 12px rgba(0, 131, 255, .6)); }
.verity-orb { position: relative; width: clamp(80px, 8.8vw, 140px); aspect-ratio: 1; margin: 0 auto 1.1rem; border: 1px solid var(--gold); border-radius: 50%; background: rgba(2, 16, 31, .82); box-shadow: inset 0 0 30px rgba(0, 127, 255, .55), 0 0 18px rgba(0, 127, 255, .35); }
.verity-orb::before, .verity-orb::after, .verity-orb span { content: ""; position: absolute; border: 1px solid rgba(38, 159, 255, .68); border-radius: 50%; }
.verity-orb::before { inset: 15% 6%; }
.verity-orb::after { inset: 6% 28%; }
.verity-orb span { left: 8%; right: 8%; top: 48%; height: 1px; border-radius: 0; }
.rail-brand { margin: 0; color: var(--gold-pale); font: 500 clamp(.9rem, 1.6vw, 1.4rem)/1.3 Georgia, serif; letter-spacing: .22em; }
.rail-subtitle { margin: .45rem 0 1.8rem; color: var(--gold-pale); font: 500 .75rem/1 Georgia, serif; letter-spacing: .36em; text-transform: uppercase; }
.rail-list { margin: 1.5rem 0 0; padding: 1.3rem 0 0; list-style: none; border-top: 1px solid rgba(211, 161, 93, .65); }
.rail-list li { margin: 0 0 1rem; color: #f1f4f7; font: 500 clamp(.56rem, .8vw, .78rem)/1 Georgia, serif; letter-spacing: .24em; text-transform: uppercase; }

.gateway-panel { position: absolute; z-index: 5; left: 50%; top: 51%; width: min(590px, 42vw); min-height: 520px; transform: translate(-50%, -43%); padding: clamp(1.35rem, 2.3vw, 2.2rem); border: 1px solid rgba(74, 183, 255, .95); border-radius: var(--radius); background: var(--panel); box-shadow: 0 0 0 1px rgba(0, 106, 255, .45), 0 0 34px rgba(0, 137, 255, .48), inset 0 0 70px rgba(0, 91, 166, .18), 0 28px 80px rgba(0,0,0,.6); backdrop-filter: blur(18px); }
.panel-halo { position: absolute; inset: -10px; z-index: -1; border: 1px solid rgba(32, 157, 255, .2); border-radius: calc(var(--radius) + 8px); pointer-events: none; }
.panel-header { text-align: center; }
.scan-mark { position: relative; width: 66px; height: 55px; margin: 0 auto .8rem; }
.scan-mark span { position: absolute; width: 21px; height: 21px; border-color: var(--blue-hot); border-style: solid; filter: drop-shadow(0 0 5px var(--blue)); }
.scan-mark span:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 9px 0 0; }
.scan-mark span:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 9px 0 0; }
.scan-mark span:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 9px; }
.scan-mark span:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 9px; }
.scan-mark i { position: absolute; width: 9px; height: 9px; left: 50%; top: 48%; border: 2px solid var(--blue-hot); border-top: 0; border-radius: 0 0 8px 8px; transform: translate(-50%, -50%); }
.eyebrow { margin: 0; color: var(--gold-pale); font: 600 .72rem/1.2 Georgia, serif; letter-spacing: .22em; text-transform: uppercase; }
h1 { margin: .35rem 0 0; font-size: clamp(1.45rem, 2.2vw, 2rem); line-height: 1.15; }
.state-copy { max-width: 38rem; margin: .45rem auto 1rem; color: var(--muted); font-size: .94rem; }
.status-strip { display: flex; justify-content: center; align-items: center; gap: .45rem; min-height: 34px; margin: 0 0 1.1rem; color: #dce9f4; font-size: .78rem; }
.status-light { width: 8px; height: 8px; border-radius: 50%; background: #9fb3c4; box-shadow: 0 0 9px currentColor; }
.status-strip.is-ok .status-light { background: var(--ok); }
.status-strip.is-error .status-light { background: var(--danger); }
.status-separator { color: var(--gold); }

.view[hidden] { display: none !important; }
.view { animation: view-in .22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.action-stack { display: grid; gap: .8rem; }
.choice-button { display: grid; grid-template-columns: 52px 1fr 24px; align-items: center; gap: .9rem; width: 100%; min-height: 72px; padding: .7rem 1rem; border: 1px solid rgba(45, 163, 255, .9); border-radius: 14px; background: rgba(3, 20, 37, .88); text-align: left; cursor: pointer; box-shadow: inset 0 0 20px rgba(0, 116, 255, .08); transition: border-color .16s, background .16s, transform .16s, box-shadow .16s; }
.choice-primary { border-color: var(--blue-hot); box-shadow: 0 0 12px rgba(0, 151, 255, .22), inset 0 0 28px rgba(0, 116, 255, .13); }
.choice-button:hover { transform: translateY(-2px); background: rgba(6, 34, 58, .94); box-shadow: 0 0 18px rgba(0, 151, 255, .25); }
.choice-button strong { display: block; font-size: 1rem; }
.choice-button small { display: block; margin-top: .22rem; color: var(--muted); font-size: .75rem; }
.choice-icon { display: grid; place-items: center; width: 46px; height: 46px; border-right: 1px solid var(--gold); color: white; font-size: 1.3rem; }
.qr-mini { width: 30px; height: 30px; margin-left: 8px; border: 5px double white; border-radius: 3px; box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 5px white; }
.arrow { font-size: 2rem; color: white; }
.text-action { display: block; min-height: 44px; margin: .55rem auto 0; padding: .65rem; border: 0; background: transparent; color: #e9f5ff; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

form { display: grid; gap: 1rem; }
label { display: grid; gap: .42rem; color: #dfeaf3; font-size: .78rem; font-weight: 650; letter-spacing: .03em; }
input { width: 100%; min-height: 48px; padding: .7rem .85rem; border: 1px solid rgba(96, 155, 203, .56); border-radius: 9px; outline: 0; background: rgba(0, 7, 14, .78); color: white; }
input:focus { border-color: var(--blue-hot); box-shadow: 0 0 0 3px rgba(22, 164, 255, .22); }
input:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-note, .challenge-instruction { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.button-row { display: grid; grid-template-columns: minmax(100px, .7fr) minmax(180px, 1.3fr); gap: .75rem; margin-top: .2rem; }
.primary-button, .secondary-button { min-height: 48px; padding: .7rem 1rem; border-radius: 10px; cursor: pointer; }
.primary-button { border: 1px solid var(--blue-hot); background: #0878c5; color: white; font-weight: 750; box-shadow: 0 0 16px rgba(0, 144, 255, .18); }
.primary-button:hover { background: #0a8add; }
.primary-button:disabled { cursor: wait; opacity: .58; }
.secondary-button { border: 1px solid rgba(123, 162, 194, .52); background: rgba(9, 24, 38, .78); }
.full-width { width: 100%; }
.code-input { text-align: center; font: 700 1.45rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .32em; }
.code-input-long { font-size: 1.12rem; letter-spacing: .22em; }
.challenge-stage { text-align: center; }
.qr-frame { display: grid; place-items: center; width: 184px; height: 184px; margin: 0 auto; padding: 10px; border: 1px solid var(--blue-hot); border-radius: 14px; background: white; box-shadow: 0 0 20px rgba(0, 157, 255, .3); }
.qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.qr-fallback { margin: 0; padding: .75rem; border: 1px solid rgba(255, 107, 116, .55); border-radius: 9px; background: rgba(84, 15, 23, .3); color: #ffeef0; font-size: .76rem; line-height: 1.4; overflow-wrap: anywhere; }
.qr-fallback p { margin: 0 0 .45rem; }
.qr-fallback code { display: block; user-select: all; color: white; font-size: .7rem; }
.expiry { min-height: 1rem; margin: 0; color: var(--gold-pale); font-size: .75rem; }

.session-seal { display: grid; place-items: center; width: 82px; height: 82px; margin: .4rem auto 1rem; border: 1px solid var(--ok); border-radius: 50%; color: var(--ok); font-size: 2.2rem; box-shadow: 0 0 24px rgba(88, 230, 176, .28); }
.view[data-view="session"] { text-align: center; }
.view[data-view="session"] h2 { margin: 0; }
.session-copy { color: var(--muted); }
.session-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1.2rem 0; }
.session-meta div { padding: .8rem; border: 1px solid rgba(67, 134, 188, .38); border-radius: 10px; background: rgba(0,0,0,.16); }
.session-meta dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; }
.session-meta dd { margin: .35rem 0 0; font: 700 .83rem/1.2 ui-monospace, monospace; }
.notice { display: grid; grid-template-columns: 24px 1fr 32px; gap: .55rem; align-items: start; margin-top: .9rem; padding: .7rem .8rem; border: 1px solid rgba(255, 107, 116, .65); border-radius: 9px; background: rgba(84, 15, 23, .46); color: #ffeef0; }
.notice p { margin: 0; font-size: .78rem; line-height: 1.4; }
.notice button { border: 0; background: transparent; font-size: 1.25rem; cursor: pointer; }

.gateway-footer { position: absolute; left: 18%; right: 18%; bottom: 2.2%; display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 1.2rem; color: var(--gold-pale); font: 500 clamp(.5rem, .8vw, .72rem)/1 Georgia, serif; letter-spacing: .26em; text-transform: uppercase; white-space: nowrap; }
.gateway-footer i { height: 1px; background: var(--gold); }
.noscript { position: fixed; z-index: 50; left: 1rem; right: 1rem; bottom: 1rem; padding: 1rem; background: #6b1620; color: white; text-align: center; }

:focus-visible { outline: 3px solid #8fd8ff; outline-offset: 3px; }
@media (max-width: 1100px) {
  .rail { opacity: .66; }
  .rail-list { display: none; }
  .gateway-panel { width: min(620px, 58vw); top: 52%; }
  .masthead { width: 58vw; }
}
@media (max-width: 760px) {
  .gateway-shell { min-height: 100svh; padding: 8.4rem 1rem 5rem; background-position: center top; }
  .gateway-shell::before { background: rgba(0, 7, 15, .67); }
  .masthead { position: absolute; top: 1.5rem; width: 90%; }
  .brand-wordmark { font-size: 2.2rem; }
  .brand-product { width: min(350px, 90%); }
  .rail { display: none; }
  .gateway-panel { position: relative; left: auto; top: auto; width: min(100%, 600px); min-height: 0; margin: 0 auto; transform: none; padding: 1.25rem; }
  .gateway-footer { position: relative; left: auto; right: auto; bottom: auto; display: flex; justify-content: center; margin-top: 2rem; font-size: .58rem; white-space: normal; text-align: center; }
  .gateway-footer i, .gateway-footer span:first-child { display: none; }
  .field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .gateway-shell { padding-inline: .6rem; }
  .gateway-panel { border-radius: 18px; }
  .choice-button { grid-template-columns: 44px 1fr 16px; gap: .55rem; padding-inline: .7rem; }
  .choice-button small { display: none; }
  .button-row { grid-template-columns: 1fr; }
  .secondary-button { order: 2; }
  .session-meta { grid-template-columns: 1fr; }
  .code-input-long { font-size: .88rem; letter-spacing: .12em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
