/* sPlayer marketing site — self-contained, no external fonts or scripts.
   Palette is sampled from the app icon: magenta #e373f2 → violet #9c6df3 → blue #4c96f6 */

:root {
  --brand-1: #e373f2;
  --brand-2: #9c6df3;
  --brand-3: #4c96f6;
  --brand-gradient: linear-gradient(135deg, var(--brand-1), var(--brand-2) 45%, var(--brand-3));

  --bg: #ffffff;
  --bg-elevated: #f6f5fb;
  --bg-sunken: #efedf7;
  --text: #17151f;
  --text-dim: #5d5872;
  --border: #e3e0ee;
  --accent: #7c4ddb;
  --shadow: 0 18px 50px -20px rgba(70, 40, 130, 0.35);
  --radius: 18px;
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0b14;
    --bg-elevated: #17141f;
    --bg-sunken: #120f1a;
    --text: #f4f2fa;
    --text-dim: #a49fba;
    --border: #2a2536;
    --accent: #c39bff;
    --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
  }
}

/* The viewer's theme toggle stamps data-theme on :root and must win both ways. */
:root[data-theme="light"] {
  --bg: #ffffff; --bg-elevated: #f6f5fb; --bg-sunken: #efedf7;
  --text: #17151f; --text-dim: #5d5872; --border: #e3e0ee; --accent: #7c4ddb;
  --shadow: 0 18px 50px -20px rgba(70, 40, 130, 0.35);
}
:root[data-theme="dark"] {
  --bg: #0d0b14; --bg-elevated: #17141f; --bg-sunken: #120f1a;
  --text: #f4f2fa; --text-dim: #a49fba; --border: #2a2536; --accent: #c39bff;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  /* `max()` keeps the 24px gutter normally and widens it only where a notch or a
     rounded corner would otherwise crowd the text — landscape on an iPhone. */
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 1em; }

.muted { color: var(--text-dim); }

/* ---------- Header ---------- */

header.site {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex; align-items: center; gap: 16px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
header.site nav { margin-left: auto; display: flex; gap: 22px; font-size: 0.94rem; }
header.site nav a { color: var(--text-dim); }
header.site nav a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 560px) {
  header.site nav { gap: 14px; font-size: 0.86rem; }

  /* Block axis only. The horizontal gutter belongs to `.wrap`, which this element also
     carries — setting it here would override that and is exactly how the text came to
     touch both edges in the first place. */
  .doc { padding-top: 36px; padding-bottom: 56px; }
  .doc h2 { margin-top: 36px; }
  .doc .updated { margin-bottom: 28px; }

  /* The callout's own padding stacks on top of the page gutter, which left its text
     noticeably narrower than everything around it. */
  .callout { padding: 14px 16px; margin: 22px 0; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  text-align: center;
  padding: 84px 0 72px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: -40% 50% auto; left: 50%;
  transform: translateX(-50%);
  width: min(760px, 120vw); height: 760px;
  background: var(--brand-gradient);
  filter: blur(110px);
  opacity: 0.22;
  border-radius: 50%;
  pointer-events: none;
}
@media (prefers-color-scheme: dark) { .hero::before { opacity: 0.30; } }

.hero > * { position: relative; }

.app-icon {
  width: 132px; height: 132px;
  border-radius: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 26px;
}

.tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.28rem);
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 auto 32px;
}

.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cta-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; align-items: center;
}

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600; font-size: 1rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 10px 26px -10px var(--brand-2);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.hero-meta {
  margin-top: 22px;
  font-size: 0.9rem;
  color: var(--text-dim);
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Sections ---------- */

section { padding: 68px 0; }
section.alt { background: var(--bg-sunken); border-block: 1px solid var(--border); }

.section-head { max-width: 660px; margin-bottom: 44px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head p { color: var(--text-dim); margin-bottom: 0; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---------- Feature grid ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--text-dim); font-size: 0.96rem; margin-bottom: 0; }

.icon-tile {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--brand-gradient);
  margin-bottom: 16px;
}
.icon-tile svg { width: 21px; height: 21px; stroke: #fff; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Split feature rows ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  align-items: center;
}
.split + .split { margin-top: 72px; }
.split.reverse .split-visual { order: -1; }
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; gap: 30px; }
  .split.reverse .split-visual { order: 0; }
}

.split ul { margin: 0; padding-left: 1.1em; color: var(--text-dim); }
.split li { margin-bottom: 0.5em; }
.split li strong { color: var(--text); font-weight: 620; }

/* A framed code/terminal-ish panel used to show file layouts */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.panel pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre;
}
.panel .hl { color: var(--accent); font-weight: 600; }
.panel .dir { color: var(--text); font-weight: 600; }

/* Phone-ish mock frame for the lyrics/player illustration */
.phone {
  margin: 0 auto;
  width: min(280px, 78vw);
  aspect-ratio: 9 / 14;
  border-radius: 38px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.phone .art {
  border-radius: 14px;
  background: var(--brand-gradient);
  aspect-ratio: 1;
  display: grid; place-items: center;
  margin-bottom: 14px;
  flex: none;
}
.phone .art svg { width: 46%; height: 46%; fill: rgba(255,255,255,0.9); }
.phone .lyric { font-size: 0.82rem; text-align: center; margin-bottom: 5px; color: var(--text-dim); }
.phone .lyric.active { color: var(--text); font-weight: 650; }
.phone .bar { margin-top: auto; height: 4px; border-radius: 4px; background: var(--border); position: relative; }
.phone .bar::after {
  content: ""; position: absolute; inset: 0 42% 0 0;
  border-radius: 4px; background: var(--brand-gradient);
}
.phone .controls { display: flex; justify-content: center; gap: 22px; margin-top: 16px; }
.phone .controls span { width: 0; height: 0; border-style: solid; }

/* ---------- Language chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.94rem;
  color: var(--text-dim);
}

/* ---------- Spec table ---------- */

.spec-table-wrap { overflow-x: auto; }
table.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.spec th, table.spec td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.spec th {
  width: 210px;
  font-weight: 620;
  color: var(--text);
  white-space: nowrap;
}
table.spec td { color: var(--text-dim); }
table.spec tr:last-child th, table.spec tr:last-child td { border-bottom: none; }

/* ---------- Doc pages (privacy / support) ---------- */

/* `.doc` shares its element with `.wrap` (<main class="wrap doc">), so a `padding`
   shorthand here would reset the horizontal padding `.wrap` sets and run the text into
   both edges on a phone. Only the block axis belongs to this rule. */
.doc { padding-top: 56px; padding-bottom: 80px; max-width: 760px; }
.doc h1 { font-size: clamp(2rem, 5vw, 2.7rem); margin-bottom: 8px; }
.doc .updated { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 40px; }
.doc h2 { margin-top: 44px; font-size: 1.4rem; }
.doc h3 { margin-top: 30px; }
.doc ul { padding-left: 1.2em; color: var(--text-dim); }
.doc li { margin-bottom: 0.5em; }
.doc li strong, .doc p strong { color: var(--text); font-weight: 620; }
.doc p { color: var(--text-dim); }
.doc .lead { font-size: 1.08rem; color: var(--text); }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: 0 12px 12px 0;
  padding: 16px 20px;
  margin: 26px 0;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 0.7em; }

details.faq {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  padding: 0 20px;
  margin-bottom: 12px;
}
details.faq summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 620;
  color: var(--text);
  list-style: none;
  display: flex; align-items: center; gap: 10px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  flex: none;
}
details.faq[open] summary::before { content: "\2212"; }
details.faq > *:not(summary) { padding-bottom: 4px; }
details.faq p, details.faq ul { color: var(--text-dim); font-size: 0.96rem; }
details.faq code, .doc code, .card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ---------- Footer ---------- */

footer.site {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
footer.site nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 20px; }

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
