/* ==========================================================================
   GLEWME // ESCAPE THE CITY - PRE-MIGRATION terminal
   Dark glass. White text. Greys and black. Thin neon-yellow highlights.
   ========================================================================== */

:root {
  --accent: #E9FF41;
  --accent-dim: rgba(233, 255, 65, 0.42);
  --accent-faint: rgba(233, 255, 65, 0.12);
  --ink: #FFFFFF;
  --ink-2: #C7CBD1;
  --ink-3: #8A9098;
  --ink-4: #565B62;
  --bg: #07080A;
  --glass: rgba(18, 20, 23, 0.62);
  --glass-2: rgba(255, 255, 255, 0.045);
  --hair: rgba(255, 255, 255, 0.10);
  --hair-2: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.72), 0 2px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.55);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --display: "Rajdhani", "Barlow Condensed", "Segoe UI", system-ui, sans-serif;
}

@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Medium.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Bold.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/Rajdhani-Medium.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/Rajdhani-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Rajdhani"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/Rajdhani-Bold.ttf") format("truetype"); }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------ backgrounds */
#bg-image {
  position: fixed; inset: 0; z-index: 0;
  background: #07080A center/cover no-repeat;
  opacity: 0.55;
}
/* Both background canvases must be taken out of flow. #bg-cubes previously had
   no rule, so it sat in normal flow at full viewport height and pushed the
   modal completely below the fold. */
#bg-cubes, #bg-canvas {
  position: fixed; inset: 0; z-index: 1; display: block;
  pointer-events: none;
}
#bg-veil {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 12%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.62) 62%, rgba(0,0,0,0.9) 100%),
    linear-gradient(180deg, rgba(7,8,10,0.55) 0%, rgba(7,8,10,0.15) 30%, rgba(7,8,10,0.85) 100%);
}

/* ---------------------------------------------------------------- splash */
#splash {
  position: fixed; inset: 0; z-index: 90;
  background: #050506;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px; text-align: center;
  transition: opacity 900ms ease, visibility 900ms ease;
  cursor: pointer;
}
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#splash-art {
  position: absolute; inset: 0;
  background: #050506 center/cover no-repeat;
  opacity: 0.85;
}
#splash-inner { position: relative; z-index: 2; width: min(560px, 86vw); }
#splash .mark {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(44px, 9vw, 84px); letter-spacing: 0.20em; margin: 0 0 8px;
}
#splash .sub {
  color: var(--accent); font-weight: 600; letter-spacing: 0.42em;
  font-size: clamp(10px, 2.2vw, 13px); margin-bottom: 34px;
}
.loader-rail {
  height: 2px; width: 100%; background: rgba(255,255,255,0.10);
  overflow: hidden; border-radius: 2px;
}
.loader-fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width 240ms linear;
}
#splash .status {
  margin-top: 14px; display: flex; justify-content: space-between;
  color: var(--ink-3); font-size: 11px; letter-spacing: 0.22em;
}
#splash .enter {
  margin-top: 40px; color: var(--ink-4); font-size: 11px; letter-spacing: 0.3em;
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ----------------------------------------------------------------- shell */
#shell {
  position: relative; z-index: 5;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px 18px;
}

/* ----------------------------------------------------------------- modal */
.modal {
  width: min(880px, 100%);
  /* Always fully on screen. If the content is taller than the viewport the
     card stays put and its body scrolls, rather than the page pushing the
     card off the bottom. */
  max-height: calc(100vh - 40px);
  margin: auto;
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(120%);
  -webkit-backdrop-filter: blur(26px) saturate(120%);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  flex: none;
  padding: 22px 30px 18px;
  border-bottom: 1px solid var(--hair-2);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
}
.brand { display: flex; flex-direction: column; gap: 6px; }
.brand .mark {
  font-family: var(--display); font-weight: 700; font-size: 34px;
  letter-spacing: 0.18em; line-height: 1;
}
.brand .tag {
  color: var(--accent); font-weight: 600; font-size: 10px; letter-spacing: 0.42em;
}
.head-right { text-align: right; }
.chip-supply {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--hair); border-radius: 999px;
  padding: 7px 14px; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-2);
  background: var(--glass-2);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dot.off { background: var(--ink-4); }

.threat {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 30px;
  background: linear-gradient(90deg, rgba(233,255,65,0.09), rgba(233,255,65,0));
  border-bottom: 1px solid var(--hair-2);
  font-size: 11px; letter-spacing: 0.24em; color: var(--accent);
}
.threat .bar { width: 3px; height: 16px; background: var(--accent); }

.modal-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 22px 30px 26px;
}
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }

.section { margin-bottom: 22px; }
.section:last-child { margin-bottom: 0; }
.label {
  font-size: 10px; letter-spacing: 0.32em; color: var(--ink-3);
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}
.label::after { content: ""; flex: 1; height: 1px; background: var(--hair-2); }

/* -------------------------------------------------------------- wallets */
.wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wallet-btn {
  appearance: none; cursor: pointer; text-align: left;
  background: var(--glass-2); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  padding: 16px 16px; font-family: var(--mono); font-size: 13px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.wallet-btn:hover:not(:disabled) { border-color: var(--accent-dim); background: rgba(255,255,255,0.07); transform: translateY(-1px); }
.wallet-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wallet-btn .wname { font-weight: 600; letter-spacing: 0.08em; }
.wallet-btn .wstate { font-size: 10px; letter-spacing: 0.2em; color: var(--ink-4); }
.wallet-btn.detected .wstate { color: var(--accent); }

.account {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--glass-2); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.account .who { display: flex; flex-direction: column; gap: 5px; }
.account .addr { font-weight: 600; letter-spacing: 0.06em; font-size: 14px; }
.account .meta { font-size: 10px; letter-spacing: 0.2em; color: var(--ink-4); }

/* ---------------------------------------------------------- collections */
.col-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.col-tile {
  position: relative; cursor: pointer; user-select: none;
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--glass-2); padding: 18px 16px 16px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  box-shadow: var(--shadow-sm);
}
.col-tile:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.2); }
.col-tile.on { border-color: var(--accent); background: var(--accent-faint); }
.col-tile .cname {
  font-family: var(--display); font-weight: 700; font-size: 22px;
  letter-spacing: 0.1em; margin-bottom: 6px;
}
.col-tile .cmeta { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-4); word-break: break-all; }
.col-tile .tickbox {
  position: absolute; top: 14px; right: 14px;
  width: 16px; height: 16px; border: 1px solid var(--hair); border-radius: 4px;
}
.col-tile.on .tickbox { border-color: var(--accent); background: var(--accent); }

/* ------------------------------------------------------------- quantity */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pane {
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--glass-2); padding: 16px; box-shadow: var(--shadow-sm);
}
.pane .k { font-size: 10px; letter-spacing: 0.3em; color: var(--ink-3); margin-bottom: 10px; }
.qty { display: flex; align-items: center; gap: 14px; }
.qty button {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid var(--hair);
  color: var(--ink); font-size: 18px; line-height: 1; font-family: var(--mono);
  transition: border-color 160ms ease, background 160ms ease;
}
.qty button:hover:not(:disabled) { border-color: var(--accent-dim); background: rgba(255,255,255,0.09); }
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty .n { font-family: var(--display); font-weight: 700; font-size: 30px; min-width: 44px; text-align: center; }

.total { display: flex; align-items: baseline; gap: 10px; }
.total .big { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: 0.04em; }
.total .cur { color: var(--accent); font-size: 13px; letter-spacing: 0.24em; font-weight: 600; }

/* -------------------------------------------------------------- preview */
.preview-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: start; }
.preview-frame {
  width: 200px; height: 200px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--hair); background: #0B0C0E; box-shadow: var(--shadow-sm);
  position: relative;
}
.preview-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-frame .pending {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; letter-spacing: 0.24em; color: var(--ink-4);
}
.preview-notes { font-size: 12px; color: var(--ink-2); line-height: 1.8; }
.preview-notes b { color: var(--ink); font-weight: 600; }
.preview-notes .hint { color: var(--ink-4); font-size: 11px; }

/* --------------------------------------------------------------- action */
.cta {
  width: 100%; cursor: pointer; margin-top: 4px;
  background: var(--accent); color: #0A0B0C; border: 1px solid var(--accent);
  border-radius: 12px; padding: 18px 20px;
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.2em;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}
.cta:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.cta:disabled { opacity: 0.35; cursor: not-allowed; }
.cta.ghost { background: transparent; color: var(--ink); border-color: var(--hair); }
.cta.ghost:hover:not(:disabled) { border-color: var(--accent-dim); }

.notice {
  margin-top: 16px; border-radius: var(--radius-sm); padding: 14px 16px;
  border: 1px solid var(--hair); background: var(--glass-2);
  font-size: 12px; line-height: 1.7; color: var(--ink-2); display: none;
}
.notice.show { display: block; }
.notice.err { border-color: rgba(255,90,90,0.5); color: #FFC9C9; }
.notice.ok { border-color: var(--accent-dim); color: var(--ink); }
.notice a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }

.spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 800ms linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- passes */
.pass-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pass-card {
  border: 1px solid var(--hair); border-radius: 12px; overflow: hidden;
  background: var(--glass-2); box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, transform 160ms ease;
}
.pass-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.pass-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.pass-card .pmeta { padding: 12px 13px 14px; }
.pass-card .pid { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: 0.08em; }
.pass-card .pline { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-4); margin-top: 5px; }
.pass-card .pcols { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.tagline-chip {
  font-size: 9px; letter-spacing: 0.14em; padding: 3px 7px; border-radius: 999px;
  border: 1px solid var(--accent-dim); color: var(--accent);
}
.empty { font-size: 12px; color: var(--ink-4); letter-spacing: 0.1em; }

.modal-foot {
  flex: none;
  border-top: 1px solid var(--hair-2); padding: 14px 30px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  font-size: 10px; letter-spacing: 0.2em; color: var(--ink-4); flex-wrap: wrap;
}
.modal-foot a { color: var(--ink-3); text-decoration: none; }
.modal-foot a:hover { color: var(--accent); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 720px) {
  .wallet-grid, .col-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .preview-wrap { grid-template-columns: 1fr; }
  .preview-frame { width: 100%; height: auto; aspect-ratio: 1/1; }
  .modal-head, .modal-body, .threat, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .brand .mark { font-size: 27px; }
}

/* ==========================================================================
   ADMIN PANEL - Ctrl+Shift+A
   ========================================================================== */
#admin {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(3, 4, 5, 0.78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#admin.open { display: flex; }

.admin-card {
  width: min(880px, 100%); max-height: 90vh;
  display: flex; flex-direction: column;
  background: rgba(16, 18, 21, 0.96);
  border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--hair-2);
}
.admin-title { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: 0.2em; }
.admin-sub { font-size: 10px; letter-spacing: 0.3em; color: var(--ink-4); margin-top: 4px; }
.admin-head-actions { display: flex; gap: 8px; }

.admin-scroll { overflow-y: auto; padding: 22px 24px; flex: 1; }
.admin-foot { padding: 16px 24px; border-top: 1px solid var(--hair-2); }

.admin-sec { margin-bottom: 26px; }
.admin-sec:last-child { margin-bottom: 0; }

.admin-label {
  font-size: 10px; letter-spacing: 0.32em; color: var(--accent);
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}
.admin-label::after { content: ""; flex: 1; height: 1px; background: var(--hair-2); }

.admin-note {
  font-size: 12px; color: var(--ink-2); line-height: 1.7; margin-bottom: 14px;
  background: var(--glass-2); border: 1px solid var(--hair);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.admin-note a { color: var(--accent); text-decoration: none; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.admin-grid.three { grid-template-columns: repeat(3, 1fr); }

#admin label {
  display: block; font-size: 10px; letter-spacing: 0.2em;
  color: var(--ink-3); margin-bottom: 7px;
}
#admin input[type=text], #admin input[type=password], #admin input[type=number], #admin textarea {
  width: 100%; background: rgba(0,0,0,0.35); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  padding: 11px 13px; font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color 160ms ease;
}
#admin input:focus, #admin textarea:focus { border-color: var(--accent); }
#admin textarea { resize: vertical; line-height: 1.6; }

.admin-colour { display: flex; gap: 8px; align-items: center; }
.admin-colour input[type=color] {
  width: 46px; height: 42px; padding: 0; border: 1px solid var(--hair);
  border-radius: var(--radius-sm); background: transparent; cursor: pointer; flex: none;
}

.admin-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

.admin-btn, .admin-ghost {
  cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--hair); background: var(--glass-2); color: var(--ink);
  transition: border-color 160ms ease, background 160ms ease;
}
.admin-btn:hover, .admin-ghost:hover { border-color: var(--accent-dim); background: rgba(255,255,255,0.07); }
.admin-btn.accent { background: var(--accent); color: #0A0B0C; border-color: var(--accent); font-weight: 600; }
.admin-btn.accent:hover { filter: brightness(1.06); }
.admin-btn.wide { width: 100%; padding: 15px; font-size: 13px; }
.admin-ghost { padding: 9px 13px; font-size: 10px; }

#admin .hint { font-size: 11px; color: var(--ink-4); line-height: 1.7; margin-top: 8px; }

.admin-msg {
  display: none; margin-top: 18px; padding: 13px 15px;
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--glass-2); font-size: 12px; line-height: 1.7; color: var(--ink-2);
}
.admin-msg.show { display: block; }
.admin-msg.ok { border-color: var(--accent-dim); color: var(--ink); }
.admin-msg.err { border-color: rgba(255,90,90,0.55); color: #FFC9C9; }
.admin-msg a { color: var(--accent); }

/* assets */
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.asset-card {
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--glass-2); overflow: hidden;
}
.asset-thumb {
  height: 104px; background: #0A0B0D; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--hair-2);
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb span { font-size: 10px; letter-spacing: 0.24em; color: var(--ink-4); }
.asset-meta { padding: 12px; }
.asset-name { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; }
.asset-sub { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-4); margin: 5px 0 10px; }
.asset-btn {
  display: block; text-align: center; cursor: pointer;
  border: 1px solid var(--hair); border-radius: 8px; padding: 9px;
  font-size: 10px; letter-spacing: 0.18em; transition: border-color 160ms ease;
}
.asset-btn:hover { border-color: var(--accent); }

/* contrast table */
.ctable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ctable th {
  text-align: left; font-size: 9px; letter-spacing: 0.22em; color: var(--ink-4);
  font-weight: 400; padding: 0 0 9px;
}
.ctable td { padding: 8px 0; border-top: 1px solid var(--hair-2); color: var(--ink-2); }
.ctable td:first-child { color: var(--ink); }
.g-aaa { color: var(--accent); }
.g-aa { color: var(--ink-2); }
.g-low { color: #FF8A8A; }

@media (max-width: 720px) {
  .admin-grid, .admin-grid.three, .asset-grid { grid-template-columns: 1fr; }
  #admin { padding: 10px; }
  .admin-card { max-height: 95vh; }
}
