@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap');

:root{
  --bg: #12181B;
  --surface: #1B2429;
  --surface-2: #212C31;
  --border: #2A383E;
  --text: #EDEAE3;
  --text-dim: #8FA3A8;
  --accent: #E8A33D;
  --accent-dim: #7A5A2A;
  --accent2: #6FCF97;
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0; height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

button{ font-family: inherit; cursor:pointer; }
input{ font-family: inherit; }

.app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* HEADER */
.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 18px 28px;
  border-bottom:1px solid var(--border);
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-mark{
  font-size:26px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(232,163,61,0.5));
}
.brand-text{ display:flex; flex-direction:column; line-height:1.1; }
.brand-name{
  font-family: var(--font-display);
  font-weight:700;
  font-size:20px;
  letter-spacing: 2px;
}
.brand-sub{
  font-size:11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.header-status{
  font-family: var(--font-mono);
  font-size:12px;
  color: var(--text-dim);
}

/* LAYOUT */
.layout{
  flex:1;
  display:grid;
  grid-template-columns: 260px 1fr 300px;
  gap:1px;
  background: var(--border);
}
.presets, .now-playing, .side-panel{
  background: var(--bg);
  padding: 20px;
}

.panel-label{
  font-family: var(--font-mono);
  font-size:11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

/* PRESETS */
.presets-head{
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:12px;
}
.preset-count{
  font-family: var(--font-mono);
  color: var(--accent);
  font-size:12px;
}
.preset-search{
  width:100%;
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding:9px 12px;
  font-size:13px;
  margin-bottom:14px;
}
.preset-search:focus{ outline:2px solid var(--accent); outline-offset:1px; }

.preset-list{
  display:flex;
  flex-direction:column;
  gap:4px;
  max-height: calc(100vh - 220px);
  overflow-y:auto;
  padding-right:4px;
}
.preset-item{
  display:flex;
  align-items:center;
  gap:10px;
  background: transparent;
  border:1px solid transparent;
  border-radius: var(--radius);
  padding:8px 10px;
  text-align:left;
  color: var(--text-dim);
  font-size:13px;
  transition: background .15s, color .15s, border-color .15s;
}
.preset-item:hover{ background: var(--surface); color: var(--text); }
.preset-item.is-active{
  background: var(--surface-2);
  border-color: var(--accent-dim);
  color: var(--accent);
}
.preset-num{
  font-family: var(--font-mono);
  font-size:11px;
  min-width: 26px;
  color: inherit;
  opacity:.7;
}
.preset-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.preset-tally{ font-family: var(--font-mono); font-size:10px; opacity:.6; }

/* NOW PLAYING */
.now-playing{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 22px;
  text-align:center;
}
.dial-wrap{
  position:relative;
  width:150px; height:150px;
  display:flex; align-items:center; justify-content:center;
}
.dial-ring{
  position:absolute; inset:0;
  width:100%; height:100%;
  transform: rotate(-90deg);
}
.dial-ring-bg{
  fill:none; stroke: var(--surface-2); stroke-width:4;
}
.dial-ring-fg{
  fill:none; stroke: var(--accent); stroke-width:4;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 339.3;
  transition: stroke-dashoffset .1s linear;
}
.dial-btn{
  position:relative; z-index:2;
  width:104px; height:104px;
  border-radius:50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, var(--surface-2), var(--surface) 70%);
  box-shadow: 0 4px 18px rgba(0,0,0,0.4), inset 0 0 0 1px var(--border);
  display:flex; align-items:center; justify-content:center;
  color: var(--accent);
}
.dial-btn:hover{ color: var(--text); }
.icon{ width:34px; height:34px; fill: currentColor; }

.track-info{ max-width: 340px; }
.track-category{
  display:block;
  font-family: var(--font-mono);
  font-size:11px;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom:6px;
}
.track-title{
  font-family: var(--font-display);
  font-size:22px;
  font-weight:600;
  margin:0;
}

.transport{ display:flex; gap:18px; align-items:center; }
.btn-ghost{
  background:none; border:none; color: var(--text-dim);
  padding:8px; border-radius:8px;
}
.btn-ghost:hover{ color: var(--text); background: var(--surface); }
.icon-sm{ width:20px; height:20px; fill: currentColor; stroke: none; }
.icon-sm.dim{ opacity:.6; }

.scrubber-row{
  width:100%; max-width:420px;
  display:flex; align-items:center; gap:10px;
}
.tape-counter{
  font-family: var(--font-mono);
  font-size:12px;
  color: var(--text-dim);
  min-width:42px;
}
.scrubber{
  -webkit-appearance:none; appearance:none;
  flex:1; height:4px; border-radius:2px;
  background: var(--surface-2);
  outline:none;
}
.scrubber::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:13px; height:13px; border-radius:50%;
  background: var(--accent);
  cursor:pointer;
  box-shadow: 0 0 0 3px rgba(232,163,61,0.2);
}
.scrubber::-moz-range-thumb{
  width:13px; height:13px; border-radius:50%;
  background: var(--accent); border:none;
}

.switches{
  display:flex; gap:24px; flex-wrap:wrap; justify-content:center;
}
.switch-group{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.switch-label{
  font-family: var(--font-mono); font-size:10px; text-transform:uppercase;
  letter-spacing:1.5px; color: var(--text-dim);
}
.rocker{
  display:flex; background: var(--surface); border:1px solid var(--border);
  border-radius: 8px; padding:3px; gap:2px;
}
.rocker-opt{
  border:none; background:transparent; color: var(--text-dim);
  font-size:12px; padding:6px 12px; border-radius:6px;
}
.rocker-opt.is-active{ background: var(--accent-dim); color: var(--accent); }

.volume-row{
  display:flex; align-items:center; gap:10px; width:100%; max-width:200px;
}

/* SIDE PANEL */
.side-panel{ display:flex; flex-direction:column; gap:22px; }
.panel-block-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }

.btn-offline{
  width:100%;
  display:flex; align-items:center; justify-content:center; gap:8px;
  background: var(--surface);
  border:1px solid var(--border);
  color: var(--text);
  padding:10px; border-radius: var(--radius);
  font-size:13px; font-weight:500;
}
.btn-offline:hover{ border-color: var(--accent); color: var(--accent); }
.btn-offline.is-downloading{ opacity:.7; pointer-events:none; }
.btn-offline .icon-sm{ fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }

.offline-meter{ margin-top:14px; }
.offline-meter-bar{
  height:6px; border-radius:3px; background: var(--surface-2); overflow:hidden;
}
.offline-meter-fill{
  height:100%; width:0%; background: var(--accent2);
  transition: width .3s ease;
}
.offline-meter-text{
  display:block; margin-top:6px;
  font-family: var(--font-mono); font-size:11px; color: var(--text-dim);
}
.offline-hint{
  font-size:12px; color: var(--text-dim); line-height:1.5; margin-top:12px;
}

.queue-block{ flex:1; display:flex; flex-direction:column; min-height:0; }
.queue-list{
  flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:2px;
}
.queue-item{
  display:flex; align-items:center; gap:8px;
  padding:7px 8px; border-radius:8px;
  font-size:12.5px; color: var(--text-dim);
}
.queue-item:hover{ background: var(--surface); color: var(--text); cursor:pointer; }
.queue-item.is-current{ color: var(--accent); background: var(--surface-2); }
.queue-item-dot{
  width:6px; height:6px; border-radius:50%; background: var(--border); flex-shrink:0;
}
.queue-item-dot.is-cached{ background: var(--accent2); }
.queue-item-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* FOOTER */
.footer{
  padding:12px 28px;
  border-top:1px solid var(--border);
  font-size:11px; color: var(--text-dim);
  text-align:center;
}
.footer code{ color: var(--accent); }

/* SCROLLBARS */
.preset-list::-webkit-scrollbar, .queue-list::-webkit-scrollbar{ width:6px; }
.preset-list::-webkit-scrollbar-thumb, .queue-list::-webkit-scrollbar-thumb{
  background: var(--surface-2); border-radius:3px;
}

/* RESPONSIVE */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .presets{ order:2; }
  .now-playing{ order:1; }
  .side-panel{ order:3; }
  .preset-list, .queue-list{ max-height: 260px; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; }
}
