/* Beatmaker — dark studio theme, mobile-first. */
:root {
  --bg: #0c0e12;
  --panel: #14171e;
  --panel2: #1a1e27;
  --line: #262c38;
  --text: #e9ebf1;
  --muted: #9aa3b2;
  --accent: #8b7cff;
  --accent-ink: #14101f;
  --danger: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent); }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.logo { font-size: 20px; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.main-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.main-nav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px;
}
.main-nav a:hover { color: var(--text); background: var(--panel2); }
.credits-chip {
  font-size: 13px; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; white-space: nowrap;
}
.credits-chip button { background: none; border: 0; color: var(--accent); padding: 0; font-size: 13px; }

/* Hero */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.02em; margin-bottom: 8px; }
.hero .lede { color: var(--muted); font-size: 17px; max-width: 720px; }
.hero .lede strong { color: var(--text); }

/* Tool */
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.play-btn {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  font-weight: 700; padding: 10px 22px; font-size: 16px;
}
.play-btn.playing { background: var(--danger); color: #2a0d0d; }
.transport-ctl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.transport-ctl input[type="range"] { width: 110px; accent-color: var(--accent); }
.transport-val { color: var(--text); font-variant-numeric: tabular-nums; min-width: 40px; }
.ghost-btn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 8px 12px; font-size: 14px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }

.genre-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px;
}
.pill.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--panel2)); }
.template-info { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.template-info .chords { color: var(--text); }

.grid { overflow-x: auto; padding-bottom: 4px; }
.lane-row {
  display: grid; grid-template-columns: 148px minmax(480px, 1fr);
  gap: 8px; align-items: center; margin-bottom: 4px; min-width: 640px;
}
.lane-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lane-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.note-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.lane-ctl { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.mini-btn {
  width: 22px; height: 22px; padding: 0; font-size: 11px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted); border-radius: 5px;
}
.mini-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vol { width: 56px; accent-color: var(--accent); }
.cells { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.cell {
  aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: 4px;
  background: #232833; transition: background 0.08s;
}
.cell:hover { background: #2e3542; }
.cell.beat { box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.18); }
.cell.on { background: var(--accent); }
.cell.on.roll { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 4px, #6a5ae0 4px, #6a5ae0 8px); }
.cell.mel { background: #1d2230; }
.cell.mel.on { background: #4ade80; }
.cell.now { outline: 2px solid #fff; outline-offset: -1px; }
.melody-head { display: flex; gap: 12px; align-items: baseline; margin: 14px 0 6px; }
.melody-head span:first-child { font-weight: 700; }
.melody-head .hint { color: var(--muted); font-size: 13px; }
.grid-hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* Export bar */
.export-bar { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.export-bar h2 { font-size: 17px; margin-bottom: 4px; }
.export-note { color: var(--muted); font-size: 14px; }
.export-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.btn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  border-radius: 9px; padding: 10px 16px; font-size: 15px; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.export-status { color: var(--muted); font-size: 14px; min-height: 1.4em; margin: 0; }

/* Content sections */
.section { padding: 24px 0; }
.section h2 { font-size: 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 17px; }
.card p { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.card .price { font-size: 18px; font-weight: 700; color: var(--text); }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.muted { color: var(--muted); }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--muted); margin: 8px 0 0; }

table.price-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.price-table th, .price-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.price-table th { color: var(--muted); font-weight: 600; }
.price-table tr:last-child td { border-bottom: 0; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: flex-start; justify-content: center; padding: 24px 16px;
  background: rgba(0, 0, 0, 0.65);
}
.modal.open { display: flex; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-width: 520px; width: 100%; padding: 20px; margin-top: 8vh; }
.modal-box h2 { margin-bottom: 8px; }
.modal-close { float: right; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; }
.pack-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.modal-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 32px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: nowrap; gap: 10px; }
  .logo { flex-shrink: 0; }
  .main-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { padding: 6px 8px; white-space: nowrap; }
  .credits-chip { display: none; }
  .lane-row { grid-template-columns: 92px minmax(440px, 1fr); min-width: 548px; }
  .lane-head { flex-direction: column; align-items: flex-start; gap: 3px; }
  .lane-ctl { margin-left: 0; }
  .vol { width: 64px; }
  .transport-ctl input[type="range"] { width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
