:root {
  --bg: #0e1014;
  --panel: #161a21;
  --panel2: #1c212a;
  --ink: #f0f2f5;
  --mut: #9aa3b0;
  --line: #262c37;
  --acc: #e8b34b;
  --acc-ink: #1a1405;
  --r: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0; }

/* ---------- gate ---------- */
body.locked { overflow: hidden; height: 100vh; }
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.7s ease;
}
.gate.away { opacity: 0; pointer-events: none; }
.gate-in { text-align: center; width: min(400px, 100%); }
.gate-title {
  margin: 0 0 34px;
  font-size: clamp(34px, 7vw, 54px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  animation: gateIn 0.9s ease-out;
}
@keyframes gateIn { from { opacity: 0; transform: translateY(12px); } }
.gate-video-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  padding: 14px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  animation: gateIn 0.9s ease-out 0.1s backwards;
}
.gate-video-btn:hover { border-color: var(--acc); transform: translateY(-1px); }
.gv-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--acc-ink);
  flex: none;
}
.gv-ico svg { margin-left: 2px; }
.gate-video {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(8, 9, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gate-video[hidden] { display: none; }
.gv-in {
  position: relative;
  max-width: min(860px, 100%);
}
.gv-in video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 78vh;
  border-radius: var(--r);
  background: #000;
}
.gv-close {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--panel2);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.gv-close:hover { background: var(--line); }
.gate-form {
  display: flex;
  gap: 10px;
  animation: gateIn 0.9s ease-out 0.15s backwards;
}
.gate-form input {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 15px 18px;
  outline: none;
}
.gate-form input:focus { border-color: var(--acc); }
.gate-form input::placeholder { letter-spacing: normal; color: var(--mut); }
.gate-form button {
  width: 56px;
  border: 0;
  border-radius: 12px;
  background: var(--acc);
  color: var(--acc-ink);
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.15s;
}
.gate-form button:hover { transform: translateX(2px); }
.gate-err {
  min-height: 22px;
  margin: 14px 0 0;
  color: #e06055;
  font-size: 14px;
}
.gate-form.shake { animation: shake 0.4s; }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.exit-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  padding: 8px 16px;
  background: rgba(22, 26, 33, 0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mut);
  font-size: 13px;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: color 0.15s, border-color 0.15s;
}
.exit-btn:hover { color: var(--ink); border-color: var(--acc); }
body.locked .exit-btn { display: none; }

#assemble { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ---------- hero ---------- */
.hero {
  padding: clamp(56px, 10vh, 120px) 20px clamp(40px, 7vh, 80px);
  text-align: center;
}
.hero-in { max-width: 720px; margin: 0 auto; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--acc);
}
h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hl { color: var(--acc); }
.lead {
  margin: 20px auto 0;
  max-width: 58ch;
  color: var(--mut);
  font-size: clamp(15px, 2.2vw, 18px);
}
.stats {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 6vw, 56px);
  margin: 30px 0 34px;
}
.stat b {
  display: block;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 13px; color: var(--mut); }
.cta {
  display: inline-block;
  background: var(--acc);
  color: var(--acc-ink);
  font-weight: 600;
  text-decoration: none;
  padding: 14px 30px;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(232, 179, 75, 0.25); }

/* ---------- viewer ---------- */
.viewer-wrap { padding: 0 clamp(8px, 2vw, 24px); }
.viewer {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  height: min(86vh, 900px);
  background: #090a0d;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.stage img { display: block; pointer-events: none; }
.cells { position: absolute; inset: 0; }
.cell-hl {
  position: absolute;
  border: calc(2.5px * var(--inv, 1)) solid var(--acc);
  border-radius: calc(4px * var(--inv, 1));
  pointer-events: none;
}
.cell-hl.pulse { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 179, 75, 0.55); }
  70% { box-shadow: 0 0 0 calc(10px * var(--inv, 1)) rgba(232, 179, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 179, 75, 0); }
}
.tooltip {
  position: absolute;
  z-index: 4;
  background: rgba(14, 16, 20, 0.92);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -130%);
}
.zoombar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoombar button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(22, 26, 33, 0.92);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
}
.zoombar button:hover { border-color: var(--acc); color: var(--acc); }
.hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(14, 16, 20, 0.85);
  border: 1px solid var(--line);
  color: var(--mut);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: calc(100% - 130px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.4s;
}
.hint.off { opacity: 0; }

/* ---------- catalog ---------- */
.catalog { padding: clamp(56px, 9vh, 100px) 20px 30px; }
.catalog-in { max-width: 1100px; margin: 0 auto; }
h2 { font-size: clamp(26px, 4vw, 38px); font-weight: 800; letter-spacing: -0.01em; }
.sub { color: var(--mut); margin: 12px 0 26px; max-width: 60ch; }
.controls { display: flex; flex-direction: column; gap: 14px; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--mut);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--acc); }
.chip.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
.found { color: var(--mut); font-size: 13.5px; margin: 14px 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.pcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.15s, transform 0.15s;
}
.pcard:hover { border-color: var(--acc); transform: translateY(-2px); }
.pcard { overflow: hidden; }
.pcard img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  margin: 0;
  border: 0;
  background: var(--panel2);
}
.pcard span {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  padding: 8px 9px 9px;
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-back { position: absolute; inset: 0; background: rgba(5, 6, 8, 0.7); backdrop-filter: blur(3px); }
.card {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  max-height: min(92vh, 700px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  animation: up 0.22s ease-out;
}
@keyframes up { from { opacity: 0; transform: translateY(14px); } }
.card > img {
  width: 42%;
  object-fit: cover;
  background: var(--panel2);
}
.card-body { padding: clamp(20px, 4vw, 36px); overflow-y: auto; flex: 1; }
.cat {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--acc);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.card h3 { font-size: clamp(22px, 3.4vw, 32px); font-weight: 800; letter-spacing: -0.01em; }
.ach {
  margin: 14px 0 0;
  font-size: clamp(16px, 2.4vw, 19px);
  font-weight: 600;
  color: var(--acc);
  line-height: 1.4;
}
.desc { color: var(--mut); margin: 12px 0 0; }
.meta { color: var(--mut); font-size: 13px; margin: 16px 0 0; }
.show-btn {
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--acc);
  color: var(--acc);
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 11px 22px;
  border-radius: 999px;
  cursor: pointer;
}
.show-btn:hover { background: var(--acc); color: var(--acc-ink); }
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(14, 16, 20, 0.6);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}
.close:hover { background: rgba(14, 16, 20, 0.9); }

footer { padding: 40px 20px 60px; text-align: center; }
footer p { color: var(--mut); font-size: 14px; max-width: 52ch; margin: 0 auto; }

button:focus-visible, a:focus-visible, .pcard:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .viewer { height: 74vh; }
  .card { flex-direction: column; overflow-y: auto; }
  .card > img { width: 100%; max-height: 42vh; }
  .card-body { overflow: visible; }
  .stats { gap: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
  .hint { display: none; }
}
