/* REAL // TWIN — viral landing. Palette and HUD language from GDD v2.6 / Gemini v3.0. */

:root {
  --obsidian: #080a0f;
  --panel: #0f131c;
  --panel-2: #121826;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --dim: #64748b;
  --crimson: #ff3b30;
  --amber: #f59e0b;
  --cyan: #00f0ff;
  --emerald: #10b981;
  --violet: #8b5cf6;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--obsidian);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img, canvas { max-width: 100%; height: auto; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: var(--crimson); color: #fff; }

.cyber-grid {
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  opacity: 0.18;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
  background-size: 100% 4px;
}

.wrap {
  width: min(680px, calc(100% - 32px));
  margin: 0 auto;
}

/* --- Header --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(8, 10, 15, 0.86);
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
}

.topbar-inner {
  width: min(680px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.slash { color: var(--crimson); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 10px var(--crimson);
  animation: ping 1.6s ease-out infinite;
}

@keyframes ping {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(1.6); opacity: 0.15; }
  100% { transform: scale(1); opacity: 1; }
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.archai-link {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}

.archai-link:hover {
  color: var(--cyan);
  text-decoration: none;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 59, 48, 0.4);
  color: var(--crimson);
  background: rgba(255, 59, 48, 0.1);
  white-space: nowrap;
}

/* --- Hero --- */
.hero {
  padding: 28px 0 8px;
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--amber);
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.2;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.02em;
}

.glitch-title {
  text-shadow: 2px 0 rgba(255, 59, 48, 0.75), -2px 0 rgba(0, 240, 255, 0.75);
}

.lede {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

/* --- Search --- */
.search-box {
  background: var(--panel);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

label.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#place-input {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  background: var(--obsidian);
  border: 1px solid #334155;
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}

#place-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

@media (min-width: 520px) {
  .actions { flex-direction: row; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 13px 16px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: wait; }

.btn-amber {
  background: var(--amber);
  color: var(--obsidian);
  font-family: var(--mono);
  flex: 1;
}

.btn-amber:hover { background: #fbbf24; }

.btn-ghost {
  background: rgba(15, 19, 28, 0.9);
  color: var(--text);
  border-color: #334155;
  font-family: var(--mono);
  font-size: 13px;
}

.btn-ghost:hover { border-color: #64748b; background: #1e293b; }

.btn-crimson {
  background: var(--crimson);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.25);
}

.btn-crimson:hover { background: #ff5248; }

.btn-cyan {
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan);
  border-color: rgba(0, 240, 255, 0.35);
  font-family: var(--mono);
  font-size: 13px;
}

.btn-cyan:hover { background: rgba(0, 240, 255, 0.2); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: var(--obsidian);
  color: var(--muted);
}

.chip:hover { border-color: var(--cyan); color: var(--cyan); }

/* --- Telemetry / status --- */
.log {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--obsidian);
  border: 1px solid #1e293b;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  line-height: 1.7;
  min-height: 0;
}

.log:empty { display: none; }
.log .ok { color: var(--cyan); }
.log .warn { color: var(--amber); }
.log .err { color: var(--crimson); }

.notice, .error-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.notice {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: #cbd5e1;
}

.error-banner {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.35);
  color: #fecaca;
}

.hidden { display: none !important; }

/* --- File card --- */
#file-section,
#card-panel,
#preorder {
  scroll-margin-top: 72px;
}

.file-card {
  margin-top: 22px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.12), rgba(15, 19, 28, 0.96) 28%);
  border: 1px solid rgba(255, 59, 48, 0.38);
  box-shadow: 0 0 28px rgba(255, 59, 48, 0.08);
  position: relative;
}

.file-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #1e293b;
  font-family: var(--mono);
}

.file-id {
  color: var(--crimson);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.pill-danger { background: rgba(255, 59, 48, 0.18); color: var(--crimson); }
.pill-clearance { background: rgba(245, 158, 11, 0.12); color: var(--amber); border-color: rgba(245, 158, 11, 0.3); }
.pill-open { background: rgba(16, 185, 129, 0.12); color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); }

.meta-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  font-family: var(--mono);
  font-size: 12px;
}

.meta-row { display: flex; justify-content: space-between; gap: 12px; }
.meta-k { color: var(--dim); }
.meta-v { color: var(--cyan); text-align: right; }

.drift-bar {
  height: 6px;
  border-radius: 99px;
  background: #1e293b;
  overflow: hidden;
  margin-top: 4px;
}

.drift-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--crimson));
  width: 0;
}

.story {
  margin: 0;
  color: #cbd5e1;
  font-size: 14.5px;
  line-height: 1.85;
}

.quest {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(8, 10, 15, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.quest-k {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 6px;
}

.quest p { margin: 0; font-size: 13px; color: #cbd5e1; }

/* Redaction — black bars, unreadable until unlocked */
.redacted {
  display: inline;
  background: #05060a;
  color: #05060a;
  padding: 0 6px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  user-select: none;
  cursor: default;
  transition: background 0.35s ease, color 0.35s ease, text-shadow 0.35s ease;
}

.redacted::selection { background: #05060a; color: #05060a; }

body:not(.is-unlocked) .redacted:hover {
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.45), 2px 0 0 rgba(0, 240, 255, 0.25);
}

body.is-unlocked .redacted {
  background: rgba(255, 59, 48, 0.12);
  color: #fecaca;
  text-shadow: none;
  user-select: text;
  box-shadow: none;
}

.unlock-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unlock-hint {
  font-size: 12px;
  color: var(--muted);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .btn-row { grid-template-columns: 1fr 1fr; }
}

.nearby {
  margin-top: 14px;
}

.nearby h2 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--dim);
  font-weight: 500;
}

.nearby-list { display: flex; flex-direction: column; gap: 8px; }

.poi {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(8, 10, 15, 0.7);
  border: 1px solid #1e293b;
  color: var(--text);
}

.poi strong { display: block; color: #fff; font-size: 14px; }
.poi span { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.poi.is-active, .poi:hover { border-color: rgba(255, 59, 48, 0.55); background: rgba(255, 59, 48, 0.08); }

/* Share card */
.card-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid #1e293b;
}

.card-panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #fff;
}

.card-panel p.hint { margin: 0 0 12px; font-size: 12px; color: var(--muted); }

.card-frame {
  margin: 0 auto 12px;
  width: min(280px, 70%);
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #000;
  box-shadow: var(--shadow);
}

.card-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Fake door */
.preorder {
  margin: 28px 0 10px;
  padding: 20px 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.preorder h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #fff;
}

.price {
  font-family: var(--mono);
  color: var(--emerald);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}

.fineprint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.form label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form input[type="email"],
.form input[type="text"] {
  padding: 12px 12px;
  border-radius: 10px;
  background: var(--obsidian);
  border: 1px solid #334155;
  outline: none;
}

.form input:focus { border-color: var(--emerald); }

.hp {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none;
}

.consent {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.consent input { margin-top: 3px; }

.form-msg { font-size: 13px; min-height: 1.2em; }
.form-msg.ok { color: var(--emerald); }
.form-msg.err { color: #fecaca; }

/* Footer */
footer {
  margin: 32px 0 24px;
  padding-top: 18px;
  border-top: 1px solid #1e293b;
  font-size: 11px;
  color: var(--dim);
  line-height: 1.7;
}

footer strong { color: var(--muted); font-weight: 600; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #080a0f; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ff3b30; }

@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
  .glitch-title { text-shadow: none; }
  * { transition: none !important; }
}
