:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #1b1b1b;
  --panel2: #252525;
  --border: #424242;
  --text: #f6f6f6;
  --muted: #b7b7b7;
  --accent: #f2f2f2;
  --tg-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --tg-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}
body { background:var(--bg); }
body::before { display:none; }
.icon-defs,.sr-only { position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden; }
.icon { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; flex:none; }
button:focus-visible,a:focus-visible,summary:focus-visible { outline:2px solid #fff; outline-offset:3px; }
.btn { color:#161616; background:#e6e6e6; border-color:#e6e6e6; }
.btn:hover { background:#fff; }
.btn.secondary,.account-form input { background:#151515; color:var(--text); border-color:var(--border); }
.btn.secondary:hover,.nav:hover { background:var(--panel2); border-color:#666; }
.nav.active { color:#fff; background:#303030; border-color:#696969; box-shadow:none; }
.card,.glass,.scan-row,.match-card,.beat-drop {
  background:var(--panel); color:var(--text); border:1px solid var(--border);
}
.result a { color:#e5e5e5; }
.sidebar { background:#101010; }
.auth-shell { background:var(--bg); }
.auth-card { border-radius:24px; box-shadow:none; }
.main { flex:1 1 0; min-width:0; padding:28px 24px 40px; }
.shell-header { display:flex; justify-content:flex-end; align-items:center; position:relative; z-index:2; }
.profile-trigger { display:flex; gap:10px; align-items:center; padding:7px 9px; min-height:36px; min-width:36px;
  border:1px solid #565656; border-radius:10px; background:#141414; color:var(--text); }
.profile-trigger .icon { width:20px; height:20px; }
.header-brand { display:block; width:100%; height:auto; }
.sidebar-brand { margin-inline:14px 12px; }
.auth-brand { max-width:290px; }
.mobile-mark,.bottom-nav { display:none; }
#dashboard { position:relative; }
.home-hero { position:relative; isolation:isolate; padding:22px 0 27px; }
.home-intro { position:relative; }
.home-intro h1 { margin:0; font-size:clamp(32px,5vw,56px); line-height:1.01; letter-spacing:-.035em; font-weight:730; }
.home-intro p { margin:14px 0 0; color:#b9b9b9; font-size:clamp(16px,2vw,22px); line-height:1.22; }
.home-art { position:absolute; inset:-80px -20px -30px 24%; overflow:hidden; z-index:-1; pointer-events:none; }
.workspace-art i { position:absolute; background:radial-gradient(circle,#e1e1e1 .55px,transparent .75px);
  background-size:3px 3px; display:block; width:85%; height:41%; border-radius:50%;
  -webkit-mask-image:radial-gradient(ellipse at 60% 45%,#000,transparent 70%); mask-image:radial-gradient(ellipse at 60% 45%,#000,transparent 70%); }
.workspace-art i:nth-child(1) { top:-14%; right:-4%; transform:rotate(34deg); opacity:.63; box-shadow:inset 0 11px 24px #aaa6; }
.workspace-art i:nth-child(2) { top:36%; right:-46%; transform:rotate(-37deg); opacity:.8; box-shadow:inset 8px 10px 29px #aaa6; }
.workspace-art i:nth-child(3) { top:65%; right:-4%; transform:rotate(-24deg); opacity:.66; box-shadow:inset -12px 9px 24px #aaa6; }
.home-art span { position:absolute; right:24%; top:30%; width:41%; height:45%; background:#f8f8f8;
  transform:rotate(16deg); clip-path:polygon(50% 0,51% 42%,54% 47%,100% 50%,54% 52%,51% 57%,50% 100%,49% 57%,46% 52%,0 50%,46% 47%,49% 42%);
  opacity:.46; }
.hero-upload { display:grid; place-items:center; align-content:center; gap:9px; width:100%; min-height:174px; border-radius:20px; background:var(--panel2); border-color:#646464; }
.hero-upload .icon { width:34px; height:34px; }
.hero-upload strong { font-size:22px; letter-spacing:-.02em; }
.hero-upload span,.home-actions small { color:#c0c0c0; font-size:13px; }
.home-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:20px 0 24px; }
.home-actions button { min-height:92px; border-radius:16px; display:grid; place-items:center; align-content:center;
  gap:6px; padding:6px 4px; font-weight:550; min-width:0; }
.home-actions .icon { width:25px; height:25px; }
.home-actions button:disabled { opacity:.62; cursor:default; }
.home-actions small { font-size:10px; line-height:1; font-weight:400; }
.hero-upload:hover,.home-actions button:not(:disabled):hover { border-color:#dedede; }
.recent-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 12px; }
.recent-heading h2 { font-size:20px; letter-spacing:-.02em; margin:0; }
.quiet-btn { border:0; background:none; color:var(--muted); display:inline-flex; align-items:center; gap:4px; padding:7px 0 7px 7px; }
.quiet-btn .icon { width:15px; height:15px; }
.home-activity { display:grid; gap:8px; }
.scan-row { display:flex; gap:12px; width:100%; align-items:center; text-align:left; color:var(--text);
  border-radius:14px; padding:7px 11px;
  min-height:57px; }
.wave-square { display:grid; place-items:center; width:38px; height:37px; flex:none; border:1px solid #424242;
  border-radius:7px; background:#151515; }
.wave-square .icon { width:32px; height:23px; stroke-width:1; }
.scan-row .scan-title { min-width:0; flex:1; }
.scan-title strong,.scan-title small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.scan-title small { color:var(--muted); margin-top:3px; font-size:12px; }
.scan-row .pill { border-radius:25px; padding:5px 7px; background:#2d2d2d; font-size:11px; white-space:nowrap; }
.scan-row > .icon { width:13px; height:13px; }
.home-counts { margin-top:16px; color:var(--muted); }
.home-counts summary { cursor:pointer; font-size:13px; }
.home-counts .stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:10px 0 0; }
.home-counts .stat-label { letter-spacing:0; }
.home-counts .card { padding:10px; }
#profileForm { margin-top:16px; }
#telegramSettings { margin-top:18px; }
#telegramSettings label { display:flex; align-items:center; gap:8px; }
#telegramSettings .card-title { margin-bottom:8px; }
@media(max-width:767px) {
  .sidebar { display:none; }
  .main { width:100%; padding:calc(14px + var(--tg-top) + var(--tg-content-safe-area-inset-top, 0px))
    16px calc(93px + var(--tg-bottom) + var(--tg-content-safe-area-inset-bottom, 0px)); }
  .shell-header { justify-content:space-between; }
  .mobile-mark { display:block; width:min(190px, 68%); }
  .profile-trigger { min-width:27px; min-height:27px; padding:4px; }
  .profile-trigger .icon { width:17px; height:17px; }
  #accountName { display:none; }
  .home-hero { padding:23px 0 26px; }
  .home-intro h1 { font-size:clamp(22px,7vw,36px); }
  .home-intro p { margin-top:13px; font-size:12.5px; line-height:1.18; }
  .home-art { inset:-68px 0 -25px 18%; }
  .home-art span { right:24%; top:34%; }
  .hero-upload { min-height:128px; gap:8px; }
  .hero-upload .icon { width:32px; height:32px; }
  .hero-upload strong { font-size:17px; }
  .hero-upload span { font-size:11px; }
  .home-actions { gap:10px; margin:20px 0 22px; }
  .home-actions button { min-height:69px; border-radius:17px; font-size:clamp(10px,3vw,14px); }
  .home-actions .icon { width:22px; height:22px; }
  .home-actions small { font-size:8px; }
  .recent-heading { margin:0 2px 8px; }
  .recent-heading h2 { font-size:15px; }
  .quiet-btn { font-size:12px; }
  .scan-row { min-height:49px; gap:8px; padding:6px 7px; }
  .scan-title strong { font-size:12px; }
  .scan-title small { font-size:10px; }
  .scan-row .pill { font-size:9px; }
  .wave-square { width:35px; height:33px; }
  .bottom-nav { display:grid; grid-template-columns:repeat(4,1fr); align-items:center; position:fixed; z-index:3;
    bottom:calc(10px + var(--tg-bottom) + var(--tg-content-safe-area-inset-bottom, 0px)); left:5%; width:90%;
    height:51px; padding:6px 12px; border-radius:20px; }
  .bottom-nav .nav { display:grid; place-items:center; width:100%; margin:0; padding:4px; border-radius:15px; height:36px; }
  .bottom-nav .icon { width:19px; height:19px; }
  .page:not(#dashboard) { padding-top:22px; }
  .toolbar > input { width:100%; min-width:0; }
  #releasesTable { overflow:auto; }
  .auth-shell { min-height:100dvh; padding:calc(24px + var(--tg-top)) 16px 24px; }
}
.scan-dialog { width:min(90vw,520px); max-width:calc(100% - 24px); min-width:0; max-height:82dvh;
  overflow-x:hidden; overflow-y:auto; color:var(--text); background:#141414;
  overflow-wrap:anywhere; white-space:normal; }
.scan-dialog h2, .scan-dialog .activity, .scan-dialog button { min-width:0; white-space:normal; }
.scan-row .scan-title strong { white-space:normal; overflow-wrap:anywhere; }
.scan-dialog::backdrop { background:#000a; }
.scan-dialog form { display:flex; justify-content:flex-end; }
@media(min-width:768px) and (max-width:900px) {
  .app { display:flex; }
  .sidebar nav { display:block; }
  .sidebar .nav { display:flex; width:100%; }
}

.support-page .card, #supportQueue { margin-top: 16px; }
.support-form { max-width: 620px; }
.support-form textarea, .support-form select, .support-filter select {
  width: 100%; padding: 10px 12px; color: var(--text); background: #151515;
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.support-form textarea { resize: vertical; }
.account-form .support-check, .support-check { display: flex; align-items: center; gap: 8px; }
.support-form .support-check input, .support-check input { width: auto; margin: 0; }
.support-filter { display: grid; gap: 6px; max-width: 280px; margin: 12px 0; }
.support-ticket { display: block; text-align: left; width: 100%; margin: 8px 0; overflow-wrap: anywhere; }
.support-ticket .subtitle { display: block; margin: 4px 0 0; }
.support-pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
[data-thread]:not(:empty) { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; }
[data-thread] h3, .support-message p { overflow-wrap: anywhere; }
.support-message { border-bottom: 1px solid var(--border); padding: 10px 0; }
.support-message p { white-space: pre-wrap; margin: 4px 0 8px; }
[data-thread] .support-form, [data-thread] .support-check { margin-top: 14px; }

.beat-scan-state { display: grid; justify-items: end; gap: 4px; flex: none; }
.beat-scan-state small { color: var(--muted); font-size: 11px; text-align: right; }
.beat-card-pagination { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
@media (max-width: 600px) {
  .beat-scan-state small { font-size: 9px; }
}

#scanDiagnostics { margin-top: 16px; }
#scanDiagnostics pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.app { isolation:isolate; }
.workspace-art {
  position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none;
  mask-image:linear-gradient(90deg, transparent 4%, #0005 42%, #000 100%);
}
.workspace-art i {
  width:max(78vw, 620px); height:clamp(120px, 30vh, 310px);
  animation:wave-drift 56s ease-in-out infinite alternate;
}
.workspace-art i:nth-child(1) { top:-1%; right:-13%; opacity:.34; }
.workspace-art i:nth-child(2) { top:37%; right:-39%; opacity:.42; animation-delay:-19s; }
.workspace-art i:nth-child(3) { top:71%; right:-15%; opacity:.29; animation-delay:-33s; }
@keyframes wave-drift { to { translate:-2vw 2vh; } }
@media (prefers-reduced-motion:reduce) {
  .workspace-art i, .page.active { animation:none; }
}
.sidebar .nav { gap:10px; }
.sidebar .nav .icon { width:23px; height:23px; color:#d0d0d0; }
.library-list-header { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.library-list-header h2 { margin:0; font-size:18px; }
.btn.choose-beats {
  margin-inline-start:auto; padding:7px 11px; white-space:nowrap;
  background:#e6e6e6; border-color:#eee; color:#141414; font-weight:700;
}
.btn.choose-beats:hover { background:#fff; }
#uploadMessage { margin:8px 0; }
#uploadMessage:empty { margin:0; }
#beatsTable table { table-layout:fixed; }
#beatsTable th, #beatsTable td { padding-inline:6px; }
#beatsTable th:last-child { width:96px; }
#beatsTable :is(th,td):last-child { text-align:right; }
#beatsTable td { color:var(--text); overflow-wrap:anywhere; }
#beatsTable .btn { min-height:40px; padding:7px 9px; }
#releaseMatches .match-card time { color:var(--muted); }
#releaseMatches .match-card .toolbar { max-width:fit-content; }
#workspace { --sidebar-width:235px; }
.sidebar { width:var(--sidebar-width); }
@media (768px <= width <= 900px) { #workspace { --sidebar-width:205px; } }
@media (width < 768px) { #workspace { --sidebar-width:0px; } }
.beat-drop {
  position:fixed; z-index:5; top:50%; left:calc(50% + var(--sidebar-width) / 2);
  transform:translate(-50%, -50%) scale(.97);
  width:min(440px, calc(100% - var(--sidebar-width) - 32px)); min-height:220px;
  display:grid; place-items:center; align-content:center; gap:16px; padding:24px;
  border-color:#676767; border-radius:24px;
  box-shadow:0 12px 32px #0006; text-align:center;
  font-size:clamp(18px, 4vw, 22px); font-weight:650;
  opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity .18s ease, transform .18s ease, visibility .18s,
    background-color .18s ease, border-color .18s ease;
}
.beat-drop .icon { width:48px; height:48px; }
.beat-drop.is-dragging { opacity:1; visibility:visible; pointer-events:auto; transform:translate(-50%, -50%); }
.beat-drop.over { background:var(--panel2); border-color:#a9a9a9; }
@media (prefers-reduced-motion:reduce) { .beat-drop { transition:none; } }
.scan-status { display:inline-flex; align-items:baseline; gap:7px; line-height:1.3; }
.scan-status::before { content:""; width:7px; height:7px; border-radius:50%; flex:none; background:#a0a0a0; }
.scan-status[data-status="pending_review"]::before { background:#f2c755; }
.scan-status[data-status="confirmed"]::before { background:#76cf94; }
.scan-status[data-status="analysis_error"]::before { background:#fa7a83; }
.scan-status[data-status="false_match"]::before { background:#baabdb; }
.scan-title .scan-status { margin-top:4px; font-size:12px; }
#releaseMatches { display:grid; gap:8px; }
.match-card { margin:0; overflow-wrap:anywhere; }
.match-card .toolbar { margin:10px 0 0; }
.match-card .message:empty { display:none; }
.match-card [aria-pressed="true"] { border-color:#ddd; }
@media (max-width:600px) {
  .scan-title small { white-space:normal; }
  .scan-title .scan-status { font-size:10px; }
}
