/* Goal Archive — Night Arcade theme */
:root {
  --bg: #07090f;
  --panel: #0d1119;
  --panel-2: #121826;
  --line: #1e2636;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #4da3ff;
  --accent-2: #37e0a8;
  --hot: #ff5470;
  --radius: 14px;
  --mono: "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
.mono { font-family: var(--mono); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { display: block; }

/* ---------- starfield + boot ---------- */
#stars {
  position: fixed; inset: 0; z-index: -1;
  width: 100vw; height: 100vh; display: block;
  opacity: .8;
}
.boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot pre {
  color: var(--accent); font-size: 13px; letter-spacing: .08em; line-height: 1.9;
  text-shadow: 0 0 12px rgba(77,163,255,.35);
  min-width: 320px; min-height: 6.5em;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 {
  margin: 0; font-size: 17px; letter-spacing: .28em; font-weight: 650;
  font-family: var(--mono);
}
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(77,163,255,.55);
  animation: pulse 2.6s ease-out infinite;
  align-self: center;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(77,163,255,.45); }
  70%  { box-shadow: 0 0 0 11px rgba(77,163,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(77,163,255,0); }
}
.count { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.controls { display: flex; align-items: center; gap: 14px; }
#search {
  width: 240px; padding: 8px 13px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  outline: none; transition: border-color .18s ease, width .22s ease;
  font-size: 13.5px;
}
#search:focus { border-color: var(--accent); width: 300px; }
#search::placeholder { color: var(--muted); }

.chips { display: flex; gap: 6px; }
.chip {
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  font-size: 12.5px; letter-spacing: .02em;
  transition: all .18s ease;
}
.chip:hover { color: var(--text); border-color: #2b3650; }
.chip.active {
  color: #06121f; background: var(--accent); border-color: var(--accent);
  font-weight: 600;
}

.viewtoggle {
  display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.viewtoggle button {
  padding: 7px 12px; color: var(--muted); font-size: 14px;
  transition: all .16s ease;
}
.viewtoggle button.active { background: var(--panel-2); color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative; margin: 22px 26px 6px;
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  overflow: hidden; min-height: 280px;
  display: flex; align-items: flex-end;
}
.hero-bg { position: absolute; inset: 0; }
.hero-bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  opacity: .5;
  animation: kenburns 18s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.07); } }
.hero-fade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(7,9,15,.96) 0%, rgba(7,9,15,.72) 42%, rgba(7,9,15,.12) 100%);
}
.scanline {
  position: absolute; left: 0; right: 0; height: 90px; top: -90px;
  background: linear-gradient(180deg, transparent, rgba(77,163,255,.075), transparent);
  animation: sweep 8s linear infinite;
  pointer-events: none;
}
@keyframes sweep { from { top: -90px; } to { top: 110%; } }
.hero-content { position: relative; padding: 30px 34px; max-width: 640px; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .32em;
  color: var(--accent); margin-bottom: 10px;
}
.hero-content h2 {
  margin: 0 0 8px; font-size: 34px; line-height: 1.12; font-weight: 700;
  letter-spacing: -.01em;
}
.hero-content p {
  margin: 0 0 20px; color: var(--muted); max-width: 54ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  padding: 9px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line);
  transition: all .17s ease;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; }
.btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.ghost { color: var(--text); background: rgba(255,255,255,.03); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.small { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }

/* ---------- grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px; padding: 20px 26px 60px;
}
.grid.strip {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 30px;
}
.grid.strip .card { flex: 0 0 360px; scroll-snap-align: start; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform .19s ease, border-color .19s ease, box-shadow .19s ease;
  animation: rise .5s ease backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(77,163,255,.55);
  box-shadow: 0 14px 38px -18px rgba(0,0,0,.85);
  outline: none;
}
.card.incomplete { cursor: default; opacity: .75; }
.card.incomplete:hover { transform: none; border-color: var(--line); box-shadow: none; }

.thumb { position: relative; aspect-ratio: 16/9; background: var(--panel-2); overflow: hidden; }
.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 3.2s ease, opacity .25s ease;
}
.card:hover .thumb img { transform: scale(1.04); }
.ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; letter-spacing: .08em;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255,255,255,.045) 50%, transparent 70%) ,
    var(--panel-2);
  background-size: 220% 100%, auto;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0, 0 0; } to { background-position: -120% 0, 0 0; } }
.thumb.has-img .ph { display: none; }

.live-holder, .live-holder iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.live-holder { pointer-events: none; opacity: 0; transition: opacity .35s ease; }
.live-holder.on { opacity: 1; }
.live-holder.on ~ img, .thumb .live-holder.on + * ~ img { opacity: 0; }

.ribbon {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  max-width: calc(100% - 24px); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; font-weight: 700;
  padding: 4px 9px; border-radius: 6px;
  background: rgba(6,10,18,.78); backdrop-filter: blur(4px);
  color: var(--accent-2); border: 1px solid rgba(55,224,168,.35);
}
.card.incomplete .ribbon { color: var(--hot); border-color: rgba(255,84,112,.35); }
.ribbon.green { color: var(--accent-2); border-color: rgba(55,224,168,.35); }
.ribbon.muted { color: var(--muted); border-color: rgba(139,148,167,.3); }
.sync-btn { margin-left: 10px; align-self: center; }
.sync-btn[disabled] { opacity: .6; }

/* ---------- harness badges (colors set inline per card via --hz) ---------- */
.hz-badge {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; font-weight: 700;
  padding: 4px 9px; border-radius: 6px;
  background: rgba(6,10,18,.78); backdrop-filter: blur(4px);
  color: var(--hz, var(--muted));
  border: 1px solid color-mix(in srgb, var(--hz, #8b94a7) 40%, transparent);
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.hz-badge[hidden] { display: none; }
.hz-badge .glyph { font-size: 11px; line-height: 1; }
.card:hover .hz-badge, .card:focus-within .hz-badge { opacity: 1; }

/* ---------- favorites star ---------- */
.fav-btn {
  position: absolute; bottom: 8px; right: 8px; z-index: 4;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  font-size: 14px; line-height: 1; color: rgba(200,215,235,.55);
  background: rgba(6,10,18,.72); backdrop-filter: blur(4px);
  border: 1px solid rgba(139,148,167,.3);
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.fav-btn:hover { transform: scale(1.12); color: #fde68a; border-color: rgba(253,230,138,.5); }
.fav-btn.active, #ov-fav.active { color: #fde68a; border-color: rgba(253,230,138,.55); box-shadow: 0 0 10px rgba(253,230,138,.25); }
#ov-fav.active { color: #fde68a; }

/* favorites-only toggle in crumb row */
.fav-toggle {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: rgba(200,215,235,.55);
  background: rgba(6,10,18,.6); border: 1px solid rgba(139,148,167,.3);
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.fav-toggle:hover { color: #fde68a; border-color: rgba(253,230,138,.5); }
.fav-toggle.on { color: #fde68a; border-color: rgba(253,230,138,.6); box-shadow: 0 0 10px rgba(253,230,138,.22); }

/* ---------- loading skeleton ---------- */
.card.skeleton { cursor: default; pointer-events: none; }
.sk-thumb {
  height: 168px; border-radius: 0;
  background: linear-gradient(100deg, rgba(120,150,190,.06) 40%, rgba(120,150,190,.14) 50%, rgba(120,150,190,.06) 60%);
  background-size: 200% 100%; animation: skShimmer 1.4s linear infinite;
}
.sk-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.sk-line {
  height: 10px; border-radius: 5px;
  background: linear-gradient(100deg, rgba(120,150,190,.07) 40%, rgba(120,150,190,.15) 50%, rgba(120,150,190,.07) 60%);
  background-size: 200% 100%; animation: skShimmer 1.4s linear infinite;
}
.sk-line.w60 { width: 60%; } .sk-line.w90 { width: 90%; } .sk-line.w40 { width: 40%; }
@keyframes skShimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }

/* ---------- toasts ---------- */
#arcade-toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.arcade-toast {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: #e8f4ff; padding: 9px 16px; border-radius: 10px;
  background: rgba(6,10,18,.85); backdrop-filter: blur(6px);
  border: 1px solid rgba(139,148,167,.35);
  animation: toastIn .25s cubic-bezier(.2,.7,.3,1) both;
}
.arcade-toast.ok { border-color: rgba(74,222,128,.5); color: #d7ffe6; }
.arcade-toast.out { opacity: 0; transition: opacity .35s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- breadcrumb row ---------- */
.crumb-row {
  display: flex; align-items: center; gap: 14px;
  max-width: 1400px; margin: 0 auto; padding: 10px 22px 0;
}
.crumb { font-size: 11px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }

/* ---------- models view ---------- */
.model-card {
  --ac: var(--accent);
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: 14px; cursor: pointer; position: relative;
  background: rgba(10,16,28,.72); border: 1px solid color-mix(in srgb, var(--ac) 26%, transparent);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), border-color .2s ease, box-shadow .2s ease;
  animation: rise .5s ease backwards;
}
.model-card:hover, .model-card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--ac) 60%, transparent);
  box-shadow: 0 14px 40px rgba(0,0,0,.45), 0 0 30px color-mix(in srgb, var(--ac) 12%, transparent);
  outline: none;
}
.mc-glyph {
  flex-shrink: 0; width: 58px; height: 58px; border-radius: 14px;
  display: grid; place-items: center; color: var(--ac);
  border: 1px solid color-mix(in srgb, var(--ac) 40%, transparent);
  background: color-mix(in srgb, var(--ac) 8%, transparent);
  font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .08em;
  box-shadow: 0 0 18px color-mix(in srgb, var(--ac) 14%, transparent) inset;
}
.mc-body { flex: 1; min-width: 0; }
.mc-name {
  margin: 0 0 4px; font-family: var(--mono); font-size: 14px; font-weight: 700;
  letter-spacing: .14em; color: #e8f4ff; text-transform: uppercase;
  text-shadow: 0 0 12px color-mix(in srgb, var(--ac) 40%, transparent);
}
.mc-desc { margin: 0; font-size: 12px; color: var(--muted); }
.mc-stats { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.mc-stats span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; color: var(--muted); }
.mc-favs { color: #fde68a !important; }

/* ---------- model view: sections + harness cards ---------- */
.section-head {
  grid-column: 1 / -1; margin: 6px 0 0;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .3em; color: var(--muted); text-transform: uppercase;
  border-bottom: 1px solid rgba(139,148,167,.18); padding-bottom: 8px;
}
.section-head .star { color: #fde68a; margin-right: 6px; }
.subgrid { grid-column: 1 / -1; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.harness-card {
  --hz: var(--muted);
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 14px; cursor: pointer;
  background: rgba(10,16,28,.72); border: 1px solid color-mix(in srgb, var(--hz) 24%, transparent);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), border-color .2s ease, box-shadow .2s ease;
  animation: rise .5s ease backwards;
}
.harness-card:hover, .harness-card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--hz) 60%, transparent);
  box-shadow: 0 14px 40px rgba(0,0,0,.45), 0 0 30px color-mix(in srgb, var(--hz) 12%, transparent);
  outline: none;
}
.hc-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 10px currentColor; background: var(--hz); }
.hc-body { flex: 1; min-width: 0; }
.hc-name {
  margin: 0 0 3px; font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: .18em; color: #e8f4ff; text-transform: uppercase;
}
.hc-desc { margin: 0; font-size: 11.5px; color: var(--muted); }
.hc-count {
  flex-shrink: 0; font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--hz); border: 1px solid color-mix(in srgb, var(--hz) 35%, transparent);
  padding: 4px 10px; border-radius: 8px;
}
.card[data-harness]:hover {
  border-color: color-mix(in srgb, var(--hz, var(--accent)) 55%, transparent);
}
.card[data-harness] .c-tags { color: var(--hz, #5b6578); opacity: .9; }
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 7px; vertical-align: 1px;
}
.hz-chips:not(:empty) { margin-left: -6px; }

.card-body { padding: 14px 16px 13px; }
.c-title { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; letter-spacing: -.005em; }
.c-desc {
  margin: 0 0 10px; color: var(--muted); font-size: 13px; min-height: 38px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card footer {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 11.5px;
}
.c-tags { color: #5b6578; letter-spacing: .06em; }

.empty { text-align: center; color: var(--muted); padding: 80px 0 120px; font-size: 14px; }

/* ---------- overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; }
.overlay[hidden] { display: none; }
.overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,6,11,.62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: fadein .22s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.overlay-panel {
  position: relative; margin: auto;
  width: min(1500px, calc(100vw - 48px)); height: min(900px, calc(100vh - 48px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  display: grid; grid-template-columns: 1fr 340px; overflow: hidden;
  animation: pop .24s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.965); } to { opacity: 1; transform: none; } }
.overlay-close {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10,14,22,.7); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
  transition: all .16s ease;
}
.overlay-close:hover { color: var(--text); border-color: var(--hot); }

.ov-stage { position: relative; background: #000; display: flex; flex-direction: column; }
/* corner brackets */
.ov-stage::before, .ov-stage::after {
  content: ""; position: absolute; width: 26px; height: 26px; z-index: 4;
  pointer-events: none; border: 2px solid rgba(77,163,255,.5);
}
.ov-stage::before { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.ov-stage::after { bottom: 52px; right: 8px; border-left: none; border-top: none; }
.ov-stage iframe { flex: 1; border: 0; width: 100%; }
.ov-note {
  position: absolute; inset: 0; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px;
}
.ov-note:not([hidden]) { display: flex; }
.ov-bar {
  display: flex; gap: 8px; padding: 9px 12px;
  background: var(--panel); border-top: 1px solid var(--line);
}

.ov-side {
  border-left: 1px solid var(--line); padding: 24px 22px;
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
  background: var(--panel);
}
.ov-side h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.01em; }
.ov-side > p { margin: 0; color: var(--muted); font-size: 13.5px; }
.meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.meta dt { color: #5b6578; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; align-self: baseline; }
.meta dd { margin: 0; color: var(--text); word-break: break-all; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery img {
  width: 100%; aspect-ratio: 16/10; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
}
.gallery .g-empty { grid-column: 1/-1; color: #5b6578; font-size: 12px; }
.ov-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.ov-actions .btn { width: 100%; text-align: center; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- misc ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232c40; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  #search { width: 160px; }
  #search:focus { width: 200px; }
  .overlay-panel { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: calc(100vh - 48px); }
  .ov-side { border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
