:root {
  color-scheme: dark;
  --bg: #080913;
  --surface: #111321;
  --surface-2: #191a2b;
  --text: #f7f8ff;
  --muted: #a9aec4;
  --line: rgba(211,220,255,.13);
  --pink: #ff5bc8;
  --cyan: #39ddff;
  --violet: #9870ff;
  --orange: #ff9b72;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
:root[data-theme="violet"] { --pink: #df6cff; --cyan: #718cff; --violet: #bd79ff; --orange: #ff82bb; }
:root[data-theme="sunset"] { --pink: #ff668b; --cyan: #ffc55f; --violet: #c86bff; --orange: #ff9455; }
:root[data-theme="racing"] { --pink: #ffae4a; --cyan: #27e3d0; --violet: #537dff; --orange: #ff804d; }
:root[data-theme="prism"] { --pink: #b36bff; --cyan: #31e6d2; --violet: #766bff; --orange: #ffbd6b; }
:root[data-theme="graphite"] { --pink: #aab4d4; --cyan: #c5e8f0; --violet: #9a9ec7; --orange: #d7b7a6; }
:root[data-reduced-motion="true"] *,
:root[data-reduced-motion="true"] *::before,
:root[data-reduced-motion="true"] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(ellipse at 3% -15%,rgba(74,65,181,.16),transparent 42%),radial-gradient(ellipse at 97% 0%,rgba(226,62,181,.10),transparent 36%),var(--bg); background-attachment: fixed; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: 72px 1fr 76px; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--line); background: rgba(8,9,19,.92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 850; letter-spacing: 0; }
.brand-lockup { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: .96; }
.brand-lockup small { color: #f4f5ff; font-size: 10px; font-weight: 760; letter-spacing: .14em; }
.brand-lockup > span { font-size: 18px; font-weight: 950; letter-spacing: -.035em; }
.brand img { filter: drop-shadow(0 0 8px rgba(57,221,255,.38)) drop-shadow(0 0 12px rgba(255,91,200,.24)); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.local-badge { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.icon-button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); padding: 10px 14px; cursor: pointer; }
.install-button[hidden] { display: none; }
.settings-open-button { font-size: 13px; }
main { width: 100%; min-height: 0; }
.screen { min-height: 100%; padding: clamp(18px, 4vw, 42px); }
.screen[hidden] { display: none; }
.bottom-nav { height: 76px; position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: center; align-items: stretch; gap: clamp(4px, 2vw, 22px); padding: 8px 12px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(8,9,19,.95); backdrop-filter: blur(20px); }
.nav-item { min-width: 64px; display: grid; align-content: center; justify-items: center; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; }
.nav-item > span { font-size: 22px; line-height: 1; }
.nav-item small { font-size: 10px; }
.nav-item.selected { color: var(--cyan); text-shadow: 0 0 16px color-mix(in srgb,var(--cyan) 50%,transparent); }
.nav-item.create-nav > span { width: 34px; height: 27px; display: grid; place-items: center; border-radius: 9px; color: #090913; background: linear-gradient(115deg, var(--cyan), var(--violet) 52%, var(--pink)); box-shadow: 0 0 18px color-mix(in srgb,var(--violet) 38%,transparent); font-size: 24px; font-weight: 500; }
.page-heading { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.04; }
.eyebrow { color: var(--cyan); font-size: 10px; letter-spacing: .18em; font-weight: 800; margin: 0 0 10px; }
.subheading { color: var(--muted); margin: 10px 0 0; max-width: 620px; line-height: 1.6; }
.feed-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; max-width: 1120px; margin: 8px auto 24px; }
.feed-switch { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.feed-switch button { border: 0; padding: 9px 15px; background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer; }
.feed-switch button.active { background: var(--surface-2); color: var(--text); }
.clip-list { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,320px), 1fr)); gap: 18px; }
.clip-card { min-height: 580px; max-height: 76vh; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg,#17253e,#311d45 55%,#111019); }
.clip-card:nth-child(3n+2) { background: linear-gradient(150deg,#0c3645,#17334e 48%,#111019); }
.clip-card:nth-child(3n+3) { background: linear-gradient(150deg,#43223b,#443023 52%,#111019); }
.clip-card video,.clip-card img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; background: #08080c; }
.clip-gradient { position: absolute; inset: 0; background: linear-gradient(180deg,rgba(0,0,0,.08),transparent 34%,rgba(0,0,0,.78)); pointer-events: none; }
.clip-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.play-mark { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); color: white; background: rgba(12,12,19,.26); font-size: 23px; backdrop-filter: blur(10px); }
.clip-label { position: absolute; top: 16px; left: 16px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(9,9,13,.5); color: rgba(255,255,255,.78); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.clip-sound { position: absolute; z-index: 2; top: 56px; left: 14px; width: min(280px,calc(100% - 28px)); display: grid; gap: 4px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; color: white; background: rgba(9,9,13,.72); backdrop-filter: blur(12px); }
.clip-sound span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.clip-sound audio { width: 100%; height: 32px; }
.clip-caption { position: absolute; left: 20px; right: 78px; bottom: 20px; }
.clip-caption h2 { font-size: 16px; margin: 0 0 4px; }
.clip-caption p { color: rgba(255,255,255,.82); line-height: 1.5; margin: 6px 0; font-size: 14px; }
.clip-tags { color: var(--cyan); font-size: 12px; }
.clip-actions { position: absolute; right: 15px; bottom: 22px; display: grid; gap: 14px; justify-items: center; }
.clip-action { width: 46px; min-height: 46px; padding: 5px 2px; display: grid; justify-items: center; align-content: center; gap: 2px; color: white; background: rgba(9,9,13,.45); border: 1px solid rgba(255,255,255,.12); border-radius: 15px; cursor: pointer; backdrop-filter: blur(10px); }
.clip-action span { font-size: 19px; line-height: 1; }
.clip-action small { font-size: 9px; color: rgba(255,255,255,.8); }
.clip-action[aria-pressed="true"] { color: var(--pink); }
.empty-state { max-width: 850px; margin: 34px auto; padding: clamp(28px,6vw,62px); border-radius: 28px; border: 1px solid rgba(255,255,255,.12); background: radial-gradient(circle at 80% 10%,color-mix(in srgb,var(--pink) 18%,transparent),transparent 36%),radial-gradient(circle at 8% 78%,color-mix(in srgb,var(--cyan) 16%,transparent),transparent 36%),radial-gradient(circle at 48% 0%,color-mix(in srgb,var(--violet) 10%,transparent),transparent 45%),var(--surface); }
.empty-state h2 { font-size: clamp(25px,4vw,38px); letter-spacing: -.03em; margin: 0; }
.empty-state p { color: var(--muted); line-height: 1.6; max-width: 570px; }
.primary-button,.secondary-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 0; border-radius: 14px; font-weight: 750; color: #080913; background: linear-gradient(110deg,var(--cyan),var(--violet) 48%,var(--pink) 78%,var(--orange)); cursor: pointer; box-shadow: 0 5px 20px color-mix(in srgb,var(--violet) 17%,transparent); }
.secondary-button { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.primary-button:disabled { opacity: .4; cursor: not-allowed; }
.primary-button.compact { min-height: 42px; white-space: nowrap; }
.create-layout { max-width: 980px; margin: 10px auto; display: grid; grid-template-columns: minmax(0,1fr) minmax(270px,.8fr); align-items: start; gap: 26px; }
.form-card,.preview-card,.info-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px; }
.preview-card { min-height: 410px; display: grid; place-items: center; position: sticky; top: 92px; overflow: hidden; background: linear-gradient(150deg,#15223b,#291b39 64%,#101017); }
.preview-card video,.preview-card img { width: 100%; max-height: 540px; object-fit: contain; border-radius: 14px; background: #000; }
.preview-placeholder { text-align: center; padding: 28px; }
.preview-placeholder .big-plus { margin: 0 auto 18px; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; color: #08080d; background: linear-gradient(135deg,var(--cyan),var(--pink)); font-size: 40px; }
.field { display: grid; gap: 8px; margin: 0 0 18px; }
.field > span { color: #d7d4df; font-size: 13px; font-weight: 700; }
.field input,.field textarea,.field select,.search-input { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; color: var(--text); background: #0e0e14; }
.field textarea { min-height: 116px; resize: vertical; line-height: 1.5; }
.field input[type=file] { padding: 11px; }
.helper-text { color: var(--muted); line-height: 1.5; font-size: 12px; margin: -8px 0 18px; }
.safe-note { padding: 12px 14px; border-radius: 13px; color: #c5c2d0; background: rgba(255,255,255,.04); font-size: 12px; line-height: 1.5; }
.sound-studio { margin: 22px 0 18px; padding: 18px; border: 1px solid rgba(57,225,219,.2); border-radius: 18px; background: linear-gradient(145deg,rgba(57,225,219,.055),rgba(255,79,145,.045)); }
.sound-studio h2 { margin: 0 0 8px; font-size: 19px; }
.sound-studio .helper-text { margin: 0 0 14px; }
.sound-studio .field { margin: 0 0 14px; }
.sound-studio .search-input { max-width: none; margin: 0; }
.sound-studio select { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; color: var(--text); background: #0e0e14; }
.sound-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sound-studio audio { width: 100%; margin: 0 0 12px; }
[hidden] { display: none !important; }
.discover-wrap,.profile-wrap,.saved-wrap { max-width: 1120px; margin: 12px auto; }
.search-input { margin: 24px 0; max-width: 560px; }
.results-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 14px; }
.result-card { min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(140deg,rgba(57,225,219,.09),rgba(255,79,145,.08)),var(--surface); }
.result-card h3 { margin: 0; }
.result-card p { color: var(--muted); line-height: 1.5; margin: 7px 0 0; }
.profile-top { display: flex; align-items: center; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.avatar { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 23px; color: #111; font-size: 28px; font-weight: 900; background: linear-gradient(140deg,var(--cyan),var(--pink)); }
.stats { display: flex; gap: 26px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); }
.comments-dialog { width: min(520px,calc(100% - 24px)); max-height: min(78vh,700px); padding: 22px; border: 1px solid var(--line); border-radius: 24px; color: var(--text); background: #111119; box-shadow: 0 25px 100px #000b; }
.comments-dialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(5px); }
.settings-dialog { width: min(720px,calc(100% - 24px)); max-height: min(88vh,900px); overflow: auto; padding: clamp(18px,4vw,30px); border: 1px solid rgba(255,255,255,.13); border-radius: 26px; color: var(--text); background: radial-gradient(circle at 90% 0,rgba(57,225,219,.1),transparent 31%),#111119; box-shadow: 0 25px 100px #000b; }
.settings-dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(6px); }
.settings-nav { display: flex; gap: 8px; overflow-x: auto; padding: 5px 0 16px; border-bottom: 1px solid var(--line); }
.settings-nav a { flex: 0 0 auto; padding: 9px 12px; border-radius: 999px; color: var(--text); text-decoration: none; background: var(--surface-2); font-size: 12px; }
.settings-group { min-width: 0; margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.settings-group legend,.settings-group h3 { padding: 0 6px; margin: 0 0 10px; font-weight: 800; font-size: 16px; }
.settings-group h4 { margin: 20px 0 8px; font-size: 13px; }
.settings-group .field { margin: 12px 0; }
.settings-group .helper-text { margin: 7px 0; }
.setting-option { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting-option:last-child { border-bottom: 0; }
.setting-option span { display: grid; gap: 4px; }
.setting-option b { font-size: 13px; }
.setting-option small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.setting-option input { width: 44px; height: 24px; flex: 0 0 auto; accent-color: var(--cyan); cursor: pointer; }
.blocked-list { margin: 8px 0 0; padding: 0; list-style: none; }
.blocked-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.blocked-list li span { display: grid; gap: 4px; }
.blocked-list li small { color: var(--muted); }
.blocked-list .secondary-button { min-height: 36px; padding: 0 12px; font-size: 11px; }
.settings-actions { position: sticky; bottom: -30px; margin: 16px -2px -4px; padding: 12px 2px 4px; background: #111119; }
.danger-button { border-color: rgba(255,79,145,.28); color: #ff93b7; }
.comments-closed { opacity: .7; cursor: default; }
.dialog-top { display: flex; justify-content: space-between; align-items: start; }
.dialog-top h2 { margin: 0 0 15px; }
.close-dialog { font-size: 22px; width: 40px; height: 40px; padding: 0; }
.comments-list { max-height: 48vh; overflow: auto; display: grid; gap: 13px; padding: 10px 0 18px; }
.comment-item { border-bottom: 1px solid var(--line); padding: 0 0 12px; }
.comment-item b { display: block; font-size: 12px; margin-bottom: 5px; }
.comment-item p { margin: 0; color: #dedbe6; line-height: 1.45; white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; min-width: 0; padding: 0 13px; color: var(--text); background: #09090d; border: 1px solid var(--line); border-radius: 13px; }
.local-note { color: var(--muted); font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 95px; transform: translate(-50%,14px); opacity: 0; pointer-events: none; z-index: 20; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: #1a1923; box-shadow: 0 12px 38px #0008; transition: .22s ease; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }
.footer-links { display: flex; gap: 14px; margin-top: 24px; }
.footer-links a { color: var(--muted); font-size: 12px; }
.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; }
.auth-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 24px 0; }
.name-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.auth-grid h2,.admin-panel h2 { margin-top: 0; }
.quota-note,.admin-panel { margin: 24px 0; padding: 20px; border: 1px solid rgba(57,225,219,.18); border-radius: 20px; background: linear-gradient(145deg,rgba(57,225,219,.055),rgba(255,79,145,.04)),var(--surface); }
.quota-note h2,.admin-panel h3 { margin: 0 0 10px; }
.quota-note p,.admin-panel p { color: var(--muted); line-height: 1.55; }
.profile-section { margin-top: 28px; }
.admin-panel h3 { margin-top: 28px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.admin-row p { margin: 5px 0; }
.admin-row small { color: var(--muted); overflow-wrap: anywhere; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.button-row .secondary-button { min-height: 38px; padding: 0 12px; font-size: 12px; }
.moderation-item { display: grid; grid-template-columns: minmax(130px,220px) minmax(0,1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.moderation-media { min-height: 150px; overflow: hidden; border-radius: 14px; background: #050509; }
.moderation-media video,.moderation-media img { width: 100%; height: 100%; min-height: 150px; position: static; object-fit: cover; background: #050509; }
.moderation-copy { min-width: 0; }
.moderation-copy p { overflow-wrap: anywhere; }
.moderation-copy small { color: var(--muted); }
.admin-panel .form-card { margin-top: 12px; }

@media (max-width: 720px) {
  .app-shell { grid-template-rows: 60px 1fr 70px; }
  .topbar { height: 60px; padding: 0 14px; }
  .topbar-actions { gap: 6px; }
  .brand { font-size: 17px; }
  .local-badge { font-size: 9px; }
  .install-label { display: none; }
  .settings-label { display: none; }
  .screen { padding: 18px 14px; }
  .feed-heading { align-items: start; flex-direction: column; margin: 4px 0 18px; }
  .clip-list { grid-template-columns: 1fr; }
  .clip-card { min-height: min(680px,calc(100dvh - 170px)); max-height: none; }
  .create-layout { grid-template-columns: 1fr; gap: 14px; }
  .preview-card { min-height: 280px; position: static; order: -1; }
  .form-card { padding: 18px; }
  .sound-studio { padding: 14px; }
  .bottom-nav { height: 70px; gap: 0; justify-content: space-around; padding-inline: 4px; }
  .nav-item { min-width: 54px; }
  .profile-top { align-items: start; }
  .stats { flex-wrap: wrap; gap: 10px 18px; }
  .auth-grid { grid-template-columns: 1fr; }
  .name-fields { grid-template-columns: 1fr; gap: 0; }
  .admin-row { align-items: stretch; flex-direction: column; gap: 3px; }
  .moderation-item { grid-template-columns: 1fr; }
  .moderation-media { max-height: 300px; }
  .settings-dialog { width: calc(100% - 14px); max-height: 92vh; padding: 16px; border-radius: 22px; }
  .settings-group { padding: 13px; }
  .settings-actions { bottom: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
