/* Rola — styles. Tokens, type, spacing and shapes come from the
   J Developments App Design Guide (version 1). Nothing here invents new ones. */

@font-face { font-family: 'Outfit'; font-weight: 300; font-display: swap; src: url('../fonts/outfit-latin-300-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-weight: 300; font-display: swap; src: url('../fonts/outfit-latin-ext-300-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Outfit'; font-weight: 400; font-display: swap; src: url('../fonts/outfit-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-weight: 400; font-display: swap; src: url('../fonts/outfit-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url('../fonts/dm-sans-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url('../fonts/dm-sans-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ground: #F2F4F1; --surface: #FFFFFF;
  --text: #14202B; --text-soft: #4B5A66;
  --primary: #1F4E79; --on-primary: #F2F4F1;
  --line: #A9C4D6; --tint: #E3ECF2;
  --good: #1E7A4C; --caution: #8A5300; --danger: #B3261E;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --font-head: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --margin: 16px;
  --nav-h: 64px;
  --mini-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F1B26; --surface: #172733;
    --text: #F2F4F1; --text-soft: #A9C4D6;
    --primary: #8DB8DA; --on-primary: #0F1B26;
    --line: #2A3D4D; --tint: #1D3345;
    --good: #6CCB98; --caution: #F0B45A; --danger: #F28B82;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 16px/1.4 var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; font-weight: 400; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

/* ---------- type roles ---------- */
.title { font: 300 28px/1.1 var(--font-head); }
.heading { font: 400 18px/1.1 var(--font-head); }
.small { font-size: 14px; }
.caption { font-size: 12px; color: var(--text-soft); }
.soft { color: var(--text-soft); }
.num, .dur, .time { font-variant-numeric: tabular-nums; }

/* ---------- frame ---------- */
#view {
  max-width: 960px; margin: 0 auto;
  padding: 0 var(--margin) calc(var(--nav-h) + var(--safe-b) + 32px);
  min-height: 100dvh;
}
body.has-mini #view { padding-bottom: calc(var(--nav-h) + var(--mini-h) + var(--safe-b) + 32px); }

.progress { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s linear; }
.progress.loose i { width: 30%; animation: slide 1.8s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(-30%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .progress.loose i { animation: none; width: 100%; opacity: .5; } }

.topbar { display: flex; align-items: center; gap: 4px; min-height: 64px; padding: 16px 0 8px; }
.topbar .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 0; }
.topbar .icon-btn { color: var(--primary); }
.topbar .icon-btn:first-child { margin-left: -12px; }
.topbar .icon-btn:last-child { margin-right: -12px; }

.icon-btn { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; }
.icon-btn:active { background: var(--tint); }
.icon-btn[aria-pressed="true"] { background: var(--tint); color: var(--primary); }

/* ---------- buttons ---------- */
.btn {
  height: 48px; padding: 0 24px; border-radius: var(--r-md); font: 400 16px/1 var(--font-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.secondary { border: 1px solid var(--primary); color: var(--primary); }
.btn.text { color: var(--primary); padding: 0 12px; margin-left: -12px; }
.btn.danger { background: var(--danger); color: var(--on-primary); }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 12px; margin: 16px 0 8px; }
.actions .btn { flex: 1; }
.actions-under { display: flex; align-items: center; min-height: 48px; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; margin: 0 0 16px; }
.chip { height: 32px; padding: 0 12px; border-radius: var(--r-sm); background: var(--tint); color: var(--text); font-size: 14px; display: inline-flex; align-items: center; position: relative; }
.chip::after { content: ''; position: absolute; inset: -8px 0; } /* 48 px touch target */
.chip[aria-current="true"] { background: var(--primary); color: var(--on-primary); }

/* ---------- cards, rows ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.card .heading { margin-bottom: 12px; }
.card p + p, .card p + .btn, .card .field + .btn, .card .btn + p { margin-top: 12px; }

.section { margin: 24px 0 12px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px 4px 4px 16px; position: relative; width: 100%; text-align: left;
  content-visibility: auto; contain-intrinsic-size: auto 57px; cursor: pointer;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
.row.plain { padding-right: 16px; }
.row-text { flex: 1; min-width: 0; }
.row-title, .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 14px; color: var(--text-soft); }
.row .value { color: var(--text-soft); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; flex: none; }
.row .num { width: 24px; text-align: right; color: var(--text-soft); font-size: 14px; flex: none; }
.row .dur { color: var(--text-soft); font-size: 14px; flex: none; }
.row .dl-mark { color: var(--text-soft); flex: none; }
.row .icon-btn { color: var(--text-soft); margin-left: -8px; }
.row.current { background: var(--tint); }
.row.current .row-title { color: var(--primary); }
.row.unavailable .row-title { color: var(--text-soft); }
.disc { padding: 16px 16px 8px; position: relative; }
.row + .disc::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); }

/* ---------- cover art ---------- */
.art { aspect-ratio: 1; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--tint); color: var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art.thumb { width: 40px; border-radius: var(--r-sm); }
.art.thumb .icon svg { width: 20px; height: 20px; }
.art .icon svg { width: 40%; height: 40%; min-width: 20px; min-height: 20px; }
.art .icon { width: 100%; height: 100%; align-items: center; justify-content: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 16px 12px; }
.tile { display: block; min-width: 0; }
.tile .art { width: 100%; margin-bottom: 8px; }
.tile .row-title { font-size: 16px; }

.album-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.album-head .art { width: min(100%, 280px); align-self: center; }
.album-head .title { overflow-wrap: anywhere; }
.album-head .meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.album-head a { color: var(--primary); }
@media (min-width: 640px) {
  .album-head { flex-direction: row; align-items: flex-end; gap: 24px; }
  .album-head .art { width: 200px; align-self: auto; }
}

/* ---------- inputs ---------- */
.field { display: block; }
.field .caption { display: block; margin-bottom: 4px; }
.input { width: 100%; height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; }
.input:focus { outline: none; border-color: var(--primary); }
.input::placeholder { color: var(--text-soft); }

/* ---------- banners, empty states ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--danger); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 12px; }
.banner .icon { color: var(--danger); }
.banner.note { border-color: var(--line); }
.banner.note .icon { color: var(--primary); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 48px 16px; max-width: 360px; margin: 0 auto; }
.empty .drawing { color: var(--line); }
.empty .btn { width: 100%; }
.status { margin: 0 0 12px; }

/* ---------- bottom navigation and mini player ---------- */
.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line); display: flex;
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-soft); font-size: 12px; min-height: 48px; }
.nav a[aria-current="page"] { color: var(--primary); }

.mini {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); height: var(--mini-h);
  background: var(--surface); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 4px 0 16px; cursor: pointer;
}
.mini .bar { position: absolute; top: -1px; left: 0; height: 2px; background: var(--primary); width: 0; }
.mini .icon-btn { color: var(--primary); }

/* ---------- now playing ---------- */
.now { position: fixed; z-index: 40; inset: 0; background: var(--ground); display: flex; flex-direction: column; padding: 0 var(--margin) calc(24px + var(--safe-b)); overflow-y: auto; }
.now-inner { width: 100%; max-width: 440px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }
.now .topbar { flex: none; }
.now .topbar .caption { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; min-height: 0; }
.now-body .art { width: min(100%, 46dvh); align-self: center; }
.now .title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.now .who { color: var(--text-soft); margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .who a { color: var(--primary); }
.scrub { display: flex; flex-direction: column; gap: 4px; }
.scrub .times { display: flex; justify-content: space-between; }
.controls { display: flex; align-items: center; justify-content: space-between; }
.controls .icon-btn { color: var(--text); }
.controls .icon-btn[aria-pressed="true"] { color: var(--primary); }
.controls .big { width: 64px; height: 64px; background: var(--primary); color: var(--on-primary); }
.controls .big:active { background: var(--primary); opacity: .85; }
.now-queue { flex: 1; padding-bottom: 16px; }
.now-queue .value { padding-right: 12px; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 48px; margin: 0; background: transparent; cursor: pointer; --fill: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--primary) var(--fill), var(--line) var(--fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); margin-top: -6px; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--primary); }

/* ---------- dialogs, sheets, snackbar ---------- */
.backdrop { position: fixed; z-index: 50; inset: 0; background: rgb(20 32 43 / .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 24px 24px calc(24px + var(--safe-b)); width: 100%; max-width: 480px; max-height: 80dvh; overflow-y: auto; }
.sheet .heading { margin-bottom: 8px; }
.sheet .rows { margin: 8px -24px -8px; }
.sheet .rows .row { padding: 4px 24px; gap: 16px; }
.sheet .rows .row::before { display: none; }
.sheet .rows .row .icon { color: var(--primary); }
.sheet .rows .row.is-danger, .sheet .rows .row.is-danger .icon { color: var(--danger); }
.backdrop.center { align-items: center; padding: 24px; }
.backdrop.center .sheet { border-radius: var(--r-lg); max-width: 400px; padding: 24px; border: 1px solid var(--line); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.dialog-actions .btn { padding: 0 16px; }
.dialog-actions .btn.text { margin: 0; }
.sheet .field { margin-top: 16px; }

.snack { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); display: flex; justify-content: center; pointer-events: none; }
body.has-mini .snack { bottom: calc(var(--nav-h) + var(--mini-h) + var(--safe-b) + 16px); }
.snack p { background: var(--text); color: var(--ground); border-radius: var(--r-md); padding: 12px 16px; max-width: 480px; font-size: 14px; }

/* ---------- sign-in ---------- */
.signin { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px var(--margin) calc(32px + var(--safe-b)); text-align: center; }
.signin .mark { width: 96px; height: 96px; color: var(--primary); }
.signin .box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 24px; align-items: center; }
.signin .btn { width: 100%; }
.signin .banner { text-align: left; width: 100%; margin: 0; }
.signin .credit { position: absolute; bottom: calc(24px + var(--safe-b)); left: 0; right: 0; }

.credit { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--text-soft); margin: 32px 0 0; }
.credit-j { display: inline-flex; color: var(--primary); }
@media (prefers-color-scheme: dark) { .credit, .credit-j { color: var(--text); } }

/* ---------- wider screens: navigation moves to the side ---------- */
@media (min-width: 900px) {
  :root { --margin: 24px; --rail: 200px; }
  .nav { top: 0; right: auto; width: var(--rail); height: auto; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 24px 12px; border-top: 0; border-right: 1px solid var(--line); bottom: 0; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: 48px; padding: 0 12px; font-size: 16px; border-radius: var(--r-md); }
  .nav a[aria-current="page"] { background: var(--tint); }
  #view { margin-left: var(--rail); max-width: none; padding-left: 32px; padding-right: 32px; padding-bottom: 48px; }
  #view > * { max-width: 960px; }
  body.has-mini #view { padding-bottom: calc(var(--mini-h) + 48px); }
  .mini { left: var(--rail); bottom: 0; }
  .snack, body.has-mini .snack { left: var(--rail); bottom: 24px; }
  body.has-mini .snack { bottom: calc(var(--mini-h) + 24px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 24px 16px; }
  .backdrop { align-items: center; }
  .sheet { border-radius: var(--r-lg); border: 1px solid var(--line); }
  .actions .btn { flex: none; min-width: 144px; }
}
