:root {
  --bg: #ffffff;
  --alt: #f5f5f7;
  --ink: #1d1d1f;
  --sub: #515154;
  --line: #e3e3e8;
  --accent: #2f6fe4;
  --accent-hover: #2559c2;
  --button-hover: #2559c2;
  --accent-soft: #e3ecfd;
  --card: #ffffff;
  --header: rgba(255, 255, 255, 0.9);
  --thumb: #ffffff;
  --ring: rgba(0, 0, 0, 0.06);
  --shade: rgba(30, 40, 60, 0.18);
  --video-bg: #f0f2f6;
  --ok: #1a7f45;
  --warn: #8a5a00;
  color-scheme: light;
  --radius: 16px;
  --wrap: 1120px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

/* Dark: follows the OS unless the visitor picked one with the header button (same as the app's Appearance setting) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #1b1c1f;
  --alt: #232428;
  --card: #2a2c31;
  --ink: #e8e9ec;
  --sub: #9ba1ab;
  --line: #34363c;
  --accent: #4d8af0;
  --accent-hover: #6a9ef3;
  --button-hover: #3b78e0;
  --accent-soft: #24324d;
  --header: rgba(27, 28, 31, 0.88);
  --thumb: #3a3c42;
  --ring: rgba(255, 255, 255, 0.08);
  --shade: rgba(0, 0, 0, 0.5);
  --video-bg: #26282d;
  --ok: #4cc27f;
  --warn: #f0c46a;
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c1f;
  --alt: #232428;
  --card: #2a2c31;
  --ink: #e8e9ec;
  --sub: #9ba1ab;
  --line: #34363c;
  --accent: #4d8af0;
  --accent-hover: #6a9ef3;
  --button-hover: #3b78e0;
  --accent-soft: #24324d;
  --header: rgba(27, 28, 31, 0.88);
  --thumb: #3a3c42;
  --ring: rgba(255, 255, 255, 0.08);
  --shade: rgba(0, 0, 0, 0.5);
  --video-bg: #26282d;
  --ok: #4cc27f;
  --warn: #f0c46a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
html:lang(en) body { line-height: 1.6; }
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 700; text-wrap: balance; font-feature-settings: "palt" 1; }
/* Japanese headings break only at spaces and <wbr> (otherwise "データ / ベース" on phones) */
html:lang(ja) h1, html:lang(ja) h2, html:lang(ja) .feature h3 { word-break: keep-all; overflow-wrap: break-word; }
p { text-wrap: pretty; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
:target { scroll-margin-top: 80px; }
[hidden] { display: none !important; }
code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.88em;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--alt);
  overflow-wrap: anywhere;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand:hover { color: var(--ink); }
.brand img { width: 28px; height: 28px; }
.site-nav { display: flex; align-items: center; gap: 24px; margin-left: auto; font-size: 15px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sub);
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}
.icon-btn:hover { background: var(--alt); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .sun { display: block; } :root:not([data-theme="light"]) .theme-toggle .moon { display: none; } }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
.site-nav a { color: var(--sub); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.site-nav a.button, .site-nav a.button:hover { color: #fff; }
@media (max-width: 760px) { .site-nav .opt { display: none; } }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms;
}
.button:hover { background: var(--button-hover); color: #fff; }
.button.small { min-height: 36px; padding: 0 16px; font-size: 14px; }
.button.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px currentColor; }
.button.ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }
.button svg { width: 18px; height: 18px; }

/* Hero */
.hero { padding: 80px 0 0; text-align: center; overflow: hidden; }
.hero .icon { width: 88px; height: 88px; margin: 0 auto 24px; }
.hero h1 { font-size: clamp(32px, 5.2vw, 56px); line-height: 1.3; letter-spacing: -0.01em; }
.hero h1 .nb { display: inline-block; }
html:lang(en) .hero h1 { line-height: 1.15; letter-spacing: -0.02em; }
.hero .lead { max-width: 36em; margin: 24px auto 0; font-size: 19px; color: var(--sub); }
.hero .cta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px 24px; margin-top: 32px; }
.hero .meta { margin-top: 16px; font-size: 14px; color: var(--sub); }
.hero .stage { margin-top: 56px; }

.seg {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--alt);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg button {
  position: relative;
  z-index: 1;
  min-width: 128px;
  min-height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: color 200ms;
}
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg .thumb {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 2);
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  transform: translateX(calc(var(--pos, 0) * 100%));
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.seg-note { margin-top: 16px; font-size: 15px; color: var(--sub); min-height: 1.8em; }

.window {
  position: relative;
  max-width: 1040px;
  margin: 32px auto 0;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--ring), 0 24px 64px var(--shade);
  background: var(--card);
}
.window img { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 400ms; }
.window[data-mode="ipod"] .rb, .window[data-mode="rockbox"] .os { opacity: 0; }
@media (max-width: 760px) {
  .hero { padding-top: 48px; }
  .hero .icon { width: 72px; height: 72px; }
  .hero .lead { font-size: 17px; }
  .seg button { min-width: 0; }
  .window { border-radius: 8px; }
}
@media (max-width: 400px) {
  .hero h1 { font-size: 28px; }
}

/* Sections */
.section { padding: 112px 0; }
.section.alt { background: var(--alt); }
.section-head { text-align: center; max-width: 760px; margin: 0 auto 56px; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.35; }
html:lang(en) .section-head h2 { line-height: 1.2; }
.section-head p { margin-top: 16px; color: var(--sub); font-size: 18px; }
@media (max-width: 760px) {
  .section { padding: 72px 0; }
  .section-head { margin-bottom: 40px; }
}

.video {
  max-width: 1040px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--ring), 0 16px 48px var(--shade);
}
.video video { width: 100%; aspect-ratio: 16 / 9; background: var(--video-bg); }

/* Feature grid: heading, short text, screenshot */
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.feature {
  display: flex;
  flex-direction: column;
  padding: 40px 40px 0;
  border-radius: var(--radius);
  background: var(--alt);
  overflow: hidden;
}
.section.alt .feature { background: var(--card); }
.feature h3 { font-size: 24px; line-height: 1.4; }
.feature p { margin-top: 12px; color: var(--sub); }
.feature .shot { margin-top: auto; padding-top: 32px; margin-right: -40px; }
.feature .shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 0 0; border-radius: 8px 0 0 0; box-shadow: 0 0 0 1px var(--ring), 0 8px 32px var(--shade); }
.feature.wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 40px; align-items: center; padding: 48px 0 48px 48px; }
.feature.wide .shot { margin: 0; padding: 0; }
.feature.wide .shot img { border-radius: 8px 0 0 8px; }
.yomi-eg { margin-top: 16px; font-size: 22px; font-weight: 700; }
.yomi-eg span { color: var(--accent); }
@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; gap: 24px; }
  .feature { padding: 32px 24px 0; }
  .feature .shot { margin-right: -24px; }
  .feature.wide { display: flex; padding: 32px 0 0 24px; gap: 0; }
  .feature.wide .shot { padding-top: 32px; }
  .feature.wide > div:first-child { padding-right: 24px; }
}

/* Small features: plain list in columns */
.more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; margin-top: 80px; }
.more h3 { font-size: 18px; line-height: 1.5; }
.more p { margin-top: 8px; color: var(--sub); font-size: 16px; }
@media (max-width: 860px) { .more { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; } }
@media (max-width: 560px) { .more { grid-template-columns: 1fr; margin-top: 56px; } }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--card); box-shadow: 0 0 0 1px var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 16px 24px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { font-size: 14px; color: var(--sub); font-weight: 700; background: var(--alt); }
tbody th { font-weight: 700; white-space: nowrap; }
.compare td { width: 40%; }
.compare tbody th { width: 20%; }
.models td { white-space: nowrap; width: 1%; }
.models tbody th { white-space: normal; }
.yes, .no, .part { font-weight: 700; }
.yes { color: var(--ok); }
.part { color: var(--warn); }
.no { color: var(--sub); font-weight: 400; }
td small { display: block; color: var(--sub); font-size: 14px; font-weight: 400; white-space: normal; }
.notes { margin-top: 32px; padding-left: 1.2em; color: var(--sub); font-size: 16px; }
.notes li + li { margin-top: 8px; }
@media (max-width: 640px) {
  th, td { padding: 12px 16px; font-size: 15px; }
  .compare, .compare thead, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: auto; }
  .compare thead { display: none; }
  .compare tbody th { width: auto; padding-top: 8px; padding-bottom: 8px; border-bottom: 0; background: var(--alt); white-space: normal; }
  .compare td { border-bottom: 0; padding-top: 8px; padding-bottom: 8px; }
  .compare td::before { content: attr(data-label); display: block; font-size: 13px; font-weight: 700; color: var(--sub); }
  .compare tr { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .compare tbody tr:last-child { border-bottom: 0; }
  /* Supported iPods: one block per model, the two modes side by side under the name */
  .models, .models tbody, .models th, .models td { display: block; width: auto; }
  .models thead { display: none; }
  .models tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; padding: 16px; border-bottom: 1px solid var(--line); }
  .models tbody tr:last-child { border-bottom: 0; }
  .models tbody th { grid-column: 1 / -1; padding: 0 0 8px; border-bottom: 0; }
  .models td { padding: 0; border-bottom: 0; white-space: normal; }
  .models td::before { content: attr(data-label); display: block; font-size: 13px; font-weight: 700; color: var(--sub); }
}

/* Download */
.downloads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.dl {
  display: flex;
  flex-direction: column;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line);
}
.dl.current { box-shadow: 0 0 0 2px var(--accent); }
.dl h3 { font-size: 22px; }
.dl .req { margin-top: 4px; font-size: 14px; color: var(--sub); }
.dl .buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dl .first { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); line-height: 1.7; }
.release { margin-top: 32px; text-align: center; font-size: 15px; color: var(--sub); }
@media (max-width: 860px) { .downloads { grid-template-columns: 1fr; } }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 18px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 24px; line-height: 1.2; color: var(--sub); font-weight: 400; transition: transform 200ms; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 0 24px; color: var(--sub); }
.faq .answer > * + * { margin-top: 12px; }
.faq .answer ul, .faq .answer ol { padding-left: 1.4em; }
.faq .answer li + li { margin-top: 4px; }

/* Footer */
.site-footer { padding: 48px 0 64px; background: var(--alt); font-size: 14px; color: var(--sub); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 24px; padding: 0; list-style: none; }
.site-footer .links a { color: var(--ink); text-decoration: none; }
.site-footer .links a:hover { text-decoration: underline; }
.site-footer p + p { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0ms !important; }
}

/* Support: Ko-fi panel */
.support .wrap { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 64px; align-items: center; }
.support h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.35; }
.support-text p { margin-top: 16px; max-width: 32em; color: var(--sub); font-size: 18px; }
.support-text p.small { font-size: 15px; }
.kofi iframe { display: block; width: 100%; max-width: 440px; height: 620px; margin: 0 auto; border: 0; background: transparent; }
@media (max-width: 860px) {
  .support .wrap { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 480px) {
  .site-header .wrap { padding: 0 16px; }
  .site-nav { gap: 16px; }
  .site-nav .lang { display: none; }
}
