/* ============================================================
   GSWESTOK Radio — vintage dial faceplate, amber/teal on charcoal
   ============================================================ */

:root{
  --bg:        #14120d;
  --panel:     #1c1811;
  --panel-2:   #241f16;
  --line:      #392f20;
  --amber:     #ffb238;
  --amber-dim: #a97a2e;
  --teal:      #6fcf97;
  --text:      #f2ead8;
  --text-dim:  #9c9483;
  --shadow:    rgba(0,0,0,.45);

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Work Sans', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --fade-out: 1.8s;
  --fade-in:  .45s;
}

@media (prefers-reduced-motion: reduce){
  :root{ --fade-out: .01s; --fade-in: .01s; }
}

*{ box-sizing:border-box; }

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

body{
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255,178,56,.07), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.015) 0 1px, transparent 1px 34px),
    var(--bg);
}

/* -------------------- fullscreen visualizer -------------------- */

#visualizer-canvas,
#visualizer-fallback-canvas{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  display:block;
  opacity:0;
  z-index:1;
  pointer-events:none;
  transition: opacity var(--fade-out) ease;
  background:#000;
}

body.idle #visualizer-canvas{
  opacity:1;
  transition: opacity var(--fade-out) ease;
}

/* If Butterchurn can't render on this machine, the built-in
   Canvas2D visualizer takes over for the rest of the session. */
body.idle.use-fallback-viz #visualizer-canvas{ opacity:0; }
body.idle.use-fallback-viz #visualizer-fallback-canvas{
  opacity:1;
  transition: opacity var(--fade-out) ease;
}

/* -------------------- main UI shell -------------------- */

.ui{
  position:relative;
  z-index:2;
  height:100vh;
  width:100%;
  max-width:560px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  padding:22px 20px 18px;
  opacity:1;
  transform:translateY(0);
  transition: opacity var(--fade-out) ease, transform var(--fade-out) ease;
  pointer-events:auto;
}

body.idle .ui{
  opacity:0;
  transform:translateY(-6px);
  pointer-events:none;
  transition: opacity var(--fade-out) ease, transform var(--fade-out) ease;
}

body:not(.idle) .ui{
  transition: opacity var(--fade-in) ease, transform var(--fade-in) ease;
}

/* -------------------- tuner header (signature element) -------------------- */

.tuner{
  border:1px solid var(--line);
  border-radius:10px;
  background:
    linear-gradient(180deg, var(--panel-2), var(--panel));
  padding:14px 16px 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 8px 24px var(--shadow);
  flex-shrink:0;
}

.tuner-brand{
  display:flex;
  align-items:baseline;
  gap:9px;
  font-family:var(--font-display);
  letter-spacing:.14em;
  margin-bottom:10px;
}

.on-air{
  width:8px; height:8px; border-radius:50%;
  background:var(--amber-dim);
  box-shadow:0 0 0 rgba(255,178,56,0);
  transition: background .4s ease, box-shadow .4s ease;
  flex-shrink:0;
  transform:translateY(-1px);
}

body.is-playing .on-air{
  background:var(--amber);
  box-shadow:0 0 8px 2px rgba(255,178,56,.55);
  animation: flicker 3.2s ease-in-out infinite;
}

@keyframes flicker{
  0%,100%{ opacity:1; }
  92%{ opacity:1; }
  94%{ opacity:.55; }
  96%{ opacity:1; }
}

.brand-mark{ font-size:20px; font-weight:700; color:var(--text); }
.brand-sub{ font-size:14px; font-weight:600; color:var(--amber-dim); letter-spacing:.28em; }

.tuner-path{
  display:flex;
  align-items:center;
  gap:8px;
  border-top:1px dashed var(--line);
  padding-top:10px;
  font-family:var(--font-mono);
  font-size:13px;
  color:var(--text-dim);
  min-height:24px;
}

.back-btn{
  display:flex; align-items:center; justify-content:center;
  width:26px; height:26px;
  border-radius:6px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--amber);
  cursor:pointer;
  flex-shrink:0;
  transition: background .15s ease, transform .1s ease;
}
.back-btn:hover{ background:rgba(255,178,56,.08); }
.back-btn:active{ transform:scale(.92); }
.back-btn.is-hidden{ display:none; }

.path-label{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; letter-spacing:.03em; }

/* -------------------- list panel -------------------- */

.panel{
  flex:1 1 auto;
  min-height:0;
  margin:16px 0;
  border:1px solid var(--line);
  border-radius:10px;
  background: linear-gradient(180deg, rgba(0,0,0,.14), transparent 60%), var(--panel);
  overflow:hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.list{
  list-style:none;
  margin:0;
  padding:6px;
  height:100%;
  overflow-y:auto;
}

.list::-webkit-scrollbar{ width:9px; }
.list::-webkit-scrollbar-track{ background:transparent; }
.list::-webkit-scrollbar-thumb{ background:var(--line); border-radius:6px; }

.row{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 12px;
  border-radius:8px;
  cursor:pointer;
  color:var(--text);
  transition: background .12s ease;
}
.row:hover{ background:var(--panel-2); }
.row:active{ background:rgba(255,178,56,.09); }

.row-index{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--text-dim);
  width:24px;
  flex-shrink:0;
  text-align:right;
}

.row-name{
  flex:1;
  font-size:15.5px;
  font-weight:500;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.row-chevron{ color:var(--text-dim); flex-shrink:0; }

.row.playing{ background:rgba(111,207,151,.09); }
.row.playing .row-name{ color:var(--teal); font-weight:600; }
.row.playing .row-index{ color:var(--teal); }

.row.genre .row-name{ font-family:var(--font-display); font-size:19px; letter-spacing:.02em; }

.empty-note{
  padding:26px 16px;
  color:var(--text-dim);
  font-size:14px;
  line-height:1.55;
}
.empty-note code{
  font-family:var(--font-mono);
  background:var(--panel-2);
  padding:1px 5px;
  border-radius:4px;
  color:var(--amber);
}

/* -------------------- transport -------------------- */

.transport{
  flex-shrink:0;
  border:1px solid var(--line);
  border-radius:10px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding:14px 16px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 8px 24px var(--shadow);
}

.now-playing{ margin-bottom:10px; }
.np-title{
  font-family:var(--font-display);
  font-size:20px;
  font-weight:600;
  color:var(--text);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.np-genre{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--amber-dim);
  letter-spacing:.06em;
  margin-top:2px;
}

.progress{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.time{
  font-family:var(--font-mono);
  font-size:11.5px;
  color:var(--text-dim);
  width:34px;
  flex-shrink:0;
}
#time-duration{ text-align:right; }

.seek{
  -webkit-appearance:none;
  appearance:none;
  flex:1;
  height:4px;
  border-radius:3px;
  background: linear-gradient(90deg, var(--amber) var(--fill,0%), var(--line) var(--fill,0%));
  cursor:pointer;
}
.seek::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:13px; height:13px;
  border-radius:50%;
  background:var(--amber);
  box-shadow:0 0 6px rgba(255,178,56,.6);
  cursor:pointer;
  margin-top:-4.5px;
}
.seek::-moz-range-thumb{
  width:13px; height:13px; border:none; border-radius:50%;
  background:var(--amber);
  box-shadow:0 0 6px rgba(255,178,56,.6);
  cursor:pointer;
}
.seek::-moz-range-track{ height:4px; border-radius:3px; background:var(--line); }
.seek:disabled{ opacity:.5; cursor:default; }

.controls{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

.ctl{
  display:flex; align-items:center; justify-content:center;
  position:relative;
  width:42px; height:42px;
  border-radius:50%;
  border:1px solid var(--line);
  background:var(--panel-2);
  color:var(--text);
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.ctl:hover{ border-color:var(--amber-dim); color:var(--amber); }
.ctl:active{ transform:scale(.93); }

.ctl.primary{
  width:54px; height:54px;
  background:var(--amber);
  color:#1a1509;
  border-color:var(--amber);
}
.ctl.primary:hover{ background:#ffc25e; color:#1a1509; }

.ctl[aria-pressed="true"]{
  color:var(--teal);
  border-color:var(--teal);
  background:rgba(111,207,151,.1);
}

.repeat-one-badge{
  position:absolute;
  bottom:1px; right:1px;
  font-family:var(--font-mono);
  font-size:9px;
  line-height:1;
  background:var(--teal);
  color:#0e2016;
  border-radius:50%;
  width:13px; height:13px;
  display:none;
  align-items:center; justify-content:center;
}
#repeat-btn[data-mode="one"] .repeat-one-badge{ display:flex; }
#repeat-btn[data-mode="one"]{ color:var(--teal); border-color:var(--teal); background:rgba(111,207,151,.1); }
#repeat-btn[data-mode="all"]{ color:var(--teal); border-color:var(--teal); background:rgba(111,207,151,.1); }

/* -------------------- responsive -------------------- */

@media (max-width:420px){
  .ui{ padding:14px 12px 12px; }
  .ctl{ width:38px; height:38px; }
  .ctl.primary{ width:50px; height:50px; }
  .np-title{ font-size:18px; }
}

/* -------------------- focus visibility -------------------- */

button:focus-visible, .seek:focus-visible, .row:focus-visible{
  outline:2px solid var(--amber);
  outline-offset:2px;
}
