:root {
  --fg: #1a1a1a;
  --bg: #fbf8fb;
  --muted: #6a6a6a;
  --rule: #e0d4dd;
  --accent: #8a3a78;
  --code-bg: #f1ebef;
  --subtitle-fg: #555;
  --caption-fg: #555;
  --footnote-fg: #333;
  --footnote-target-bg: #f8e0ec;
  --footnote-link: #a07a96;
  --margin-note-fg: #555;
  --margin-note-ref-fg: #a07a96;
  --header-fg: #6a6a6a;
  --header-fg-hover: #1a1a1a;
  --link-thickness: 1px;
  --link-thickness-hover: 2px;
  --body-font: Charter, "Iowan Old Style", "Iowan Old Style BT", "Palatino Linotype", Palatino, Georgia, serif;
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --code-font: "SF Mono", Menlo, Consolas, monospace;
  --body-line-height: 1.6;
  --bg-image: none;
  --paper-overlay: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
}

html {
  background: var(--bg);
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--body-font);
  font-size: 18px;
  line-height: var(--body-line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: var(--bg-image);
  position: relative;
}

article::after {
  content: "";
  display: block;
  clear: both;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--paper-overlay);
}

header, article {
  position: relative;
  z-index: 1;
}

header {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2rem 240px 0 240px;
  font-family: var(--ui-font);
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  header {
    max-width: 680px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

header .site-title {
  color: var(--header-fg);
  text-decoration: none;
  font-size: 1.55rem;
  letter-spacing: -0.005em;
}

header .site-title:hover {
  color: var(--header-fg-hover);
}

header .site-nav {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  font-size: 0.95rem;
}

header .site-nav:empty {
  display: none;
}

header .site-nav a {
  color: var(--header-fg);
  text-decoration: none;
}

header .site-nav a:hover {
  color: var(--header-fg-hover);
}

article {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2rem 240px 6rem 240px;
}

article h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 1.5rem 0 0.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

article > time {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 2.5rem 0;
  font-family: var(--ui-font);
}

.subtitle {
  font-style: italic;
  color: var(--subtitle-fg);
  font-size: 1.2em;
  margin: 0.4em 0 0 0;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

article figure { margin: 1.5em 0; }
article figcaption,
article .image-caption {
  font-style: italic;
  font-size: 0.9em;
  color: var(--caption-fg);
  text-align: center;
  margin-top: 0.5em;
  line-height: 1.4;
}

.captioned-image-container { text-align: center; }
.captioned-image-container figure { display: inline-block; max-width: 100%; }
.captioned-image-container .image-link,
.captioned-image-container picture,
.captioned-image-container img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

article h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 0.75rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

article h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.5rem;
  font-weight: 600;
}

article h4 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  font-weight: 600;
}

article p {
  margin: 1rem 0;
}

article a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: var(--link-thickness);
  text-underline-offset: 0.15em;
}

article a:hover {
  text-decoration-thickness: var(--link-thickness-hover);
}

article ul, article ol {
  padding-left: 1.5rem;
}

article li {
  margin: 0.25rem 0;
}

article blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

article code {
  font-family: var(--code-font);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

article pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}

article pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

article table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  width: 100%;
  font-size: 0.95rem;
}

article th, article td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

article th {
  background: var(--code-bg);
  font-weight: 600;
}

article hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

article table.phonology-table {
  width: auto;
  margin: 1.5rem auto;
  font-size: 0.85rem;
  empty-cells: show;
}

article table.phonology-table th,
article table.phonology-table td {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--rule);
}

article table.phonology-table th {
  background: var(--code-bg);
  font-weight: 600;
}

article table.phonology-table sup {
  font-size: 0.75em;
}

.smcaps {
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

article img {
  max-width: 100%;
  height: auto;
}

article .footnote {
  font-size: 0.875rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1rem;
}

.archive ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.archive li {
  margin: 1.25rem 0;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.archive li:last-child {
  border-bottom: none;
}

.archive .post-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: block;
}

.archive .post-subtitle {
  display: block;
  color: var(--muted);
  margin-top: 0.35rem;
  font-style: italic;
}

.archive .post-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.archive .entry-meta {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.tag {
  display: inline-block;
  font-family: var(--ui-font);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  line-height: 1.4;
}

/* ---------- project page meta ---------- */

body.project article > time { margin-bottom: 1rem; }

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0.5rem 0 1rem;
  font-family: var(--ui-font);
}

.entry-meta > time {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem 0 1rem;
}

.project-action {
  display: inline-block;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.project-action:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.youtube-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  background: var(--code-bg);
  border-radius: 4px;
  overflow: hidden;
}

.youtube-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- versioned releases ---------- */

.release-notes {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  font-style: italic;
}

.prior-versions {
  margin-top: 0.6rem;
  font-family: var(--ui-font);
  font-size: 0.85rem;
}

.prior-versions summary {
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: inline-block;
  user-select: none;
}

.prior-versions summary::-webkit-details-marker { display: none; }

.prior-versions summary::before {
  content: "▸ ";
  font-size: 0.85em;
  display: inline-block;
  width: 1em;
}

.prior-versions[open] summary::before { content: "▾ "; }

.prior-versions summary:hover { color: var(--fg); }

.prior-versions ul {
  list-style: none;
  padding: 0.4rem 0 0 1.4rem;
  margin: 0;
}

.prior-versions li {
  margin: 0.2rem 0;
  color: var(--muted);
}

.prior-versions a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.release-date {
  font-size: 0.85em;
  color: var(--muted);
  margin-left: 0.4em;
}

.release-notes-inline {
  color: var(--muted);
  font-style: italic;
}

.footnote-ref {
  font-size: 0.75em;
  line-height: 0;
}

.footnote-ref a {
  color: var(--footnote-link);
  text-decoration: none;
  padding: 0 0.1em;
}

.footnote-ref a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.margin-note {
  float: right;
  clear: right;
  width: 220px;
  margin-right: -240px;
  margin-top: 0.2em;
  margin-bottom: 0.5em;
  font-size: 0.8em;
  line-height: 1.4;
  color: var(--margin-note-fg);
  font-style: italic;
}

.margin-note .margin-note-ref {
  margin-right: 0.25em;
  font-style: normal;
  color: var(--margin-note-ref-fg);
}

.margin-note .math-inline {
  white-space: nowrap;
  display: inline-block;
}

.margin-note iframe {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  margin-top: 0.5em;
  border: 0;
}

.margin-note .youtube-wrap,
.margin-note .youtube-inner {
  width: 100%;
  max-width: 100%;
}

.footnotes { display: none; }
.footnotes ol { padding-left: 1.5em; }
.footnotes li {
  font-size: 0.9em;
  line-height: 1.5;
  margin-bottom: 0.5em;
  color: var(--footnote-fg);
}
.footnotes li:target { background: var(--footnote-target-bg); }
.footnote-backlink {
  text-decoration: none;
  color: var(--footnote-link);
  margin-left: 0.25em;
}

@media (max-width: 900px) {
  article {
    max-width: 680px;
    padding: 2rem 1.25rem 6rem 1.25rem;
  }
  .margin-note { display: none; }
  .footnotes { display: block; }
  .footnotes::before {
    content: "";
    display: block;
    border-top: 1px solid var(--rule);
    margin: 3em 0 1em;
  }
}

/* ---------- theme picker ---------- */

#theme-picker {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  font-family: var(--ui-font);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

#theme-picker button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#theme-picker button:hover {
  opacity: 1;
  color: var(--fg);
  border-color: var(--fg);
}

#theme-picker .theme-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  min-width: 9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  display: none;
}

#theme-picker.open .theme-menu { display: block; }

#theme-picker .theme-menu li {
  margin: 0;
  padding: 0;
}

#theme-picker .theme-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  opacity: 1;
  padding: 0.35rem 0.85rem;
  color: var(--muted);
}

#theme-picker .theme-menu button:hover {
  background: var(--code-bg);
  color: var(--fg);
}

#theme-picker .theme-menu button.active {
  color: var(--fg);
  font-weight: 600;
}

@media (max-width: 900px) {
  #theme-picker {
    top: 0.6rem;
    right: 0.6rem;
  }
}

/* ---------- themes ---------- */

[data-theme="light"] {
  --fg: #1a1a1a;
  --bg: #fbf8fb;
  --muted: #6a6a6a;
  --rule: #e0d4dd;
  --accent: #8a3a78;
  --code-bg: #f1ebef;
  --subtitle-fg: #555;
  --caption-fg: #555;
  --footnote-fg: #333;
  --footnote-target-bg: #f8e0ec;
  --footnote-link: #a07a96;
  --margin-note-fg: #555;
  --margin-note-ref-fg: #a07a96;
  --header-fg: #6a6a6a;
  --header-fg-hover: #1a1a1a;
}

[data-theme="dark"] {
  --fg: #e8dde8;
  --bg: #181420;
  --muted: #8b8290;
  --rule: #2e2638;
  --accent: #d88ac0;
  --code-bg: #221a2c;
  --subtitle-fg: #b8a8b8;
  --caption-fg: #9a90a0;
  --footnote-fg: #c8b8c4;
  --footnote-target-bg: #3a2842;
  --footnote-link: #7a6e80;
  --margin-note-fg: #a89aa8;
  --margin-note-ref-fg: #d88ac0;
  --header-fg: #8b8290;
  --header-fg-hover: #e8dde8;
}

[data-theme="dark"] .katex { color: inherit; }

[data-theme="solarized"] {
  --fg: #586e75;
  --bg: #fdf6e3;
  --muted: #93a1a1;
  --rule: #eee8d5;
  --accent: #268bd2;
  --code-bg: #eee8d5;
  --subtitle-fg: #657b83;
  --caption-fg: #657b83;
  --footnote-fg: #586e75;
  --footnote-target-bg: #f4e8b0;
  --footnote-link: #93a1a1;
  --margin-note-fg: #657b83;
  --margin-note-ref-fg: #93a1a1;
  --header-fg: #93a1a1;
  --header-fg-hover: #073642;
}

[data-theme="solarized"] article a {
  color: #268bd2;
  text-decoration-color: rgba(38,139,210,0.5);
}

[data-theme="terminal"] {
  --fg: #33ff66;
  --bg: #050a05;
  --muted: #4d9961;
  --rule: #1a3a1a;
  --accent: #aaffaa;
  --code-bg: #0a160a;
  --subtitle-fg: #66cc77;
  --caption-fg: #4d9961;
  --footnote-fg: #66cc77;
  --footnote-target-bg: #1a3a1a;
  --footnote-link: #4d9961;
  --margin-note-fg: #66cc77;
  --margin-note-ref-fg: #4d9961;
  --header-fg: #4d9961;
  --header-fg-hover: #aaffaa;
  --body-font: "SF Mono", "JetBrains Mono", "Fira Mono", Menlo, Consolas, monospace;
  --code-font: "SF Mono", "JetBrains Mono", "Fira Mono", Menlo, Consolas, monospace;
  --body-line-height: 1.55;
}

[data-theme="terminal"] body {
  text-shadow: 0 0 1px rgba(51,255,102,0.35);
}

[data-theme="terminal"] body::before {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0) 0px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.18) 3px,
      rgba(0,0,0,0) 4px
    ),
    radial-gradient(
      ellipse at center,
      rgba(0,0,0,0) 55%,
      rgba(0,0,0,0.55) 100%
    );
}

[data-theme="terminal"] .katex { color: inherit; }

[data-theme="newspaper"] {
  --fg: #18181a;
  --bg: #f3eee2;
  --muted: #5a564c;
  --rule: #c8c1ac;
  --accent: #18181a;
  --code-bg: #e6dfca;
  --subtitle-fg: #3a362c;
  --caption-fg: #5a564c;
  --footnote-fg: #2a2620;
  --footnote-target-bg: #ddd2a8;
  --footnote-link: #6a665c;
  --margin-note-fg: #3a362c;
  --margin-note-ref-fg: #6a665c;
  --header-fg: #5a564c;
  --header-fg-hover: #18181a;
  --body-font: "Old Standard TT", "Hoefler Text", Georgia, "Times New Roman", serif;
  --body-line-height: 1.55;
}

[data-theme="newspaper"] body::before {
  background-image:
    radial-gradient(circle at 23% 17%, rgba(60,40,20,0.05) 0.6px, transparent 1.3px),
    radial-gradient(circle at 71% 63%, rgba(60,40,20,0.04) 0.5px, transparent 1.2px),
    radial-gradient(circle at 47% 88%, rgba(60,40,20,0.05) 0.7px, transparent 1.4px);
  background-size: 7px 7px, 11px 11px, 13px 13px;
}

[data-theme="newspaper"] article h1 {
  font-weight: 700;
  letter-spacing: -0.015em;
}

[data-theme="newspaper"] article h2 {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.25rem;
}

[data-theme="paper-lined"] {
  --fg: #1c2440;
  --bg: #fbf9f1;
  --muted: #6c7088;
  --rule: #b8d4e8;
  --accent: #c14242;
  --code-bg: #f0ecdf;
  --subtitle-fg: #4a4f6b;
  --caption-fg: #6c7088;
  --footnote-fg: #1c2440;
  --footnote-target-bg: #fce8a0;
  --footnote-link: #8a8fa6;
  --margin-note-fg: #4a4f6b;
  --margin-note-ref-fg: #c14242;
  --header-fg: #6c7088;
  --header-fg-hover: #1c2440;
}

[data-theme="paper-lined"] body::before {
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0,
      rgba(0,0,0,0) 31px,
      rgba(120,170,200,0.35) 31px,
      rgba(120,170,200,0.35) 32px
    ),
    linear-gradient(
      to right,
      rgba(0,0,0,0) calc(50% - 360px),
      rgba(193,66,66,0.35) calc(50% - 360px),
      rgba(193,66,66,0.35) calc(50% - 359px),
      rgba(0,0,0,0) calc(50% - 359px)
    );
}

@media (max-width: 900px) {
  [data-theme="paper-lined"] body::before {
    background-image:
      repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0) 0,
        rgba(0,0,0,0) 31px,
        rgba(120,170,200,0.35) 31px,
        rgba(120,170,200,0.35) 32px
      );
  }
}

[data-theme="tufte"] {
  --fg: #111111;
  --bg: #fffff8;
  --muted: #6a6a6a;
  --rule: #cfcabf;
  --accent: #a01c1c;
  --code-bg: #f3f1e8;
  --subtitle-fg: #404040;
  --caption-fg: #555;
  --footnote-fg: #2a2a2a;
  --footnote-target-bg: #fff0b8;
  --footnote-link: #888;
  --margin-note-fg: #444;
  --margin-note-ref-fg: #a01c1c;
  --header-fg: #6a6a6a;
  --header-fg-hover: #111;
  --body-font: et-book, "Iowan Old Style", Palatino, "Hoefler Text", Georgia, serif;
  --body-line-height: 1.7;
}

[data-theme="tufte"] article h1,
[data-theme="tufte"] article h2,
[data-theme="tufte"] article h3 {
  font-weight: 400;
  font-style: italic;
}

[data-theme="tufte"] article a {
  color: var(--fg);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
}

[data-theme="tufte"] .footnote-ref a,
[data-theme="tufte"] .margin-note-ref {
  color: var(--accent);
}

[data-theme="dusk-rose"] {
  --fg: #3a2030;
  --bg: #faecef;
  --muted: #8a6478;
  --rule: #e8c8d4;
  --accent: #b8527a;
  --code-bg: #f3dde2;
  --subtitle-fg: #6a4055;
  --caption-fg: #8a6478;
  --footnote-fg: #4a2838;
  --footnote-target-bg: #f0c0c8;
  --footnote-link: #a07088;
  --margin-note-fg: #6a4055;
  --margin-note-ref-fg: #b8527a;
  --header-fg: #8a6478;
  --header-fg-hover: #3a2030;
  --body-font: "Iowan Old Style", Charter, Palatino, "Hoefler Text", Georgia, serif;
}

[data-theme="dusk-rose"] body::before {
  background: linear-gradient(
    160deg,
    rgba(255, 220, 230, 0.0) 0%,
    rgba(255, 200, 220, 0.18) 40%,
    rgba(220, 160, 190, 0.30) 100%
  );
}

[data-theme="dusk-rose"] article h1 {
  color: var(--accent);
  font-weight: 500;
}

[data-theme="dusk-rose"] article h2,
[data-theme="dusk-rose"] article h3 {
  color: #6a2848;
}

[data-theme="dusk-rose"] article a {
  color: #6a2848;
  text-decoration-color: var(--accent);
}

[data-theme="synthwave"] {
  --fg: #f5e8ff;
  --bg: #0f0a1f;
  --muted: #b08fd8;
  --rule: #4a2a6a;
  --accent: #ff5cb0;
  --code-bg: #1a0f2e;
  --subtitle-fg: #d8c0f0;
  --caption-fg: #b08fd8;
  --footnote-fg: #d8c0f0;
  --footnote-target-bg: #3a1a5a;
  --footnote-link: #8a6ab0;
  --margin-note-fg: #c0a8e0;
  --margin-note-ref-fg: #ff5cb0;
  --header-fg: #b08fd8;
  --header-fg-hover: #ff5cb0;
}

[data-theme="synthwave"] body::before {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,92,176,0.04) 0px,
      rgba(255,92,176,0.04) 1px,
      transparent 1px,
      transparent 80px
    ),
    linear-gradient(
      180deg,
      #0f0a1f 0%,
      #1a0d2e 40%,
      #2a0f3e 75%,
      #3a1450 100%
    );
}

[data-theme="synthwave"] article h1 {
  color: #ff5cb0;
  text-shadow: 0 0 12px rgba(255,92,176,0.4);
}

[data-theme="synthwave"] article h2,
[data-theme="synthwave"] article h3 {
  color: #6cd9ff;
}

[data-theme="synthwave"] article a {
  color: #6cd9ff;
  text-decoration-color: rgba(108,217,255,0.6);
}

[data-theme="synthwave"] article a:hover {
  text-shadow: 0 0 8px rgba(108,217,255,0.5);
}

[data-theme="synthwave"] article blockquote {
  border-left-color: var(--accent);
}

[data-theme="synthwave"] .katex { color: inherit; }

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

.soundtrack-player {
  margin: 1.5rem 0;
  padding: 0.9rem 1rem 0.8rem;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--ui-font);
  font-size: 0.95rem;
}

.soundtrack-player .sp-now-playing {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.soundtrack-player .sp-track-num {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.soundtrack-player .sp-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  line-height: 1.25;
}

.soundtrack-player .sp-row-main .sp-song {
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.soundtrack-player .sp-row-main .sp-source {
  color: var(--muted);
  font-size: 0.82em;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.soundtrack-player .sp-row-main .sp-source:empty {
  display: none;
}

.soundtrack-player .sp-now-playing .sp-usage {
  color: var(--muted);
  font-size: 0.85em;
  font-style: italic;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.soundtrack-player .sp-now-playing .sp-usage:empty {
  display: none;
}

.soundtrack-player .sp-scrubber {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

.soundtrack-player .sp-progress {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0;
}

.soundtrack-player .sp-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.soundtrack-player .sp-progress::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.soundtrack-player .sp-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.soundtrack-player .sp-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.soundtrack-player .sp-controls button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--fg);
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.soundtrack-player .sp-controls button:hover {
  color: var(--accent);
  border-color: var(--rule);
}

.soundtrack-player .sp-controls button svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

.soundtrack-player .sp-play {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  padding: 0.3rem 0.7rem !important;
}

.soundtrack-player .sp-play:hover {
  filter: brightness(1.1);
}

.soundtrack-player .sp-shuffle {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.soundtrack-player .sp-shuffle::before {
  content: "⇄";
  margin-right: 0.35em;
  font-size: 1.05em;
}

.soundtrack-player .sp-shuffle.active {
  color: var(--accent);
  border-color: var(--accent);
}

.soundtrack-player .sp-tracklist {
  margin-top: 0.7rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.55rem;
}

.soundtrack-player .sp-tracklist summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 0.85rem;
  display: inline-block;
}

.soundtrack-player .sp-tracklist summary::-webkit-details-marker { display: none; }

.soundtrack-player .sp-tracklist summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1em;
  font-size: 0.85em;
}

.soundtrack-player .sp-tracklist[open] summary::before { content: "▾ "; }

.soundtrack-player .sp-tracklist summary:hover { color: var(--fg); }

.soundtrack-player .sp-tracklist ol {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 18rem;
  overflow-y: auto;
}

.soundtrack-player .sp-tracklist li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.3;
  transition: background 0.12s ease;
}

.soundtrack-player .sp-tracklist li:hover {
  background: var(--rule);
}

.soundtrack-player .sp-tracklist li.playing {
  color: var(--accent);
  font-weight: 500;
}

.soundtrack-player .sp-tracklist li .sp-num {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
  width: 1.6em;
  flex-shrink: 0;
}

.soundtrack-player .sp-tracklist li.playing .sp-num {
  color: var(--accent);
}

.soundtrack-player .sp-tracklist li .sp-usage {
  color: var(--muted);
  font-size: 0.82em;
  font-style: italic;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.soundtrack-player .sp-tracklist li.playing .sp-usage {
  color: var(--accent);
  opacity: 0.85;
}

.soundtrack-player .sp-tracklist li .sp-dur {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
  flex-shrink: 0;
  width: 2.6em;
  text-align: right;
}

.soundtrack-player .sp-tracklist li.playing .sp-dur {
  color: var(--accent);
}

@media (max-width: 600px) {
  .soundtrack-player .sp-now-playing {
    flex-wrap: wrap;
  }
}
