/* HANGAR RADIO — dark hangar theme */
:root {
  --bg: #0b0d12;
  --surface: #14161f;
  --surface2: #1c1f2c;
  --line: #262a3a;
  --text: #e8eaf2;
  --muted: #8b90a3;
  --accent: #8b7bff;
  --accent-soft: rgba(139, 123, 255, 0.16);
  --mini-h: 62px;
  --tabs-h: 58px;
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body {
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans SC", "Noto Sans JP", sans-serif;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: baseline; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px;
  background: linear-gradient(180deg, rgba(11,13,18,0.98) 70%, rgba(11,13,18,0.86));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-size: 19px; font-weight: 800; letter-spacing: 0.12em; }
.wordmark span { color: var(--accent); margin-left: 4px; }
.tagline { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; flex: 1; }
#desknav { display: none; gap: 4px; }
#desknav a { padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
#desknav a.active, #desknav a:hover { color: var(--text); background: var(--surface2); }

/* ---------- main view ---------- */
#view { padding: 16px 16px calc(var(--mini-h) + var(--tabs-h) + var(--sab) + 28px); outline: none; }
.view-title { font-size: 22px; font-weight: 800; margin: 6px 2px 14px; letter-spacing: 0.01em; }
.view-sub { color: var(--muted); font-size: 13px; margin: -10px 2px 16px; }

/* library grid */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.album-card { cursor: pointer; }
.album-card img { width: 100%; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); }
.album-card .a-title { font-weight: 650; font-size: 14px; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .a-artist { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* album page */
.album-hero { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.album-hero img { width: 138px; height: 138px; border-radius: 12px; border: 1px solid var(--line); }
.album-hero .h-eyebrow { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.album-hero .h-title { font-size: 21px; font-weight: 800; margin: 2px 0; }
.album-hero .h-artist { color: var(--muted); font-size: 14px; }
.btn-row { display: flex; gap: 10px; margin: 4px 0 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #0b0d12; font-weight: 750; font-size: 14px;
  padding: 10px 20px; border-radius: 999px;
}
.btn.ghost { background: var(--surface2); color: var(--text); }
.btn svg { width: 15px; height: 15px; }

.track-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 6px; border-radius: 10px; cursor: pointer;
}
.track-row:active { background: var(--surface); }
.track-row .t-no { width: 22px; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.track-row .t-meta { flex: 1; min-width: 0; }
.track-row .t-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-row .t-artist { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-row .t-dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.track-row.playing .t-title { color: var(--accent); }
.track-row img.t-thumb { width: 42px; height: 42px; border-radius: 6px; }

/* equalizer bars for playing row */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 22px; height: 16px; justify-content: center; }
.eq i { width: 3px; background: var(--accent); animation: eqb 0.9s ease-in-out infinite; border-radius: 1px; }
.eq i:nth-child(2) { animation-delay: 0.25s; }
.eq i:nth-child(3) { animation-delay: 0.5s; }
@keyframes eqb { 0%, 100% { height: 4px; } 50% { height: 15px; } }
.eq.paused i { animation-play-state: paused; height: 4px; }
.track-row .eq { display: none; }
.track-row.playing .eq { display: inline-flex; }
.track-row.playing .t-no { display: none; }
.rep-badge { position: absolute; font-size: 9px; font-weight: 800; margin-left: 22px; margin-top: -14px; }

/* sessions */
.session-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.session-card {
  background: linear-gradient(160deg, var(--surface2), var(--surface));
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 14px;
  cursor: pointer; position: relative; overflow: hidden;
}
.session-card:active { border-color: var(--accent); }
.session-card .s-hours { color: var(--accent); font-weight: 800; font-size: 24px; letter-spacing: 0.02em; }
.session-card .s-name { font-weight: 750; font-size: 15px; margin-top: 2px; letter-spacing: 0.05em; }
.session-card .s-sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.session-card .s-star { position: absolute; right: -14px; top: -18px; font-size: 74px; opacity: 0.07; }

/* search */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 16px;
}
.search-box input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font: inherit; }
.search-box svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.result-head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; margin: 16px 2px 6px; }
.empty { color: var(--muted); text-align: center; padding: 44px 20px; font-size: 14px; }

/* playlists */
.pl-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; cursor: pointer; }
.pl-row:active { background: var(--surface); }
.pl-row .pl-art { width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--line); }
.pl-row .pl-name { font-weight: 650; }
.pl-row .pl-count { color: var(--muted); font-size: 12.5px; }
.new-pl { display: flex; gap: 10px; margin-bottom: 16px; }
.new-pl input {
  flex: 1; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); padding: 10px 14px; outline: none; font: inherit;
}
.new-pl input:focus { border-color: var(--accent); }

/* ---------- mini player ---------- */
#mini {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--sab)); z-index: 40;
  height: var(--mini-h);
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: rgba(24, 26, 38, 0.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); cursor: pointer;
}
.mini-progress { position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--line); }
#mini-bar { height: 100%; width: 0; background: var(--accent); }
#mini-art { width: 42px; height: 42px; border-radius: 6px; }
.mini-meta { flex: 1; min-width: 0; }
#mini-title { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mini-artist { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tabs ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabs-h) + var(--sab)); padding-bottom: var(--sab);
  display: flex; background: rgba(15, 17, 25, 0.98); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
#tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: 0.03em;
}
#tabs a.active { color: var(--accent); }
.t-ic svg { width: 21px; height: 21px; }

/* ---------- icon buttons ---------- */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; color: var(--text); }
.icon-btn:active { background: var(--surface2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.mode { color: var(--muted); }
.icon-btn.mode.on { color: var(--accent); }
.icon-btn.mode .mode-dot { position: absolute; margin-top: 26px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.text-btn { color: var(--muted); font-size: 13px; font-weight: 650; padding: 6px 10px; }

/* ---------- now playing ---------- */
#np {
  position: fixed; inset: 0; z-index: 60;
  background: linear-gradient(180deg, #171a28 0%, var(--bg) 55%);
  display: flex; flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 22px calc(26px + var(--sab));
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.3, 0.8, 0.3, 1);
}
#np.open { transform: translateY(0); }
.np-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chip {
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(139,123,255,0.35);
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.np-artwrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px 0; }
#np-art {
  width: min(78vw, 46vh, 420px); aspect-ratio: 1; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}
.np-meta { margin: 10px 2px 6px; }
#np-title { font-size: 20px; font-weight: 800; }
#np-artist { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.np-scrub { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.np-scrub span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; width: 38px; }
.np-scrub span:last-child { text-align: right; }
#np-seek { flex: 1; appearance: none; -webkit-appearance: none; height: 4px; border-radius: 2px; background: var(--line); outline: none; }
#np-seek::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); border: none; box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
#np-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: none; }
.np-controls { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 0; }
.play-big {
  width: 68px; height: 68px; border-radius: 50%; background: var(--text); color: #0b0d12;
  display: inline-flex; align-items: center; justify-content: center;
}
.play-big:active { transform: scale(0.96); }
.play-big svg { width: 30px; height: 30px; }

/* ---------- sheets ---------- */
#scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.55); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--surface2); border-radius: 18px 18px 0 0; border-top: 1px solid var(--line);
  max-height: 72vh; display: flex; flex-direction: column;
  padding-bottom: calc(10px + var(--sab));
  transform: translateY(100%); transition: transform 0.24s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.sheet.open { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.sheet-head b { flex: 1; font-size: 16px; }
.sheet-body { overflow-y: auto; padding: 4px 10px; }
.ctx-track { display: flex; align-items: center; gap: 12px; padding: 12px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ctx-track img { width: 46px; height: 46px; border-radius: 6px; }
.ctx-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 10px; border-radius: 10px; font-weight: 600; font-size: 15px; text-align: left; }
.ctx-item:active { background: var(--surface); }
.ctx-item svg { width: 19px; height: 19px; color: var(--muted); }

/* toast */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--mini-h) + var(--tabs-h) + var(--sab) + 18px); z-index: 90;
  background: #262b3d; color: var(--text); font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); white-space: nowrap;
}

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  #topbar { padding: 16px 28px; }
  .tagline { flex: none; margin-right: auto; }
  #desknav { display: flex; }
  #tabs { display: none; }
  :root { --tabs-h: 0px; }
  #view { max-width: 1240px; margin: 0 auto; padding: 26px 28px calc(var(--mini-h) + 40px); }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px; }
  .session-grid { grid-template-columns: repeat(4, 1fr); }
  #mini { bottom: 0; }
  .track-row:hover, .pl-row:hover, .ctx-item:hover { background: var(--surface); }
  #desknav a { cursor: pointer; }
  .album-card:hover .a-title { color: var(--accent); }
  #np { background: rgba(11, 13, 18, 0.7); backdrop-filter: blur(6px); align-items: center; justify-content: center; }
  .sheet { left: 50%; right: auto; width: 480px; transform: translate(-50%, 100%); border-radius: 18px 18px 0 0; }
  .sheet.open { transform: translate(-50%, 0); }
}
@media (min-width: 900px) {
  #np { padding: 0; }
  #np-card {
    width: 480px; background: linear-gradient(180deg, #171a28, #10131d);
    border: 1px solid var(--line); border-radius: 20px; padding: 22px 26px 26px;
    display: flex; flex-direction: column; max-height: 88vh;
  }
}
@media (max-width: 899.98px) {
  #np-card { display: contents; }
}
