:root {
  color-scheme: light;
  --page-width: min(920px, calc(100vw - 36px));
  --sidebar-width: 0px;          /* mobile default; desktop overrides below */
  --composer-height: 70px;
  --composer-bottom: env(safe-area-inset-bottom, 0px);
  --keyboard-offset: 0px;
  --bg: #fbfaf7;
  --panel: #fffefa;
  --text: #242520;
  --muted: #5e5b54;          /* WCAG AA contrast on panel */
  --faint: #aaa49a;
  --line: #ded8ce;
  --line-soft: #eee8df;
  --accent: #d9574b;
  --accent-soft: #fbf0ed;
  --accent-line: rgba(217, 87, 75, 0.32);
  --accent-line-strong: rgba(217, 87, 75, 0.50);
  --accent-glow: rgba(217, 87, 75, 0.28);
  --accent-shadow: rgba(217, 87, 75, 0.32);
  --turntable-base: linear-gradient(135deg, #3a3833 0%, #1f1d1a 78%);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 70% 18%, rgba(217, 87, 75, 0.055), transparent 26%),
    linear-gradient(180deg, #fbfaf7 0%, #f8f5ef 100%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--composer-height) + var(--composer-bottom) + 28px);
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: var(--page-width);
  min-height: 0;
  margin: 0 auto;
  padding: 32px 0 36px;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  overflow-x: clip;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin: 18px auto 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 680;
}

.brand-mark {
  width: 18px;
  height: 28px;
  border-left: 4px solid var(--accent);
  border-right: 4px solid var(--accent);
  opacity: 0.88;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 520;
}

.intro {
  display: grid;
  gap: 8px;
  width: min(760px, 100%);
  margin: 0 auto;
  text-align: center;
  /* H1 is visually-hidden; only status-line (rare) takes vertical space. */
}

/* The intro H1 ("粘贴微博视频地址开始收听") is now redundant: the topbar
   tagline + sidebar + welcome trackTitle already orient the user. We keep
   the element in the DOM for screen readers (the section's aria-labelledby
   still references it) but visually hide it everywhere. */
.intro h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.intro > p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.status-line {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.status-line[hidden] {
  display: none;
}

.status-line[data-state="resolving"] {
  color: #9a493f;
}

.status-line[data-state="ready"] {
  color: #486347;
}

.status-line[data-state="error"] {
  color: #8c2e25;
}

/* Two-column app layout: persistent sidebar (history) + main shell.
   On narrow viewports the sidebar collapses above the main content. */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
  overflow-x: clip;
}

.sidebar {
  display: none;             /* desktop-only by default; mobile shows differently */
}

.sidebar-toggle {
  display: none;
}

@media (min-width: 901px) {
  :root {
    --sidebar-width: 270px;
    /* Page width must leave room for the sidebar so the shell never
       overflows the main column on mid-width laptops. */
    --page-width: min(940px, calc(100vw - var(--sidebar-width) - 48px));
  }

  /* Desktop layout is "fixed app shell": the whole window equals 100vh, no
     page-level scroll. Sidebar scrolls internally; main shell only scrolls
     internally if its own content overflows (rare). */
  html, body {
    height: 100vh;
    overflow: hidden;
  }

  body {
    padding-bottom: 0;       /* composer is fixed; shell handles its own
                                bottom inset, body doesn't need padding */
  }

  body.sidebar-collapsed {
    --sidebar-width: 0px;
  }

  .layout {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    transition: grid-template-columns 180ms ease;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-self: stretch;
    height: 100vh;
    padding: 28px 14px 28px;
    border-right: 1px solid var(--line);
    background:
      linear-gradient(180deg, rgba(255, 254, 250, 0.82), rgba(250, 249, 245, 0.68)),
      var(--bg);
    overflow: hidden;
    overscroll-behavior: contain;
    z-index: 5;
    transition: opacity 160ms ease, transform 180ms ease, border-color 180ms ease;
  }

  body.sidebar-collapsed .sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-16px);
    border-right-color: transparent;
  }

  .sidebar-toggle {
    position: fixed;
    top: 36px;
    left: calc(var(--sidebar-width) - 17px);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 254, 250, 0.94);
    color: var(--muted);
    box-shadow:
      0 8px 18px rgba(39, 34, 24, 0.07),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    transition: left 180ms ease, color 140ms ease, background 140ms ease, border-color 140ms ease, transform 120ms ease;
  }

  .sidebar-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
  }

  .sidebar-toggle:active {
    transform: scale(0.96);
  }

  .sidebar-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  body.sidebar-collapsed .sidebar-toggle {
    left: 18px;
  }

  body.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
  }

  .shell {
    height: 100vh;
    margin: 0 auto;
    padding: 32px 24px calc(var(--composer-height) + var(--composer-bottom) + 34px);
    overflow-x: hidden;
    overflow-y: auto;        /* internal scroll only when content actually
                                overflows (very short viewports) */
    overscroll-behavior: contain;
  }
}

.sidebar-group {
  display: flex;
  flex: 1 1 0;
  min-height: 116px;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-group.is-collapsed {
  flex: 0 0 auto;
  min-height: 0;
}

.sidebar-head {
  flex: 0 0 auto;            /* stays pinned at the top of the sidebar */
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-mark {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.72;
}

.sidebar-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 12px;
  font-weight: 660;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  transition: color 140ms ease, background 140ms ease, transform 160ms ease;
}

.section-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.section-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-group.is-collapsed .section-toggle svg {
  transform: rotate(-90deg);
}

.sidebar-group.is-collapsed .recent-rail {
  display: none;
}

.sidebar-empty {
  margin: 0;
  padding: 10px 6px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

/* Recent list — vertical, ChatGPT-style. Each successful resolve adds a card.
   This is the only element that scrolls in the sidebar; the .sidebar-head
   above it stays pinned. */
.recent-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 16px;
  flex: 1 1 auto;
  min-height: 0;             /* required so flex child can scroll inside parent */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.recent-rail[hidden] { display: none; }

.recent-rail::-webkit-scrollbar {
  width: 5px;
}

.recent-rail::-webkit-scrollbar-track {
  background: transparent;
}

.recent-rail::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.recent-rail::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

.recent-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.recent-card-main {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.recent-card:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.recent-card:hover .recent-delete,
.recent-card:focus-within .recent-delete {
  opacity: 1;
  pointer-events: auto;
}

.recent-card:focus-visible,
.recent-card-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.recent-card.is-current {
  background: #fffaf6;
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(94, 43, 36, 0.06);
}

.recent-card-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

.recent-card-title {
  font-size: 13px;
  font-weight: 640;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.35;
}

.recent-card-meta {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.recent-delete {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 0;
  background: rgba(255, 254, 250, 0.92);
  color: var(--faint);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 140ms ease, color 140ms ease, background 140ms ease, transform 120ms ease;
}

.recent-delete:hover {
  background: rgba(217, 87, 75, 0.1);
  color: var(--accent);
}

.recent-delete:active {
  transform: translateY(-50%) scale(0.94);
}

.recent-delete:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.recommend-category {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recommend-category + .recommend-category {
  margin-top: 10px;
}

.recommend-category-title {
  padding: 8px 12px 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

/* Mobile: collapse sidebar into a top section, show only when there's
   real history (renderRecentRail toggles a class). */
@media (max-width: 900px) {
  .sidebar {
    display: none;           /* keep hidden on mobile to preserve current
                                phone layout — history dropdown still works
                                when the input is focused */
  }
}

.panel {
  min-height: 0;
  position: relative;
  overflow: visible;
  width: min(780px, 100%);
  margin: 0 auto;
  padding: clamp(54px, 8vh, 88px) 42px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.panel::before {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: 96px;
  height: 300px;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(70, 58, 42, 0.028), transparent 52%),
    radial-gradient(ellipse at 50% 54%, rgba(232, 224, 211, 0.10), transparent 80%);
  filter: blur(34px);
  transform: perspective(420px) rotateX(60deg);
  transform-origin: center top;
  opacity: 0.46;
}

.timer-head span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.timer-chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
}

.timer-chip.active {
  background: var(--accent-soft);
}

.player {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  text-align: center;
}

.deck-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: min(100%, 430px);
  padding: 0 0 8px;
}

.deck-side-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 254, 250, 0.84);
  color: #4f4c45;
  box-shadow:
    0 9px 20px rgba(39, 34, 24, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.deck-side-control .control-btn {
  width: 40px;
  height: 40px;
  color: inherit;
}

/* Turntable chassis: classic vinyl proportions are ~1.3:1 horizontally with the
   platter on the LEFT and a dedicated tonearm rest area on the right. We mirror
   that — disc anchored at left, arm pivot mounted on the right shelf. */
.turntable {
  position: relative;
  --deck-w: clamp(270px, 32vw, 350px);
  width: min(var(--deck-w), 100%);
  aspect-ratio: 1.27 / 1;
  display: grid;
  grid-template-columns: minmax(0, 75.4%) 1fr;
  align-items: center;
  border-radius: 18px;
  border: 1px solid rgba(8, 8, 7, 0.48);
  background:
    radial-gradient(ellipse at 30% 8%, rgba(255, 255, 255, 0.13) 0%, transparent 42%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055), transparent 25%, rgba(0, 0, 0, 0.18) 100%),
    linear-gradient(180deg, #48453e 0%, #2b2924 50%, #181713 100%);
  box-shadow:
    0 32px 38px rgba(26, 24, 20, 0.18),
    0 12px 18px rgba(26, 24, 20, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -4px 8px rgba(0, 0, 0, 0.42);
}

/* Soft brushed-metal sheen across the platter base. The two "screws" at the
   bottom corners are subtly visible; the LED indicator lives at lower-right
   so it doesn't crowd the pivot housing in the upper-right. */
.turntable::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background:
    radial-gradient(circle at 8.2% 88.5%, rgba(0, 0, 0, 0.4) 0 3px, rgba(255, 255, 255, 0.08) 3px 4px, transparent 5px),
    radial-gradient(circle at 93% 88.5%, rgba(0, 0, 0, 0.4) 0 3px, rgba(255, 255, 255, 0.08) 3px 4px, transparent 5px),
    radial-gradient(circle at 92% 72%, rgba(128, 118, 96, 0.62) 0 2.2px, rgba(0, 0, 0, 0.36) 3px 4px, transparent 4.8px),
    linear-gradient(120deg, transparent 0 15%, rgba(255, 255, 255, 0.045) 24%, transparent 38% 100%);
  pointer-events: none;
  z-index: 1;
}

.turntable.is-playing::before {
  background:
    radial-gradient(circle at 8.2% 88.5%, rgba(0, 0, 0, 0.4) 0 3px, rgba(255, 255, 255, 0.08) 3px 4px, transparent 5px),
    radial-gradient(circle at 93% 88.5%, rgba(0, 0, 0, 0.4) 0 3px, rgba(255, 255, 255, 0.08) 3px 4px, transparent 5px),
    radial-gradient(circle at 92% 72%, #ff8270 0 1.25px, #d9574b 1.7px 2.25px, rgba(76, 22, 18, 0.72) 2.8px 3.6px, transparent 4.4px),
    radial-gradient(circle at 92% 72%, rgba(255, 105, 88, 0.12) 0 4.2px, transparent 6.8px),
    linear-gradient(120deg, transparent 0 15%, rgba(255, 255, 255, 0.045) 24%, transparent 38% 100%);
}

.turntable::after {
  content: none;
}

.deck-foot {
  position: absolute;
  bottom: -4px;
  width: 9%;
  height: 4.4%;
  border-radius: 999px;
  background: linear-gradient(180deg, #151410, #050505);
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 0;
}

.deck-foot-left { left: 7.5%; }
.deck-foot-right { right: 7.5%; }

.cover {
  width: 168px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  filter: saturate(0.6) contrast(0.94);
}

/* Vinyl disc — the round media surface spins when audio is playing.
   Sits in the left grid cell of the turntable; centered within that cell. */
.cd {
  width: 84.2%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  perspective: 600px;
  position: relative;
  overflow: visible; /* tonearm extends outside the 168×168 box */
  justify-self: center;
  z-index: 2;
}

/* Tonearm pivot housing — the cylindrical mount the arm pivots on. In a real
   turntable the housing is fixed to the chassis and only the arm rotates; we
   render it as a static disk under the rotating .tonearm so the pivot no
   longer floats. Sits just outside the disc, top-right of the chassis. */
.tonearm-base {
  position: absolute;
  /* Aligned to the pivot's rotation-anchor: with the pivot now centered
     on tonearm's transform-origin (76%, 10%), the pivot stays at fixed
     CD coords (104.24%, 0%) in every rotation state. Base diameter 22%
     → left = 104.24 - 11 = 93.24% (right offset -15.24%), top = 0 - 11. */
  top: -11%;
  right: -15%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  /* Anodized matte black — real pivot towers aren't shiny gold. Highlight
     stays small (top-left), 90%+ of the disk reads as dark metal. */
  background:
    radial-gradient(circle at 32% 26%, #4a443d 0%, #2a2722 28%, #14120f 62%, #060604 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 3px rgba(0, 0, 0, 0.55);
  z-index: 4;            /* below tonearm (6); above disc */
  pointer-events: none;
}

/* Inner mounting collar — the recessed ring where the arm bearings sit. */
.tonearm-base::before {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #1c1a16 0%, #060604 78%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.78),
    0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Tonearm rest cup — sits on the chassis right shelf, just outside the disc.
   Aligned so the stylus touches down here at rotate(-5deg) rest. */
.cd-rest {
  position: absolute;
  top: 58%;
  right: -19%;
  width: 13%;
  height: 4.8%;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(18, 17, 15, 0.92) 0 34%, transparent 36%),
    linear-gradient(90deg, transparent 0 17%, rgba(255, 255, 255, 0.18) 19% 28%, transparent 30% 100%),
    linear-gradient(to bottom, #7b766a 0%, #2f2d28 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 2px 3px rgba(0, 0, 0, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.24);
  z-index: 5;
}

/* Tonearm — curved tube with cartridge details, scaled relative to the disc so
   the pivot sits on the chassis right shelf and the stylus sweeps onto vinyl. */
.tonearm {
  position: absolute;
  top: -12%;
  right: -22%;
  width: 74%;
  height: 120%;
  z-index: 6;
  transform-origin: 76% 10%;
  transform: rotate(-31deg) translateY(1px);
  transition: transform 1.1s cubic-bezier(0.34, 1.12, 0.64, 1);
  pointer-events: none;
  filter:
    drop-shadow(0 1px 1px rgba(255, 255, 255, 0.12))
    drop-shadow(0 4px 4px rgba(0, 0, 0, 0.28));
}

.cd.is-playing .tonearm {
  transform: rotate(0deg) translateY(-1px);
}

.tonearm-pivot {
  position: absolute;
  /* Align pivot CENTER with tonearm's transform-origin (76% 10%) so the
     pivot stays put regardless of arm rotation. With width:18% / aspect-
     ratio:1 the pivot is 13.32% of CD height tall (18% × 74% / 120%);
     half of that is 5.55% so top = 10% - 5.55% = 4.45%, left = 76% - 9%. */
  top: 4.45%;
  left: 67%;
  width: 18%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #f2ead8 0%, #b5ab98 22%, #776f62 56%, #282722 100%);
  box-shadow:
    0 0 0 5px rgba(8, 8, 7, 0.32),
    0 0 0 6px rgba(255, 255, 255, 0.045),
    0 4px 7px rgba(0, 0, 0, 0.28),
    inset 0 -1px 1px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
  z-index: 2;
}

.tonearm-pivot::after {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 35%, #6c675d, #12110e 74%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.65),
    0 1px 0 rgba(255, 255, 255, 0.12);
}

.tonearm-svg {
  position: absolute;
  inset: -7% 0 0 -2%;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tonearm-shadow,
.tonearm-tube,
.tonearm-highlight {
  fill: none;
  stroke-linecap: round;
}

.tonearm-shadow {
  stroke: rgba(0, 0, 0, 0.26);
  stroke-width: 7;
  transform: translate(1px, 2px);
}

.tonearm-tube {
  stroke: url(#tonearmTube);
  stroke-width: 5.2;
}

.tonearm-highlight {
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.2;
}

.tonearm-headshell {
  fill: #2a2721;
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 0.55;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.tonearm-screw {
  fill: #b7b0a4;
  stroke: rgba(0, 0, 0, 0.42);
  stroke-width: 0.28;
  opacity: 0.86;
}

.tonearm-cartridge-top {
  fill: #403c34;
  stroke: rgba(0, 0, 0, 0.48);
  stroke-width: 0.4;
}

.tonearm-cartridge-side {
  fill: #181611;
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 0.4;
}

.tonearm-cartridge-front {
  fill: #2d2922;
  stroke: rgba(255, 255, 255, 0.055);
  stroke-width: 0.4;
}

.tonearm-cantilever-mount {
  fill: #aaa397;
  stroke: rgba(0, 0, 0, 0.42);
  stroke-width: 0.28;
}

.tonearm-wire {
  stroke-width: 0.8;
  opacity: 0.55;
}

.tonearm-wire-blue { stroke: #376aa8; }
.tonearm-wire-red { stroke: #cc554d; }

/* Cantilever rod — the thin aluminium tube extending from the cartridge
   underside down to the diamond. Two strokes: base tone + a brighter
   highlight line offset by 0.25 to suggest a cylindrical surface. */
.tonearm-needle {
  stroke: #b8b1a4;
  stroke-width: 0.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0.4px 0.5px rgba(0, 0, 0, 0.48));
}

.tonearm-needle-glint {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.22;
  stroke-linecap: round;
  pointer-events: none;
}

/* Tiny soft pill where the diamond touches the vinyl. */
.tonearm-contact-shadow {
  fill: rgba(0, 0, 0, 0.32);
  filter: blur(0.4px);
}

/* Diamond stylus — a kite-shape that reads as a real conical/elliptical
   diamond glued to the cantilever, not a generic ellipse. Subtle dark
   stroke gives the facets edge definition. */
.tonearm-stylus {
  fill: #f2ecd9;
  stroke: rgba(34, 30, 25, 0.62);
  stroke-width: 0.2;
  filter: drop-shadow(0 0.5px 0.5px rgba(0, 0, 0, 0.55));
}

/* Highlight on the upper-left face of the diamond — what catches a
   stage/turntable LED in real macro shots. */
.tonearm-stylus-glint {
  fill: #ffffff;
  opacity: 0.92;
  pointer-events: none;
}

/* Tiny needle tip in accent color, peeking below the head. The head bottom +
   tip together reach 4 px past local y=109, ~104 px from the pivot centre. */

@media (prefers-reduced-motion: reduce) {
  .tonearm { transition: none; }
}

.cd-disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #050505 0 5%, transparent 5.4%),
    radial-gradient(circle at center, transparent 0 23.8%, rgba(255, 255, 255, 0.035) 24.5% 25.4%, transparent 26%),
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.12), transparent 18%),
    radial-gradient(circle at center, #181818 0 28%, #0b0b0b 64%, #050505 100%);
  box-shadow:
    0 2px 3px rgba(255, 255, 255, 0.18) inset,
    0 -3px 6px rgba(0, 0, 0, 0.58) inset,
    0 8px 14px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: filter 200ms ease;
}

.cd-disc::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background:
    /* Lead-in groove — the wider, smoother band you can see at the disc's
       outer edge before the music starts. Helps the eye land on "this is
       a vinyl LP" not "this is a CD". */
    radial-gradient(
      circle at center,
      transparent 0 92%,
      rgba(0, 0, 0, 0.35) 92.5% 93.4%,
      transparent 94% 100%
    ),
    /* Tighter spiral grooves — 0.6px lines on a 1.6px pitch read more like
       LP grooves than CD pits at typical viewing sizes. */
    repeating-radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.018) 0 0.6px,
      rgba(0, 0, 0, 0.28) 0.6px 1.2px,
      rgba(255, 255, 255, 0.008) 1.2px 1.6px
    );
  opacity: 0.92;
  pointer-events: none;
  z-index: 1;
}

.cd-disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    linear-gradient(118deg, transparent 0 41%, rgba(255, 255, 255, 0.055) 48%, transparent 57%),
    radial-gradient(ellipse at 66% 72%, rgba(0, 0, 0, 0.26), transparent 34%);
  mix-blend-mode: screen;
  opacity: 0.42;
  pointer-events: none;
  z-index: 4;
}

.cd.is-resolving .cd-disc {
  filter: brightness(0.92);
}

.cd.is-resolving .cd-rainbow,
.cd.is-resolving .cd-grooves {
  animation: cd-spin 4s linear infinite;
}

.cd.is-resolving .cd-label {
  animation: cd-resolve-pulse 1.2s ease-in-out infinite;
}

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

.cd-disc.is-spinning .cd-rainbow,
.cd-disc.is-spinning .cd-grooves {
  animation: cd-spin 28s linear infinite;
}

/* Iridescent reflective ring sitting in the data area of the disc. */
.cd-rainbow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(116, 55, 82, 0.34),
    rgba(118, 91, 54, 0.22),
    rgba(62, 100, 92, 0.2),
    rgba(61, 83, 128, 0.24),
    rgba(103, 62, 112, 0.24),
    rgba(116, 55, 82, 0.34)
  );
  mix-blend-mode: screen;
  opacity: 0.26;
  filter: blur(0.3px) saturate(0.72);
  z-index: 2;
}

/* Concentric grooves to give the CD a printed/pressed feel. */
.cd-grooves {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at center,
      rgba(255, 255, 255, 0.016) 0 1px,
      rgba(0, 0, 0, 0.18) 1px 2px
    );
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 3;
}

/* Cream label printed at the center of the disc — title goes here. */
.cd-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 45%;
  height: 45%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fffefa 0%, #fbf2ec 64%, #edd8ce 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  text-align: center;
  overflow: hidden;        /* clip silk-screen text inside the round label */
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.045),
    0 2px 6px rgba(0, 0, 0, 0.08),
    0 1px 1px rgba(0, 0, 0, 0.05) inset;
  /* faint silk-screen ink texture */
  filter: contrast(0.98);
  z-index: 5;
}

.cd-brand {
  font-size: 8.5px;
  letter-spacing: 0.08em;   /* down from 0.2em — letters were overflowing the
                               75px round label and getting clipped at edges */
  font-weight: 700;
  color: var(--accent);
  opacity: 0.78;
  text-transform: uppercase;
  white-space: nowrap;      /* "WEIBO LISTEN" stays on one line; if it doesn't
                               fit, the label clips it cleanly via overflow:hidden */
}

.cd-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 680;
  color: #4b3a36;
  /* subtle ink-print look */
  text-shadow: 0 0 1px rgba(75, 58, 54, 0.18);
  word-break: break-word;
  max-width: 100%;
  transition: font-size 220ms ease;
}

.cd:hover .cd-label {
  z-index: 2;
}

.cd:hover .cd-title {
  -webkit-line-clamp: 6;
  font-size: 12px;
}

/* Center spindle hole. */
.cd-spindle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9%;
  height: 9%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #2a2a2a 0%, #0a0a0a 70%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 1px 1px rgba(0, 0, 0, 0.4) inset;
  z-index: 6;
}

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

@media (prefers-reduced-motion: reduce) {
  .cd-rainbow,
  .cd-grooves,
  .cd-disc.is-spinning .cd-rainbow,
  .cd-disc.is-spinning .cd-grooves {
    animation: none;
  }
}

.track p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.track {
  margin-top: 12px;
  width: 100%;
}

/* Source host + quality chip strip, replaces the old "来自微博视频" label.
   Surfaces actual provenance and lets the user switch quality. */
.track-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.track-meta:has(.meta-chip-action:not([hidden])) {
  min-height: 28px;
  margin-bottom: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 540;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meta-chip-action {
  flex: 0 0 auto;
  min-width: 104px;
  height: 32px;
  padding-inline: 14px 12px;
  cursor: pointer;
  border-color: var(--line);
  color: var(--muted);
  transition: background 160ms ease, border-color 160ms ease;
}

.meta-chip-action #qualityLabel {
  min-width: 0;
  flex: 0 0 auto;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.meta-chip-action:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line-strong);
  color: var(--accent);
}

.meta-chip-action[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line-strong);
  color: var(--accent);
}

.meta-chip[hidden] { display: none; }

.chip-caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 4px solid currentColor;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  opacity: 0.7;
}

.quality-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 12;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  min-width: 126px;
  max-width: min(180px, calc(100vw - 48px));
  transform: translateX(-50%);
}

.quality-menu[hidden] { display: none; }

.quality-menu li { margin: 0; }

.quality-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 540;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.quality-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.quality-menu button[aria-current="true"] {
  color: var(--accent);
}

.quality-menu .quality-dim {
  color: var(--faint);
  font-size: 11px;
  font-weight: 480;
}

.quality-menu .quality-dim:empty {
  display: none;
}

.track h1 {
  margin: 0;
  max-width: 650px;
  min-height: 0;
  font-size: clamp(22px, 2.25vw, 27px);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 660;
  text-wrap: balance;
  margin-inline: auto;
}

.track > span {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 520;
}

.track h1:empty,
.track > span:empty,
.cd-title:empty {
  display: none;
}

.timeline {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  align-self: center;
  gap: 12px;
  width: min(100%, 580px);
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: #d9d4cb;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid #fffefa;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(94, 43, 36, 0.22);
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #d9d4cb;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fffefa;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(94, 43, 36, 0.22);
}

/* Seek track wrapper hosts the buffered overlay underneath the range input. */
.seek-track {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 28px;
}

.seek-track input[type="range"] {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  background: transparent;
}

.seek-buffered {
  position: absolute;
  left: 0;
  top: 50%;
  height: 4px;
  width: 0%;
  border-radius: 2px;
  background: rgba(217, 87, 75, 0.24);
  transform: translateY(-50%);
  pointer-events: none;
  transition: width 200ms linear;
}

/* Track-error / retry block sits between timeline and controls when something
   goes wrong (CDN expired, network drop, decoder failure). */
.track-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid #b04a3f; /* cooler than accent so it reads as warning */
  border-radius: var(--radius);
  background: #fdeae6;
  color: #8c2e25;
  font-size: 13px;
}

.track-error[hidden] { display: none; }

.track-error-icon {
  flex-shrink: 0;
  color: #b04a3f;
}

.track-error-text {
  flex: 1;
  min-width: 0;
}

.track-error button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #b04a3f;
  border-radius: 6px;
  background: #fffefa;
  color: #8c2e25;
  font-weight: 620;
  cursor: pointer;
  flex-shrink: 0;
}

.track-error button:hover {
  background: #b04a3f;
  color: #fffefa;
}

.volume {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  position: relative;
}

.vol-slider {
  position: static;
  width: 74px;
  opacity: 1;
  transform: none;
  transition: opacity 160ms ease;
}

.vol-icon .vol-mute { display: none; }
#muteToggle[data-level="0"] .vol-icon .vol-base { opacity: 0.5; }
#muteToggle[data-level="0"] .vol-icon .vol-wave1,
#muteToggle[data-level="0"] .vol-icon .vol-wave2 { display: none; }
#muteToggle[data-level="0"] .vol-icon .vol-mute { display: inline; }
#muteToggle[data-level="1"] .vol-icon .vol-wave2 { display: none; }

/* Recent-history dropdown sits above the composer when the input is focused. */
.history-list {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.98);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
}

.history-list[hidden] { display: none; }

.history-list li { margin: 0; }

.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-item:hover {
  background: var(--accent-soft);
}

.history-title {
  font-size: 13px;
  font-weight: 620;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.history-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.controls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 8px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.95), rgba(250, 249, 245, 0.84));
  box-shadow:
    0 12px 26px rgba(39, 34, 24, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.transport-tool {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Round, accent-filled play / pause button. Icon-only. */
.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fffefa;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 7px 16px rgba(217, 87, 75, 0.3);
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
}

.play-button:hover {
  background: #c84d42;
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 8px 18px rgba(217, 87, 75, 0.38);
}

.play-button:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.32) inset,
    0 4px 10px rgba(217, 87, 75, 0.28);
}

.play-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.play-icon {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
}

.play-button.is-playing .play-icon {
  width: 14px;
  height: 16px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(currentColor, currentColor) left / 4px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right / 4px 100% no-repeat;
}

/* Secondary skip buttons that flank the play button. */
.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: color 120ms ease, background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.control-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(217, 87, 75, 0.12);
}

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

.control-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.control-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Sleep timer is a side control near the deck, with the popover shown below. */
.sleep-timer {
  position: relative;
  margin-left: 0;
}

.sleep-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel);
  opacity: 0;
  transition: opacity 160ms ease;
}

.sleep-timer.is-armed .sleep-dot {
  opacity: 1;
}

.sleep-popover {
  align-self: center;
  width: min(260px, 100%);
  margin-top: 12px;
  z-index: 12;
  min-width: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

.sleep-popover[hidden] { display: none; }

.sleep-popover::after {
  display: none;
}

.sleep-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

.sleep-status strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sleep-chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.timer-chip {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 540;
}

.timer-chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.timer-chip.active {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.composer {
  position: fixed;
  left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
  bottom: calc(18px + var(--composer-bottom) + var(--keyboard-offset));
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  width: min(760px, calc(100vw - var(--sidebar-width) - 64px));
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 254, 250, 0.9)),
    rgba(255, 254, 250, 0.94);
  box-shadow:
    0 10px 28px rgba(39, 34, 24, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  opacity: 1;
}

.composer input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.composer input:focus {
  background: rgba(250, 249, 245, 0.86);
}

.composer input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.composer button:focus-visible,
.timer-chip:focus-visible,
.history-item:focus-visible,
.meta-chip-action:focus-visible,
.quality-menu button:focus-visible,
.track-error button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.composer input:focus-visible {
  outline-offset: 2px;
}

.composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--accent);
  color: #fffefa;
  font-weight: 620;
  box-shadow: 0 6px 14px var(--accent-line);
  transition: background 160ms ease, color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.composer button:hover {
  background: #c84d42;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(217, 87, 75, 0.34);
}

.composer button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.resolve-icon {
  display: inline-block;
  vertical-align: middle;
}

.resolve-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: resolve-spinner 0.8s linear infinite;
}

#resolveButton.is-loading {
  cursor: progress;
}

#resolveButton.is-loading .resolve-icon {
  display: none;
}

#resolveButton.is-loading span:first-child {
  display: none;
}

#resolveButton.is-loading .resolve-spinner {
  display: inline-block;
}

@keyframes resolve-spinner {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--composer-bottom) + var(--keyboard-offset));
  z-index: 10;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 640px) {
  .shell {
    width: min(calc(100vw - 36px), 420px);
    padding: 24px 0 calc(var(--composer-height) + var(--composer-bottom) + 30px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
    padding-inline: 18px;
  }

  .brand-mark {
    flex: 0 0 auto;
  }

  .panel {
    width: 100%;
    padding: 34px 8px 22px;
  }

  .intro {
    margin: 10px auto 12px;
    text-align: left;
  }

  .intro h1 {
    font-size: 17px;
  }

  .player {
    gap: 12px;
  }

  .deck-stage {
    width: 100%;
  }

  .deck-side-control {
    width: 40px;
    height: 40px;
  }

  .deck-side-control .control-btn {
    width: 36px;
    height: 36px;
  }

  .turntable {
    width: min(260px, 100%);
    aspect-ratio: 1.27 / 1;
    grid-template-columns: minmax(0, 76%) 1fr;
    margin: 0 auto;
  }

  .cover {
    width: 100%;
  }

  .cd {
    width: min(154px, 70%);
    margin: 0 auto;
  }

  .tonearm {
    top: -12%;
    right: -23%;
    width: 76%;
    height: 120%;
    transform-origin: 76% 10%;
  }

  .tonearm-pivot {
    left: 67.5%;
    width: 18%;
    height: auto;
  }

  .tonearm-svg {
    inset: -7% 0 0 -2%;
  }

  .cd-rest {
    right: -20%;
    width: 14px;
    height: 6px;
  }

  .track h1 {
    font-size: clamp(22px, 7vw, 27px);
  }

  .timeline {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    gap: 10px;
  }

  .controls {
    gap: 6px;
    max-width: 100%;
    padding: 7px 9px;
  }

  .play-button {
    width: 54px;
    height: 54px;
  }

  .control-btn {
    width: 40px;
    height: 40px;
  }

  .timer-list {
    grid-template-columns: 1fr 1fr;
  }

  .composer {
    position: fixed;
    left: 50%;
    bottom: calc(14px + var(--composer-bottom) + var(--keyboard-offset));
    grid-template-columns: minmax(0, 1fr);
    width: min(100vw - 28px, 420px);
    margin: 0;
    border-radius: 16px;
    transform: translateX(-50%);
    opacity: 1;
  }

  .vol-slider {
    width: 48px;
  }

  .composer button {
    width: 100%;
  }
}

.document-page {
  min-height: 100vh;
  padding: 0;
  overflow-y: auto;
}

.document-shell {
  width: min(760px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.document-card {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.document-card h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.15;
}

.document-card h2 {
  margin: 28px 0 8px;
  font-size: 17px;
  line-height: 1.3;
}

.document-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

@media (min-width: 901px) {
  html:has(.document-page),
  body.document-page {
    height: auto;
    overflow-y: auto;
  }
}
