:root {
  --bg: #0b0b0c;
  --panel: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .12);
  --text: #f4f4f5;
  --muted: #a1a1aa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---------- Viewer ---------- */
.deck {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img { height: 26px; width: auto; display: block; }

.brand .sep { width: 1px; height: 22px; background: var(--line); flex: none; }

.brand .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools { display: flex; gap: 6px; flex: none; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--panel);
  transition: background .15s ease;
}

.icon-btn:hover { background: rgba(255, 255, 255, .14); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; }

.stage {
  position: relative;
  min-height: 0;
  margin: 0 20px;
  display: grid;
  place-items: center;
  touch-action: pan-y;
}

.slide { display: grid; place-items: center; width: 100%; height: 100%; }

.frame {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  opacity: 0;
  transform: scale(.985);
  transition: opacity .35s ease, transform .35s ease;
  background: #000;
}

.frame.in { opacity: 1; transform: none; }
.frame canvas { display: block; }

.frame .hit {
  position: absolute;
  display: block;
  cursor: pointer;
  border-radius: 4px;
  transition: background .15s ease;
}

.frame .hit:hover { background: rgba(255, 255, 255, .12); }

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  z-index: 2;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
}

.nav.prev { left: 12px; }
.nav.next { right: 12px; }
.nav svg { width: 22px; height: 22px; }

.bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px 18px;
  position: relative;
}

.counter {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 64px;
  text-align: center;
}

.bottombar .icon-btn.m { display: none; }

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .06);
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  transition: width .3s ease;
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
  z-index: 3;
}

.loader[hidden] { display: none; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error a { text-decoration: underline; color: var(--text); }

.rotate-hint {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .topbar { padding: 12px 14px; }
  .brand img { height: 22px; }
  .stage { margin: 0 10px; }
  .frame { border-radius: 6px; }
  .nav { display: none; }
  .bottombar .icon-btn.m { display: grid; }
  .bottombar { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

@media (max-width: 768px) and (orientation: portrait) {
  .rotate-hint { display: block; }
}

@media (max-height: 500px) {
  .topbar { padding: 6px 14px; }
  .brand img { height: 20px; }
  .icon-btn { width: 34px; height: 34px; }
  .bottombar { padding: 4px 14px 8px; }
  .nav { width: 44px; height: 44px; }
}

/* Fullscreen: maximize slide */
.deck:fullscreen .stage { margin: 0; }
.deck:fullscreen .frame { border-radius: 0; box-shadow: none; }

/* ---------- Menu ---------- */
.menu {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { max-width: 1120px; width: 100%; margin: 0 auto; padding: 0 24px; }

.menu header { padding: 48px 0 36px; }
.menu header img { height: 34px; width: auto; display: block; }

.menu h1 {
  margin-top: 44px;
  font-size: clamp(34px, 5.5vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.menu h1 em {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-style: italic;
}

.menu .lead { margin-top: 14px; color: var(--muted); font-size: 17px; }

.menu main { flex: 1; padding-bottom: 72px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  background: #151518;
  border: 1px solid #25252b;
  border-radius: 18px;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}

.card:hover { transform: translateY(-3px); border-color: #3a3a42; }

.thumb {
  aspect-ratio: 16 / 9;
  background: #0f0f11;
  position: relative;
  overflow: hidden;
}

.thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .4s ease, transform .4s ease;
}

.thumb canvas.in { opacity: 1; }
.card:hover .thumb canvas { transform: scale(1.03); }

.thumb .spinner { position: absolute; top: 50%; left: 50%; margin: -17px 0 0 -17px; }

.card .body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }

.tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.card h2 { margin-top: 8px; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
.card p { margin-top: 6px; color: var(--muted); font-size: 15px; flex: 1; }

.cta {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 999px;
  background: #fff;
  color: #0b0b0c;
  font-size: 14px;
  font-weight: 700;
}

.cta svg { width: 16px; height: 16px; }

.menu footer {
  border-top: 1px solid #25252b;
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.menu footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.menu footer a:hover { color: var(--text); }

@media (max-width: 480px) {
  .menu header { padding: 32px 0 24px; }
  .menu h1 { margin-top: 32px; }
  .grid { grid-template-columns: 1fr; }
}
