:root {
  --bg: #faf6f0;
  --ink: #1a1714;
  --muted: #6b5d50;
  --line: #e8dfd2;
  --accent: #8a3a2a;
  --accent-soft: #f3e6dc;
  --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 8px 24px -12px rgba(80,40,10,0.18);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110e;
    --ink: #f1ebe1;
    --muted: #a59581;
    --line: #2a241d;
    --accent: #e0a07a;
    --accent-soft: #2a1c14;
    --shadow: 0 1px 0 rgba(0,0,0,0.3), 0 8px 24px -12px rgba(0,0,0,0.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

main, .hdr, .ftr { max-width: 720px; margin: 0 auto; padding: 0 18px; }

.hdr { padding-top: 28px; padding-bottom: 8px; }
h1 {
  font: 600 32px/1.1 "New York", "Iowan Old Style", Georgia, serif;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

.toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.t {
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.t[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.part { margin: 28px 0; }
.part-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h2 {
  font: 600 14px/1 -apple-system, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.part-head h2 { margin-bottom: 0; }
.full-btn {
  font: inherit;
  font-size: 13px;
  padding: 9px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.full-btn:active { transform: scale(0.98); }
.full-btn.playing { background: var(--accent-soft); color: var(--accent); }

.lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.line {
  display: grid;
  grid-template-columns: 28px 1fr 32px;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  -webkit-user-select: none;
  user-select: none;
}
.line:active { transform: scale(0.995); }
.line.static { cursor: default; grid-template-columns: 28px 1fr; }
.line.static:active { transform: none; }

.line.playing {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}
.line.playing .play { color: var(--accent); }

.num {
  color: var(--muted);
  font: 500 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  padding-top: 4px;
}
.body { min-width: 0; }
.ar {
  font: 500 19px/1.55 "New York", "Iowan Old Style", Georgia, serif;
  letter-spacing: -0.005em;
  color: var(--ink);
  word-wrap: break-word;
}
.half {
  display: inline;
  padding: 2px 4px;
  margin: -2px -2px;
  border-radius: 6px;
  background: linear-gradient(180deg, transparent 60%, var(--accent-soft) 60%);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.half:active { background: var(--accent-soft); }
.half.playing {
  background: var(--accent);
  color: var(--bg);
}
.ph-half { transition: color 0.15s, background 0.15s; padding: 1px 3px; border-radius: 4px; }
.ph-half.playing { background: var(--accent-soft); color: var(--accent); }

.tip {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  font-style: italic;
}
.tip-half {
  background: linear-gradient(180deg, transparent 60%, var(--accent-soft) 60%);
  padding: 1px 4px;
  border-radius: 4px;
  font-style: normal;
  color: var(--ink);
}
.ph {
  margin-top: 6px;
  font: 400 14px/1.45 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  letter-spacing: 0;
}
.en {
  margin-top: 6px;
  font: 400 14px/1.45 -apple-system, system-ui, sans-serif;
  color: var(--muted);
  font-style: italic;
}
.hint {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  font-style: italic;
}
.play {
  font-size: 18px;
  color: var(--muted);
  text-align: center;
  padding-top: 4px;
  transition: color 0.15s;
}

body.hide-phonetic .ph { display: none; }
body.hide-english .en { display: none; }
body.big .ar { font-size: 22px; }
body.big .ph { font-size: 16px; }
body.big .en { font-size: 16px; }

.note {
  margin-top: 16px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border-left: 2px solid var(--line);
  font-style: italic;
}

.ftr {
  padding: 24px 18px 32px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

#player { display: none; }
