:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  color: #f2f3f5;
  background: #1e1f22;
  --surface: #313338;
  --line: #41434a;
  --muted: #b5bac1;
  --accent: #a9adff;
  --ink: #1e1f22;
  --blurple: #4d56cf;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .44; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.top {
  min-height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; gap: 11px; align-items: center; font-size: 20px; font-weight: 750; text-decoration: none; }
.mark { display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 34px; aspect-ratio: 1; background: var(--blurple); border-radius: 50%; }
.mark i { width: 2px; height: 9px; background: #fff; border-radius: 3px; }
.mark i:nth-child(2) { height: 17px; }
.mark i:nth-child(3) { height: 13px; }
.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .88rem; }
.account span { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 1312px; margin: auto; padding: 34px 24px 64px; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.055em; line-height: 1.06; }
h2 { font-size: 1.23rem; letter-spacing: -.026em; }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.connection, .server { color: var(--muted); font-size: .88rem; }
.connection { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.dot { width: 8px; height: 8px; background: #807b88; border-radius: 50%; flex: none; }
.dot.active { background: #9edcab; }
.server { display: grid; gap: 7px; width: 100%; font-weight: 650; }
.workspace { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 16px; align-items: start; }
.sidebar { background: #2b2d31; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sidebar h2 { margin: 22px 0 6px; font-size: .86rem; color: var(--muted); }
.sidebar ul { list-style: none; padding: 0; margin: 0 0 12px; }
.sidebar > button { width: 100%; margin-top: 8px; }
.sidebar .hint { margin: 7px 0; }
.voice-member { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.voice-member span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.channel-group { color: var(--muted); font-size: .72rem; font-weight: 700; padding: 9px 5px 3px; overflow-wrap: anywhere; }
.channel-button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; color: var(--muted); padding: 8px; border-radius: 6px; min-height: 36px; overflow-wrap: anywhere; }
.channel-button:hover:not(:disabled), .channel-button.active { background: #3c3f46; color: #fff; }
.channel-button.active::after { content: ""; margin-left: auto; background: #57f287; width: 7px; height: 7px; border-radius: 50%; flex: none; }

.grid { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.card { padding: clamp(15px, 2vw, 23px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.section-head { display: flex; gap: 14px; justify-content: space-between; align-items: center; }
#phase { color: var(--accent); font-size: .82rem; }
.player { --accent: #c8fa82; background: radial-gradient(ellipse at 12% 0, #354730, transparent 72%), #222623; }
.now { display: flex; align-items: center; gap: clamp(15px, 3vw, 25px); margin: 25px 0 20px; }
.art { position: relative; display: grid; place-items: center; width: clamp(82px, 12vw, 148px); aspect-ratio: 1; flex: none; border-radius: 9px; overflow: hidden; background: #2c3929; box-shadow: 0 15px 26px #0b10097a; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.record { width: 72%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #212337 0 4%, #9299ff 5% 20%, #232429 21% 33%, #484a55 34% 35%, #232429 36% 44%, #484a55 45% 46%, #232429 47% 55%, #484a55 56% 57%, #232429 58% 100%); box-shadow: 0 5px 20px #0006; }
.record.large { width: 116px; margin-bottom: 8px; }
.metadata { min-width: 0; overflow-wrap: anywhere; }
.metadata h3 { font-size: clamp(1.15rem, 3vw, 1.8rem); line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.metadata p { margin-top: 7px; color: var(--muted); font-size: .91rem; }
input[type=range] { display: block; width: 100%; margin: 0; accent-color: var(--accent); min-height: 24px; cursor: pointer; }
input[type=range]:disabled { cursor: default; opacity: .55; }
.time { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.transport { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 15px; }
.playback { display: flex; align-items: center; gap: 8px; }
.play, .transport-icon { display: inline-grid; place-items: center; border: 0; border-radius: 50%; padding: 0; }
.play { width: 52px; height: 52px; background: var(--accent); color: #18231b; }
.play:hover:not(:disabled) { background: #ddffad; }
.transport-icon { width: 40px; height: 40px; color: #e3e9df; background: transparent; }
.transport-icon:hover:not(:disabled) { background: #ffffff17; }
.play-icon, .skip-icon { width: 0; height: 0; border: 9px solid transparent; border-left: 14px solid currentColor; border-right: 0; margin-left: 3px; }
.play.playing .play-icon { width: 14px; height: 17px; border: solid currentColor; border-width: 0 4px; margin-left: 0; }
.skip-icon { position: relative; border-width: 6px 0 6px 10px; margin-left: -3px; }
.skip-icon::after { content: ""; position: absolute; width: 2px; height: 12px; left: 1px; top: -6px; background: currentColor; }
.previous-icon { transform: scaleX(-1); }
.transport-icon[aria-pressed="true"] { color: var(--accent); background: #c8fa8220; }
.track-row .queue-play { font-size: 1rem; min-width: 36px; padding: 4px; color: #c8fa82; }
.back-icon { font-size: 1.45rem; line-height: 1; }
.player input[type="range"] { appearance: none; background: transparent; --fill: 0%; }
.player input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 9px; background: linear-gradient(to right, var(--accent) var(--fill), #566054 var(--fill)); }
.player input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #f4f8f1; margin-top: -4px; }
.player input[type="range"]::-moz-range-track { height: 5px; background: #566054; border-radius: 9px; }
.player input[type="range"]::-moz-range-progress { height: 5px; background: var(--accent); border-radius: 9px; }
.player input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #f4f8f1; }
.mic-meter { display: grid; gap: 4px; color: var(--muted); font-size: .78rem; margin-top: 10px; }
.mic-meter meter { width: 100%; height: 10px; accent-color: #a8ed7b; }
.volume { display: grid; grid-template-columns: auto 1fr 46px; align-items: center; gap: 10px; margin-top: 17px; color: var(--muted); font-size: .85rem; }
.volume output { text-align: right; font-variant-numeric: tabular-nums; }
.button, select, input:not([type=range]) { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; font-size: .86rem; font-weight: 650; text-decoration: none; }
.primary { color: #fff; background: var(--blurple); border-color: transparent; }
.primary:hover:not(:disabled) { background: #5b65dc; }
.muted, select, input:not([type=range]) { background: #232428; color: inherit; }
.muted:hover:not(:disabled) { background: #3c3f46; }
.compact { min-height: 36px; }
input:not([type=range]), select { width: 100%; min-width: 0; }
input::placeholder { color: #a8a4af; }

#count { color: var(--muted); font-size: .8rem; margin-left: 5px; font-weight: 500; }
.queue ol, .history ol, #results { margin: 0; padding: 0; list-style: none; }
.queue ol { max-height: 310px; overflow: auto; scrollbar-color: #52515a transparent; }
.history ol { max-height: 360px; overflow: auto; scrollbar-color: #52515a transparent; }
.track-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.track-row:last-child { border-bottom: 0; }
.thumb { flex: 0 0 42px; height: 42px; border-radius: 8px; overflow: hidden; background: radial-gradient(circle, #d98c71 0 12%, #42323d 14% 50%, #332934 52%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-name { display: grid; flex: 1; min-width: 0; gap: 4px; }
.row-name a, .row-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name a { text-decoration: none; font-size: .89rem; font-weight: 650; }
.row-name a:hover { text-decoration: underline; }
.row-name span { color: var(--muted); font-size: .79rem; }
.empty, .hint, .error { font-size: .9rem; line-height: 1.45; }
.empty, .hint { color: var(--muted); margin: 16px 0 0; }
.error { color: #ffb5ab; margin-top: 12px; }
.discovery, .history { grid-column: 1 / -1; }
.sources { color: var(--muted); margin-top: 9px; font-size: .8rem; }
.discovery form { display: grid; grid-template-columns: minmax(0, 1fr) 164px auto; gap: 10px; margin-top: 14px; }
#link-form { grid-template-columns: minmax(0, 1fr) auto; padding-top: 13px; border-top: 1px solid var(--line); }
#upload-form { grid-template-columns: minmax(0, 1fr) auto; }
.youtube-cookies { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.youtube-cookies h3 { font-size: 1rem; }
.youtube-cookies .hint { margin-top: 7px; }
#youtube-cookies-form { grid-template-columns: minmax(0, 1fr) auto; }
input[type=file]::file-selector-button { margin-right: 8px; background: #41434a; border: 0; border-radius: 4px; color: inherit; padding: 4px 8px; cursor: pointer; }
.notice { position: fixed; right: 20px; bottom: 20px; max-width: min(440px, calc(100% - 40px)); border: 1px solid var(--line); background: #28272d; padding: 13px 16px; border-radius: 12px; color: #fff; box-shadow: 0 8px 35px #0008; }
.notice.error { color: #ffb5ab; }
.welcome { margin: min(8vh, 70px) auto 0; display: grid; justify-items: center; gap: 16px; max-width: 560px; padding: 42px 20px; text-align: center; background: radial-gradient(at 50% 0, #3a3b56, transparent 75%), var(--surface); }
.welcome p { color: var(--muted); max-width: 36ch; line-height: 1.5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar ul { max-height: 210px; overflow: auto; }
  main { padding: 30px 16px 64px; }
  .top { padding: 0 16px; }
}
@media (max-width: 480px) {
  .discovery form, #link-form { grid-template-columns: minmax(0, 1fr) auto; }
  #query, #link { grid-column: 1 / -1; }
  #link-submit { grid-column: 1 / -1; justify-self: start; }
}
