/* Mi Ritmo — interface system
   Kind: software (music streaming app). Deal: palette blue-black-cornflower
   (bg #0a0d14, surface #131824, ink #e9edf3, accent #5ab9fc), type host
   (Host Grotesk with JetBrains Mono for counters), radius soft, buttons solid.
   The accent is the single signal: it marks what is playing and the one primary
   action in view. Everything else is ink, hairline and a blue-black ground. */

/* ---------------------------------------------------------------- typefaces
   Both faces ship in web/assets/fonts and are embedded in the Go binary, so
   the app has no third-party dependency and installs/plays offline. Latin and
   Latin Extended only: the UI is Portuguese, and the wider unicode ranges are
   dead weight. */

@font-face {
  font-family: "Host Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/host-grotesk-latin.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: "Host Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./fonts/host-grotesk-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./fonts/jetbrains-mono-latin.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./fonts/jetbrains-mono-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- tokens */

:root {
  /* palette */
  --p-bg: #0a0d14;
  --p-surface: #131824;
  --p-ink: #e9edf3;
  --p-muted: #8891a1;
  --p-accent: #5ab9fc;
  --p-accent-ink: #0a0d14;

  /* grounds */
  --bg: var(--p-bg);
  --surface: var(--p-surface);
  --surface-2: #171d2b;
  --surface-3: #1c2332;
  --surface-4: #222a3b;
  --surface-5: #141a27;
  --surface2: var(--surface-2);

  /* ink */
  --text: var(--p-ink);
  --on-surface: var(--p-ink);
  --on-surface-sub: #a2abbb;
  --on-surface-faint: var(--p-muted);
  --subtext: var(--on-surface-sub);
  --muted: var(--p-muted);
  --faint: var(--p-muted);
  --ink: var(--p-ink);

  /* lines and washes */
  --line: rgba(233, 237, 243, 0.08);
  --line-strong: rgba(233, 237, 243, 0.16);
  --grid: rgba(233, 237, 243, 0.16);
  --outline: var(--line-strong);
  --border-soft: var(--line);
  --hover: rgba(233, 237, 243, 0.05);
  --wash: rgba(233, 237, 243, 0.05);
  --wash-strong: rgba(233, 237, 243, 0.09);
  --wash-soft: rgba(233, 237, 243, 0.035);
  --scrim: rgba(4, 6, 10, 0.66);
  --overlay-scrim: rgba(4, 6, 10, 0.78);
  --pwa-scrim: rgba(4, 6, 10, 0.72);
  --topbar-glass: rgba(10, 13, 20, 0.86);

  /* accent */
  --accent: var(--p-accent);
  --accent-hover: #79c9ff;
  --accent-fill: var(--p-accent);
  --accent-2: var(--p-accent);
  --accent-2-fill: var(--p-accent);
  --on-accent: var(--p-accent-ink);
  --accent-wash: rgba(90, 185, 252, 0.12);
  --accent-wash-soft: rgba(90, 185, 252, 0.07);
  --focus: var(--p-accent);

  /* status */
  --danger: #ff7b72;
  --warn: #f2c14e;
  --warn-wash: rgba(242, 193, 78, 0.14);
  --ok: #5fd3a1;

  /* type */
  --font-display: "Host Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: var(--font-display);
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-sans: var(--font-text);
  --display-weight: 500;
  --display-tracking: -0.035em;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --lh-ui: 1.5;
  --lh-title: 1.1;

  /* spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --space-1: var(--s-1);
  --space-2: var(--s-2);
  --space-3: var(--s-3);
  --space-4: var(--s-4);
  --space-5: var(--s-5);
  --space-6: var(--s-6);
  --space-7: var(--s-7);
  --space-8: var(--s-8);
  --space-page-bottom: 112px;

  /* radius, shadow, motion */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-btn: 8px;
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-pill: 999px;
  --radius-round: 50%;
  --shadow-1: 0 1px 2px rgba(4, 6, 10, 0.5);
  --shadow-2: 0 12px 28px rgba(4, 6, 10, 0.45);
  --shadow-3: 0 28px 70px rgba(4, 6, 10, 0.6);
  --dur-fast: 140ms;
  --dur: 180ms;
  --dur-slow: 240ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* controls */
  --btn-h: 44px;
  --sidebar-w: 268px;
  --player-h: 88px;
  --page-gutter: 32px;
  --container: 1440px;
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  margin: 0;
}

@supports (height: 100dvh) {
  html,
  body,
  #app {
    height: 100dvh;
  }
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-base) / var(--lh-ui) var(--font-text);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p,
figure,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: var(--lh-title);
  text-wrap: balance;
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

::selection {
  background: rgba(90, 185, 252, 0.28);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

@supports not selector(:focus-visible) {
  :focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(233, 237, 243, 0.14);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(233, 237, 243, 0.26);
  background-clip: content-box;
}

/* ---------------------------------------------------------------- layout */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.main-area {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(90, 185, 252, 0.07), transparent 60%),
    var(--bg);
}

.page {
  min-height: 100%;
  padding-bottom: var(--space-page-bottom);
}

.page-padding {
  padding: 40px var(--page-gutter) 0;
}

.page-title {
  margin: 0;
  font-size: clamp(32px, 2.6vw + 12px, 46px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.page-padding > .page-title + * {
  margin-top: var(--s-5);
}

.page-padding > .page-title:only-child {
  margin-bottom: 0;
}

.section {
  padding: 20px var(--page-gutter);
}

/* A section that follows the page heading sits tight under it; later sections
   keep the full vertical rhythm between blocks. */
.page-padding > .page-title + .section,
.page-padding + .section {
  padding-top: 8px;
}

/* Some routes wrap their sections in .page-padding, which already carries the
   gutter; the section must not add a second one. */
.page-padding .section,
.page-padding .card-wrap {
  padding-right: 0;
  padding-left: 0;
}

.section-title {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.detail-meta {
  font-size: var(--fs-sm);
  color: var(--muted);
}

@media (max-width: 767px) {
  :root {
    --page-gutter: 20px;
    --space-page-bottom: 172px;
  }

  .page-padding {
    padding-top: 24px;
  }

  .section {
    padding: 16px var(--page-gutter);
  }

  .section-title {
    font-size: 19px;
  }
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  flex-shrink: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.sidebar-brand svg {
  width: 22px;
  height: 22px;
  color: var(--bg);
  padding: 5px;
  box-sizing: content-box;
  border-radius: 9px;
  background: var(--accent);
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--muted);
}

.sidebar-close:hover {
  background: var(--wash);
  color: var(--ink);
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--wash-soft);
  color: var(--ink);
}

.nav-link.active {
  background: var(--surface-3);
  color: var(--ink);
}

.nav-link.active svg {
  color: var(--accent);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.sidebar-playlists-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 26px 24px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-playlists-label svg {
  width: 14px;
  height: 14px;
}

.sidebar-playlists {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 12px;
}

.playlist-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 34px;
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.playlist-link:hover {
  background: var(--wash-soft);
  color: var(--ink);
}

.playlist-link.active {
  color: var(--ink);
  background: var(--wash);
}

.playlists-empty {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: var(--r-sm);
  padding: 6px 8px;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.sidebar-user-handle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.sidebar-guest {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}

.sidebar-guest-actions {
  display: flex;
  gap: 8px;
}

.sidebar-guest-actions > button {
  flex: 1;
  min-height: 38px;
  padding: 6px 10px;
  font-size: var(--fs-xs);
}

/* ---------------------------------------------------------------- mobile chrome */

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: max(6px, env(safe-area-inset-top)) 14px 6px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-glass);
  backdrop-filter: blur(14px) saturate(120%);
}

.mobile-topbar > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.mobile-topbar .install-app-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.mobile-topbar > span svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.mobile-topbar .install-app-btn {
  margin-left: auto;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}

.mobile-overlay.open {
  display: block;
}

.mobile-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
}

.mobile-sidebar {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: min(86vw, 312px);
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.mobile-sidebar .sidebar-content {
  height: 100%;
}

/* The drawer gets its own close affordance; the desktop rail never shows it. */
.mobile-sidebar .sidebar-close {
  display: inline-flex;
}

.mobile-sidebar .sidebar-header {
  padding-top: max(24px, calc(env(safe-area-inset-top) + 16px));
}

.mobile-nav {
  display: none;
}

/* ---------------------------------------------------------------- buttons */

.btn-primary,
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  padding: 0 22px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-primary svg,
.btn-accent svg {
  width: 16px;
  height: 16px;
}

.btn-primary:hover,
.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 24px rgba(90, 185, 252, 0.22);
}

.btn-primary:active,
.btn-accent:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 0 20px;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-secondary svg {
  width: 16px;
  height: 16px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--wash);
  border-color: rgba(233, 237, 243, 0.28);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(1px);
}

.icon-btn,
.btn-icon-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.icon-btn svg,
.btn-icon-lg svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover,
.btn-icon-lg:hover {
  background: var(--wash);
  color: var(--ink);
}

.icon-btn:active,
.btn-icon-lg:active {
  transform: scale(0.94);
}

.icon-btn.liked,
.icon-btn[aria-pressed="true"] {
  color: var(--accent);
}

.btn-icon-lg {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
}

.install-app-btn,
.mobile-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.install-app-btn:hover,
.mobile-login-btn:hover {
  background: var(--accent-wash);
  border-color: rgba(90, 185, 252, 0.5);
  color: var(--accent);
}

.mobile-login-btn {
  margin-left: auto;
}

.topbar-menu {
  display: none;
}

/* ---------------------------------------------------------------- cards */

.card-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233, 237, 243, 0.14) transparent;
}

.card-row::-webkit-scrollbar {
  height: 6px;
}

.card-row::-webkit-scrollbar-thumb {
  border: 0;
  border-radius: 999px;
  background: rgba(233, 237, 243, 0.14);
}

.card-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
  padding: 2px var(--page-gutter) 8px;
}

.card-wrap > .empty-state,
.card-wrap > .guest-auth-cta {
  grid-column: 1 / -1;
}

.card {
  width: 176px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  padding: 10px;
  background: transparent;
  text-align: left;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card-wrap > .card {
  width: auto;
}

.card:hover,
.card:focus-visible {
  background: var(--surface-2);
}

.card:hover .card-image {
  transform: scale(1.03);
}

.card-image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.card-image-wrap.square {
  aspect-ratio: 1 / 1;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}

.card-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 20px rgba(4, 6, 10, 0.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.card-play svg {
  width: 16px;
  height: 16px;
}

.card:hover .card-play,
.card:focus-within .card-play {
  opacity: 1;
  transform: none;
}

.card-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.card-title {
  margin: 12px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 3px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 36px 24px;
  margin: 8px 0;
  text-align: center;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state p:first-child {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--ink);
}

.empty-state p:last-child {
  margin-top: 4px;
  font-size: var(--fs-sm);
}

.guest-auth-cta {
  max-width: 520px;
  margin: 24px auto;
  padding: 32px 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.guest-auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex-shrink: 0;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tab-btn:hover:not(.active) {
  background: var(--surface-3);
  color: var(--ink);
}

.tab-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

/* ---------------------------------------------------------------- track rows */

.track-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px;
}

.track-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  transition: background var(--dur) var(--ease);
}

.track-row:hover,
.track-row:focus-within {
  background: var(--wash);
}

.track-row.playing {
  background: var(--accent-wash-soft);
}

.track-number {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.track-play-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--ink);
}

.track-play-btn svg {
  width: 13px;
  height: 13px;
}

.track-row:hover .track-num-text {
  display: none;
}

.track-row:hover .track-play-btn {
  display: inline-flex;
}

.track-row.playing .track-title {
  color: var(--accent);
}

.track-row.playing .track-num-text {
  display: none;
}

.track-row.playing .track-number::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
}

.track-row.playing:hover .track-number::before {
  display: none;
}

.track-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.track-art {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
}

.track-info {
  min-width: 0;
}

.track-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.track-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.track-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.track-like,
.track-add,
.track-mobile-add,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.track-like svg,
.track-add svg,
.track-mobile-add svg,
.download-button svg {
  width: 15px;
  height: 15px;
}

.track-like:hover,
.track-add:hover,
.track-mobile-add:hover,
.download-button:hover {
  background: var(--wash-strong);
  color: var(--ink);
}

.track-like {
  opacity: 0;
}

.track-row:hover .track-like,
.track-row:focus-within .track-like,
.track-like.liked {
  opacity: 1;
}

.track-like.liked {
  color: var(--accent);
}

.download-button:disabled {
  opacity: 0.4;
}

.track-duration {
  width: 42px;
  margin-left: 6px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.track-mobile-add {
  display: none;
}

.track-more {
  display: contents;
}

.track-more-toggle,
.track-action-label,
.track-more-menu {
  display: none;
}

@media (min-width: 640px) {
  .track-row {
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    padding: 6px 12px;
  }
}

.playlist-track-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.playlist-track-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.remove-track-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 999px;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.remove-track-btn:hover {
  background: var(--wash-strong);
  color: var(--danger);
}

.playlist-track-row:hover .remove-track-btn,
.playlist-track-row:focus-within .remove-track-btn {
  opacity: 1;
}

.queue-track-wrap {
  position: relative;
  padding-left: 10px;
}

.queue-current-marker {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
}

.download-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border-bottom: 1px solid var(--line);
}

.download-history-row:last-child {
  border-bottom: 0;
}

.download-history-row > div {
  min-width: 0;
}

/* ---------------------------------------------------------------- detail headers */

.detail-header {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 48px var(--page-gutter) 32px;
  overflow: hidden;
}

.detail-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 320px;
  background: radial-gradient(90% 100% at 18% 0%, rgba(90, 185, 252, 0.12), transparent 70%);
  pointer-events: none;
}

.detail-header > * {
  position: relative;
}

.detail-header.horizontal {
  flex-direction: row;
  align-items: flex-end;
  gap: 28px;
  flex-wrap: wrap;
}

.detail-art {
  width: 208px;
  height: 208px;
  flex-shrink: 0;
  border-radius: var(--r-lg);
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: var(--shadow-3);
}

.detail-art-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 208px;
  height: 208px;
  flex-shrink: 0;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line);
  font-size: 64px;
  color: var(--accent);
  box-shadow: var(--shadow-3);
}

.detail-info {
  min-width: 0;
  text-align: left;
}

/* Only the side-by-side header lets the text column flex; stacked, the info
   block sizes to its content instead of taking a 320px flex basis in height. */
.detail-header.horizontal .detail-info {
  flex: 1 1 320px;
}

.detail-type {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-title {
  margin-top: 10px;
  font-size: clamp(34px, 4vw + 8px, 60px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  word-break: break-word;
}

.detail-meta {
  margin-top: 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.album-artist-link {
  display: inline-block;
  margin-top: 12px;
  font-size: var(--fs-sm);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(90, 185, 252, 0.4);
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur) var(--ease);
}

.album-artist-link:hover {
  text-decoration-color: currentColor;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 22px;
}

.artist-detail-header .detail-info {
  text-align: left;
}

.artist-detail-header .detail-actions {
  justify-content: flex-start;
}

.album-save {
  gap: 8px;
}

.album-save.liked {
  border-color: rgba(90, 185, 252, 0.4);
  color: var(--accent);
}

.detail-content {
  padding: 0 var(--page-gutter);
}

.detail-content > .section-title {
  margin: 8px 0 14px;
  font-size: 20px;
}

.detail-content > .section-title:not(:first-child) {
  margin-top: 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 8px;
  min-height: 40px;
  font-size: var(--fs-sm);
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}

.back-link svg {
  width: 15px;
  height: 15px;
}

.back-link:hover {
  color: var(--ink);
}

@media (min-width: 640px) {
  /* A collection page (Curtidas) has no artist line, so on a wide screen its
     artwork sits beside the title like every other detail header. */
  .detail-header:not(.horizontal) {
    flex-direction: row;
    align-items: flex-end;
    gap: 28px;
  }

  .detail-header:not(.horizontal) .detail-art,
  .detail-header:not(.horizontal) .detail-art-icon {
    width: 168px;
    height: 168px;
  }
}

@media (max-width: 639px) {
  .detail-header {
    padding: 24px var(--page-gutter) 20px;
  }

  .detail-header.horizontal {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .detail-art,
  .detail-art-icon {
    width: 100%;
    max-width: 200px;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: var(--r-md);
  }

  .detail-info,
  .detail-header.horizontal .detail-info,
  .artist-detail-header .detail-info {
    flex: none;
    text-align: left;
  }

  .detail-actions,
  .artist-detail-header .detail-actions {
    justify-content: flex-start;
  }

  .detail-title {
    font-size: clamp(26px, 8vw, 34px);
  }
}

/* ---------------------------------------------------------------- search */

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.search-input-wrap {
  position: relative;
  flex: 1 1 300px;
  max-width: 560px;
}

.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 12px 16px 12px 44px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:hover {
  border-color: rgba(233, 237, 243, 0.24);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-icon svg {
  width: 17px;
  height: 17px;
}

/* The resting search page: a short prompt instead of an empty canvas. */
.search-hint {
  padding: 28px 0 8px;
}

.search-hint-title {
  font-size: var(--fs-lg);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.search-hint-text {
  margin-top: 8px;
  max-width: 46ch;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--muted);
}

.search-type-select {
  min-height: 48px;
  min-width: 148px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 0 38px 0 16px;
  background-color: var(--surface);
  color: var(--ink);
  font-size: var(--fs-md);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238891a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color var(--dur) var(--ease);
}

.search-type-select:focus {
  border-color: var(--accent);
  outline: none;
}

@media (max-width: 767px) {
  .search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-input-wrap {
    flex: none;
    max-width: none;
  }

  .search-type-select {
    width: 100%;
  }
}

/* ---------------------------------------------------------------- forms */

.form-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 11px 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.form-input::placeholder {
  color: var(--muted);
}

.form-input:hover {
  border-color: rgba(233, 237, 243, 0.24);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

textarea.form-input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238891a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select {
  color-scheme: dark;
  accent-color: var(--accent);
}

select option,
select optgroup {
  background: var(--surface-3);
  color: var(--ink);
}

.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(255, 123, 114, 0.18);
}

.login-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  line-height: 1.45;
}

.login-error:not(:empty) {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 123, 114, 0.1);
}

/* ---------------------------------------------------------------- login */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(70% 55% at 50% -8%, rgba(90, 185, 252, 0.16), transparent 66%),
    var(--bg);
}

.login-box {
  width: 100%;
  max-width: 420px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
  text-align: center;
}

.login-brand > svg {
  width: 30px;
  height: 30px;
  padding: 14px;
  box-sizing: content-box;
  border-radius: 20px;
  background: var(--accent);
  color: var(--bg);
}

.login-brand h1 {
  font-size: clamp(28px, 3vw + 12px, 38px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.login-brand p {
  max-width: 34ch;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transition: border-color var(--dur) var(--ease);
}

.login-form:focus-within {
  border-color: rgba(90, 185, 252, 0.4);
}

.phone-input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.phone-dial-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 62px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.phone-input-field {
  flex: 1;
  min-width: 0;
}

.phone-mask-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.4;
}

.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h);
  margin-top: 4px;
  border-radius: var(--r-btn);
  padding: 0 22px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.login-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 8px 26px rgba(90, 185, 252, 0.24);
}

.login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-mode-link,
.login-guest-link {
  align-self: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.login-mode-link {
  text-decoration: underline;
  text-decoration-color: rgba(233, 237, 243, 0.2);
  text-underline-offset: 4px;
}

.login-mode-link:hover,
.login-guest-link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.login-guest-link {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
}

.login-guest-link:hover {
  border-color: rgba(233, 237, 243, 0.3);
  background: var(--wash);
}

.login-admin-link {
  display: block;
  width: fit-content;
  margin: 20px auto 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  text-align: center;
  transition: color var(--dur) var(--ease);
}

.login-admin-link:hover {
  color: var(--accent);
}

.admin-login-box {
  max-width: 400px;
}

.admin-login-form {
  gap: 10px;
}

.admin-login-back {
  margin-top: 22px;
}

.country-selector-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.country-selector-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-3);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.country-selector-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.country-selector-name {
  font-size: var(--fs-md);
  font-weight: 600;
}

.country-selector-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.login-toggle {
  display: flex;
  gap: 4px;
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-3);
}

.login-toggle-btn {
  flex: 1;
  min-height: 36px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.login-toggle-btn.active {
  background: var(--accent);
  color: var(--on-accent);
}

.login-toggle-btn:hover:not(.active) {
  color: var(--ink);
}

@media (max-width: 480px) {
  .login-form {
    padding: 20px 18px;
    border-radius: var(--r-md);
  }
}

/* ---------------------------------------------------------------- player */

.bottom-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  height: var(--player-h);
  border-top: 1px solid var(--line);
  padding: 0 20px;
  background: var(--bg);
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.now-playing-open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-radius: var(--r-sm);
  padding: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.now-playing-open:hover {
  background: var(--wash);
}

.now-playing-art {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: var(--shadow-1);
}

.now-playing-info {
  min-width: 0;
}

.now-playing-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.now-playing-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  font-size: var(--fs-xs);
  color: var(--muted);
  cursor: pointer;
}

.now-playing-artist:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--muted);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.player-btn svg {
  width: 17px;
  height: 17px;
}

.player-btn:hover {
  color: var(--ink);
  background: var(--wash);
}

.player-btn:active {
  transform: scale(0.93);
}

.player-btn.active {
  color: var(--accent);
}

.player-btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.player-btn-main svg {
  width: 18px;
  height: 18px;
}

.player-btn-main:hover {
  background: var(--accent-hover);
  transform: scale(1.045);
}

.player-btn-main:active {
  transform: scale(0.96);
}

.player-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.progress-time {
  width: 38px;
  text-align: right;
}

.progress-time:last-child {
  text-align: left;
}

.progress-track {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  height: 18px;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.progress-track::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 3px;
  border-radius: 999px;
  background: rgba(233, 237, 243, 0.18);
  transform: translateY(-50%);
  transition: background var(--dur) var(--ease);
}

.progress-track:hover::before {
  background: rgba(233, 237, 243, 0.28);
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 1;
  height: 3px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateY(-50%);
  pointer-events: none;
  transition: height var(--dur) var(--ease), background var(--dur) var(--ease);
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.progress-track:hover .progress-fill,
.progress-track.dragging .progress-fill {
  height: 4px;
  background: var(--accent);
}

.progress-track:hover .progress-fill::after,
.progress-track.dragging .progress-fill::after {
  opacity: 1;
  background: var(--accent);
}

.player-volume {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.vol-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.vol-icon svg {
  width: 16px;
  height: 16px;
}

.volume-slider {
  width: 96px;
  accent-color: var(--ink);
}

.player-notice {
  position: fixed;
  z-index: 9000;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 104px);
  /* Same anchoring trap as .app-toast: a fixed box at left:50% shrink-to-fits
     into the right half only, so text wraps far too early. */
  width: max-content;
  max-width: min(92vw, 460px);
  transform: translateX(-50%);
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-4);
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: center;
  box-shadow: var(--shadow-2);
}

/* ---------------------------------------------------------------- fullscreen player */

.fullscreen-player {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(90, 185, 252, 0.14), transparent 62%),
    var(--bg);
}

.fullscreen-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fullscreen-top .icon-btn {
  width: 44px;
  height: 44px;
}

/* Keep the download button on the same optical row as the queue button: same
   44px square target and vertically centred inside the actions group. */
.fullscreen-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fullscreen-top .download-button {
  width: 44px;
  height: 44px;
}

.fullscreen-top .download-button svg {
  width: 18px;
  height: 18px;
}

.fullscreen-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 32px);
  min-height: 0;
  padding: 12px 0 8px;
}

.fullscreen-art {
  width: min(72vw, 384px, 42vh);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: var(--shadow-3);
}

.fullscreen-track-info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 420px);
}

.fullscreen-track-info > div {
  min-width: 0;
}

.fullscreen-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(22px, 2.4vw + 10px, 28px);
  letter-spacing: -0.03em;
}

.fullscreen-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  font-size: var(--fs-md);
  color: var(--muted);
  cursor: pointer;
}

.fullscreen-artist:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fullscreen-transport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(100%, 420px);
}

/* Only the playback controls sit here, so the main button is dead centre. */
.fullscreen-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 18px);
  width: 100%;
}

.fullscreen-buttons .player-btn {
  width: 44px;
  height: 44px;
}

/* Shuffle and repeat: the queue-shape toggles, one quiet centred row below
   the transport. Muted until active, so they never read as playback keys. */
.fullscreen-extras {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.fullscreen-extras .player-btn {
  width: 40px;
  height: 40px;
}

.fullscreen-extras .player-btn svg {
  width: 16px;
  height: 16px;
}

.fullscreen-btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.fullscreen-btn-main svg {
  width: 22px;
  height: 22px;
}

.fullscreen-btn-main:hover {
  background: var(--accent-hover);
  transform: scale(1.03);
}

.fullscreen-btn-main:active {
  transform: scale(0.96);
}

.fullscreen-btn-main.is-playing {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 1px rgba(90, 185, 252, 0.35), 0 0 32px rgba(90, 185, 252, 0.28);
}

.fullscreen-player .fullscreen-content > .player-progress {
  display: grid;
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) minmax(38px, auto);
  align-items: center;
  column-gap: 12px;
  width: min(100%, 420px);
  max-width: 420px;
}

.fullscreen-player .progress-time {
  width: auto;
  min-width: 38px;
  font-size: 11px;
  color: var(--muted);
}

.fullscreen-player .progress-time:first-child {
  text-align: left;
}

.fullscreen-player .progress-time:last-child {
  text-align: right;
}

.fullscreen-player .progress-track {
  height: 44px;
}

.fullscreen-player .progress-track::before {
  height: 4px;
}

.fullscreen-player .progress-fill {
  height: 4px;
}

.fullscreen-player .progress-fill::after {
  width: 12px;
  height: 12px;
  opacity: 1;
}

@media (max-width: 767px) {
  .fullscreen-player {
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .fullscreen-content {
    gap: clamp(14px, 2.6vh, 22px);
  }

  .fullscreen-art {
    width: min(82vw, 340px, 40vh);
    border-radius: var(--r-md);
  }
}

@media (max-width: 767px) and (max-height: 650px) and (orientation: portrait) {
  .fullscreen-art {
    width: min(64vw, 280px, 30vh);
  }

  .fullscreen-content {
    gap: 10px;
  }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .fullscreen-content {
    display: grid;
    grid-template-columns: min(36vh, 210px) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 8px 22px;
  }

  .fullscreen-art {
    grid-column: 1;
    grid-row: 1 / 4;
    width: min(36vh, 210px);
    align-self: center;
  }

  .fullscreen-track-info {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
  }

  .fullscreen-content > .player-progress {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .fullscreen-transport {
    grid-column: 2;
    grid-row: 3;
    width: 100%;
  }
}

/* ---------------------------------------------------------------- settings */

.settings-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px var(--page-gutter) 0;
}

.settings-page > .page-title {
  margin-bottom: 26px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px;
  background: var(--surface);
}

.settings-card h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.settings-text {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.55;
}

.settings-text strong {
  color: var(--ink);
  font-weight: 500;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.settings-playlists {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
  transition: background var(--dur) var(--ease);
}

.settings-playlist-item svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.settings-playlist-item:hover {
  background: var(--wash);
}

.settings-dl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--fs-sm);
}

.settings-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.settings-dl > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-dt {
  color: var(--muted);
}

.settings-dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 767px) {
  .settings-page {
    padding: 24px var(--page-gutter) 0;
  }

  .settings-card {
    padding: 18px;
  }
}

/* ---------------------------------------------------------------- admin */

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.admin-section > h2,
.admin-section > h3,
.admin-section > p,
.admin-section > form > h2,
.admin-section > form > p {
  margin: 0;
}

.admin-section h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.admin-section > form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.admin-section .form-input {
  width: 100%;
}

.admin-section > button,
.admin-section > form > button {
  align-self: flex-start;
}

.admin-section [role="status"]:empty {
  display: none;
}

.admin-section .settings-card:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* A bare documentation link inside a section is real body text, so it reads
   as a link rather than inheriting the surrounding ink. */
.admin-section > a {
  align-self: flex-start;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(90, 185, 252, 0.45);
  text-underline-offset: 3px;
}

.admin-section > a:hover {
  color: var(--accent-hover);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.admin-toolbar > select,
.admin-toolbar .form-input,
.admin-toolbar .search-input {
  width: auto;
  flex: 0 0 auto;
}

.admin-toolbar > button {
  flex: 0 0 auto;
}

.admin-country-filter {
  flex: 0 0 auto;
  min-width: 168px;
}

.admin-section > .admin-country-filter {
  display: block;
  width: auto;
  margin: 0;
}

.admin-song-selection,
.admin-pagination {
  flex-wrap: wrap;
  align-items: center;
}

.admin-song-selection label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.admin-song-status {
  overflow-wrap: anywhere;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.admin-danger {
  color: var(--danger);
}

.admin-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.admin-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.admin-row-main {
  flex: 1;
  min-width: 0;
}

.admin-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.admin-row-sub {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-row-actions > button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.admin-row-actions > button:hover {
  background: var(--wash);
  border-color: rgba(233, 237, 243, 0.26);
}

/* Row actions rendered as .icon-btn keep a square target instead of stretching
   the text-button padding around a single glyph. */
.admin-row-actions > .icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  font-size: 14px;
}

.admin-row-actions .admin-danger {
  border-color: rgba(255, 123, 114, 0.32);
  color: var(--danger);
}

.admin-row-actions .admin-danger:hover {
  background: rgba(255, 123, 114, 0.1);
  border-color: rgba(255, 123, 114, 0.5);
}

.admin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chip {
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--accent-wash);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge {
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--warn-wash);
  color: var(--warn);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-phone-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-song-selection,
.admin-pagination {
  gap: 10px;
}

.admin-section textarea.form-input {
  min-height: 110px;
}

.country-assignment-control,
.country-assignment-list {
  display: grid;
  gap: 8px;
}

.country-assignment-list {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-top: 4px;
}

.country-assignment-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.country-assignment-option input {
  accent-color: var(--accent);
}

@media (max-width: 560px) {
  .admin-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* Only labelled actions stretch. Icon-only row actions stay square and sit
     against the trailing edge instead of becoming two empty wide boxes. */
  .admin-row-actions > button:not(.icon-btn) {
    flex: 1 1 120px;
    min-height: 40px;
  }

  .admin-row-actions > .icon-btn {
    flex: 0 0 auto;
  }

  .admin-row-actions:has(> .icon-btn) {
    justify-content: flex-end;
  }

  .admin-section > button,
  .admin-section > form > button {
    align-self: stretch;
  }
}

/* ---------------------------------------------------------------- upload / admin modals */

.modal-upload {
  max-width: 500px;
}

.upload-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upload-file-input {
  display: none;
}

.upload-dropzone,
.upload-photo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 18px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.upload-dropzone {
  min-height: 120px;
}

.upload-photo-drop {
  flex-direction: row;
  justify-content: flex-start;
  min-height: 56px;
  padding: 12px 16px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.upload-dropzone:hover,
.upload-photo-drop:hover,
.upload-dropzone.drag {
  border-color: rgba(90, 185, 252, 0.55);
  background: var(--accent-wash-soft);
}

.upload-dropzone.error {
  border-color: var(--danger);
}

/* A chosen file turns the dashed drop area into a confirmed, solid state. */
.upload-dropzone.has-file {
  border-style: solid;
  border-color: rgba(90, 185, 252, 0.45);
  background: var(--accent-wash-soft);
}

.upload-dropzone.has-file .upload-dropzone-icon {
  opacity: 0.65;
}

.upload-dropzone-icon {
  font-size: 26px;
  color: var(--accent);
}

.upload-dropzone-title {
  margin-top: 2px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink);
}

.upload-dropzone-hint,
.upload-info {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.45;
}

.upload-progress {
  margin-top: 10px;
}

.upload-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width var(--dur-slow) var(--ease);
}

.upload-progress-text {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.upload-fails {
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.upload-fail {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--danger);
  overflow-wrap: anywhere;
}

.upload-fail strong {
  color: var(--ink);
}

@media (max-width: 480px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay-scrim);
  backdrop-filter: blur(3px);
}

.modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  max-height: 84vh;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 22px;
  background: var(--surface-5);
  box-shadow: var(--shadow-3);
  animation: modal-in var(--dur) var(--ease);
}

.modal-wide {
  max-width: 640px;
}

.modal h3 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.modal-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.modal-empty {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: var(--r-sm);
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
  transition: background var(--dur) var(--ease);
}

.modal-item:hover {
  background: var(--surface-3);
}

.modal-item.new {
  color: var(--accent);
  font-weight: 500;
}

.modal-item svg,
.admin-row-actions svg,
.app-toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* app.js renders its "Cancelar" as a standalone .modal-close, so it reads as a
   quiet full-width text action rather than a square icon target. */
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  margin-top: 2px;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--muted);
  font-size: var(--fs-sm);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.modal-close:hover {
  background: var(--wash);
  color: var(--ink);
}

/* An icon-only close keeps its square shape. */
.modal-close:has(svg) {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
}

.modal-close svg {
  width: 17px;
  height: 17px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.modal-section-label {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-scroll {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 767px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  .modal {
    max-height: calc(100dvh - env(safe-area-inset-top) - 16px);
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
    border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-sm);
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions > button {
    width: 100%;
    min-height: 48px;
  }
}

/* ---------------------------------------------------------------- status */

.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.loading-screen svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.app-toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  /* Clear the desktop player bar; the phone chrome overrides this with the
     floating mini player + tab bar height further down. */
  bottom: calc(var(--player-h) + 18px + env(safe-area-inset-bottom));
  /* A fixed box anchored at left:50% shrink-to-fits into the right half of the
     viewport, so a longer message wraps at half the screen. max-content lets
     the single line exist and max-width clamps it on narrow screens. */
  width: max-content;
  max-width: min(90vw, 420px);
  transform: translate(-50%, 10px);
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-4);
  color: var(--ink);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.app-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------- PWA install */

.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--pwa-scrim);
  backdrop-filter: blur(4px);
}

.pwa-card {
  width: min(100%, 420px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 36px 26px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.pwa-card h1 {
  font-size: clamp(24px, 5vw, 30px);
  letter-spacing: -0.035em;
}

.promo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: var(--accent);
  background: var(--accent-wash);
}

.promo-icon svg {
  width: 26px;
  height: 26px;
}

.promo-eyebrow {
  margin: 22px 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.promo-description {
  margin: 12px auto 24px;
  max-width: 32ch;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.55;
}

.pwa-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 12px 20px;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  white-space: normal;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.pwa-btn:hover {
  background: var(--wash);
}

.pwa-btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.pwa-btn.primary:hover {
  background: var(--accent-hover);
}

.pwa-btn:disabled {
  opacity: 0.8;
  cursor: wait;
}

/* ---------------------------------------------------------------- ads */

.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #04060a;
  color: #fff;
  text-align: center;
}

.ad-overlay p {
  margin: 0;
}

.ad-overlay [hidden] {
  display: none !important;
}

.ad-media {
  position: absolute;
  inset: calc(env(safe-area-inset-top) + 56px) 12px calc(env(safe-area-inset-bottom) + 88px);
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-media img,
.ad-media video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ad-media video {
  transform: translateZ(0);
}

.ad-audio-label {
  max-width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-md);
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 18px;
  font-weight: 500;
}

.ad-overlay [role="status"] {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top) + 16px);
  right: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(4, 6, 10, 0.62);
  font-family: var(--font-mono);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

.ad-overlay > .btn-primary {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  min-width: 180px;
  min-height: 48px;
  transform: translate(-50%, -50%);
}

.ad-destination {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  left: 16px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.ad-destination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(220px, 100%);
  min-height: 48px;
  border-radius: 999px;
  padding: 10px 24px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(4, 6, 10, 0.5);
  pointer-events: auto;
}

.ad-destination a:focus-visible,
.ad-overlay > .btn-primary:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ad-skip {
  position: absolute;
  z-index: 3;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 16px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 16px;
  background: rgba(4, 6, 10, 0.62);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.ad-skip:hover {
  background: rgba(255, 255, 255, 0.16);
}

.ad-skip:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ad-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.ad-gate > [role="status"] {
  position: static;
  top: auto;
  right: auto;
  /* A brief gate: a slow pulse says "working", not "stuck". */
  animation: ad-gate-pulse 1.6s ease-in-out infinite;
}

@keyframes ad-gate-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* ---------------------------------------------------------------- notifications inbox */

.notification-inbox-wrap {
  display: flex;
  flex: none;
}

.notification-bell {
  width: 40px;
  height: 40px;
}

.notification-inbox {
  position: fixed;
  z-index: 60;
  top: calc(64px + env(safe-area-inset-top));
  right: 12px;
  width: min(400px, calc(100vw - 24px));
  max-height: min(70vh, 600px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
}

.notification-inbox[hidden] {
  display: none;
}

.notification-inbox-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notification-inbox-heading h2 {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.notification-inbox-item {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.notification-inbox-item strong {
  font-size: var(--fs-md);
  font-weight: 500;
}

.notification-inbox-item p {
  margin: 6px 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.5;
}

.notification-inbox-item time {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.notification-inbox-item a {
  display: inline-block;
  padding: 10px 0 4px;
  font-size: var(--fs-sm);
  color: var(--accent);
}

/* ---------------------------------------------------------------- mobile */

/* The mobile chrome applies to narrow screens and to a phone held sideways,
   where the viewport is wide but the pointer is still a finger. */
@media (max-width: 767px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html,
  body {
    overscroll-behavior-y: contain;
  }

  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
  }

  .topbar-menu {
    display: inline-flex;
  }

  .mobile-nav {
    display: flex;
    flex-shrink: 0;
    justify-content: space-around;
    gap: 2px;
    min-height: 58px;
    padding: 4px 6px max(4px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg);
  }

  .mobile-nav-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
  }

  .mobile-nav-item svg {
    width: 21px;
    height: 21px;
  }

  .mobile-nav-item.active {
    color: var(--accent);
  }

  /* The mini player is a floating card above the tab bar. */
  .bottom-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "track actions"
      "progress progress";
    align-items: center;
    gap: 0 8px;
    height: auto;
    margin: 6px 10px 0;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 8px 10px 0;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(4, 6, 10, 0.45);
  }

  .now-playing {
    grid-area: track;
    min-width: 0;
  }

  .now-playing-open {
    gap: 10px;
    padding: 0;
  }

  .now-playing-art {
    width: 44px;
    height: 44px;
  }

  .now-playing-title {
    font-size: var(--fs-sm);
  }

  /* Secondary actions live in the expanded player on a phone. */
  .now-playing > .icon-btn,
  .now-playing > .download-button {
    display: none;
  }

  .player-volume {
    display: none;
  }

  .player-controls {
    display: contents;
  }

  .player-buttons {
    grid-area: actions;
    justify-content: flex-end;
    gap: 0;
  }

  .player-buttons > .player-btn:not(.player-btn-main):not(:nth-last-child(2)) {
    display: none;
  }

  .player-buttons > .player-btn:nth-last-child(2),
  .player-btn-main {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .player-progress {
    grid-area: progress;
    max-width: none;
    gap: 0;
  }

  .bottom-bar .progress-time {
    display: none;
  }

  .bottom-bar .progress-track {
    height: 18px;
  }

  .bottom-bar .progress-fill,
  .bottom-bar .progress-track:hover .progress-fill {
    height: 3px;
    background: var(--accent);
  }

  .bottom-bar .progress-fill::after {
    width: 8px;
    height: 8px;
    background: var(--accent);
    opacity: 1;
  }

  /* Rows: big tap targets, the play button replaces the number. */
  .track-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 64px;
    padding: 6px 4px;
  }

  .track-number {
    width: 44px;
    min-height: 44px;
  }

  .track-row .track-num-text {
    display: none;
  }

  .track-play-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
  }

  .track-play-btn svg {
    width: 15px;
    height: 15px;
  }

  .track-art {
    width: 44px;
    height: 44px;
  }

  .track-like {
    opacity: 1;
    width: 40px;
    height: 40px;
  }

  .track-actions {
    gap: 0;
  }

  .track-actions .track-like {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .track-mobile-add {
    display: none;
  }

  .track-duration {
    display: none;
  }

  /* Secondary row actions collapse into a menu. */
  .track-more {
    position: relative;
    display: block;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }

  /* The button's label is its text node, so the glyph replaces it visually
     while the accessible name stays "Mais opções para <faixa>". */
  .track-more-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0;
  }

  .track-more-toggle::before {
    content: "⋮";
    font-size: 19px;
    line-height: 1;
    letter-spacing: 0;
  }

  .track-more.open .track-more-toggle,
  .track-more-toggle:focus-visible {
    background: var(--wash-strong);
    color: var(--ink);
  }

  .track-more-menu {
    position: absolute;
    z-index: 80;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 2px;
    width: min(82vw, 280px);
    max-height: min(60dvh, 420px);
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 6px;
    background: var(--surface-4);
    box-shadow: var(--shadow-3);
  }

  .track-more.open .track-more-menu {
    display: flex;
  }

  .track-more-option {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    border-radius: var(--r-sm);
    padding: 8px 12px;
    color: var(--ink);
    text-align: left;
  }

  .track-more-option:hover,
  .track-more-option:focus-visible {
    background: var(--wash-strong);
  }

  .track-action-label {
    display: inline;
    font-size: var(--fs-sm);
  }

  .card-wrap {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
  }

  .card {
    width: 152px;
    padding: 8px;
  }

  .card-title {
    margin-top: 10px;
    font-size: var(--fs-sm);
  }

  .app-toast {
    bottom: calc(168px + env(safe-area-inset-bottom));
  }

  .admin-toolbar > * {
    flex: 1 1 140px;
  }
}

@media (max-width: 400px) {
  .track-row,
  .album-track-list .track-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  /* A playlist row nests the track grid inside a flex wrapper, so the hidden
     number column has to leave the grid too or the title lands in its place. */
  .playlist-track-row .track-number {
    display: none;
  }

  .playlist-track-row .track-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* A landscape phone: the mini player flattens into one row and the tab bar
   keeps its full complement of controls, because there is width for them. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
  }

  .mobile-nav {
    display: flex;
    min-height: 46px;
  }

  .mobile-nav-item {
    min-height: 40px;
  }

  .bottom-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    height: auto;
    padding: 6px 12px;
  }

  .now-playing {
    flex: 0 1 220px;
    min-width: 0;
  }

  .now-playing > .icon-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
  }

  .player-controls {
    display: flex;
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .player-buttons {
    flex-shrink: 0;
    justify-content: flex-start;
    gap: 2px;
  }

  .player-buttons > .player-btn:not(.player-btn-main):not(:nth-last-child(2)) {
    display: inline-flex;
  }

  .player-buttons > .player-btn {
    width: 32px;
    height: 32px;
  }

  .player-btn-main {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .player-progress {
    flex: 1;
    max-width: none;
  }

  .page {
    padding-bottom: 24px;
  }
}

/* ---------------------------------------------------------------- album / liked sections */

.liked-section-title,
.album-tracks-title {
  margin: 24px 0 14px;
  font-size: 20px;
}

.liked-section-title:first-child,
.album-tracks-title:first-child {
  margin-top: 4px;
}

.album-detail-content {
  padding-bottom: 8px;
}

.album-detail-header .detail-art {
  border-radius: var(--r-md);
}

/* ---------------------------------------------------------------- admin tabs */

.admin-notifications,
.admin-ads,
.admin-api-keys {
  gap: 18px;
}

.admin-notifications > .settings-card,
.admin-ads > .settings-card,
.admin-api-keys > .settings-card {
  border-radius: var(--r-md);
}

.admin-login-screen .login-brand > svg {
  background: var(--surface-3);
  color: var(--accent);
}

/* ---------------------------------------------------------------- row actions */

.track-share,
.track-queue {
  display: inline-flex;
}

.notification-inbox-list {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

