:root {
  --bg: #08110d;
  --ink: #e8fff4;
  --muted: #8aae9a;
  --line: #244036;
  --accent: #3dff9a;
  --spot: #163528;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
h1, h2, h3 { font-family: 'Orbitron', sans-serif; }
@view-transition { navigation: auto; }
header.top { view-transition-name: topbar; }
.gallery-main { view-transition-name: stage; }
::view-transition-old(stage) { animation: 380ms ease both stage-out; }
::view-transition-new(stage) { animation: 480ms ease both stage-in; }
@keyframes stage-out { to { opacity: 0; transform: translateY(14px); } }
@keyframes stage-in { from { opacity: 0; transform: translateY(18px); } }
.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.modes { display: flex; gap: 8px; }
.corner-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.corner-btn[hidden] { display: none !important; }
.corner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #07140f;
  color: #cfeede;
  text-decoration: none;
  font: 600 0.82rem/1 inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
/* Log in / out — deliberately quieter than the hero so it doesn't shout (matches the app). */
.corner-btn.is-main { background: #04140c; color: var(--accent); border-color: rgba(61, 255, 154, 0.6); font-weight: 700; }
.corner-btn:hover { border-color: #3dff9a; color: #3dff9a; background: rgba(61, 255, 154, 0.08); }
.corner-btn:active { transform: translateY(1px); }
.corner-btn.is-main:hover { background: var(--accent); color: #04140c; border-color: var(--accent); }
/* Emerald balance chip — always on when signed in; taps through to /plans */
.emerald-pill { gap: 6px; padding: 8px 12px; }
.emerald-pill .gem-ico {
  width: 15px; height: 15px; flex: none;
  fill: rgba(61, 255, 154, 0.3); stroke: #3dff9a; stroke-width: 1.6; stroke-linejoin: round;
}
.emerald-pill b { font: 800 0.8rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #3dff9a; letter-spacing: 0.02em; }
.modes a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.modes a:hover { color: var(--ink); border-color: rgba(61, 255, 154, 0.6); }
.modes a.on {
  color: #04140c;
  background: linear-gradient(135deg, #e7fff1, #3dff9a);
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(61, 255, 154, 0.32);
}
.brand-mark { display: inline-flex; text-decoration: none; }
.mark { width: 28px; height: 28px; display: block; }
.nav-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* slavpic kit: nav buttons are CUT-corner (clip-path), not rounded pills — match the dashboard. */
.modes a, .corner-btn {
  border-radius: 0 !important;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
h1 { margin: 0; font-size: 1.05rem; font-weight: 700; }
main { padding: 22px 24px 48px; }
.gallery-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0 0 4px; }
.g-title { margin: 0; font: 900 1.7rem/1 'Orbitron', sans-serif; color: var(--ink); letter-spacing: 0.02em; }
.g-count {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 13px;
  background: rgba(61, 255, 154, 0.08); border: 1px solid rgba(61, 255, 154, 0.3); color: #8fcdb0;
  font: 600 0.78rem/1 'Share Tech Mono', ui-monospace, monospace; letter-spacing: 0.06em; text-transform: uppercase;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.g-count[hidden] { display: none; }
.g-count b { font: 800 1.1rem/1 'Orbitron', sans-serif; color: #3dff9a; }
.lede { margin: 6px 0 16px; color: var(--muted); }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.shot {
  aspect-ratio: 3 / 4;
  width: 100%;
  padding: 0;
  border-radius: 0;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  border: 1px solid var(--line);
  background-color: #070d0a;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.shot:hover, .shot:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  outline: none;
}
.shot-wrap { position: relative; }
/* Always-visible download icon on every thumbnail (no hover needed — works on touch) */
.q-download {
  position: absolute; top: 8px; right: 8px; z-index: 3; padding: 0;
  width: 38px; height: 38px; cursor: pointer;
  border-radius: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(4, 10, 8, 0.82); border: 1px solid rgba(61, 255, 154, 0.55); color: #3dff9a;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: background 0.15s, transform 0.1s;
}
.q-download svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.q-download:hover { background: rgba(61, 255, 154, 0.22); color: #eafff4; }
.q-download:active { transform: scale(0.9); }
.q-download.busy { opacity: 0.5; cursor: default; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: rgba(3, 8, 6, 0.92);
  backdrop-filter: blur(6px);
  padding: 16px;
  overflow: hidden;            /* overlay itself never scrolls — image + bar fit the viewport */
  overscroll-behavior: contain;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 6px 4px;
}
.lb-cap-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 0;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  border: 1px solid var(--line);
  background: rgba(7, 20, 15, 0.6);
  color: var(--ink);
  font: 500 0.9rem/1 'Share Tech Mono', ui-monospace, Menlo, monospace;
  outline: none;
  transition: border-color 0.15s;
}
.lb-cap-input::placeholder { color: var(--muted); }
.lb-cap-input:focus { border-color: rgba(61, 255, 154, 0.6); }
.lb-cap-input.saved { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(61,255,154,.4); }
.lb-dl {
  flex: 0 0 auto;
  padding: 13px 22px;
  border-radius: 0;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  border: 0;
  background: linear-gradient(135deg, #e7fff1, #3dff9a);
  color: #04140c;
  font: 800 0.82rem/1 'Orbitron', ui-sans-serif, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 8px 22px -10px rgba(61, 255, 154, 0.8);
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}
.lb-dl:hover { filter: brightness(1.05); }
.lb-dl:disabled { opacity: 0.6; cursor: default; }
.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 0;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  border: 1px solid rgba(61, 255, 154, 0.4);
  background: rgba(7, 20, 15, 0.85);
  color: var(--accent);
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 1;
  transition: border-color 0.15s, background 0.15s;
}
.lb-close:hover { border-color: var(--accent); background: rgba(61, 255, 154, 0.12); }
body.lb-open { overflow: hidden; }
.empty {
  color: var(--muted);
  padding: 32px 0;
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: 1fr 1fr; }
  main, .top { padding-left: 14px; padding-right: 14px; }
  /* Header wraps instead of overflowing sideways when signed in: brand + modes on top,
     the emerald + account pills flow to a second right-aligned row. */
  .top { flex-wrap: wrap; row-gap: 10px; gap: 10px; }
  .corner-nav { flex-wrap: wrap; justify-content: flex-end; }
  .corner-btn { min-height: 34px; padding: 7px 12px; font-size: 0.68rem; }
  .emerald-pill { padding: 7px 11px; }
  .modes a { font-size: 0.82rem; padding: 7px 12px; }
  .q-download { width: 40px; height: 40px; top: 6px; right: 6px; }
  .q-download svg { width: 20px; height: 20px; }
  /* Lightbox on phones: stack the bar so the download button spans the full width at the
     bottom (easy thumb reach) and the caption wraps instead of forcing sideways scroll. */
  .lightbox { padding: 12px; }
  .lb-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 2px 2px;
  }
  .lb-cap-input { text-align: center; }
  .lb-dl { width: 100%; padding: 15px; font-size: 0.95rem; }
  .lb-close { top: 10px; right: 10px; }
}
