/* Piano Rush websites (player: web/player, admin: web/admin): the shared night-purple brand theme
   (pink / cyan / gold accents). Site-only rules live in each site's own stylesheet. */
:root {
  --bg0: #0d0620;
  --bg1: #14092b;
  --bg2: #22113f;
  --bg3: #2d1657;
  --pink: #ff4fa3;
  --pink2: #ff7cbd;
  --cyan: #3fe0ff;
  --gold: #ffc94a;
  --red: #ff4d5e;
  --green: #3fe08c;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --faint: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.12);
  --line2: rgba(255, 255, 255, 0.2);
  --field: rgba(10, 4, 26, 0.6);
  --card: rgba(45, 22, 87, 0.55);
  --radius: 20px;
  --radius-sm: 12px;
  --gutter: 16px;
  --font: 'Fredoka', 'Segoe UI', 'Trebuchet MS', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Luckiest Guy', 'Fredoka', 'Arial Black', 'Segoe UI Black', Impact, system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'Consolas', 'SFMono-Regular', 'Menlo', monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg1);
  background-image:
    radial-gradient(900px 520px at 8% -8%, rgba(255, 79, 163, 0.22), transparent 60%),
    radial-gradient(800px 520px at 100% 6%, rgba(63, 224, 255, 0.16), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(255, 201, 74, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 55%, var(--bg1) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }

[hidden] { display: none !important; }

a { color: var(--cyan); }

h1, h2, h3 { margin: 0; line-height: 1.15; }

p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 14px; border-radius: 10px;
  background: var(--gold); color: #1a0b33; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ------------------------------------------------------------------ header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(20, 9, 43, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { height: 46px; width: auto; filter: drop-shadow(0 4px 14px rgba(255, 79, 163, 0.35)); }
.brand-sub {
  font-weight: 600; font-size: 14px; color: var(--muted);
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap;
}
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.status {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 4px 4px 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
.status[data-state="ok"] .status-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.status[data-state="dry"] .status-dot { background: #a99bd6; }
.status[data-state="error"] .status-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.status[data-state="busy"] .status-dot { background: var(--cyan); animation: pulse 0.9s ease-in-out infinite alternate; }
.status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.target-badge {
  font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(63, 224, 255, 0.16); color: var(--cyan); border: 1px solid rgba(63, 224, 255, 0.4);
}
.target-badge.live {
  background: linear-gradient(90deg, rgba(255, 201, 74, 0.25), rgba(255, 77, 94, 0.3));
  color: var(--gold); border-color: rgba(255, 201, 74, 0.6);
  box-shadow: 0 0 12px rgba(255, 77, 94, 0.35);
}
.status-check {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line2);
}
.status-check:hover { background: rgba(255, 255, 255, 0.16); }
.status-check:disabled { opacity: 0.6; cursor: progress; }

.lang { display: flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.lang button {
  font: inherit; font-weight: 700; font-size: 13px; color: var(--muted);
  min-width: 38px; padding: 4px 8px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--pink); color: #fff; box-shadow: 0 2px 10px rgba(255, 79, 163, 0.45); }

@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

/* ------------------------------------------------------------------ layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter) 40px; }

.hero { text-align: center; padding: 34px 0 22px; }
.hero-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(34px, 7vw, 56px); letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff 0%, #ffe3f2 45%, var(--pink2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(13, 6, 32, 0.9)) drop-shadow(0 0 22px rgba(255, 79, 163, 0.35));
}
.hero-text { margin: 10px auto 0; max-width: 620px; color: var(--muted); font-size: 17px; }
.status-line {
  display: inline-block; margin-top: 14px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 77, 94, 0.14); border: 1px solid rgba(255, 77, 94, 0.45); color: #ffd0d5; font-weight: 500;
}

.card {
  position: relative;
  margin-top: 18px; padding: 22px;
  background: linear-gradient(180deg, rgba(53, 27, 102, 0.6), rgba(34, 17, 63, 0.66));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(5, 1, 18, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.step-head h2 { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: 0.03em; }
.step-num {
  flex: none; width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 20px; color: #1a0b33;
  background: linear-gradient(135deg, var(--gold), var(--pink));
  box-shadow: 0 4px 14px rgba(255, 79, 163, 0.4);
}
.busy { display: inline-flex; align-items: center; gap: 8px; color: var(--cyan); font-weight: 500; font-size: 14px; margin-left: auto; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(63, 224, 255, 0.3); border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ buttons */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.08);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: inherit; font-weight: 600; font-size: 16px; line-height: 1.1; color: var(--text);
  border-radius: 14px; border: 1px solid transparent; background: var(--btn-bg);
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #ff6db3, var(--pink));
  box-shadow: 0 6px 20px rgba(255, 79, 163, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 0 rgba(120, 0, 60, 0.35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(255, 79, 163, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-gold {
  color: #2a1300;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  box-shadow: 0 6px 20px rgba(255, 201, 74, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-danger {
  background: linear-gradient(180deg, #ff6b78, #e8283c);
  box-shadow: 0 6px 22px rgba(255, 59, 78, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  letter-spacing: 0.03em;
}
.btn-ghost { background: rgba(255, 255, 255, 0.06); border-color: var(--line2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 11px; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 18px; border-radius: 16px; }

/* ------------------------------------------------------------------ drop zone */
.drop {
  position: relative;
  border: 2px dashed rgba(63, 224, 255, 0.4);
  border-radius: 18px;
  background: rgba(10, 4, 26, 0.35);
  padding: 26px 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.drop.dragging {
  border-color: var(--pink);
  background: rgba(255, 79, 163, 0.1);
  box-shadow: 0 0 0 6px rgba(255, 79, 163, 0.12), inset 0 0 40px rgba(255, 79, 163, 0.15);
}
.drop.has-file { border-style: solid; border-color: rgba(63, 224, 255, 0.35); padding: 14px; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-icon { width: 56px; height: 56px; color: var(--cyan); filter: drop-shadow(0 0 12px rgba(63, 224, 255, 0.5)); }
.drop-title { font-size: 20px; font-weight: 600; }
.drop-or { color: var(--faint); font-size: 14px; }
.drop-hint { color: var(--faint); font-size: 14px; margin-top: 4px; }
.file-chip { display: flex; align-items: center; gap: 12px; text-align: left; flex-wrap: wrap; }
.file-icon {
  width: 44px; height: 44px; padding: 10px; border-radius: 12px; flex: none;
  color: #1a0b33; background: linear-gradient(135deg, var(--cyan), #a78bff);
}
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-size { color: var(--faint); font-size: 14px; }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; gap: 16px 20px; }
  .span-2 { grid-column: span 2; }
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
fieldset.field { border: 0; padding: 0; }
.field > label, .label-row label, legend { font-weight: 600; font-size: 15px; }
legend { padding: 0; margin-bottom: 6px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.req { color: var(--pink); }
.opt { color: var(--faint); font-weight: 400; font-size: 13px; }
.counter { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--red); font-weight: 600; }
.help { color: var(--faint); font-size: 13.5px; }
.field-error { color: #ff9aa5; font-size: 14px; font-weight: 500; }
.field-note { color: var(--gold); font-size: 13.5px; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; min-height: 46px;
  font: inherit; font-size: 16px; color: var(--text);
  padding: 10px 14px;
  background: var(--field);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 64px; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select option { background: var(--bg2); color: var(--text); }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.32); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(63, 224, 255, 0.25);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 77, 94, 0.2); }
.mono { font-family: var(--mono) !important; letter-spacing: 0.02em; }
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.35); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  min-height: 36px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.4); color: var(--text); }
.chip[aria-pressed="true"] {
  color: #fff; border-color: var(--pink);
  background: linear-gradient(180deg, rgba(255, 79, 163, 0.45), rgba(255, 79, 163, 0.25));
  box-shadow: 0 0 12px rgba(255, 79, 163, 0.3);
}
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

/* composer picker (Classical): a searchable list of the game's composers + "new composer" */
.combo { position: relative; }
.combo-input {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.combo-input.is-new { color: var(--cyan); font-weight: 600; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 300px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(5, 1, 18, 0.65);
}
.combo-list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 500;
}
.combo-list li:hover { background: rgba(255, 255, 255, 0.07); }
.combo-list li.active { background: linear-gradient(180deg, rgba(255, 79, 163, 0.4), rgba(255, 79, 163, 0.24)); }
.combo-list .combo-key { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
.combo-list .combo-new { color: var(--cyan); font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 10px 10px; }
.combo-list .combo-empty { color: var(--faint); cursor: default; }
.combo-list .combo-empty:hover { background: none; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--pink); flex: none; cursor: pointer; }
.checks { justify-content: center; gap: 2px; }

.mini-title { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 10px 0 8px; }
.track-list { display: grid; gap: 6px; }
.track {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(10, 4, 26, 0.4); border: 1px solid var(--line);
  font-size: 14px;
}
.track.is-melody { border-color: rgba(255, 79, 163, 0.55); background: rgba(255, 79, 163, 0.08); }
.track-name { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.track-name strong { font-weight: 600; overflow-wrap: anywhere; }
.track-idx { color: var(--faint); font-variant-numeric: tabular-nums; }
.track-count, .track-range { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.badge-melody { background: var(--pink); color: #fff; }

/* ------------------------------------------------------------------ result */
.placeholder { color: var(--faint); padding: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  padding: 14px 16px; border-radius: 16px;
  background: rgba(10, 4, 26, 0.42); border: 1px solid var(--line);
  min-width: 0;
}
.stat-label { font-size: 13px; color: var(--faint); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.stat-wide { grid-column: 1 / -1; }
.tier-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; margin-top: 4px;
  font-weight: 700; font-size: 17px; color: #fff; white-space: nowrap;
  background: var(--tier, #3498db);
  box-shadow: 0 0 14px color-mix(in srgb, var(--tier, #3498db) 60%, transparent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.tier-pill .stars { letter-spacing: 1px; font-size: 13px; opacity: 0.9; }
.tier-pill.on-light { color: #2a1300; text-shadow: none; }
.fid { display: flex; align-items: flex-start; gap: 10px; }
.fid-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; color: #08130d; }
.fid-ok .fid-icon { background: var(--green); box-shadow: 0 0 12px rgba(63, 224, 140, 0.6); }
.fid-fail .fid-icon { background: var(--red); color: #fff; box-shadow: 0 0 12px rgba(255, 77, 94, 0.6); }
.fid-ok .fid-title { color: var(--green); font-weight: 700; }
.fid-fail .fid-title { color: #ff8a96; font-weight: 700; }
.fid ul { margin: 6px 0 0; padding-left: 18px; color: #ffc2c8; }

.plan {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 12px; padding: 12px 16px; border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 4, 26, 0.42);
}
.plan-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; }
.plan.free .plan-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.plan.composer .plan-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.plan.too-long .plan-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.plan-title { font-size: 13px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.plan-main { font-weight: 600; }
.plan.composer .plan-main { color: var(--gold); }
.plan.too-long .plan-main { color: #ff8a96; }
.plan-sub { color: var(--muted); font-size: 14px; }

.warnings { margin-top: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 201, 74, 0.08); border: 1px solid rgba(255, 201, 74, 0.35); }
.warnings h3 { font-size: 14px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.warnings ul { margin: 0; padding-left: 18px; color: #ffe7b0; font-size: 14.5px; }

.conv-error { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: rgba(255, 77, 94, 0.12); border: 1px solid rgba(255, 77, 94, 0.45); }
.conv-error .x { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-weight: 700; }
.conv-error strong { display: block; font-size: 17px; }
.conv-error p { color: #ffd0d5; }
.conv-error .hint { color: var(--muted); font-size: 14px; margin-top: 4px; }

.msg { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-weight: 500; }
.msg-error { background: rgba(255, 77, 94, 0.13); border: 1px solid rgba(255, 77, 94, 0.45); color: #ffd6da; }
.msg-error ul { margin: 6px 0 0; padding-left: 20px; }

/* ------------------------------------------------------------------ preview */
.preview { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 760px) {
  .preview { grid-template-columns: minmax(280px, 360px) 1fr; gap: 24px; }
}
.board-wrap {
  position: relative; width: 100%; max-width: 380px; margin: 0 auto;
  aspect-ratio: 9 / 14; max-height: 72vh;
  border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(63, 224, 255, 0.3);
  box-shadow: 0 0 0 4px rgba(13, 6, 32, 0.6), 0 16px 40px rgba(5, 1, 18, 0.6), 0 0 40px rgba(255, 79, 163, 0.18);
  background: #140a2c;
}
@media (max-width: 759px) {
  .board-wrap { aspect-ratio: auto; height: min(68vh, 560px); max-height: none; }
}
.board { width: 100%; height: 100%; touch-action: manipulation; }
.board-play {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, #ff6db3, var(--pink));
  box-shadow: 0 0 0 8px rgba(255, 79, 163, 0.18), 0 10px 30px rgba(255, 79, 163, 0.55);
  display: grid; place-items: center;
  transition: transform 0.12s ease;
}
.board-play:hover { transform: translate(-50%, -50%) scale(1.05); }
.board-play svg { width: 36px; height: 36px; margin-left: 4px; }
.preview-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.transport { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-play { min-width: 150px; }
.btn-play .i-pause { display: none; }
.btn-play.playing .i-play { display: none; }
.btn-play.playing .i-pause { display: block; }
.seek-row { display: flex; flex-direction: column; gap: 4px; }
.times { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
#tNow { color: var(--text); }
.volume-row { display: flex; align-items: center; gap: 12px; }
.vol-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; flex: none; }
.vol-label svg { width: 20px; height: 20px; color: var(--cyan); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--gold)) 0 / var(--fill) 100% no-repeat, rgba(255, 255, 255, 0.14);
}
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--pink), var(--gold)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%; margin-top: -6px;
  background: #fff; border: 3px solid var(--pink); box-shadow: 0 0 10px rgba(255, 79, 163, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--pink); box-shadow: 0 0 10px rgba(255, 79, 163, 0.6);
}
input[type="range"]:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
input[type="range"]:disabled { opacity: 0.4; cursor: not-allowed; }

.loadbar .bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.loadbar .bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width 0.15s; }
.loadbar p { margin-top: 6px; font-size: 14px; color: var(--muted); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 16px; height: 22px; border-radius: 5px; flex: none; }
.sw-single { background: linear-gradient(180deg, #24173f, #05030b); border: 1.5px solid var(--cyan); }
.sw-long { height: 30px; background: linear-gradient(180deg, #3b1e72, #06030e); border: 1.5px solid var(--pink); }
.sw-double { width: 26px; background: linear-gradient(90deg, #120a24 0 40%, transparent 40% 60%, #120a24 60%); border: 1.5px solid var(--gold); }
.sw-svg { flex: none; }
.sw-rest { background: rgba(255, 255, 255, 0.05); border: 1.5px dashed rgba(255, 255, 255, 0.35); }

/* ------------------------------------------------------------------ send (both sites) */
.lead { color: var(--muted); margin-bottom: 16px; }
.lead strong { color: var(--text); }
.warn-line { color: var(--gold); font-weight: 600; font-size: 14px; }
.warn-line::before { content: '⚠ '; }
.advanced summary { cursor: pointer; color: var(--muted); font-weight: 600; width: fit-content; padding: 4px 0; }
.advanced[open] summary { margin-bottom: 4px; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.action-note { color: var(--faint); font-size: 14px; }
.json { text-align: left; margin-top: 14px; }
.json summary { cursor: pointer; font-weight: 600; color: var(--cyan); }
.json pre {
  margin: 8px 0 0; padding: 12px; border-radius: 12px; max-height: 240px; overflow: auto;
  background: rgba(5, 2, 14, 0.7); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.45; color: #cfe9ff;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.failure {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; border-radius: 16px;
  background: rgba(255, 77, 94, 0.12); border: 1px solid rgba(255, 77, 94, 0.5);
}
.failure .x { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-weight: 700; }
.failure strong { display: block; font-size: 17px; }
.failure p { color: #ffd6da; }
.failure .detail { color: var(--faint); font-size: 13px; margin-top: 6px; font-family: var(--mono); overflow-wrap: anywhere; }
.failure ul { margin: 6px 0 0; padding-left: 18px; color: #ffd6da; }
.info-line { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: rgba(63, 224, 255, 0.1); border: 1px solid rgba(63, 224, 255, 0.4); color: #cff6ff; }
.ok-line { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: rgba(63, 224, 140, 0.12); border: 1px solid rgba(63, 224, 140, 0.5); color: #c9ffe2; font-weight: 600; }
@media (max-width: 640px) {
  .actions .btn-lg { width: 100%; }
}

/* ------------------------------------------------------------------ footer, toast */
.foot { text-align: center; color: var(--faint); font-size: 13px; padding: 10px var(--gutter) 40px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: rgba(34, 17, 63, 0.96); border: 1px solid var(--line2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); font-weight: 500;
}
.toast.ok { border-color: rgba(63, 224, 140, 0.6); }
.toast.error { border-color: rgba(255, 77, 94, 0.7); }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner {
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    grid-template-areas: "brand lang" "status status";
    padding: 8px var(--gutter);
  }
  .top-actions { display: contents; }
  .brand { grid-area: brand; }
  .lang { grid-area: lang; align-self: center; }
  .status { grid-area: status; }
  .status-text { flex: 1 1 auto; max-width: none; }
  .brand-logo { height: 40px; }
  .brand-sub { display: none; }
  .card { padding: 18px 14px; border-radius: 18px; }
  .step-head h2 { font-size: 22px; }
  .stat-value { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .track { grid-template-columns: auto 1fr; gap: 2px 12px; }
  .track-name { grid-column: 1 / -1; }
  .track-count, .track-range { font-size: 13px; }
  .hero { padding: 24px 0 14px; }
  .hero-text { font-size: 16px; }
}
@media (max-width: 359px) {
  .status-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ preview song card */
.now {
  padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 79, 163, 0.14), rgba(63, 224, 255, 0.08));
  border: 1px solid var(--line2);
}
.now-title { display: flex; flex-direction: column; min-width: 0; }
.now-name { font-family: var(--display); font-size: 24px; letter-spacing: 0.02em; line-height: 1.1; overflow-wrap: anywhere; }
.now-artist { color: var(--muted); font-weight: 500; }
.now-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.now-meta .tier-pill { margin-top: 0; font-size: 14px; padding: 2px 10px; }
@media (max-width: 759px) {
  /* Phones: the transport right under the board, the song card after it. */
  .preview-side .now { order: 3; }
  .preview-side .legend, .preview-side > .help { order: 4; }
}

/* ------------------------------------------------------------------ Duo view (2026-10-09)
   The song dealt as Duo mode deals it: one piano hand per board, the two boards side by side
   under one clock (workbench.js renderDuoView; the admin Songs tab uses the same pieces). */
.duo-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 600; }
.duo-toggle svg { width: 20px; height: 20px; flex: none; }
.duo-info {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px;
  margin: -4px 0 16px; padding: 8px 14px; border-radius: 12px;
  background: rgba(63, 224, 255, 0.08); border: 1px solid rgba(63, 224, 255, 0.3);
  color: var(--muted); font-size: 14px;
}
.duo-info strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.duo-info.is-error { background: rgba(255, 201, 74, 0.08); border-color: rgba(255, 201, 74, 0.35); color: #ffe7b0; }
.boards { position: relative; min-width: 0; }
.board-col { min-width: 0; }
.board-cap { display: flex; flex-direction: column; align-items: center; margin: 0 0 8px; text-align: center; line-height: 1.2; min-width: 0; }
.board-cap strong { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.board-cap strong::before { content: ''; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--cap); box-shadow: 0 0 8px var(--cap); }
.board-cap span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.cap-left { --cap: var(--cyan); }
.cap-right { --cap: var(--pink); }
.is-duo .boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.is-duo .boards .board-wrap { max-width: none; }
.is-duo .lg-rest { display: none; }
@media (min-width: 760px) {
  .is-duo .preview { grid-template-columns: minmax(0, 3fr) minmax(240px, 2fr); }
}
@media (max-width: 759px) {
  .is-duo .boards .board-wrap { height: min(60vh, 480px); }
}
