:root {
  color-scheme: dark;
  --page: #050b0a;
  --panel: #0a1513;
  --panel-raised: #10211e;
  --line: rgba(184, 255, 235, 0.13);
  --line-strong: rgba(111, 245, 210, 0.34);
  --text: #edf9f5;
  --muted: #98aaa5;
  --faint: #657a74;
  --teal: #62edc9;
  --teal-strong: #29cda4;
  --teal-ink: #03251c;
  --danger: #ff91a3;
  --warning: #ffd28a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.46);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(98, 237, 201, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 237, 201, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, #12322a 0, #08120f 38%, var(--page) 78%);
  background-size: 46px 46px, 46px 46px, auto;
}

button {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(41, 205, 164, 0.11), transparent 28%),
    radial-gradient(circle at 88% 78%, rgba(35, 170, 194, 0.08), transparent 30%);
}

.shell {
  width: min(100% - 32px, 620px);
  margin: 0 auto;
  padding: clamp(24px, 5vh, 54px) 0 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 4px 20px;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.shield {
  position: relative;
  display: block;
  width: 36px;
  height: 40px;
  flex: 0 0 auto;
  background: var(--teal);
  clip-path: polygon(50% 0, 92% 15%, 88% 59%, 74% 82%, 50% 100%, 26% 82%, 12% 59%, 8% 15%);
  filter: drop-shadow(0 0 12px rgba(98, 237, 201, 0.24));
}

.shield::before {
  content: "";
  position: absolute;
  inset: 2px;
  background: #0b1b17;
  clip-path: inherit;
}

.shield-keyhole {
  position: absolute;
  z-index: 1;
  top: 14px;
  left: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  transform: translateX(-50%);
}

.shield-keyhole::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--teal);
  transform: translateX(-50%);
}

.game-badge {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(98, 237, 201, 0.07);
  font: 700 0.7rem/1 var(--font-sans);
  letter-spacing: 0.12em;
}

.guard-card {
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(16, 33, 30, 0.93), rgba(7, 16, 14, 0.96));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(16px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font: 700 0.7rem/1 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px rgba(98, 237, 201, 0.85);
}

h1 {
  margin: 17px 0 9px;
  font-size: clamp(1.7rem, 6vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 48ch;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

h1,
.lede {
  text-align: center;
}

.code-stage {
  display: grid;
  place-items: center;
  margin: clamp(34px, 7vw, 46px) 0 28px;
}

.timer-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  width: clamp(232px, 58vw, 268px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal) var(--progress), rgba(255, 255, 255, 0.075) 0deg);
  box-shadow: 0 0 62px rgba(41, 205, 164, 0.08);
}

.timer-ring[data-progress="1"] { --progress: 12deg; }
.timer-ring[data-progress="2"] { --progress: 24deg; }
.timer-ring[data-progress="3"] { --progress: 36deg; }
.timer-ring[data-progress="4"] { --progress: 48deg; }
.timer-ring[data-progress="5"] { --progress: 60deg; }
.timer-ring[data-progress="6"] { --progress: 72deg; }
.timer-ring[data-progress="7"] { --progress: 84deg; }
.timer-ring[data-progress="8"] { --progress: 96deg; }
.timer-ring[data-progress="9"] { --progress: 108deg; }
.timer-ring[data-progress="10"] { --progress: 120deg; }
.timer-ring[data-progress="11"] { --progress: 132deg; }
.timer-ring[data-progress="12"] { --progress: 144deg; }
.timer-ring[data-progress="13"] { --progress: 156deg; }
.timer-ring[data-progress="14"] { --progress: 168deg; }
.timer-ring[data-progress="15"] { --progress: 180deg; }
.timer-ring[data-progress="16"] { --progress: 192deg; }
.timer-ring[data-progress="17"] { --progress: 204deg; }
.timer-ring[data-progress="18"] { --progress: 216deg; }
.timer-ring[data-progress="19"] { --progress: 228deg; }
.timer-ring[data-progress="20"] { --progress: 240deg; }
.timer-ring[data-progress="21"] { --progress: 252deg; }
.timer-ring[data-progress="22"] { --progress: 264deg; }
.timer-ring[data-progress="23"] { --progress: 276deg; }
.timer-ring[data-progress="24"] { --progress: 288deg; }
.timer-ring[data-progress="25"] { --progress: 300deg; }
.timer-ring[data-progress="26"] { --progress: 312deg; }
.timer-ring[data-progress="27"] { --progress: 324deg; }
.timer-ring[data-progress="28"] { --progress: 336deg; }
.timer-ring[data-progress="29"] { --progress: 348deg; }
.timer-ring[data-progress="30"] { --progress: 360deg; }

.timer-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(19, 46, 39, 0.95), #091410 69%);
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.4);
}

.timer-core {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: 100%;
  gap: 17px;
  padding: 0 24px;
}

.guard-code {
  min-height: 1.15em;
  padding-left: 0.11em;
  color: var(--teal);
  font: 750 clamp(2.5rem, 9vw, 3.25rem)/0.95 var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.11em;
  text-shadow: 0 0 24px rgba(98, 237, 201, 0.32);
}

.timer-label {
  color: var(--muted);
  font: 600 0.78rem/1 var(--font-sans);
  letter-spacing: 0.01em;
}

.code-stage[data-state="loading"] .timer-ring {
  animation: searching 1.15s ease-in-out infinite alternate;
}

.code-stage[data-state="stale"] .guard-code,
.code-stage[data-state="error"] .guard-code {
  color: var(--faint);
  text-shadow: none;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button,
.logout {
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  font-weight: 750;
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-copy::before,
.icon-copy::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 9px;
  border: 1.8px solid currentColor;
  border-radius: 2px;
}

.icon-copy::before {
  top: 2px;
  left: 2px;
}

.icon-copy::after {
  right: 1px;
  bottom: 1px;
  background: var(--teal);
}

.icon-refresh {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.icon-refresh::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -2px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transform: rotate(-22deg);
}

.button-primary {
  color: var(--teal-ink);
  background: var(--teal);
}

.button-secondary {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.button:not(:disabled):hover,
.logout:not(:disabled):hover {
  transform: translateY(-1px);
}

.button-secondary:not(:disabled):hover,
.logout:not(:disabled):hover {
  border-color: var(--line-strong);
  background: rgba(98, 237, 201, 0.07);
}

button:focus-visible {
  outline: 3px solid rgba(98, 237, 201, 0.35);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.message {
  min-height: 1.5em;
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

.alert {
  margin-top: 16px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 145, 163, 0.28);
  border-radius: 12px;
  color: #ffdce2;
  background: rgba(255, 145, 163, 0.075);
}

.alert strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.86rem;
}

.alert p {
  margin: 0;
  color: #dab7bd;
  font-size: 0.78rem;
  line-height: 1.5;
}

.access-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 25px 0 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.access-details div {
  min-width: 0;
  padding: 13px 14px;
  background: rgba(5, 12, 10, 0.86);
}

.access-details dt {
  margin-bottom: 5px;
  color: var(--faint);
  font: 700 0.65rem/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-details dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}

.guidance {
  display: flex;
  gap: 12px;
  margin-top: 15px;
  padding: 15px;
  border: 1px solid rgba(255, 210, 138, 0.16);
  border-radius: 13px;
  background: rgba(255, 210, 138, 0.045);
}

.guidance-icon {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 210, 138, 0.35);
  border-radius: 50%;
  color: var(--warning);
  font: 800 0.75rem/1 var(--font-sans);
}

.guidance strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.82rem;
}

.guidance p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.logout {
  display: block;
  width: 100%;
  margin-top: 15px;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.78rem;
}

footer {
  padding: 18px 10px 0;
  color: var(--faint);
  text-align: center;
  font-size: 0.68rem;
}

noscript {
  display: block;
  max-width: 620px;
  margin: 20px auto;
  padding: 15px;
  color: var(--text);
  text-align: center;
}

@keyframes searching {
  from { filter: brightness(0.68); }
  to { filter: brightness(1.14); }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 22px, 620px);
    padding-top: 18px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .guard-card {
    padding: 24px 17px;
    border-radius: 19px;
  }

  .actions,
  .access-details {
    grid-template-columns: 1fr;
  }

  .guard-code {
    font-size: clamp(2.12rem, 13.5vw, 3rem);
  }
}

@media (max-width: 360px) {
  .brand-copy small {
    display: none;
  }

  .timer-ring {
    width: 218px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
