:root {
  --bg: #0b0b0d;
  --bg-elevated: #121214;
  --bg-soft: #18181b;
  --line: #232328;
  --text: #f4f4f5;
  --muted: #9a9aa3;
  --faint: #6d6d76;
  --accent: #d7b07a;
  --accent-strong: #e8c49a;
  --danger: #e37575;
  --success: #7dcb9a;
  --overlay: rgba(0, 0, 0, .72);
  --radius: 10px;
  --radius-sm: 8px;
  --header-h: 56px;
  --rail-w: 64px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .35);
  --font: Inter, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}
img, video, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4, p { margin: 0; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 80;
  background: var(--accent); color: #111; padding: .5rem .8rem; border-radius: 6px;
}
.skip-link:focus { left: 12px; }

.app {
  min-height: 100vh;
  padding-top: var(--header-h);
  padding-left: var(--rail-w);
}

.header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h);
  z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 0 18px 0 calc(var(--rail-w) + 8px);
  background: linear-gradient(180deg, rgba(11,11,13,.96), rgba(11,11,13,.88) 70%, rgba(11,11,13,0));
  backdrop-filter: blur(16px);
}
.brand {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  font-weight: 760; letter-spacing: .18em; font-size: 15px;
}
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px rgba(215,176,122,.7);
}
.search-form {
  flex: 1; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 0;
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden;
}
.search-form input {
  flex: 1; border: 0; background: transparent; padding: 8px 16px; outline: none; min-width: 0;
}
.search-form button {
  width: 42px; height: 36px; display: grid; place-items: center; color: var(--muted);
}
.search-form button:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn, .text-btn {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; color: var(--muted);
}
.icon-btn:hover, .text-btn:hover { color: var(--text); background: var(--bg-soft); }
.avatar-btn { padding: 0; overflow: hidden; }
.avatar-btn img, .avatar-fallback {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
}
.menu-toggle { display: none; }

.rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-w);
  z-index: 45; padding: 12px 8px 16px;
  display: flex; flex-direction: column; gap: 6px;
  background: #0b0b0d; border-right: 1px solid transparent;
}
.rail a, .rail button {
  width: 48px; height: 44px; border-radius: 12px; color: var(--muted);
  display: grid; place-items: center; margin: 0 auto;
}
.rail a:hover, .rail a.active, .rail button:hover {
  color: var(--text); background: var(--bg-soft);
}
.rail-spacer { flex: 1; }
.icon { width: 20px; height: 20px; fill: currentColor; }

.page { width: min(1680px, calc(100% - 32px)); margin: 0 auto; padding: 8px 0 48px; }
.page-narrow { width: min(720px, calc(100% - 32px)); }

.hero-row, .chip-row, .people-row, .studio-row {
  display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 14px;
  scrollbar-width: none;
}
.hero-row::-webkit-scrollbar, .chip-row::-webkit-scrollbar,
.people-row::-webkit-scrollbar, .studio-row::-webkit-scrollbar { display: none; }

.person {
  flex: 0 0 72px; width: 72px; text-align: center; color: var(--muted); font-size: 11px;
}
.person img, .person .avatar-fallback {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 6px;
  object-fit: cover; background: var(--bg-soft); border: 1px solid #2a2a30;
}
.person:hover { color: var(--text); }
.person span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.studio {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--bg-elevated);
  border: 1px solid var(--line); color: var(--text); font-size: 12px; white-space: nowrap;
}
.studio img, .studio .avatar-fallback {
  width: 28px; height: 28px; border-radius: 8px; object-fit: cover;
}
.studio:hover { border-color: #3a3a42; }

.chip {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; border: 1px solid transparent;
}
.chip:hover, .chip.active { color: var(--text); background: var(--bg-soft); }

.section { margin: 8px 0 28px; }
.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.section-head a { color: var(--muted); font-size: 13px; }
.section-head a:hover { color: var(--accent-strong); }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 14px;
  margin-bottom: 8px;
}
.featured-grid .card-copy h3 { font-size: 16px; }
.recommend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.video-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 12px;
}
.video-card { min-width: 0; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9;
  border-radius: 6px; overflow: hidden; background: #161618;
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}
.video-card:hover .thumb img { transform: scale(1.04); filter: brightness(1.06); }
.badge {
  position: absolute; right: 6px; top: 6px;
  background: rgba(0,0,0,.72); color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; letter-spacing: .02em;
}
.card-meta { display: flex; gap: 8px; margin-top: 8px; min-width: 0; }
.card-meta img, .card-meta .avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--bg-soft);
}
.card-copy { min-width: 0; }
.card-copy .creator {
  display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-copy .creator:hover { color: var(--text); }
.card-copy h3 {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-stats { color: var(--faint); font-size: 12px; margin-top: 4px; }

.profile-hero { display: flex; gap: 22px; align-items: flex-start; padding: 18px 0 8px; }
.profile-avatar, .profile-avatar img, .profile-avatar .avatar-fallback {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: var(--bg-soft);
}
.profile-avatar.studio, .profile-avatar.studio img, .profile-avatar.studio .avatar-fallback { border-radius: 24px; }
.profile-kicker { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.profile-copy h1 { font-size: 28px; font-weight: 680; letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
.profile-copy .stats { color: var(--muted); margin: 6px 0 10px; }
.profile-copy .bio { max-width: 720px; color: #c6c6cc; line-height: 1.55; }
.profile-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.verified { width: 18px; height: 18px; color: var(--accent); }

.breadcrumbs { color: var(--muted); font-size: 13px; margin: 8px 0 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs a:hover { color: var(--text); }

.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 4px 0 16px; flex-wrap: wrap;
}
.toolbar h1 { font-size: 28px; letter-spacing: -.03em; }
.sort-form select, .input, textarea, select {
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; width: 100%;
}
.sort-form select { width: auto; }
.input:focus, textarea:focus, select:focus, .search-form:focus-within {
  border-color: #3d3d46;
}
textarea { min-height: 120px; resize: vertical; }

.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.player-shell {
  background: #000; border-radius: 12px; overflow: hidden; position: relative;
}
.player-shell video {
  width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: contain; background: #000; display: block;
}
.player-error {
  margin: 0; padding: 10px 12px; background: #2a1616; color: #f0b4b4; font-size: 13px;
}
.player-extra {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 10px; background: #111;
}
.player-extra button {
  color: #ddd; border: 1px solid #2a2a30; border-radius: 999px; padding: 6px 10px; font-size: 12px;
}
.player-extra button:hover { color: #fff; border-color: #444; }
.speed-menu { display: flex; gap: 6px; }
.poster-fallback {
  aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 24px;
  background: #111; color: var(--muted);
}

.watch-title { font-size: 22px; margin: 14px 0 8px; letter-spacing: -.02em; }
.watch-meta { color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.creator-bar {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.creator-bar img, .creator-bar .avatar-fallback {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--bg-soft);
}
.creator-bar h3 { font-size: 15px; }
.creator-bar p { color: var(--muted); font-size: 12px; }
.creator-bar .grow { flex: 1; }
.watch-desc { margin: 16px 0; color: #d0d0d5; line-height: 1.6; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.related-col h2 { font-size: 16px; margin-bottom: 12px; }
.related-col .related-grid { grid-template-columns: 1fr; gap: 16px 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font-weight: 600;
}
.btn:hover { border-color: #3c3c44; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a140c; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn.active { background: #2a241c; border-color: #4a3d2a; color: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: #4a2a2a; }

.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 8px; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line); color: var(--muted);
}
.pagination a:hover, .pagination .current { color: var(--text); background: var(--bg-soft); }

.form-stack { display: grid; gap: 12px; }
.form-stack label, .field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form-stack h2 { font-size: 16px; color: var(--text); margin-top: 8px; }
.hint { color: var(--faint); font-weight: 400; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(460px, 100%); background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; box-shadow: var(--shadow);
}
.install-card { width: min(560px, 100%); }
.brand-mark { letter-spacing: .22em; font-weight: 760; color: var(--accent); margin-bottom: 8px; }
.auth-card h1 { font-size: 26px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.alert { padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.alert-error { background: #2a1616; color: #f0b4b4; }
.alert-success { background: #16241c; color: #b8e0c6; }
.alert-info { background: #1b1d24; color: #d4d4da; }
.empty {
  padding: 48px 16px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 16px;
}

.footer {
  margin-top: 32px; padding: 28px 0 12px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 24px; }
.footer strong { color: var(--text); display: block; margin-bottom: 10px; }
.footer a { display: block; padding: 4px 0; }
.footer a:hover { color: var(--text); }
.legal { margin-top: 22px; color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.age-gate {
  position: fixed; inset: 0; z-index: 80; background: #070708;
  display: grid; place-items: center; padding: 24px;
}
.age-card {
  width: min(520px, 100%); text-align: center; background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: 20px; padding: 36px 28px; box-shadow: var(--shadow);
}
.age-card h1 { font-size: 30px; margin: 8px 0 12px; }
.age-card p { color: var(--muted); margin-bottom: 18px; }
.age-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.comments { margin-top: 24px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment strong { display: block; margin-bottom: 4px; }
.comment time { color: var(--faint); font-size: 12px; font-weight: 400; margin-left: 8px; }

.modal {
  position: fixed; inset: 0; background: var(--overlay); display: none; place-items: center; z-index: 70; padding: 16px;
}
.modal.open { display: grid; }
.modal-card {
  width: min(440px, 100%); background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.category-grid, .creator-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.cat-card, .creator-tile {
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
}
.cat-card:hover, .creator-tile:hover { border-color: #35353d; }
.cat-card h3 { margin-bottom: 6px; }
.creator-tile { display: flex; gap: 12px; align-items: center; }
.creator-tile img, .creator-tile .avatar-fallback {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--bg-soft);
}

@media (max-width: 1400px) {
  .video-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: 1fr 1fr; }
  .watch { grid-template-columns: 1fr; }
  .related-col .related-grid,
  .recommend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .category-grid, .creator-grid { grid-template-columns: 1fr 1fr; }
  .header { padding-left: 16px; }
  .app { padding-left: 0; }
  .rail {
    transform: translateX(-110%); transition: transform .2s ease;
    background: #0d0d10; border-right: 1px solid var(--line); width: 220px; padding: 16px 12px;
  }
  .rail.open { transform: none; }
  .rail a, .rail button { width: 100%; height: 42px; justify-content: start; display: flex; gap: 10px; padding: 0 10px; margin: 0; }
  .rail a span { display: inline; }
  .menu-toggle { display: inline-flex; }
  .search-form { max-width: none; }
}
@media (max-width: 640px) {
  .video-grid, .featured-grid, .recommend-grid,
  .related-col .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 8px; }
  .page { width: calc(100% - 16px); }
  .profile-hero { flex-direction: column; }
  .profile-copy h1, .toolbar h1 { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr; }
  .header { gap: 8px; }
  .brand span { display: none; }
}
@media (max-width: 360px) {
  .search-form input { padding-left: 10px; }
  .card-copy h3 { font-size: 12px; }
}

.rail a span { display: none; }
@media (max-width: 860px) { .rail a span, .rail button span { display: inline; } }
