@import url("/shared.css");

/* Personal station — component styles; tokens in shared.css */

/* --- top bar ------------------------------------------------------------- */

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 750; letter-spacing: -.01em; font-size: 18px;
  text-decoration: none; color: inherit;
}

main {
  padding: 4px 16px calc(var(--tabs-h) + var(--safe-b) + 24px);
  max-width: 560px; margin: 0 auto;
}

/* --- panels -------------------------------------------------------------- */

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px 14px; margin-top: 14px;
}
.panel:first-child { margin-top: 0; }
.panel > .section:first-child { margin-top: 0; }

.section {
  margin: 26px 2px 10px; font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

.help { margin: -2px 2px 12px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.help b { color: var(--text); }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { color: var(--muted); text-align: center; padding: 40px 12px; }

/* --- stations bar -------------------------------------------------------- */

.stations-bar {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 2px 0 16px; padding: 0;
}
.stations-bar::-webkit-scrollbar { display: none; }
.stations-bar:empty { display: none; }
.stab {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 8px 4px; border-radius: 14px;
  color: var(--muted); font-size: 11.5px; font-weight: 650; line-height: 1.15; text-align: center;
  flex: none; white-space: nowrap;
}
.stab .sicon { width: 44px; height: 44px; border-radius: 12px; opacity: .55; transition: opacity .15s, transform .15s; }
.stab[aria-pressed="true"] { color: var(--text); }
.stab[aria-pressed="true"] .sicon { opacity: 1; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.stab.mine { color: var(--accent); }
.stab.mine .sicon { border: 2px solid var(--accent); }
.stab.rv { justify-content: center; }
.stab.rv .switch { width: 44px; height: 26px; margin: 9px 0; }
.stab.rv .switch::after { width: 20px; height: 20px; }
.stab.rv .switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch { flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

.np .mutedbadge { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.np .mutedbadge svg { width: 32px; height: 32px; color: #fff; }
.np.muted .title { opacity: .5; }

/* --- now playing --------------------------------------------------------- */

.now { padding-top: 6px; }
.np .head { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; }
.np .thumb {
  position: relative; width: 88px; height: 88px; border-radius: 18px; overflow: hidden;
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow);
}
.np .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.np .thumb svg { width: 36px; height: 36px; }
.np .hmeta { min-width: 0; }
.kicker { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.kicker .feed { color: var(--accent); font-weight: 650; }
.np .title { margin-top: 4px; font-size: 20px; -webkit-line-clamp: 4; }
.title {
  margin: 6px 0 0; font-size: 23px; line-height: 1.22; font-weight: 750; letter-spacing: -.015em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-height: 800px) { .title { font-size: 25px; } .np .title { font-size: 22px; } }

.original {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; height: 46px;
  border-radius: 14px; background: var(--bg-2); border: 1px solid transparent; color: var(--text);
  text-decoration: none; font-weight: 700; font-size: 15px;
}
.original svg { width: 18px; height: 18px; color: var(--accent); }
.original:active { background: var(--line); }

/* --- badges -------------------------------------------------------------- */

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bdg {
  display: inline-flex; align-items: stretch; height: 32px; max-width: 100%; border-radius: 999px; overflow: hidden;
  background: var(--bg-2); color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; border: 0;
}
.bdg .l, .bdg .r { width: 24px; display: grid; place-items: center; font-size: 16px; font-weight: 700; opacity: .5; }
.bdg .t { display: flex; align-items: center; padding: 0 2px; min-width: 0; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg.feed .t { font-weight: 800; }
.bdg[data-level="-3"] { background: var(--r3); color: #fff; }
.bdg[data-level="-2"] { background: var(--r2); color: #fff; }
.bdg[data-level="-1"] { background: var(--r1); color: #5a1010; }
.bdg[data-level="1"]  { background: var(--g1); color: #0e4a22; }
.bdg[data-level="2"]  { background: var(--g2); color: #fff; }
.bdg[data-level="3"]  { background: var(--g3); color: #fff; }
.bdg:active .l, .bdg:active .r { opacity: 1; }

/* --- progress bar -------------------------------------------------------- */

.progress { margin: 18px 2px 0; }
.bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 5px; transition: width .4s linear; }
.times {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.progress .state { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 1.3em; }

/* drag-to-seek */
.progress .bar { position: relative; overflow: visible; touch-action: none; }
.progress.seekable .bar { cursor: pointer; }
.progress.seekable .bar::before { content: ""; position: absolute; inset: -14px 0; }
.progress.seekable .bar span { position: relative; }
.progress.seekable .bar span::after {
  content: ""; position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.progress.dragging .bar span { transition: none; }
.progress.dragging .bar span::after { transform: scale(1.3); }

/* --- playback controls --------------------------------------------------- */

.controls {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin: 14px 0 0; padding: 0 2px;
}
.ctl {
  position: relative; width: 64px; height: auto; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 0; color: var(--text);
}
.ctl:active { background: var(--bg-2); }
.ctl.small svg { width: 26px; height: 26px; }
.ctl svg { width: 30px; height: 30px; }
.ctl .lbl {
  font-size: 11px; font-weight: 650; color: var(--muted);
  line-height: 1.15; text-align: center;
}
.ctl.big {
  width: 76px; padding: 0; color: var(--text);
}
.ctl.big svg {
  width: 70px; height: 70px; padding: 18px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 40%, transparent);
}
.ctl.big:active svg { transform: scale(.96); }
.ctl.big .lbl { color: var(--text); }
.ctl.liked { color: var(--good); }
.ctl.disliked { color: var(--bad); }
.count {
  position: absolute; top: 0; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font: 700 11px/18px system-ui, sans-serif; font-style: normal; color: #fff; background: var(--muted);
}
.ctl.liked .count { background: var(--good); }
.ctl.disliked .count { background: var(--bad); }
.ctl[disabled] { opacity: .35; }
#play .icon-pause { display: none; }
#play.playing .icon-play { display: none; }
#play.playing .icon-pause { display: inline; }

.subctl { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }

/* --- speed pill ---------------------------------------------------------- */

.speed-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 14px;
  border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 14px; font-weight: 600;
}
.speed-pill select {
  background: transparent; border: 0; color: var(--text); font: inherit;
  font-size: 14px; font-weight: 650; padding: 4px 2px;
  -webkit-appearance: none; appearance: none; cursor: pointer; outline: none;
}

/* --- rows (coming up, browse, ratings) ----------------------------------- */

.rows { list-style: none; margin: 0; padding: 0; }
li.row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
}
li.row:last-child { border-bottom: 0; }
.row .thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--bg-2); display: grid; place-items: center; color: #fff; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb svg { width: 24px; height: 24px; }
.row .when { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row .when small { display: block; font-size: 12px; font-weight: 500; color: var(--faint); }
.row .body { min-width: 0; }
.row .t {
  font-size: 15.5px; font-weight: 650; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row .s { margin-top: 3px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.row.news .t { color: var(--news); }
.row .go { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--text); }
.row .go svg { width: 18px; height: 18px; }
.row .go:active { background: var(--line); }
li.row:active { background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.dot.article { background: #c9a0ff; }
.dot.audio { background: var(--good); }
.dot.video { background: #ffb347; }
.dot.news { background: var(--news); }

/* plain list rows (browse results, ratings) */
.rows li:not(.row) {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.rows li:not(.row):last-child { border-bottom: 0; }
.rows li:not(.row) > div { min-width: 0; }
.rows li:not(.row) > div > span {
  font-size: 15px; font-weight: 650; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rows li:not(.row) > div > small, .rows small { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }
.rows li:not(.row) button { align-self: center; white-space: nowrap; }

/* --- bottom tabs --------------------------------------------------------- */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--faint); font-size: 11.5px; font-weight: 650;
}
.tabs button[aria-selected="true"] { color: var(--accent); }

/* --- chips --------------------------------------------------------------- */

.chips { display: flex; gap: 8px; margin: 10px 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid transparent;
  background: var(--bg-2); color: var(--muted); font-size: 14px; font-weight: 600;
}
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* --- tune: profile ------------------------------------------------------- */

.profile-sum { font-weight: 650; margin: 4px 2px 10px; }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-actions button {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px;
  border-radius: 14px; background: var(--bg-2); border: 1px solid transparent;
  color: var(--text); font-weight: 700; font-size: 14px;
}
.profile-actions button:active { background: var(--line); }
.profile-tools { border-top: 1px solid var(--line); margin-top: 16px; }

/* --- tune: weights (ratings list) ---------------------------------------- */

.find {
  width: 100%; height: 44px; margin-top: 10px; padding: 0 14px; border-radius: 12px;
  border: 1px solid transparent; background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 16px; outline: none;
}
.find:focus { border-color: var(--accent); }

.weights .rows li { gap: 8px; }
.weights .rows li > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.weights .rows li > div:first-child > small { font-size: 12px; color: var(--faint); }

/* stepper-style weight buttons */
.weights {
  display: inline-flex; align-items: center; flex-shrink: 0;
  background: var(--bg-2); border: 1px solid transparent; border-radius: 999px; overflow: hidden; gap: 0;
}
.weights span {
  min-width: 36px; text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 14px;
}
.weights button {
  min-width: 44px; min-height: 44px; display: grid; place-items: center;
  font-size: 18px; font-weight: 600; border-radius: 0;
}
.weights button:active { background: var(--line); }
.weights button:last-child { font-size: 12px; font-weight: 700; letter-spacing: .04em; }

/* --- tune: descriptor badges --------------------------------------------- */

.descriptor-ratings { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.descriptor-ratings > p { flex-basis: 100%; margin: 0; }
.rating-badge {
  display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px;
  border: 1px solid var(--line); border-radius: 16px; max-width: 100%;
}
.rating-badge > span { overflow-wrap: anywhere; min-width: 0; font-size: .85rem; }
.rating-badge b { font-size: .8rem; color: var(--muted); }
.rating-badge button {
  min-width: 40px; min-height: 40px; padding: 4px 10px;
  border-radius: 12px; font-size: 16px;
}
.rating-badge button:active { background: var(--bg-2); }

/* --- tune: sources ------------------------------------------------------- */

.feed {
  display: flex; align-items: center; gap: 10px; min-height: 52px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.feed:last-child { border-bottom: 0; }
.feed input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--accent); }
.feed small { display: block; font-size: 12px; color: var(--muted); }
.source-discovery { margin: 16px 0; border-top: 1px solid var(--line); }
#feed-save-status { display: block; margin-top: 8px; }

/* --- tune: clock --------------------------------------------------------- */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dp {
  border: 1px solid transparent; background: var(--bg-2); border-radius: 12px;
  padding: 0 14px; margin-top: 12px;
}
.dp .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 0 14px; }

fieldset { border: 0; padding: 0; margin: 12px 0; min-width: 0; }
legend { font-size: .85rem; color: var(--muted); }
.option {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  padding: 8px 12px; margin: 6px 6px 0 0; border-radius: 999px; cursor: pointer; font-size: .9rem;
}
.option:has(input:checked) { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); }
.option input { accent-color: var(--accent); }

/* --- shared form elements ------------------------------------------------ */

label { display: block; margin: 16px 0 6px; font-weight: 600; }
input:not([type="checkbox"]):not([type="range"]):not([type="search"]):not([type="radio"]),
select:not(.speed-pill select) {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
select[multiple] { min-height: 110px; }

button.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px;
  padding: 12px 16px; font-weight: 700; width: 100%; margin-top: 16px;
}
button.primary:active { opacity: .85; }
button.secondary {
  background: var(--bg-2); color: var(--text); border: 1px solid transparent;
  border-radius: 12px; padding: 10px 16px; font-weight: 650;
}
button.secondary:active { background: var(--line); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wide { width: 100%; margin-top: 20px; }

summary { cursor: pointer; font-weight: 650; padding: 12px 0; color: var(--text); }
summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
summary small { display: block; font-weight: 400; color: var(--muted); margin: 6px 0 0; }

/* --- setup steps --------------------------------------------------------- */

.setup-steps { padding-left: 22px; color: var(--muted); }
.setup-steps li { margin: 12px 0; }
.setup-steps a { color: var(--accent); }
.tag {
  font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
  display: inline-block; margin-bottom: 8px;
}

/* --- notice (toast-style) ------------------------------------------------ */

#notice {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); z-index: 20;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 650; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, transform .2s;
}
#notice:empty { display: none; }
#notice.error { background: var(--bad); color: #fff; }

/* --- footer -------------------------------------------------------------- */

.foot { text-align: center; color: var(--faint); font-size: 13px; margin: 28px 0 8px; }
.foot a { color: var(--muted); text-decoration: none; font-weight: 600; }

/* --- sign-out pill -------------------------------------------------------- */

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 14px; font-weight: 600;
}
.pill-btn:active { background: var(--line); }

/* === Login page ========================================================== */

body.login-page main {
  max-width: 480px; padding-top: 9vh;
}
body.login-page .top { border-bottom: 1px solid var(--line); }
body.login-page .top .small { color: var(--muted); }
body.login-page .panel { margin-top: 24px; }
body.login-page h1 {
  font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.1; letter-spacing: -.04em; margin: 16px 0;
}
body.login-page .notice {
  position: static; transform: none; max-width: none; border-radius: 12px;
  white-space: normal; margin-top: 16px; display: block; text-align: left;
  background: transparent; color: var(--accent); font-weight: 500; padding: 0;
}
body.login-page .notice:empty { display: none; }
body.login-page .notice.error { color: var(--bad); background: transparent; }

@media (max-width: 500px) {
  main { padding-left: 14px; padding-right: 14px; }
  .panel { padding: 14px 12px 12px; }
  body.login-page .top .small { display: none; }
  .dp .grid { grid-template-columns: 1fr; }
  .profile-actions { grid-template-columns: 1fr; }
}

