:root {
  --bg: #120A0F;
  --primary: #EC5A82;
  --primary-hover: #F2749A;
  --accent: #F4A3BA;
  --soft: #F4BBCA;
  --text: #CDB6C0;
  --label: #9A7585;
  --faint: #7A626D;
  --line: rgba(244,187,202,0.12);
  --card: rgba(244,187,202,0.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5; min-height: 100vh; overflow-x: hidden;
}
button { font: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.glow { position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; filter: blur(40px);
  background: radial-gradient(circle, rgba(236,90,130,0.32), transparent 65%); }
.g1 { width: 720px; height: 720px; top: -260px; right: -180px; animation: drift 26s ease-in-out infinite alternate; }
.g2 { width: 560px; height: 560px; bottom: -240px; left: -200px; opacity: .55; background: radial-gradient(circle, rgba(176,88,160,0.45), transparent 65%); animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(-80px, 60px); } }

/* Hero */
.hero { max-width: 1440px; margin: 0 auto; padding: 88px 48px 56px; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.logo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block;
  box-shadow: 0 0 0 1px rgba(244,187,202,0.35), 0 8px 32px rgba(236,90,130,0.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { color: #fff; font-size: 16px; font-weight: 600; }
.brand-text span { color: var(--label); font-size: 13px; font-weight: 500; letter-spacing: .04em; }
.label { color: var(--label); font-size: 12px; font-weight: 600; letter-spacing: .14em; margin-bottom: 16px; }
h1 { margin: 0; color: #fff; font-size: 64px; line-height: 1.1; font-weight: 600; letter-spacing: -0.01em; }
h1 em { font-family: "Source Serif 4", Georgia, serif; font-style: italic; font-weight: 600; color: var(--accent); font-size: 1.15em; }
.sub { margin: 20px 0 36px; font-size: 17px; max-width: 620px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn { height: 40px; min-width: 150px; padding: 0 22px; border-radius: 4px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn.primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.outline { background: transparent; color: #fff; border: 1px solid rgba(244,187,202,0.35); }
.btn.outline:hover { border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; }

/* Tabs */
.tabs { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 14px 48px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: rgba(18,10,15,0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(244,187,202,0.14);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 500; }
.tab span { color: var(--faint); margin-left: 6px; font-size: 13px; }
.tab:hover { color: #fff; }
.tab.active { background: rgba(236,90,130,0.1); border-color: var(--primary); color: #fff; }
.tab.active span { color: var(--accent); }

/* Grid */
main { max-width: 1440px; margin: 0 auto; padding: 32px 48px 140px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.section-title { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; margin: 28px 0 4px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { margin: 0; color: #fff; font-size: 22px; font-weight: 600; }
.section-title span { color: var(--faint); font-size: 13px; }

.tile { position: relative; aspect-ratio: 3 / 2; border-radius: 12px; overflow: hidden; background: rgba(244,187,202,0.06);
  cursor: zoom-in; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease, opacity .3s; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(18,10,15,0.55), transparent 32%, transparent 62%, rgba(18,10,15,0.7)); opacity: 0; transition: opacity .2s; }
.tile:hover::after, .selecting .tile::after, .tile.selected::after { opacity: 1; }
.tile.selected { outline-color: var(--primary); }
.tile.selected img { transform: scale(0.94); border-radius: 8px; }

.check { position: absolute; z-index: 2; top: 10px; left: 10px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85); background: rgba(18,10,15,0.35); display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s; padding: 0; color: #fff; }
.check svg { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.tile:hover .check, .selecting .check { opacity: 1; }
.tile.selected .check { opacity: 1; background: var(--primary); border-color: var(--primary); }
.tile.selected .check svg { opacity: 1; }

.dl { position: absolute; z-index: 2; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; color: #fff; background: rgba(18,10,15,0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15); opacity: 0; transition: opacity .15s, background .15s; }
.dl svg { width: 17px; height: 17px; }
.dl:hover { background: var(--primary); border-color: var(--primary); }
.tile:hover .dl { opacity: 1; }

.badge { position: absolute; z-index: 2; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px; border-radius: 6px; background: rgba(18,10,15,0.6); color: #fff; font-size: 12px; font-weight: 600; }
.badge svg { width: 12px; height: 12px; fill: #fff; stroke: none; }

/* Selection bar */
.bar { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(760px, calc(100% - 32px));
  display: flex; align-items: center; gap: 20px; padding: 14px 14px 14px 22px; border-radius: 16px;
  background: rgba(18,10,15,0.72); border: 1px solid rgba(236,90,130,0.6); box-shadow: inset 0 0 60px rgba(236,90,130,0.18), 0 20px 50px rgba(0,0,0,0.45);
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); }
.bar[hidden] { display: none; }
.bar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar-info strong { color: #fff; font-size: 15px; font-weight: 600; }
.bar-info span { font-size: 13px; }
.bar-progress { position: absolute; left: 16px; right: 16px; top: -1px; height: 2px; border-radius: 2px; overflow: hidden; background: rgba(244,187,202,0.12); }
.bar-progress div { height: 100%; width: 0; background: var(--soft); transition: width .2s; }
.bar-actions { display: flex; gap: 10px; }
.bar .btn { min-width: 120px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(12,6,10,0.96); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(rgba(12,6,10,0.8), transparent); }
.lb-name { color: #fff; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { color: var(--faint); font-weight: 400; margin-left: 8px; font-size: 13px; }
.lb-actions { display: flex; gap: 8px; flex: none; }
.lb-btn { height: 38px; padding: 0 14px; border-radius: 4px; border: 1px solid rgba(244,187,202,0.3); background: rgba(18,10,15,0.5);
  color: #fff; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; text-decoration: none; }
.lb-btn svg { width: 17px; height: 17px; }
.lb-btn.icon { width: 38px; padding: 0; justify-content: center; }
.lb-btn:hover { border-color: var(--primary); }
#lbDownload { background: var(--primary); border-color: var(--primary); }
.lb-btn.on { background: rgba(236,90,130,0.15); border-color: var(--primary); }
.lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 68px 80px 28px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(244,187,202,0.2); background: rgba(18,10,15,0.5); color: #fff; display: grid; place-items: center; }
.lb-nav svg { width: 22px; height: 22px; }
.lb-nav:hover { border-color: var(--primary); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }

.toast { position: fixed; z-index: 60; left: 50%; top: 24px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 12px; background: rgba(18,10,15,0.9); border: 1px solid rgba(244,187,202,0.2); color: #fff; font-size: 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* Entrance */
.fade { opacity: 0; transform: translateY(26px); transition: opacity .7s ease-out, transform .7s ease-out; }
.fade.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .fade { opacity: 1; transform: none; transition: none; }
  .glow { animation: none; }
  .tile img { transition: none; }
}

/* Touch devices: controls always visible */
@media (hover: none) {
  .check, .dl { opacity: 1; }
  .tile::after { opacity: 1; }
}

@media (max-width: 880px) {
  .hero { padding: 48px 16px 32px; }
  h1 { font-size: 40px; }
  .brand { margin-bottom: 20px; }
  .logo { width: 52px; height: 52px; }
  .sub { font-size: 15px; margin: 14px 0 24px; }
  .hero-actions .btn { flex: 1; min-width: 0; }
  .tabs { padding: 12px 16px; }
  main { padding: 20px 16px 150px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .tile { border-radius: 10px; }
  .check { width: 26px; height: 26px; top: 8px; left: 8px; }
  .dl { width: 30px; height: 30px; right: 8px; bottom: 8px; }
  .bar { flex-wrap: wrap; gap: 12px; padding: 14px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .bar-actions { width: 100%; }
  .bar-actions .btn { flex: 1; min-width: 0; }
  .lb-stage { padding: 64px 0 16px; }
  .lb-nav { width: 40px; height: 40px; background: rgba(18,10,15,0.35); }
  .lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
  .lb-btn span { display: none; }
  .lb-btn { padding: 0; width: 38px; justify-content: center; }
}
