/* VEILRUN — Base styles, layout, components, responsive.
   Reads only tokens from tokens.css. Caps used sparingly (eyebrows/brand only). */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--steel-lt); text-decoration: none; }
img { max-width: 100%; display: block; }

/* Headings: display font, SENTENCE CASE (no forced uppercase). */
h1,h2,h3,.display {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  line-height: 1.1;
  font-weight: 600;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); font-weight: 500; }
h3 { font-size: 1.3rem; }
/* Caps reserved for tiny labels only — used sparingly. */
.eyebrow { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: var(--fs-small); color: var(--magenta); font-weight: 600; margin: 0 0 var(--s-2); }
.mute { color: var(--mute); }

/* ---- The seam motif ---- */
.seam { height: 2px; border: none; margin: var(--s-8) 0;
  background: linear-gradient(90deg, transparent, var(--violet), var(--magenta), var(--white), var(--magenta), var(--violet), transparent);
  box-shadow: 0 0 12px var(--magenta); opacity: 0.75; }
.seam-v { position: fixed; top: 0; left: 50%; width: 2px; height: 100%;
  background: linear-gradient(180deg, transparent, var(--magenta), transparent);
  box-shadow: 0 0 18px var(--magenta); opacity: 0.10; pointer-events: none; z-index: 0; }

/* ---- Layout ---- horizontal padding via padding-inline so it NEVER gets cancelled
       by classes that set vertical padding (this was the mobile edge bug). ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: clamp(1.15rem, 5vw, 2rem); position: relative; z-index: 1; }
.section { padding-block: var(--s-12); }
.grid { display: grid; gap: var(--s-4); }
.cols-2 { grid-template-columns: 1fr; }
.cols-3 { grid-template-columns: 1fr; }
.cols-4 { grid-template-columns: repeat(2, 1fr); }

/* ---- Glass panel ---- */
.panel { background: var(--panel-glass); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s-6); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); }

/* ---- Top nav ---- */
.nav { position: sticky; top: 0; z-index: 20; min-height: var(--nav-h);
  display: flex; align-items: center; gap: var(--s-4);
  background: rgba(11,8,24,0.9); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); padding-inline: clamp(1.15rem, 5vw, 2rem); }
.nav .brand { font-family: var(--font-display); letter-spacing: 0.22em; font-size: 1.05rem; color: var(--white); text-transform: uppercase; }
.nav .brand b { color: var(--magenta); }
.nav .links { display: flex; gap: var(--s-1); margin-left: auto; flex-wrap: wrap; }
.nav a { font-family: var(--font-body); letter-spacing: 0.01em; font-size: 0.9rem;
  color: var(--mute); padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); }
.nav a:hover, .nav a.active { color: var(--white); background: rgba(214,92,220,0.14); }
/* ---- Nav dropdown (Characters) ---- */
.nav .navdrop { position: relative; display: inline-flex; align-items: center; }
.nav .navdrop-btn { font-family: var(--font-body); letter-spacing: 0.01em; font-size: 0.9rem;
  color: var(--mute); background: none; border: none; cursor: pointer; text-decoration: none;
  padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 6px; }
.nav .navdrop-btn .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; transition: transform 0.2s ease; }
.nav .navdrop:hover .navdrop-btn, .nav .navdrop.active .navdrop-btn { color: var(--white); background: rgba(214,92,220,0.14); }
/* Menu sits flush under the button (no gap) so hover doesn't drop; an invisible bridge keeps the path continuous. */
.nav .navdrop-menu { display: none; position: absolute; top: 100%; left: 0;
  flex-direction: column; min-width: 168px; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--s-2); z-index: 30; box-shadow: var(--shadow); }
.nav .navdrop-menu::before { content: ""; position: absolute; top: -8px; left: 0; right: 0; height: 8px; }
.nav .navdrop:hover .navdrop-menu, .nav .navdrop:focus-within .navdrop-menu, .nav .navdrop.open .navdrop-menu { display: flex; }
.nav .navdrop:hover .caret, .nav .navdrop.open .caret { transform: rotate(180deg); }
.nav .navdrop-menu a { white-space: nowrap; }

/* Ever-present Feedback CTA (right side desktop, right side of mobile bottom bar). */
.nav .nav-fb { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  padding: 0.5rem 1.1rem; font-size: 0.85rem; line-height: 1; }
.nav .nav-fb .fb-ico { width: 15px; height: 15px; flex-shrink: 0; }
/* Signed-in profile chip (initial → click to sign out). */
.nav .nav-profile { display: none; align-items: center; justify-content: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: rgba(214,92,220,0.16); border: 1px solid var(--magenta); color: var(--white);
  font-family: var(--font-display); font-size: 0.85rem; }
.nav .nav-profile:hover { background: rgba(214,92,220,0.3); }
.nav .menu-btn { display: none; align-items: center; justify-content: center; margin-left: 0;
  background: none; border: 1px solid var(--line); color: var(--white);
  border-radius: var(--radius-sm); width: 46px; height: 40px; cursor: pointer; }
/* Hamburger that morphs into an X. */
.nav .menu-btn .ham, .nav .menu-btn .ham::before, .nav .menu-btn .ham::after {
  display: block; width: 22px; height: 2px; border-radius: 2px; background: var(--white); }
.nav .menu-btn .ham { position: relative; transition: background 0.12s ease; }
.nav .menu-btn .ham::before, .nav .menu-btn .ham::after { content: ""; position: absolute; left: 0; transition: transform 0.28s ease; }
.nav .menu-btn .ham::before { top: -7px; }
.nav .menu-btn .ham::after { top: 7px; }
.nav .menu-btn.open .ham { background: transparent; }
.nav .menu-btn.open .ham::before { transform: translateY(7px) rotate(45deg); }
.nav .menu-btn.open .ham::after { transform: translateY(-7px) rotate(-45deg); }

/* ---- Motion: gentle page-enter + smooth in-page scrolling ---- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: no-preference) {
  #view > * { animation: viewIn 0.3s ease both; }
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Buttons ---- */
.btn { font-family: var(--font-body); font-weight: 600; letter-spacing: 0.01em;
  background: var(--magenta); color: #140a16; border: none; border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-6); font-size: 0.95rem; cursor: pointer; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--white); border: 1px solid var(--line); }

/* ---- Toolbar / view toggle ---- */
.toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-6); }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-left: auto; }
.view-toggle button { background: transparent; color: var(--mute); border: none; padding: var(--s-2) var(--s-3);
  cursor: pointer; font-size: 0.85rem; font-family: var(--font-body); }
.view-toggle button.active { background: rgba(214,92,220,0.18); color: var(--white); }
.view-toggle button + button { border-left: 1px solid var(--line); }

/* ---- Character cards (tile view) ---- */
.card { position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--ink-2); cursor: pointer; transition: transform .15s, border-color .15s;
  aspect-ratio: 3 / 4; display: flex; flex-direction: column; justify-content: flex-end; }
.card:hover { transform: translateY(-3px); border-color: var(--accent, var(--magenta)); }
.card .card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; z-index: 0; }
.card .body { position: relative; z-index: 1; padding: var(--s-4);
  background: linear-gradient(180deg, transparent, rgba(11,8,24,0.55) 40%, rgba(11,8,24,0.94)); }
.card .accent-bar { height: 4px; width: 44px; background: var(--accent, var(--magenta)); border-radius: 4px; margin-bottom: var(--s-2); }
.card h3 { font-size: 1.35rem; }
.card .role { font-size: var(--fs-small); color: var(--mute); }

/* ---- Full view (one big card per row) ---- */
.grid.full { grid-template-columns: 1fr; }
.grid.full .card { aspect-ratio: 16 / 7; }
.grid.full .card .body { max-width: 60ch; }

/* ---- List view (compact rows → table-like on desktop) ---- */
.crew-list { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-6); }
.crew-list .row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: var(--s-4);
  padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--ink-2); cursor: pointer; }
.crew-list .row:hover { border-color: var(--accent, var(--magenta)); }
.crew-list .row img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; object-position: 50% 18%; }
.crew-list .row .nm { font-family: var(--font-display); font-size: 1.1rem; }
.crew-list .row .rl { color: var(--mute); font-size: 0.85rem; }
.crew-list .row .accent-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent, var(--magenta)); }

/* ---- World layer cards (image on top, text below — no overflow, clickable) ---- */
.wlayer { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ink-2);
  cursor: pointer; transition: transform .15s, border-color .15s; }
.wlayer:hover { transform: translateY(-3px); border-color: var(--accent, var(--magenta)); }
.wlayer img { width: 100%; height: 200px; object-fit: cover; object-position: 50% 40%; }
.wl-body { padding: var(--s-4); }
.wl-body h3 { margin: .2rem 0; }
.wl-body .role { color: var(--mute); font-size: var(--fs-small); }
.wl-body p { margin-top: .4rem; font-size: .9rem; }
.wl-count { display: inline-block; margin-top: .7rem; font-size: .8rem; color: var(--accent, var(--magenta)); }

/* ---- Kit pills & chips ---- */
.pill { display: inline-block; font-family: var(--font-body); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 0.62rem; padding: 2px 8px; border-radius: 999px; margin-right: var(--s-2);
  border: 1px solid var(--line); color: var(--mute); }
.pill.passive { color: var(--steel-lt); border-color: var(--steel); }
.pill.active  { color: var(--violet-lt); border-color: var(--violet); }
.pill.ult     { color: var(--magenta); border-color: var(--magenta); }
.chip { display: inline-block; font-family: var(--font-body); font-size: 0.85rem;
  padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); color: var(--white);
  margin: 0 var(--s-2) var(--s-2) 0; }
.chip.pick { border-color: var(--accent, var(--magenta)); color: var(--white); background: rgba(214,92,220,0.15); font-weight: 600; }

/* ---- Kit / synergy ---- */
.kit-row { padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.kit-row:last-child, .kit-row:last-of-type { border-bottom: none; }
.kit-row .name { font-weight: 600; color: var(--white); }
.syn { padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: var(--s-3);
  border-left: 3px solid var(--accent, var(--magenta)); }
.syn .syn-name { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent, var(--magenta)); }

/* ---- Character detail hero + gallery flip-through ---- */
/* min-width:0 on the grid + its children prevents mobile horizontal overflow
   (grid/flex items default to min-width:auto and refuse to shrink below content). */
.char-hero { display: grid; grid-template-columns: 1fr; gap: var(--s-6); align-items: start; min-width: 0; }
.char-hero > div { min-width: 0; max-width: 100%; }
.char-hero img { border-radius: var(--radius); border: 1px solid var(--line); width: 100%; }

.viewer { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: var(--ink-2); aspect-ratio: 3 / 4; width: 100%; max-width: 100%; }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; cursor: zoom-in; }
.viewer .arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: rgba(11,8,24,0.7); color: var(--white); border: 1px solid var(--line); border-radius: 50%;
  width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; }
.viewer .arrow:hover { border-color: var(--accent, var(--magenta)); background: rgba(11,8,24,0.9); }
.viewer .prev { left: 10px; } .viewer .next { right: 10px; }
.viewer .count { position: absolute; bottom: 10px; left: 10px; z-index: 2; font-size: 0.78rem;
  background: rgba(11,8,24,0.7); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.viewer .like { position: absolute; bottom: 10px; right: 10px; z-index: 2; cursor: pointer;
  background: rgba(11,8,24,0.7); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; color: var(--white); }
.viewer .like.on { border-color: var(--magenta); color: var(--magenta); }
.thumbs { display: flex; gap: var(--s-2); overflow-x: auto; padding: var(--s-3) 0; max-width: 100%; }
.thumbs img { height: 64px; width: 48px; object-fit: cover; object-position: 50% 18%; border-radius: 6px; border: 2px solid transparent; cursor: pointer; flex: 0 0 auto; opacity: 0.65; }
.thumbs img.on { border-color: var(--accent, var(--magenta)); opacity: 1; }

/* ---- Feedback button ---- */
.fb { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--mute);
  background: none; border: 1px dashed var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer; font-family: var(--font-body); }
.fb:hover { color: var(--white); border-color: var(--magenta); }

/* ---- Hub ---- */
.hub-hero { padding-block: var(--s-12) var(--s-6); }
.latest { display: grid; grid-template-columns: 1fr; gap: var(--s-4); align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ink-2); margin-top: var(--s-6); }
.latest img { width: 100%; height: 100%; object-fit: cover; max-height: 240px; }
.latest .l-body { padding: var(--s-6); }
.hero-btns { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); }
.jump { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.jump a { display: block; padding: var(--s-6); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--ink-2); color: var(--white); }
.jump a:hover { border-color: var(--magenta); background: rgba(214,92,220,0.08); }
.jump .k { font-family: var(--font-display); font-size: 1.2rem; }
.jump .d { color: var(--mute); font-size: 0.9rem; }

/* ---- Design system swatches ---- */
.swatches { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--s-3); }
.swatch { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.swatch .chip-color { height: 60px; }
.swatch .lbl { padding: var(--s-2) var(--s-3); font-size: 0.8rem; }
.swatch .lbl code { color: var(--mute); }

/* ---- Lab status pills ---- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.status svg { width: 13px; height: 13px; }
.status.prototyping { color: var(--cyan); border-color: var(--cyan); background: rgba(96,214,220,0.10); }
.status.idea { color: var(--violet-lt); border-color: var(--violet); background: rgba(124,74,182,0.12); }
.status.direction { color: var(--magenta); border-color: var(--magenta); background: rgba(214,92,220,0.12); }
.status.default { color: var(--mute); }
.status { align-self: flex-start; width: fit-content; }
.modecard .status { margin-bottom: 0; }
.modecard-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.votebtn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: transparent; color: var(--mute); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; cursor: pointer;
  font-family: var(--font-body); transition: color .15s, background .15s, border-color .15s, transform .1s; }
.votebtn:hover { color: var(--white); border-color: var(--magenta); }
.votebtn:active { transform: scale(0.94); }
.votebtn.on { color: #140a16; background: var(--magenta); border-color: var(--magenta); font-weight: 600; }
.votebtn .vc { font-variant-numeric: tabular-nums; }

/* ---- Hub "Recently" dashboard ---- */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-6); margin-bottom: var(--s-2); }
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-4); }
.dash-stat { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-5) var(--s-6); background: var(--ink-2); }
.dash-stat .dash-n { font-family: var(--font-display); font-size: 2.4rem; color: var(--magenta); line-height: 1; margin-bottom: var(--s-2); }
.dash-stat .mute { font-size: 0.85rem; }

/* ---- Characters overview page ---- */
.chero-split { display: grid; grid-template-columns: 1fr; gap: var(--s-4); margin-top: var(--s-6); }
.chero-panel { position: relative; display: flex; align-items: flex-end; min-height: 200px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background-size: cover; background-position: center; padding: var(--s-6) var(--s-6) var(--s-5);
  transition: transform .15s, border-color .15s; }
.chero-panel:hover { transform: translateY(-3px); border-color: var(--magenta); }
.chero-cta { font-family: var(--font-display); color: var(--white); font-size: 1.15rem; margin-top: .25rem; }
.chars-block { margin-top: var(--s-8); }
.chars-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.chars-block-head h2 { margin: 0; }
.cp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); margin-top: var(--s-5); }
.cp-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ink-2);
  transition: transform .15s, border-color .15s; }
.cp-card:hover { transform: translateY(-3px); border-color: var(--magenta); }
.cp-img { aspect-ratio: 3 / 4; background-size: cover; background-position: 50% 20%; }
.cp-meta { padding: var(--s-3) var(--s-4); }
.cp-name { font-family: var(--font-display); color: var(--white); font-size: 1.05rem; }
.cp-role { font-size: 0.76rem; margin-top: 2px; }
@media (min-width: 640px) { .chero-split { grid-template-columns: 1fr 1fr; } .cp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1040px) { .cp-grid { grid-template-columns: repeat(5, 1fr); } }

/* ---- Profile page ---- */
.pf-head { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.pf-avatar { width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0; background-size: cover; background-position: 50% 20%;
  border: 2px solid var(--magenta); }
.pf-avatar.pf-initial { display: flex; align-items: center; justify-content: center; background: rgba(214,92,220,0.16);
  font-family: var(--font-display); font-size: 2rem; color: var(--white); }
.pf-head-txt { min-width: 0; }
.pf-signout { margin-left: auto; }
.pf-name-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.pf-name-row .fld-in { flex: 1; min-width: 180px; background: var(--ink); color: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); font-size: 1rem; }
.pf-cols { display: grid; grid-template-columns: 1fr; gap: var(--s-4); margin-top: var(--s-6); }
.pf-cols .panel { margin: 0; }
@media (min-width: 720px) { .pf-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
/* Image reprioritizer */
.pf-img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
.pf-img { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--ink); }
.pf-img-thumb { position: relative; aspect-ratio: 3 / 4; background-size: cover; background-position: 50% 18%; }
.pf-img-rank { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(6,4,14,0.75); color: var(--white);
  font-family: var(--font-display); font-size: 0.8rem; }
.pf-img-ctrls { display: flex; }
.pf-img-ctrls button { flex: 1; background: var(--ink-2); border: none; border-top: 1px solid var(--line); color: var(--white);
  padding: var(--s-2); cursor: pointer; font-size: 1rem; }
.pf-img-ctrls button:first-child { border-right: 1px solid var(--line); }
.pf-img-ctrls button:hover:not(:disabled) { background: rgba(214,92,220,0.18); }
.pf-img-ctrls button:disabled { color: var(--mute); opacity: 0.4; cursor: default; }
@media (min-width: 640px) { .pf-img-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1040px) { .pf-img-grid { grid-template-columns: repeat(6, 1fr); } }

/* ---- Leaderboard ---- */
.lb-weekly { margin-bottom: var(--s-4); border-color: var(--magenta);
  background: linear-gradient(180deg, rgba(214,92,220,0.10), transparent); }
.lb-weekly-name { font-family: var(--font-display); font-size: 1.5rem; color: var(--white); margin-top: 0.2rem; }
.lb-list { padding: var(--s-2) var(--s-4); }
.lb-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: var(--s-3);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: none; }
.lb-pos { font-size: 1.2rem; text-align: center; grid-row: 1 / span 2; }
.lb-rank { color: var(--mute); font-family: var(--font-display); font-size: 0.95rem; }
.lb-who { font-weight: 600; color: var(--white); }
.lb-top .lb-who { color: var(--magenta); }
.lb-detail { grid-column: 2; font-size: 0.78rem; margin-top: 2px; }
.lb-pts { grid-row: 1 / span 2; grid-column: 3; font-family: var(--font-display); font-size: 1.15rem; color: var(--white); text-align: right; }
.lb-pts .mute { font-size: 0.7rem; }

/* ---- Gallery ---- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin: var(--s-6) 0; }
.dropdown { position: relative; }
.dd-btn, .dd-sort { background: var(--ink-2); color: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--s-2) var(--s-4); cursor: pointer; font-family: var(--font-body); font-size: 0.85rem; }
.favtoggle.active { background: rgba(214,92,220,0.18); border-color: var(--magenta); color: var(--magenta); }
.dd-panel { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3); min-width: 210px;
  max-height: 340px; overflow-y: auto; box-shadow: var(--shadow); }
.dropdown.open .dd-panel { display: block; }
.dd-opt { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 0.9rem; color: var(--white); cursor: pointer; }
.dd-opt input { accent-color: var(--magenta); }
.dd-all { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--magenta);
  cursor: pointer; padding: 2px 2px 8px; font-size: 0.85rem; border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.masonry { columns: 2; column-gap: var(--s-3); }
.masonry img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: pointer; display: block; }
.gitem { position: relative; }
.masonry .gitem { break-inside: avoid; margin-bottom: var(--s-3); }
.gitem.liked img { outline: 2px solid var(--magenta); outline-offset: -2px; box-shadow: 0 0 14px rgba(214,92,220,0.5); }
.likebadge { position: absolute; top: 8px; right: 8px; z-index: 1; background: rgba(11,8,24,0.85);
  border: 1px solid var(--magenta); color: var(--magenta); border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; }
@media (min-width: 640px) { .masonry { columns: 3; } }
@media (min-width: 1040px) { .masonry { columns: 4; } }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(6,4,14,0.94); display: none; }
.lightbox.open { display: block; }
.lightbox img { border-radius: var(--radius); border: 1px solid var(--line); }
.lb-bar { position: fixed; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center;
  gap: var(--s-4); padding: 0 var(--s-6); z-index: 60; background: rgba(11,8,24,0.85); border-bottom: 1px solid var(--line); }
.lb-bar #lb-mode { background: rgba(214,92,220,0.14); color: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 5px 14px; cursor: pointer; font-family: var(--font-body); font-size: 0.85rem; }
.lb-bar .lb-sizewrap { margin-left: auto; color: var(--mute); font-size: 0.8rem; display: none; align-items: center; gap: 8px; }
.lightbox.grid .lb-bar .lb-sizewrap { display: flex; }
.lb-bar .lb-close { font-size: 1.8rem; color: var(--white); cursor: pointer; background: none; border: none; line-height: 1; }
.lb-single { position: absolute; inset: 52px 0 0 0; display: grid; place-items: center; padding: var(--s-6); }
.lightbox.grid .lb-single { display: none; }
.lb-single .lb-img { max-width: 94vw; max-height: 82vh; object-fit: contain; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2.4rem; color: var(--white);
  background: none; border: none; cursor: pointer; padding: 0 var(--s-4); z-index: 2; }
.lightbox .lb-prev { left: 8px; } .lightbox .lb-next { right: 8px; }
.lb-single .lb-cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--mute); font-size: 0.85rem; }
.lb-single .lb-like { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: rgba(11,8,24,0.8); border: 1px solid var(--line); border-radius: 999px; padding: 5px 16px; color: var(--white); cursor: pointer; font-size: 0.9rem; }
.lb-single .lb-like.on { border-color: var(--magenta); color: var(--magenta); }
.lb-grid { display: none; }
.lightbox.grid .lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--lb-size,160px), 1fr));
  gap: var(--s-2); padding: 66px var(--s-6) var(--s-8); position: absolute; inset: 0; overflow-y: auto; align-content: start; }
.lb-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: 50% 18%; border-radius: 8px; cursor: pointer; }
.lb-grid img.liked { outline: 2px solid var(--magenta); outline-offset: -2px; }

/* ---- Threats ---- */
.threat { display: grid; grid-template-columns: 1fr; gap: var(--s-4); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: var(--ink-2); margin-bottom: var(--s-6); }
.threat .t-img { width: 100%; height: 240px; object-fit: cover; object-position: 50% 22%; cursor: pointer; }
.threat .t-body { padding: var(--s-6); }
.threat .t-body .btn { margin-top: var(--s-4); display: inline-block; }
.threat .accent-bar { height: 4px; width: 44px; background: var(--accent, var(--magenta)); border-radius: 4px; margin-bottom: var(--s-2); }
.mini-grid { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0; }
.mini-grid img { height: 96px; width: 74px; object-fit: cover; object-position: 50% 16%; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; transition: transform .1s; }
.mini-grid img:hover { transform: translateY(-2px); }
.threat .t-strip { display: flex; gap: var(--s-2); overflow-x: auto; margin-top: var(--s-3); }
.threat .t-strip img { height: 70px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; flex: 0 0 auto; }
@media (min-width: 720px) { .threat { grid-template-columns: 320px 1fr; } .threat .t-img { height: 100%; } }

/* ---- Synergy explorer ---- */
.mode-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: var(--s-4); }
.mode-tabs button { background: transparent; color: var(--mute); border: none; padding: var(--s-3) var(--s-6);
  cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; }
.mode-tabs button.active { background: rgba(214,92,220,0.18); color: var(--white); }
.mode-tabs button + button { border-left: 1px solid var(--line); }
.avatars { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-6) 0; }
.avatar { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; width: 68px; }
.avatar .ring { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line);
  background: var(--ink-2); transition: border-color .15s, transform .1s; }
.avatar .ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar:hover .ring { transform: translateY(-2px); }
.avatar.on .ring { border-color: var(--accent, var(--magenta)); box-shadow: 0 0 0 2px var(--accent, var(--magenta)); }
.avatar .nm { font-size: 0.72rem; color: var(--mute); text-align: center; }
.avatar.on .nm { color: var(--white); }
.syn-result { margin-top: var(--s-4); }
.syn-tag { display: inline-block; font-size: 0.72rem; color: var(--mute); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; margin-left: var(--s-2); }
.pair-with { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--mute); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hint { color: var(--mute); font-style: italic; }

/* ---- Feedback modal ---- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(6,4,14,0.82); display: none; place-items: center; padding: var(--s-6); }
.modal.open { display: grid; }
.modal-card { position: relative; width: min(480px, 94vw); background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s-8) var(--s-6) var(--s-6); box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-x { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--white); font-size: 1.6rem; cursor: pointer; }
.modal .fld { display: block; color: var(--mute); font-size: 0.8rem; margin-top: var(--s-4); }
.modal select, .modal .fld-in { width: 100%; margin-top: 6px; background: var(--ink); color: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3); font-family: var(--font-body); font-size: 0.95rem; }
.modal textarea { resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-6); }

/* ---- CTA card + toast ---- */
.cta-card { cursor: pointer; border: 1px dashed var(--magenta); background: rgba(214,92,220,0.06); transition: background .15s; }
.cta-card:hover { background: rgba(214,92,220,0.14); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 90;
  background: var(--ink-2); border: 1px solid var(--magenta); color: var(--white); border-radius: 999px;
  padding: 10px 20px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Board ---- */
.board { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.bcol { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-4); }
.bcol-h { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem;
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-3); }
.bcard { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3); margin-bottom: var(--s-2); background: var(--ink); }
.bcard-t { font-size: 0.9rem; }
.bcard-m { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.72rem; }
.bid { color: var(--mute); font-family: var(--font-display); }
.bpri { border-radius: 999px; padding: 1px 7px; font-weight: 600; }
.bpri.p1 { color: var(--magenta); border: 1px solid var(--magenta); }
.bpri.p2 { color: var(--violet-lt); border: 1px solid var(--violet); }
.bpri.p3 { color: var(--mute); border: 1px solid var(--line); }
@media (min-width: 720px) { .board { grid-template-columns: repeat(4, 1fr); align-items: start; } }

/* ---- Landing ---- */
.landing { min-height: 100vh; display: grid; place-items: center; text-align: center;
  background: radial-gradient(1200px 600px at 50% 0%, rgba(124,74,182,0.35), transparent 60%), var(--ink); }
.landing .tag { color: var(--violet-lt); letter-spacing: 0.02em; margin: var(--s-4) 0 var(--s-8); font-style: italic; }
.gate { display: flex; gap: var(--s-2); justify-content: center; flex-wrap: wrap; }
.gate input { background: var(--ink-2); border: 1px solid var(--line); color: var(--white);
  border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); font-size: 1rem; min-width: 220px; }
.gate .err { color: var(--magenta); font-size: 0.85rem; margin-top: var(--s-3); min-height: 1.2em; }
/* Auth error callout — bolder + colored so it stands out, with room to breathe. */
.err { color: #ff6f91; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.01em;
  margin-top: var(--s-5); min-height: 1.2em; line-height: 1.4; }
.err:not(:empty) { padding: var(--s-3) var(--s-4); border: 1px solid rgba(255,111,145,0.4);
  border-radius: var(--radius-sm); background: rgba(255,111,145,0.08); max-width: 340px; margin-left: auto; margin-right: auto; }

/* ---- "Keep your handle?" prompt on Google sign-in ---- */
.handle-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 1.2rem; background: rgba(5,3,12,0.72); backdrop-filter: blur(4px); }
.handle-card { max-width: 400px; text-align: center; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 2rem 1.8rem; box-shadow: 0 24px 60px rgba(0,0,0,0.6); }
.handle-card h3 { font-family: var(--font-display); color: var(--white); font-size: 1.4rem; margin: 0 0 var(--s-3); }
.handle-card .mute { font-size: 0.92rem; line-height: 1.55; margin: 0 0 var(--s-4); }
.handle-card .fld-in { width: 100%; background: var(--ink); color: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); font-size: 1rem; margin-bottom: var(--s-4); }
.handle-btns { display: flex; flex-direction: column; gap: var(--s-3); }

/* ---- Auth panel on the gate page ---- */
.auth { max-width: 340px; margin: var(--s-6) auto 0; text-align: left; }
.auth-tabs { display: flex; gap: var(--s-2); margin-bottom: var(--s-4); }
.auth-tab { flex: 1; background: transparent; border: 1px solid var(--line); color: var(--mute);
  padding: var(--s-2); border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; }
.auth-tab.active { color: var(--white); border-color: var(--magenta); background: rgba(214,92,220,0.12); }
.auth .google-btn { display: flex; align-items: center; justify-content: center; gap: var(--s-3); width: 100%;
  background: #fff; color: #1f1f1f; font-weight: 600; }
.auth .google-btn:hover { filter: brightness(0.95); }
.auth-or { display: flex; align-items: center; gap: var(--s-3); color: var(--mute); font-size: 0.8rem; margin: var(--s-4) 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth form { display: flex; flex-direction: column; gap: var(--s-3); }
.auth .fld-in, .auth .gate input { width: 100%; background: var(--ink-2); border: 1px solid var(--line); color: var(--white);
  border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); font-size: 1rem; }
.auth .btn { width: 100%; }
.auth .linklike { display: inline-block; margin-top: var(--s-4); background: none; border: none; color: var(--mute);
  text-decoration: underline; cursor: pointer; font-size: 0.85rem; font-family: var(--font-body); }
.auth .linklike:hover { color: var(--white); }
.auth .gate { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); }

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .cols-2 { grid-template-columns: 1fr 1fr; }
  .cols-3 { grid-template-columns: repeat(3, 1fr); }
  .cols-4 { grid-template-columns: repeat(3, 1fr); }
  .grid { gap: var(--s-6); }
  .jump { grid-template-columns: repeat(3,1fr); }
  .swatches { grid-template-columns: repeat(3,1fr); }
  .char-hero { grid-template-columns: 320px 1fr; }
  .latest { grid-template-columns: 300px 1fr; }
  .grid.full .card { aspect-ratio: 16 / 6; }
}
@media (min-width: 1040px) {
  .cols-4 { grid-template-columns: repeat(4, 1fr); }
  .swatches { grid-template-columns: repeat(4,1fr); }
}
@media (max-width: 639px) {
  /* Nav lives at the bottom on mobile so it's within thumb reach:
     [logo]  [menu ☰/✕]  [Feedback] evenly spaced. */
  .nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 40;
    justify-content: space-between; gap: var(--s-3);
    border-bottom: none; border-top: 1px solid var(--line);
    padding-bottom: calc(var(--s-2) + env(safe-area-inset-bottom, 0px)); }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  /* Menu is always in the DOM as a sheet; it slides fully up from the bottom on open
     and back down on close (transform-based so BOTH directions animate smoothly). */
  .nav .links { display: flex; position: fixed; top: auto; left: 0; right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    flex-direction: column; gap: var(--s-1);
    background: var(--ink-2); border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; padding: var(--s-4) var(--s-4) var(--s-3);
    box-shadow: 0 -14px 40px rgba(0,0,0,0.55);
    transform: translateY(calc(100% + var(--nav-h))); opacity: 0; visibility: hidden;
    transition: transform 0.34s cubic-bezier(0.22,0.61,0.36,1), opacity 0.24s ease, visibility 0s 0.34s; }
  .nav .links::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px;
    background: var(--line); margin: 0 auto var(--s-3); }
  .nav .links.open { transform: translateY(0); opacity: 1; visibility: visible;
    transition: transform 0.36s cubic-bezier(0.22,0.61,0.36,1), opacity 0.2s ease; }
  .nav .links a { padding: var(--s-3); font-size: 1rem; }
  /* Backdrop behind the open sheet. */
  .nav-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(5,3,12,0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .nav-backdrop.show { opacity: 1; pointer-events: auto; }
  .nav .menu-btn { display: flex; }
  .nav .nav-fb { padding: 0.5rem 0.95rem; }
  /* In the bottom sheet, the dropdown expands inline (no popover). Force a vertical stack —
     otherwise it inherits the desktop `display:inline-flex` (row) and the button + submenu
     links sit side-by-side and overflow. */
  .nav .navdrop { width: 100%; display: flex; flex-direction: column; align-items: stretch; }
  .nav .navdrop-btn { width: 100%; justify-content: space-between; font-size: 1rem; padding: var(--s-3); }
  .nav .navdrop-btn .caret { display: none; }
  .nav .navdrop-menu { display: flex; position: static; margin: 0; padding: 0 0 var(--s-2) var(--s-4);
    min-width: 0; background: transparent; border: none; box-shadow: none; }
  .toast { bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); }
  .view-toggle { margin-left: 0; }
  /* Character portrait was dominating the screen on mobile — cap it so text isn't dwarfed. */
  .viewer { aspect-ratio: auto; height: 54vh; max-height: 520px; }
  .char-hero { gap: var(--s-4); }
  .char-hero h1.display { font-size: 2rem; }
}
