:root {
  color-scheme: dark;
  --bg: #090b13;
  --bg-elevated: #111524;
  --surface: rgba(21, 26, 43, .76);
  --surface-solid: #161b2d;
  --text: #f6f7fb;
  --muted: #a4acc4;
  --line: rgba(188, 200, 235, .14);
  --accent: #8c7cff;
  --accent-2: #ff6b9b;
  --good: #53d6a6;
  --warning: #f7b955;
  --danger: #ff7288;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --radius: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6fb;
  --bg-elevated: #fff;
  --surface: rgba(255, 255, 255, .8);
  --surface-solid: #fff;
  --text: #171929;
  --muted: #65708b;
  --line: rgba(38, 48, 81, .14);
  --accent: #6655e9;
  --accent-2: #e65384;
  --good: #14865e;
  --warning: #a75b00;
  --danger: #c63652;
  --shadow: 0 24px 70px rgba(52, 58, 90, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(140, 124, 255, .65); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .55; }

.noise { pointer-events: none; position: fixed; inset: 0; z-index: -1; opacity: .22; background-image: radial-gradient(circle at 12% 8%, rgba(140,124,255,.17), transparent 27rem), radial-gradient(circle at 85% 10%, rgba(255,107,155,.11), transparent 23rem), radial-gradient(circle at 48% 100%, rgba(40,187,213,.09), transparent 27rem); }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .7rem 1rem; background: var(--accent); color: #fff; border-radius: 10px; }
.skip-link:focus { top: 1rem; }

.site-header { min-height: 72px; display: flex; align-items: center; gap: 2rem; position: sticky; top: 0; z-index: 20; padding: 0 clamp(1rem, 4vw, 5rem); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.22rem; font-weight: 800; letter-spacing: -.05em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-size: .8rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 7px 20px rgba(130, 105, 255, .38); }
.desktop-nav { display: flex; gap: 1.3rem; align-items: center; }
.desktop-nav a, .mobile-nav a, .mobile-nav button { color: var(--muted); border: 0; background: transparent; font-size: .92rem; font-weight: 650; }
.desktop-nav a:hover, .desktop-nav a.active, .mobile-nav a.active, .mobile-nav button:hover { color: var(--text); }
.header-actions { margin-left: auto; display: flex; gap: .7rem; align-items: center; }
.icon-button, .profile-button, .button { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.icon-button { width: 40px; height: 40px; font-size: 1.15rem; }
.profile-button { min-height: 40px; padding: .45rem .85rem; font-weight: 700; }
.icon-button:hover, .profile-button:hover, .button:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }

main { width: min(1440px, 100%); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 5rem) 5rem; }
.hero { min-height: 390px; display: grid; align-content: center; grid-template-columns: minmax(0, 700px); position: relative; overflow: hidden; padding: 4.5rem 0 3.5rem; }
.eyebrow { display: inline-flex; align-items: center; width: max-content; gap: .45rem; margin: 0 0 1rem; color: var(--good); font-size: .83rem; font-weight: 760; letter-spacing: .07em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 16%, transparent); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1.1rem; max-width: 760px; font-size: clamp(2.4rem, 7vw, 5.4rem); line-height: .97; letter-spacing: -.075em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-copy { max-width: 600px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.15rem); }
.hero-orb { position: absolute; right: 4%; top: 8%; width: min(37vw, 440px); aspect-ratio: 1; border-radius: 43% 57% 66% 34% / 49% 38% 62% 51%; background: linear-gradient(135deg, rgba(140,124,255,.55), rgba(255,107,155,.24)); filter: blur(1px); opacity: .8; animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(-35px, 24px) rotate(12deg) scale(1.07); border-radius: 60% 40% 36% 64% / 38% 58% 42% 62%; } }

.search-panel, .panel { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.search-panel { z-index: 2; padding: .7rem; display: grid; grid-template-columns: 1fr auto auto; gap: .55rem; max-width: 820px; }
.search-wrap { position: relative; }
.search-wrap > span { position: absolute; left: 1rem; top: .75rem; color: var(--muted); font-size: 1.2rem; }
.search-panel input { width: 100%; border: 0; border-radius: 12px; padding: .8rem 1rem .8rem 2.75rem; color: var(--text); background: var(--bg); }
.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .65rem 1rem; font-weight: 730; }
.button.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), #a35ef8); box-shadow: 0 8px 19px rgba(125, 95, 240, .26); }
.button.danger { color: #fff; border-color: transparent; background: var(--danger); }
.button.subtle { background: transparent; }
.button.compact { min-height: 35px; padding: .42rem .7rem; font-size: .85rem; }

.catalog-layout { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); align-items: start; gap: 1.3rem; padding-top: 1.5rem; }
.filter-panel { padding: 1rem; position: sticky; top: 88px; }
.filter-panel h2, .section-title { margin: .15rem 0 1rem; font-size: 1.15rem; letter-spacing: -.025em; }
.filter-group { padding: 1rem 0; border-top: 1px solid var(--line); }
.filter-group label, .field label { display: block; margin-bottom: .4rem; color: var(--muted); font-size: .8rem; font-weight: 700; }
.filter-group input, .filter-group select, .field input, .field textarea, .field select { width: 100%; min-height: 41px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: color-mix(in srgb, var(--bg) 80%, transparent); }
.filter-group input:focus, .filter-group select:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .42rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .33rem .55rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--bg); font-size: .76rem; }
.chip button { flex: 0 0 auto; border: 0; color: inherit; background: transparent; font-size: 1rem; line-height: 1; padding: 0; }
.filter-add { display: flex; gap: .45rem; margin-top: .5rem; }
.filter-add input { min-width: 0; }
.filter-actions { display: flex; gap: .5rem; padding-top: 1rem; }
.results-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: 1rem; }
.results-head h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -.05em; }
.results-head span { color: var(--muted); font-size: .9rem; }
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: clamp(.8rem, 1.6vw, 1.25rem); }
.movie-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid transparent; border-radius: 15px; background: var(--surface); box-shadow: 0 9px 25px rgba(0,0,0,.13); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.movie-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow); }
.poster-wrap { display: block; position: relative; aspect-ratio: 2 / 3; overflow: hidden; background: linear-gradient(140deg, #242a48, #714d9b); }
.poster-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.movie-card:hover img { transform: scale(1.055); }
.poster-fallback { display: grid; place-items: center; width: 100%; height: 100%; padding: 1rem; color: rgba(255,255,255,.8); text-align: center; font-weight: 800; background: linear-gradient(150deg, #303c6a, #8e3f76); }
.rating-pill { position: absolute; top: .55rem; right: .55rem; padding: .22rem .42rem; border: 1px solid rgba(255,255,255,.21); border-radius: 7px; color: #fff; background: rgba(9,11,19,.65); backdrop-filter: blur(6px); font-size: .75rem; font-weight: 800; }
.card-body { display: grid; gap: .22rem; padding: .75rem .75rem .9rem; }
.card-title { overflow: hidden; margin: 0; font-size: .94rem; font-weight: 760; line-height: 1.26; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }

.skeleton { overflow: hidden; border-radius: 15px; background: linear-gradient(110deg, var(--surface-solid) 24%, color-mix(in srgb, var(--surface-solid) 70%, #fff) 38%, var(--surface-solid) 54%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton.card { min-height: 280px; }
@keyframes shimmer { to { background-position-x: -220%; } }
.empty, .error-state { grid-column: 1 / -1; padding: 2.4rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.error-state { color: var(--danger); }
.pagination { display: flex; justify-content: center; align-items: center; gap: .8rem; margin: 2rem 0; color: var(--muted); font-size: .9rem; }

.detail { padding-top: clamp(1.5rem, 3vw, 3rem); }
.back-link { display: inline-flex; gap: .35rem; margin-bottom: 1.5rem; color: var(--muted); font-weight: 700; }
.detail-hero { display: grid; grid-template-columns: minmax(170px, 260px) minmax(0, 1fr); gap: clamp(1.3rem, 4vw, 3.5rem); padding: clamp(1rem, 3vw, 2rem); overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.detail-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 14px; background: #283052; }
.detail-copy { align-self: center; }
.detail-copy h1 { margin: .45rem 0 .75rem; max-width: none; font-size: clamp(2rem, 5vw, 4rem); }
.metadata { display: flex; flex-wrap: wrap; gap: .45rem .9rem; margin: 1rem 0; color: var(--muted); }
.metadata strong { color: var(--text); }
.description { max-width: 820px; color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; }
.ratings { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.1rem 0; }
.score { min-width: 82px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.score b { display: block; font-size: 1.05rem; }
.score small { color: var(--muted); }
.section { margin-top: 2.5rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.section-header h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.04em; }
.people { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.person { flex: 0 0 104px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: center; font-size: .78rem; }
.person img, .person .person-photo { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #30395e; }
.person span { display: block; overflow: hidden; padding: .45rem; text-overflow: ellipsis; white-space: nowrap; }
.mark-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.mark-picker button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); font-weight: 760; }
.mark-picker button.active, .mark-picker button:hover { color: #fff; border-color: var(--accent); background: var(--accent); }

.comments { display: grid; gap: .75rem; }
.comment { padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.comment-header { display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.comment-author { overflow: hidden; border: 0; color: var(--accent); background: transparent; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.comment p { margin: .65rem 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment-actions { display: flex; gap: .35rem; }
.comment-form { display: grid; gap: .6rem; margin-bottom: 1rem; }
.comment-form textarea { min-height: 90px; resize: vertical; }
.counter { color: var(--muted); font-size: .78rem; text-align: right; }

.account { padding-top: 2rem; }
.account-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.account-head h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); }
.account-tabs { display: flex; overflow-x: auto; gap: .4rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.account-tabs button { flex: 0 0 auto; border: 1px solid transparent; border-radius: 10px; padding: .55rem .75rem; color: var(--muted); background: transparent; font-weight: 700; }
.account-tabs button.active { color: var(--text); border-color: var(--line); background: var(--surface); }
.account-content { padding-top: 1.3rem; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.panel { padding: 1.15rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.field { margin-bottom: .85rem; }
.field textarea { min-height: 88px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
.list { display: grid; gap: .6rem; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: .7rem; padding: .72rem; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--bg) 63%, transparent); }
.list-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.muted { color: var(--muted); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); }

.modal-root:empty { display: none; }
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(5,7,13,.68); backdrop-filter: blur(9px); }
.modal { width: min(100%, 530px); max-height: min(780px, calc(100vh - 2rem)); overflow: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: 20px; background: var(--bg-elevated); box-shadow: var(--shadow); animation: modal-in .2s ease-out; }
.modal.wide { width: min(100%, 1100px); }
@keyframes modal-in { from { transform: translateY(9px) scale(.98); opacity: .1; } }
.modal-header { display: flex; justify-content: space-between; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.modal-header h2 { margin: 0; font-size: 1.32rem; letter-spacing: -.04em; }
.close-button { width: 36px; height: 36px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 1.35rem; }
.close-button:hover { color: var(--text); background: var(--surface); }
.auth-switch { margin: 1rem 0; color: var(--muted); font-size: .9rem; text-align: center; }
.text-button { border: 0; color: var(--accent); background: transparent; font-weight: 750; }
.player-shell { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 12px; background: #000; }
.player-shell iframe { width: 100%; height: 100%; border: 0; }
.profile-summary { display: grid; gap: .6rem; }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 70; display: grid; gap: .6rem; width: min(360px, calc(100vw - 2rem)); }
.toast { padding: .85rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; color: var(--text); background: var(--surface-solid); box-shadow: var(--shadow); animation: toast-in .25s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--good); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } }
.mobile-nav { display: none; }

@media (max-width: 780px) {
  .site-header { min-height: 64px; gap: .8rem; }
  .desktop-nav { display: none; }
  .profile-button { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding-bottom: 6rem; }
  .hero { min-height: 370px; padding-top: 3rem; }
  .hero-orb { right: -24%; top: 6%; width: 72vw; opacity: .53; }
  .search-panel { grid-template-columns: 1fr auto; }
  .search-panel .button.primary { display: none; }
  .catalog-layout { display: block; }
  .filter-panel { display: none; position: static; margin-bottom: 1rem; }
  .filter-panel.open { display: block; }
  .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .detail-hero { grid-template-columns: 120px minmax(0, 1fr); padding: 1rem; gap: 1rem; }
  .detail-copy h1 { font-size: 1.8rem; }
  .description { font-size: .91rem; }
  .account-grid { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; display: flex; justify-content: space-around; padding: .45rem .5rem calc(.45rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 87%, transparent); backdrop-filter: blur(18px); }
  .mobile-nav a, .mobile-nav button { display: grid; place-items: center; gap: .1rem; min-width: 70px; padding: .25rem; font-size: .68rem; }
  .mobile-nav span { font-size: 1.2rem; line-height: 1; }
}

@media (min-width: 781px) { .filter-mobile-trigger { display: none; } }
@media (max-width: 430px) { .detail-hero { grid-template-columns: 94px minmax(0, 1fr); } .detail-copy .metadata { gap: .3rem .6rem; font-size: .8rem; } .hero { min-height: 335px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
