/* =========================================================
   SITE LAYOUT
   ---------------------------------------------------------
   Structure only. Every color comes from a theme sheet in
   assets/styles/themes/, linked right after this one as
   <link id="themeLink">. site.js picks the theme by date
   (Retro Electric normally, a holiday theme in season).

   Keep literal colors out of this file: a hex or rgb()
   written here can't be changed by a theme, so it would
   show up in every one of them. Neutral black shadows and
   overlays are the exception.

   THEMES: each theme defines these on :root
     color-scheme          light or dark, for native controls
     --color-bg-start / --color-bg-end    page background gradient
     --color-surface-deep                 dark end of section panels
     --color-raised / --color-raised-deep modal and card panels
     --color-input-bg / --color-button-bg / --color-optgroup-bg
     --color-table-start / --color-table-end
     --color-th-start / --color-th-end / --color-th-hover
     --color-row-alt                      radio list alternate row
     --color-text / --color-text-muted
     --color-accent        primary (links, headings, active)
     --color-accent-hover  secondary (hover, now playing)
     --color-on-accent     text drawn on an accent fill
     --color-error
     --rgb-primary / --rgb-secondary      "r, g, b" for glows
     --rgb-tint            "r, g, b" tint of raised panels
     --rgb-text-muted / --rgb-bg-start / --rgb-bg-end

   Theme motion plays by default. Wrap any theme CSS
   animation in @media (prefers-reduced-motion:
   no-preference), the same rule site.js applies to the
   canvas effects in effects.js.
   ========================================================= */

:root {
  --fs: 1rem;
  --fs-sm: 0.75rem;
  --fs-md: 1.15rem;
  --fs-lg: 1.4rem;
  --fs-xl: 2rem;
  --fs-nav: 1rem;
  --fs-logo: 2.5rem;

  --radius: 8px;
  --radius-lg: 16px;
  --transition: 0.3s ease-in-out;

  /* Video frames and letterboxing stay black in every theme. */
  --color-black: #000;

  /* Built from the theme's palette (see the THEMES note above). A theme may
     redefine any of these too; its sheet loads after this one, so it wins. */
  --color-border: rgba(var(--rgb-primary), 0.45);
  --color-border-secondary: rgba(var(--rgb-secondary), 0.35);

  --grad-main: linear-gradient(135deg, var(--color-bg-start), var(--color-bg-end));
  --grad-surface: linear-gradient(135deg, rgba(var(--rgb-primary), 0.13), var(--color-surface-deep));
  --grad-raised: linear-gradient(135deg, rgba(var(--rgb-tint), 0.13), var(--color-raised-deep));
  --grad-table-bg: linear-gradient(135deg, var(--color-table-start), var(--color-table-end));
  --grad-table-head: linear-gradient(135deg, rgba(var(--rgb-primary), 0.16), var(--color-surface-deep));
  --grad-table-row: linear-gradient(
    135deg,
    rgba(var(--rgb-secondary), 0.08),
    rgba(var(--rgb-primary), 0.08)
  );

  --shadow-primary:
    0 0 20px rgba(var(--rgb-primary), 0.14), inset 0 0 14px rgba(var(--rgb-primary), 0.05);
  --shadow-secondary:
    0 0 18px rgba(var(--rgb-secondary), 0.12), inset 0 0 12px rgba(var(--rgb-secondary), 0.05);
}

/* =========================================================
   BASE
   ========================================================= */

html {
  font-size: 20px;
}

body {
  font-family: Arial, sans-serif;
  font-size: var(--fs);
  margin: 0;
  background: var(--grad-main);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin-bottom: 10px;
}
h1 {
  font-size: var(--fs-xl);
}
h2 {
  font-size: var(--fs-lg);
}
h3 {
  font-size: var(--fs-md);
}
h4 {
  font-size: var(--fs);
  color: var(--color-text-muted);
}

span {
  font-weight: bold;
}
li {
  margin: 10px 0 15px;
}

/* Hide scrollbars globally (radio list re-enables its own) */
* {
  scrollbar-width: none;
}
*::-webkit-scrollbar {
  display: none;
}

/* =========================================================
   LINKS
   ========================================================= */

a {
  text-decoration: none;
  color: var(--color-accent);
  transition: color 0.5s ease;
}
a:hover {
  color: var(--color-accent-hover);
}

/* =========================================================
   HEADER
   ========================================================= */

/* The shared page pieces are custom tags (site.js); they lay out exactly
   like the divs they replaced. */
site-header,
site-footer {
  display: block;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 75px;
  background: linear-gradient(
    90deg,
    rgba(var(--rgb-primary), 0.08),
    rgba(var(--rgb-secondary), 0.06)
  );
  border-bottom: 1px solid rgba(var(--rgb-primary), 0.25);
  box-shadow: 0 0 20px rgba(var(--rgb-primary), 0.1);
  z-index: 100;
}

.site-logo {
  font-size: var(--fs-logo);
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(var(--rgb-primary), 0.5);
  white-space: nowrap;
  transition: var(--transition);
}
.site-logo:hover {
  color: var(--color-accent);
  text-shadow: 0 0 28px rgba(var(--rgb-primary), 0.75);
}

.site-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-nav a {
  color: var(--color-text-muted);
  font-size: var(--fs-nav);
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--color-accent);
  border-color: rgba(var(--rgb-primary), 0.3);
  background: rgba(var(--rgb-primary), 0.07);
}

/* ── Hamburger toggle button (hidden on desktop) ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(var(--rgb-primary), 0.3);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  transition:
    transform var(--transition),
    opacity var(--transition);
  font-weight: normal;
}

/* Animate to X when open */
.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =========================================================
   PAGE BODY
   ========================================================= */

.page-body {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

/* =========================================================
   SECTIONS
   ========================================================= */

.normalsection {
  background: var(--grad-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary);
  overflow: hidden;
  box-sizing: border-box;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  gap: 12px;
  transition: background var(--transition);
}
.section-header:hover {
  background: rgba(var(--rgb-primary), 0.05);
}
.section-header h2 {
  margin: 0;
  min-width: 0;
}
.section-header.static {
  cursor: default;
  pointer-events: none;
}

.section-body {
  padding: 16px 20px;
  box-sizing: border-box;
  overflow-x: auto;
}

/* =========================================================
   COLLAPSIBLE SECTIONS & DIVS
   ========================================================= */

/* Inner expandable content inside .normalsection */
.expandedsection {
  max-height: 0;
  overflow: hidden;
  padding: 0 20px;
  transition:
    max-height 0.4s ease-in-out,
    padding 0.4s ease-in-out;
  border-top: 1px solid transparent;
}
.expandedsection.open {
  max-height: 2000px;
  padding: 16px 20px;
  border-top-color: rgba(var(--rgb-primary), 0.15);
}

/* Magenta-tinted sub-panel (album tracks, etc.) */
.collapseddiv {
  background: var(--grad-raised);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-secondary);
  margin-bottom: 10px;
}
.collapseddiv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  gap: 12px;
  transition: background var(--transition);
}
.collapseddiv-header:hover {
  background: rgba(var(--rgb-secondary), 0.06);
}
.collapseddiv-header h3 {
  margin: 0;
  flex: 1;
  font-weight: normal;
}

/* Inner expandable content inside .collapseddiv */
.expandeddiv {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  transition:
    max-height 0.4s ease-in-out,
    padding 0.4s ease-in-out;
}
.expandeddiv.open {
  max-height: 2000px;
  padding: 12px 16px;
}

/* =========================================================
   TOGGLE BUTTONS
   ========================================================= */

/* Shared base for section (+/-) toggles */
.section-toggle,
.collapseddiv-toggle {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 6px;
  background: var(--color-button-bg);
  border: 1px solid rgba(var(--rgb-primary), 0.25);
  color: var(--color-accent);
  font-size: var(--fs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
/* Magenta variant for collapseddiv toggles */
.collapseddiv-toggle {
  border-color: rgba(var(--rgb-secondary), 0.3);
  color: var(--color-accent-hover);
}

/* General button base */
button {
  font-size: var(--fs);
  cursor: pointer;
  border: 1px solid rgba(var(--rgb-primary), 0.25);
  border-radius: var(--radius);
  background: var(--color-button-bg);
  color: var(--color-accent);
  padding: 2px 7px;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

/* Plain buttons are outlined accent chips with a faint resting glow that
   switch to the secondary color on hover, as in Swiss RB Knife. The radio,
   playlist, modal and menu buttons have classes and their own rules. */
button:not([class]) {
  border-color: rgba(var(--rgb-primary), 0.5);
  box-shadow: 0 0 10px rgba(var(--rgb-primary), 0.12);
}
button:not([class]):hover:not(:disabled) {
  color: var(--color-accent-hover);
  border-color: rgba(var(--rgb-secondary), 0.6);
  background: rgba(var(--rgb-secondary), 0.1);
  box-shadow: 0 0 16px rgba(var(--rgb-secondary), 0.3);
}

/* Playlist prev/next arrows */
.player-arrow {
  width: 60px;
  min-width: 44px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--color-text);
  font-size: 3rem;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: color 0.5s ease;
}
.player-arrow:hover {
  background: rgba(0, 0, 0, 0.85);
  color: var(--color-accent-hover);
}
.player-arrow:disabled {
  cursor: default;
  pointer-events: none;
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */

label {
  color: var(--color-text);
  margin-bottom: 5px;
  display: block;
}
select {
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-input-bg);
  color: var(--color-text);
  width: 25%;
  font-size: var(--fs);
  max-width: 100%;
  box-sizing: border-box;
}
optgroup {
  color: var(--color-text);
  font-weight: bold;
  background: var(--color-optgroup-bg);
}
select option {
  background: var(--color-input-bg);
  color: var(--color-text);
}
select option:checked {
  color: var(--color-accent);
}
select:focus,
input:focus {
  outline: none;
  border-color: rgba(var(--rgb-primary), 0.7);
  box-shadow: 0 0 10px rgba(var(--rgb-primary), 0.3);
}

/* =========================================================
   TABLES
   ========================================================= */

table {
  width: fit-content;
  min-width: 300px;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: var(--grad-table-bg);
  box-sizing: border-box;
}
th,
td {
  border: 1px solid var(--color-border);
  padding: 10px;
  text-align: center;
  word-break: break-word;
}
th {
  background: var(--grad-table-head);
}
tr:nth-child(even) {
  background: var(--grad-table-row);
}

/* =========================================================
   IMAGES
   ========================================================= */

.image {
  width: 300px;
  max-width: 100%;
  height: auto;
  display: inline;
  float: left;
  margin: 0 30px 15px 0;
}
.image-banner {
  width: 600px;
  max-width: 100%;
  display: block;
  margin: 0 auto 15px;
  object-fit: cover;
  height: 100px;
}

/* =========================================================
   ALBUM LAYOUT
   ========================================================= */

.album-container {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}
.album-art {
  max-width: 300px;
  width: 100%;
  height: auto;
}
.album-tracks {
  flex: 1;
  min-width: 200px;
  overflow-x: auto;
}

/* =========================================================
   VIDEO / PLAYLIST EMBEDS
   ========================================================= */

.playlist-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.video-card {
  text-decoration: none;
  color: inherit;
  font-size: var(--fs-sm);
}
.video-card img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 5px solid var(--color-black);
  background-color: var(--color-black);
}
.video-title {
  display: block;
  margin-top: 6px;
  line-height: 1.2;
  text-align: center;
}

.video-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.video-wrapper {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 10px solid var(--color-black);
  background-color: var(--color-black);
  box-sizing: border-box;
}
.video-container {
  position: relative;
  flex: 1;
  aspect-ratio: 16 / 9;
  background: var(--color-black);
  width: 100%;
}
.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-icon {
  width: 50px;
  vertical-align: middle;
}
.yt-link {
  line-height: 0;
  margin-left: 15px;
}

/* =========================================================
   MODAL
   ========================================================= */

.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Frosted glass tinted with the theme's secondary color, as in the app. */
.modal {
  background: linear-gradient(
    135deg,
    rgba(var(--rgb-tint), 0.08),
    color-mix(in srgb, var(--color-raised-deep) 55%, transparent)
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px rgba(var(--rgb-secondary), 0.15), 0 24px 48px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(var(--rgb-secondary), 0.2);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  color: var(--color-text);
}

.modal-close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  background: transparent;
  border: 1px solid rgba(var(--rgb-secondary), 0.3);
  border-radius: 50%;
  color: var(--color-accent-hover);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
  padding: 0;
}

.modal-close:hover {
  background: rgba(var(--rgb-secondary), 0.15);
  border-color: rgba(var(--rgb-secondary), 0.6);
}

.modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--rgb-secondary), 0.25) transparent;
}

.modal-body::-webkit-scrollbar {
  display: none;
  width: 5px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(var(--rgb-secondary), 0.25);
  border-radius: 3px;
}

/* =========================================================
   FOOTER
   ========================================================= */

.fill-space {
  flex: 1;
}
footer {
  margin-top: auto;
  text-align: center;
  font-size: var(--fs-sm);
  padding: 16px;
  border-top: 1px solid rgba(var(--rgb-primary), 0.08);
  color: rgba(var(--rgb-text-muted), 0.4);
}
footer p {
  margin: 0;
}

/* =========================================================
   UTILITY
   ========================================================= */

.hidden-frame {
  display: none;
}

/* <site-pfp> (site.js) holds the profile picture, which changes with the
   theme. It lays out exactly like the img it wraps. */
site-pfp {
  display: contents;
}

/* =========================================================
   HOME PAGE — SPLIT HERO
   ========================================================= */

.home-hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}
.home-hero-left {
  background: var(--grad-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}
.home-hero-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-date {
  font-size: var(--fs-sm);
  color: var(--color-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.8;
}

/* Stat cards in the hero right column */
.card-base {
  background: var(--grad-raised);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-secondary);
  padding: 14px 16px;
}
.card-label {
  font-size: var(--fs-sm);
  color: var(--color-accent-hover);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 4px;
}
.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.card-sub {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-top: 5px;
}

/* =========================================================
   HOME PAGE — BOTTOM CARD GRID
   ========================================================= */

.home-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* About section avatar */
.about-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--color-accent),
    var(--color-accent-hover)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-on-accent);
  margin-bottom: 12px;
  flex-shrink: 0;
}

/* Album list inside the My Music card */
.album-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.album-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border-secondary);
  background: rgba(var(--rgb-secondary), 0.05);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}
.album-list-item:hover {
  background: rgba(var(--rgb-secondary), 0.1);
  border-color: rgba(var(--rgb-secondary), 0.5);
}
.album-list-item.active-album {
  background: rgba(var(--rgb-secondary), 0.15);
  border-color: rgba(var(--rgb-secondary), 0.55);
}
.album-list-item.active-album .album-item-name {
  color: var(--color-text);
}

.album-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent-hover);
  flex-shrink: 0;
}
.album-item-name {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.3;
}
.album-item-year {
  font-size: 0.65rem;
  color: rgba(var(--rgb-secondary), 0.5);
  flex-shrink: 0;
}

/* External links list inside the Where Else card */
.links-list {
  display: flex;
  flex-direction: column;
}

.links-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  padding: 8px 0;
  border-bottom: 1px solid rgba(var(--rgb-primary), 0.08);
}
.links-list-item::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.links-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--color-accent);
  padding: 8px 0;
  border-bottom: 1px solid rgba(var(--rgb-primary), 0.08);
  transition: color var(--transition);
}
.links-list a:last-child {
  border-bottom: none;
}
.links-list a:hover {
  color: var(--color-accent-hover);
}
.links-list a::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.links-section-label {
  font-size: var(--fs);
  font-weight: bolder;
  color: var(--color-text-muted);
  margin: 10px 0 6px;
}
.links-list + .links-section-label {
  margin-top: 14px;
}

/* =========================================================
   PLAYLIST PAGE
   ========================================================= */

.pl-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 14px;
  align-items: start;
}
.pl-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Collapsible grid inside each playlist section */
.pl-grid-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
}
.normalsection.open .pl-grid-wrap {
  max-height: 2000px;
}
.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(var(--rgb-primary), 0.15);
}

/* Video thumbnail cards */
.pl-thumb {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--transition);
  background: rgba(var(--rgb-primary), 0.04);
}
.pl-thumb:hover {
  border-color: rgba(var(--rgb-primary), 0.4);
}
.pl-thumb.active {
  border-color: var(--color-accent-hover);
  box-shadow:
    0 0 8px rgba(var(--rgb-secondary), 0.5),
    inset 0 0 6px rgba(var(--rgb-secondary), 0.08);
}
.pl-thumb-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-black);
}
.pl-thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pl-thumb-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: normal;
  padding: 6px 8px;
  line-height: 1.3;
  color: var(--color-text-muted);
}

/* Section header right cluster (YouTube button + toggle) */
.pl-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.pl-yt-btn {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  border: 1px solid rgba(var(--rgb-primary), 0.25);
  border-radius: var(--radius);
  padding: 4px 10px;
  white-space: nowrap;
  transition:
    color var(--transition),
    border-color var(--transition);
  pointer-events: auto;
}
.pl-yt-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}
/* Prevent header hover-highlight when hovering the YouTube link */
.section-header:has(.pl-yt-btn:hover) {
  background: transparent;
}

/* Sticky player panel */
.pl-panel {
  position: sticky;
  top: 16px;
  background: var(--grad-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-primary);
  overflow: hidden;
}
.pl-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-black);
}
.pl-player-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
#pl-player {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.pl-now {
  padding: 12px 16px;
  border-top: 1px solid rgba(var(--rgb-primary), 0.15);
}
.pl-now-label {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.pl-now-title {
  font-size: var(--fs);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.pl-now-title.active {
  color: var(--color-text);
}

.pl-nav {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(var(--rgb-primary), 0.15);
}
.pl-nav button {
  flex: 1;
}
.pl-nav button:hover:not(:disabled) {
  color: var(--color-accent);
  border-color: rgba(var(--rgb-primary), 0.3);
  background: rgba(var(--rgb-primary), 0.07);
}

/* =========================================================
   TOOLS PAGE
   ========================================================= */

.tool-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* =========================================================
   RADIO PLAYER
   ========================================================= */

/* ── Now-playing bar ── */
.radio-now-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(var(--rgb-primary), 0.15);
  margin-bottom: 10px;
}
.radio-now-info {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.radio-now-label {
  font-size: var(--fs-sm);
  color: var(--color-accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 3px;
}
.radio-now-track {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: break-word;
}
.radio-now-track-inner {
  font-weight: inherit;
}
.radio-now-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
  overflow: hidden;
}
.radio-now-artist {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-now-album {
  font-size: var(--fs-sm);
  color: rgba(var(--rgb-secondary), 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-now-album:not(:empty)::before {
  content: "· ";
  opacity: 0.5;
}

/* ── Transport controls ── */
.radio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.radio-btn {
  min-width: 38px;
  height: 36px;
  padding: 0 10px;
  font-size: var(--fs);
  border: 1px solid rgba(var(--rgb-primary), 0.3);
  border-radius: var(--radius);
  background: var(--color-button-bg);
  color: var(--color-accent);
  cursor: pointer;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.radio-btn {
  box-shadow: 0 0 10px rgba(var(--rgb-primary), 0.12);
}
.radio-btn:hover:not(:disabled) {
  color: var(--color-accent-hover);
  border-color: rgba(var(--rgb-secondary), 0.5);
  background: rgba(var(--rgb-secondary), 0.08);
  box-shadow: 0 0 16px rgba(var(--rgb-secondary), 0.3);
}
.radio-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.radio-btn-play {
  min-width: 48px;
  font-size: 1.1rem;
}
.radio-btn-play.playing {
  color: var(--color-accent-hover);
  border-color: rgba(var(--rgb-secondary), 0.5);
  box-shadow: 0 0 10px rgba(var(--rgb-secondary), 0.25);
}
.radio-btn-shuffle.active {
  color: var(--color-accent-hover);
  border-color: rgba(var(--rgb-secondary), 0.5);
  background: rgba(var(--rgb-secondary), 0.1);
}

/* ── Status badge ── */
.radio-status {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  font-weight: normal;
  flex-shrink: 0;
}

/* ── Volume ── */
.radio-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.radio-vol-icon {
  font-size: var(--fs-sm);
  min-width: 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.radio-vol-pct {
  font-size: var(--fs-sm);
  color: var(--color-accent);
  min-width: 36px;
  text-align: left;
  font-variant-numeric: tabular-nums;
  cursor: default;
  user-select: none;
}

/* Inline number input shown on double-click of volume % */
.radio-vol-edit {
  width: 38px;
  background: var(--color-bg-start);
  color: var(--color-accent);
  border: 1px solid rgba(var(--rgb-primary), 0.4);
  border-radius: 3px;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 1px 2px;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.radio-vol-edit::-webkit-outer-spin-button,
.radio-vol-edit::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.radio-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--color-accent) 0%,
    var(--color-accent) var(--vol-pct, 50%),
    rgba(var(--rgb-primary), 0.2) var(--vol-pct, 50%),
    rgba(var(--rgb-primary), 0.2) 100%
  );
  outline: none;
  border: none;
  cursor: pointer;
}
.radio-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 6px rgba(var(--rgb-primary), 0.5);
  cursor: pointer;
  transition:
    background var(--transition),
    box-shadow var(--transition);
}
.radio-volume::-webkit-slider-thumb:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 0 8px rgba(var(--rgb-secondary), 0.6);
}
.radio-volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

/* ── Progress bar ── */
.radio-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.radio-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(var(--rgb-primary), 0.15);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  /* Expanded hit area */
  padding: 8px 0;
  margin: -8px 0;
  box-sizing: content-box;
}
.radio-progress-fill {
  position: absolute;
  top: 8px;
  left: 0;
  height: 6px;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--color-accent),
    var(--color-accent-hover)
  );
  border-radius: 3px;
  pointer-events: none;
  transition: width 0.1s linear;
}
.radio-progress-bar:hover .radio-progress-fill {
  height: 8px;
  top: 7px;
}
.radio-progress-fill::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 6px rgba(var(--rgb-primary), 0.6);
  opacity: 0;
  transition: opacity var(--transition);
}
.radio-progress-bar:hover .radio-progress-fill::after {
  opacity: 1;
}
.radio-time {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Track table ── */
.radio-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.radio-th {
  padding: 8px 6px;
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  background: linear-gradient(135deg, var(--color-th-start), var(--color-th-end));
  border-bottom: 1px solid rgba(var(--rgb-primary), 0.2);
  white-space: nowrap;
  user-select: none;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
}
.radio-th.sortable {
  cursor: pointer;
  transition:
    color var(--transition),
    background var(--transition);
}
.radio-th.sortable:hover {
  color: var(--color-accent);
  background: var(--color-th-hover);
}
.radio-th.sort-active {
  color: var(--color-accent);
}
.sort-indicator {
  font-weight: normal;
  margin-left: 2px;
}

/* Column widths */
.col-id {
  width: 42px;
}
.col-artist {
  width: 22%;
}
.col-song {
  width: 28%;
}
.col-album {
  width: 22%;
}
.col-tracknum {
  width: 72px;
}
.col-dl {
  width: 68px;
}

/* ── Track list scroll container ── */
.radio-list-wrap {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--rgb-primary), 0.25) transparent;
  border: 1px solid rgba(var(--rgb-primary), 0.12);
  border-radius: var(--radius);
}
.radio-list-wrap::-webkit-scrollbar {
  display: block;
  width: 5px;
}
.radio-list-wrap::-webkit-scrollbar-thumb {
  background: rgba(var(--rgb-primary), 0.25);
  border-radius: 3px;
}

/* ── Error / empty state ── */
.radio-error {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.radio-error strong {
  display: block;
  color: var(--color-error);
  margin-bottom: 6px;
  font-size: var(--fs);
}

/* ── Track rows ── */
.radio-row {
  cursor: pointer;
  transition: background var(--transition);
}
.radio-row:nth-child(odd) td {
  background: rgba(var(--rgb-primary), 0.03);
}
.radio-row:nth-child(even) td {
  background: var(--color-row-alt);
}
.radio-row:hover td {
  background: rgba(var(--rgb-primary), 0.11) !important;
}
.radio-row.active td {
  background: rgba(var(--rgb-secondary), 0.2) !important;
  font-weight: bolder;
}
.radio-row.active td:not(.radio-row-dl-cell) {
  font-style: italic;
}
.radio-row.active td:first-child {
  border-left: 2px solid var(--color-accent-hover);
}
.radio-row.active .radio-row-num {
  color: var(--color-accent-hover);
}
.radio-row td {
  padding: 8px 6px;
  border-bottom: none;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.radio-row:last-child td {
  border-bottom: none;
}

/* Row cell classes */
.radio-row-num {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.radio-row-title {
  font-size: var(--fs-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-row-artist {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-row-album {
  font-size: var(--fs-sm);
  color: rgba(var(--rgb-secondary), 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-row-tracknum {
  font-size: var(--fs-sm);
  color: rgba(var(--rgb-secondary), 0.5);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.radio-row-dl-cell {
  text-align: center;
}

/* Pulsing play indicator on active row */
.radio-row.active .radio-row-num::after {
  content: " ▶";
  color: var(--color-accent-hover);
  animation: radio-pulse 1.2s ease-in-out infinite;
}
@keyframes radio-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Download button — pill style (table row) */
.radio-row-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--color-accent);
  background: rgba(var(--rgb-primary), 0.08);
  border: 1px solid rgba(var(--rgb-primary), 0.3);
  border-radius: 20px;
  padding: 5px 14px;
  white-space: nowrap;
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
  position: relative;
  z-index: 1;
  text-decoration: none;
}
.radio-row-dl:hover {
  color: var(--color-accent-hover);
  background: rgba(var(--rgb-secondary), 0.12);
  border-color: rgba(var(--rgb-secondary), 0.5);
}

/* Download button — now-playing bar (mobile only, hidden by default) */
.radio-now-dl {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  color: var(--color-accent);
  background: rgba(var(--rgb-primary), 0.08);
  border: 1px solid rgba(var(--rgb-primary), 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  text-decoration: none;
  margin-top: 6px;
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}
.radio-now-dl:hover {
  color: var(--color-accent-hover);
  background: rgba(var(--rgb-secondary), 0.12);
  border-color: rgba(var(--rgb-secondary), 0.5);
}

/* =========================================================
   RADIO — RESPONSIVE
   ========================================================= */

/* Tablet ≤900px: hide album + track# columns; show mobile download button */
@media (max-width: 900px) {
  .col-album,
  .radio-row-album,
  .col-tracknum,
  .radio-row-tracknum {
    display: none;
  }
  .radio-now-dl {
    display: inline-flex;
  }
}

/* Mobile ≤600px: restore album/track#; hide ID and download columns */
@media (max-width: 600px) {
  .col-album,
  .radio-row-album,
  .col-tracknum,
  .radio-row-tracknum {
    display: table-cell;
  }
  .col-id,
  .radio-row-num,
  .col-dl,
  .radio-row-dl-cell {
    display: none;
  }
  .radio-row-dl {
    padding: 5px 10px;
    gap: 0;
    font-size: 1rem;
  }
  .radio-row-dl .dl-label {
    display: none;
  }
  .radio-volume {
    width: 70px;
  }
  .radio-list-wrap {
    max-height: 340px;
  }
  .col-tracknum {
    width: 44px;
  }
}

@media (max-width: 480px) {
  .radio-volume {
    width: 55px;
  }
}

/* =========================================================
   RESPONSIVE — TABLET (≤768px)
   ========================================================= */

@media (max-width: 768px) {
  html {
    font-size: 17px;
  }
  .page-body {
    padding: 14px 14px 0;
  }
  .site-header {
    padding: 0 16px;
  }
  .site-nav a {
    padding: 5px 10px;
  }
  .section-header {
    padding: 12px 16px;
  }
  .section-body {
    padding: 14px 16px;
  }
  select {
    width: 100%;
  }
  .image,
  .album-art {
    width: 100%;
    float: none;
    margin: 0 0 15px;
  }
  .image-banner {
    height: auto;
  }
  .album-container {
    flex-direction: column;
    align-items: center;
  }
  .album-tracks {
    width: 100%;
    text-align: center;
    margin: 0;
    padding: 0;
    min-width: 0;
  }
  table {
    width: 100%;
    min-width: 0;
    font-size: 0.85rem;
  }
  td,
  th {
    padding: 7px 6px;
  }
  .pl-layout {
    grid-template-columns: 1fr;
  }
  .pl-panel {
    position: static;
    order: -1;
  }
}

/* =========================================================
   RESPONSIVE — MOBILE (≤480px)
   ========================================================= */

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }
  .site-header {
    padding: 0 12px;
    height: 50px;
  }
  .site-logo {
    font-size: 1.3rem;
  }
  .site-nav {
    gap: 4px;
  }
  .site-nav a {
    padding: 4px 8px;
  }
  .page-body {
    padding: 10px 10px 0;
    gap: 10px;
  }
  .section-header {
    padding: 10px 14px;
  }
  .section-body {
    padding: 12px 14px;
  }
  .collapseddiv-header {
    padding: 10px 12px;
  }
  button {
    padding: 5px 10px;
  }
  .playlist-row {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  .video-wrapper {
    border-width: 4px;
  }
  .player-arrow {
    width: 36px;
    font-size: 2rem;
  }
}

/* =========================================================
   RESPONSIVE — HOME PAGE HERO (≤900px and ≤480px)
   ========================================================= */

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
  }
  .home-hero-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .home-cards {
    grid-template-columns: 1fr;
  }

  .tool-cards {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: linear-gradient(
      135deg,
      rgba(var(--rgb-bg-start), 0.98),
      rgba(var(--rgb-bg-end), 0.98)
    );
    border-bottom: 1px solid rgba(var(--rgb-primary), 0.25);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    padding: 10px 16px 14px;
    gap: 4px;
    z-index: 99;
  }
  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 10px 14px;
    border: 1px solid transparent;
  }

  .site-header {
    position: relative;
  }
}

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

/* Screenshot at the top of a card (Swiss RB Knife page) */
.card-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

p.card-sub {
  margin-bottom: 0;
}

/* Read by screen readers and search engines, not shown on screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
