:root {
  --bg: #070a12;
  --panel: #101521;
  --panel-2: #151b2a;
  --card: #121827;
  --line: rgba(178, 190, 255, 0.13);
  --text: #eef3ff;
  --muted: #9aa8c4;
  --dim: #63708d;
  --blue: #6ca7ff;
  --violet: #8e7cff;
  --black: #05070d;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.46);
  --radius: 8px;
  --speed: 0.2s;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(108, 167, 255, 0.08), transparent 32%),
    linear-gradient(225deg, rgba(142, 124, 255, 0.07), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
body.age-locked {
  overflow: hidden;
}

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
  backdrop-filter: blur(18px);
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 13, 0.94);
}
.age-gate[hidden] { display: none; }
.age-gate__panel {
  width: min(480px, 100%);
  padding: 30px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.age-gate__domain {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.age-gate h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}
.age-gate p {
  color: var(--muted);
}
.age-gate__actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}
.age-gate__actions a {
  min-height: 44px;
  padding: 10px 14px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.age-gate__actions button {
  color: #06101f;
  font-weight: 800;
  background: var(--blue);
  border-color: transparent;
}

.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: rgba(16, 21, 33, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color var(--speed), background var(--speed), transform var(--speed);
}
.nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}

.main-layout { padding: 26px 0 80px; }

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(320px, 1fr);
  gap: 32px;
  align-items: end;
  padding: 38px;
  background: linear-gradient(145deg, rgba(21, 27, 42, 0.96), rgba(8, 11, 19, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(34px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
}

.search-box {
  display: grid;
  gap: 12px;
}

.search-box input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.search-box input::placeholder { color: var(--dim); }

.search-actions {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
}

button {
  min-height: 44px;
  color: var(--text);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform var(--speed), border-color var(--speed), background var(--speed), box-shadow var(--speed);
}
button:hover {
  transform: translateY(-1px);
  border-color: rgba(108, 167, 255, 0.5);
  background: rgba(108, 167, 255, 0.12);
}
button:active { transform: translateY(0) scale(0.98); }

button[type="submit"], #filterApply {
  background: linear-gradient(135deg, rgba(108, 167, 255, 0.95), rgba(142, 124, 255, 0.9));
  border-color: transparent;
  color: #06101f;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  padding: 0;
}

.filter-panel {
  position: absolute;
  right: 38px;
  bottom: -118px;
  z-index: 20;
  width: min(420px, calc(100% - 32px));
  padding: 18px;
  background: rgba(10, 14, 24, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-panel[hidden] { display: none; }
.filter-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  min-height: 32px;
}
.filter-bar, .filter-actions, #history-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-bar { padding-right: 34px; }
.filter-actions { justify-content: flex-end; margin-top: 14px; }

.filter-bar button {
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.filter-bar button.active {
  color: #06101f;
  background: var(--blue);
  border-color: transparent;
}

.flow-tools {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
  margin: 28px 0 22px;
}
.title-toggle-btn {
  padding: 0 14px;
  color: var(--blue);
  font-weight: 800;
}
#history-box span {
  padding: 7px 11px;
  color: var(--dim);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.section-title {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}

.video-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  align-items: start;
}

.video-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,0.26);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.video-card.show {
  opacity: 1;
  transform: translateY(0);
}
.video-card:hover {
  border-color: rgba(142, 124, 255, 0.55);
  box-shadow: 0 20px 44px rgba(0,0,0,0.44);
  transform: translateY(-3px);
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--black);
}
.thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.22s, filter 0.22s;
}
.video-card:hover .thumb img {
  transform: scale(1.04);
  filter: saturate(1.04);
}

.site-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 7px;
  color: var(--text);
  background: rgba(5, 7, 13, 0.72);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}
.site-tag.PH { background: rgba(255, 145, 0, 0.9); color: #140900; border-color: transparent; }
.site-tag.XV { background: rgba(218, 37, 29, 0.9); color: #fff; border-color: transparent; }
.site-tag.SB { background: rgba(44, 178, 108, 0.9); color: #021009; border-color: transparent; }
.site-tag.JB { background: rgba(227, 197, 108, 0.92); color: #171002; border-color: transparent; }
.site-tag.NJ { background: rgba(108, 167, 255, 0.92); color: #041125; border-color: transparent; }
.site-tag.RD { background: rgba(236, 67, 84, 0.9); color: #fff; border-color: transparent; }
.site-tag.XH { background: rgba(255, 195, 57, 0.94); color: #1a1000; border-color: transparent; }

.video-title {
  min-height: 48px;
  margin: 0;
  padding: 12px 12px 44px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body.titles-hidden .thumb {
  aspect-ratio: 16 / 12;
}
body.titles-hidden .video-title {
  display: none;
}
body.titles-hidden .fav-btn {
  background: rgba(5, 7, 13, 0.72);
}

.fav-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--dim);
}
.fav-btn.active {
  color: var(--blue);
  border-color: rgba(108, 167, 255, 0.6);
}

.empty-message {
  grid-column: 1 / -1;
  padding: 52px 20px;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translate(-50%, 12px);
  padding: 10px 14px;
  color: var(--text);
  background: rgba(10, 14, 24, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#scroll-trigger { height: 90px; }

@media (max-width: 820px) {
  .topbar, .hero-panel, .flow-tools { grid-template-columns: 1fr; }
  .topbar { position: static; }
  .nav { width: 100%; overflow-x: auto; }
  .hero-panel { padding: 24px; }
  h1 { font-size: 42px; }
  .filter-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
  .age-gate__actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1180px); }
  .video-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .video-title { font-size: 12px; padding: 10px 10px 40px; }
  .hero-panel { padding: 20px; }
  h1 { font-size: 34px; }
}
