/* ============================================================================
   Waypoint — wayfinding console aesthetic
   Deep warm-black, topographic texture, amber waypoint accent, route stepper.
   Self-contained: system font stacks, no external requests.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0e0d0b;
  --bg-2:        #131110;
  --surface:     #1a1714;
  --surface-2:   #211d18;
  --line:        #2c261e;
  --line-soft:   #221e18;

  --amber:       #e5a00d;
  --amber-bright:#ffb732;
  --amber-dim:   #9a6c09;
  --amber-glow:  rgba(229,160,13,.35);

  --text:        #ece6da;
  --text-dim:    #908676;
  --text-faint:  #5f594d;
  --success:     #5bc88a;
  --error:       #e7655c;

  --radius:      14px;
  --radius-sm:   9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  padding: clamp(1.1rem, 4vw, 3rem) 1.1rem 4rem;
}

/* ── Atmosphere: topographic contours + amber glow + grain ──────────────── */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(229,160,13,.10), transparent 55%),
    radial-gradient(80% 60% at 85% 8%, rgba(229,160,13,.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.topo {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23e5a00d' stroke-opacity='.05' stroke-width='1'%3E%3Ccircle cx='300' cy='150' r='60'/%3E%3Ccircle cx='300' cy='150' r='110'/%3E%3Ccircle cx='300' cy='150' r='165'/%3E%3Ccircle cx='300' cy='150' r='225'/%3E%3Ccircle cx='300' cy='150' r='290'/%3E%3Ccircle cx='80' cy='480' r='50'/%3E%3Ccircle cx='80' cy='480' r='95'/%3E%3Ccircle cx='80' cy='480' r='145'/%3E%3Ccircle cx='540' cy='520' r='40'/%3E%3Ccircle cx='540' cy='520' r='85'/%3E%3Ccircle cx='540' cy='520' r='135'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 760px 760px;
  background-position: center top;
}

/* ── Shell ──────────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 540px; }

/* ── Header / wordmark ──────────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 1.6rem;
  animation: rise .7s var(--ease) both;
}
.pin {
  width: 46px; height: 46px; flex: none;
  filter: drop-shadow(0 4px 14px var(--amber-glow));
}
.pin .dot { transform-origin: 24px 18px; animation: pinPulse 2.6s ease-in-out infinite; }
.wordmark h1 {
  font-size: clamp(1.55rem, 6vw, 1.95rem);
  font-weight: 800; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(180deg, #fff 0%, var(--amber-bright) 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark p {
  font-size: .78rem; color: var(--text-dim); margin-top: 4px; letter-spacing: .01em;
}

/* ── Route stepper ──────────────────────────────────────────────────────── */
.route {
  position: relative;
  display: flex; justify-content: space-between;
  margin: 0 auto 1.7rem; padding: 0 8px;
  animation: rise .7s var(--ease) .06s both;
}
.route::before, .route__fill {
  content: ""; position: absolute; top: 13px; left: 30px; right: 30px; height: 2px;
  background: var(--line); border-radius: 2px;
}
.route__fill {
  right: auto; width: 0; background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  box-shadow: 0 0 10px var(--amber-glow); transition: width .5s var(--ease);
}
.station { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.station__pin {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-2); border: 2px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--text-faint);
  transition: all .35s var(--ease);
}
.station__label {
  font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); transition: color .35s var(--ease); text-align: center;
}
.station.active .station__pin {
  border-color: var(--amber); color: var(--amber-bright); background: #221806;
  box-shadow: 0 0 0 4px rgba(229,160,13,.12), 0 0 16px var(--amber-glow);
}
.station.active .station__label { color: var(--amber); }
.station.done .station__pin { border-color: var(--amber-dim); color: var(--amber); background: #1c1507; }
.station.done .station__label { color: var(--text-dim); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 24px 60px -30px rgba(0,0,0,.9);
  animation: rise .6s var(--ease) .12s both;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229,160,13,.5), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.eyebrow {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); margin-bottom: .5rem; display: flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 16px; height: 1px; background: var(--amber-dim); }
.card h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: .35rem; }
.lede { font-size: .9rem; color: var(--text-dim); margin-bottom: 1.2rem; }

/* ── Instruction list ───────────────────────────────────────────────────── */
.steps-list { list-style: none; margin: 0 0 1.3rem; display: grid; gap: .7rem; }
.steps-list li {
  display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: start;
  font-size: .87rem; color: var(--text);
}
.steps-list li .num {
  width: 22px; height: 22px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--amber);
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  display: grid; place-items: center;
}
.steps-list li span.t { color: var(--text-dim); }
.steps-list code {
  font-family: var(--mono); font-size: .82em; color: var(--amber-bright);
  background: #1d1709; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
  word-break: break-all;
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
label { display: block; font-size: .76rem; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .01em; }
input[type=text], input[type=password] {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; font-size: .92rem; font-family: var(--mono);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: var(--text-faint); }
input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(229,160,13,.14); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  width: 100%; border: none; cursor: pointer; font-family: var(--sans);
  font-size: .95rem; font-weight: 650; padding: 13px 16px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn-primary {
  color: #1a1205; background: linear-gradient(180deg, var(--amber-bright), var(--amber));
  box-shadow: 0 6px 22px -8px var(--amber-glow), 0 1px 0 rgba(255,255,255,.3) inset;
}
.btn-primary:hover { box-shadow: 0 10px 30px -8px var(--amber-glow); }
.btn-primary:disabled { background: #322c22; color: var(--text-faint); cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--amber-dim); color: var(--amber-bright); }

/* ── Copy fields ────────────────────────────────────────────────────────── */
.copy-field {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); overflow: hidden; margin: 6px 0 2px;
}
.copy-field .val {
  flex: 1; min-width: 0; padding: 11px 13px; font-family: var(--mono); font-size: .8rem;
  color: var(--text); white-space: nowrap; overflow-x: auto; scrollbar-width: none;
  display: flex; align-items: center;
}
.copy-field .val::-webkit-scrollbar { display: none; }
.copy-field button {
  flex: none; border: none; border-left: 1px solid var(--line);
  background: var(--surface-2); color: var(--amber); cursor: pointer;
  padding: 0 15px; font-size: .76rem; font-weight: 650; font-family: var(--sans);
  display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s;
}
.copy-field button:hover { background: #2a2218; }
.copy-field button.copied { color: var(--success); }
.copy-field button svg { width: 14px; height: 14px; }

/* big tappable code (device user code) */
.usercode {
  position: relative; cursor: pointer; user-select: all;
  font-family: var(--mono); font-size: clamp(1.9rem, 9vw, 2.5rem); font-weight: 700;
  letter-spacing: .12em; text-align: center; color: var(--amber-bright);
  padding: 1.1rem; margin: .4rem 0 .2rem; border-radius: var(--radius);
  background: radial-gradient(120% 130% at 50% 0%, #251a07, var(--bg));
  border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s;
}
.usercode:hover { border-color: var(--amber-dim); box-shadow: 0 0 24px -8px var(--amber-glow); }
.usercode .hint {
  position: absolute; bottom: 7px; left: 0; right: 0; text-align: center;
  font-family: var(--sans); font-size: .62rem; letter-spacing: .08em; color: var(--text-faint);
  text-transform: uppercase;
}
.usercode.copied .hint { color: var(--success); }

/* ── Callout (move-above-Cinemeta) ──────────────────────────────────────── */
.callout {
  border: 1px solid var(--amber-dim); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(229,160,13,.08), rgba(229,160,13,.02));
  padding: 1rem 1.05rem; margin: 1rem 0; font-size: .85rem;
}
.callout .ctitle { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--amber-bright); margin-bottom: .4rem; }
.callout ol { margin: .5rem 0 0 1.1rem; display: grid; gap: .3rem; color: var(--text-dim); font-size: .83rem; }
.callout ol strong { color: var(--text); }
.callout.warn { border-color: var(--line); background: var(--surface-2); }
.callout.warn .ctitle { color: var(--text); }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--line-soft); margin: 1.3rem 0; }
.sub { font-size: .8rem; color: var(--text-dim); }
.link { color: var(--amber); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
.link:hover { border-color: var(--amber); }
.link-row { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; }
.err { color: var(--error); font-size: .82rem; margin-top: .6rem; }
.poll { display: flex; align-items: center; justify-content: center; gap: 9px; font-size: .85rem; color: var(--text-dim); margin-top: 1rem; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--amber);
  animation: spin .8s linear infinite;
}
.center { text-align: center; }
.mt { margin-top: 1rem; }
.hidden { display: none !important; }
.foot { text-align: center; font-size: .72rem; color: var(--text-faint); margin-top: 1.6rem; }
.foot a { color: var(--text-dim); }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pinPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .7; } }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.pop { animation: pop .3s var(--ease); }

@media (max-width: 420px) {
  .card { padding: 1.25rem 1.1rem; }
  .station__label { font-size: .52rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
