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

:root {
  --bg:        #0d0d1a;
  --surface:   #16162a;
  --surface2:  #22223a;
  --surface3:  #2e2e50;
  --accent:    #f0a500;
  --accent-lo: rgba(240, 165, 0, 0.12);
  --danger:    #e05252;
  --text:      #e8e8f2;
  --muted:     #6e6e90;
  --radius:    14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ── Page layout: [ad] [center] [ad] ─────────────────── */
.page-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  overflow: hidden;
}

/* Sidebar ad slots — vertically centered in viewport */
.ad-slot {
  width: 160px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: max(1rem, calc(50vh - 300px));
}

.ad-placeholder {
  background: var(--surface2);
  border: 1px dashed var(--surface3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.8;
}

.ad-placeholder.skyscraper { width: 160px; height: 600px; }
.ad-placeholder.banner      { width: 320px; height: 100px; }

/* Ad slots hidden until activated */
.ad-slot,
.ad-banner-mobile,
.ad-banner-top-mobile { display: none; }

@media (max-width: 520px) {
  /* Hide "Setlist" text, keep only the icon so the title fits */
  .btn-setlist-text       { display: none; }
  .btn-open-setlist-label { width: 26px; padding: 0; }

  /* Subdivision label above buttons */
  .subdivision    { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .subdiv-buttons { width: 100%; flex-wrap: wrap; }
  .subdiv-btn     { flex: 1 1 calc(50% - 0.2rem); }
}

/* Hide everything outside the metronome in fullscreen */
.is-fullscreen .ad-slot,
.is-fullscreen .ad-banner-mobile,
.is-fullscreen .ad-banner-top-mobile,
.is-fullscreen .seo-section,
.is-fullscreen .site-footer { display: none !important; }

/* ── App shell ───────────────────────────────────────── */
.app {
  width: 600px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 24px;
  padding: 2rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
}

/* ── Title row ───────────────────────────────────────── */
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  gap: 0.5rem;
}

.title {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Shared icon button (fullscreen + setlist open) */
.btn-icon {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--surface3);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

.btn-open-setlist-label {
  width: auto;
  padding: 0 0.6rem;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-family: inherit;
}

#btn-fullscreen   { position: absolute; right: 0; }
#btn-open-setlist { position: absolute; left: 0; }

/* ── Beat header (dots + accent toggle) ──────────────── */
.beat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.beat-indicators {
  display: flex;
  gap: 12px;
  align-items: center;
}

.beat-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--surface3);
  transition: background 0.06s ease, transform 0.06s ease, box-shadow 0.06s ease;
}

.beat-dot.accent {
  border-color: var(--accent);
}

.beat-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
  box-shadow: 0 0 14px rgba(240, 165, 0, 0.7);
}

/* ── Accent toggle ───────────────────────────────────── */
.accent-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
  user-select: none;
}

.accent-toggle:hover { color: var(--text); }

/* ── Switch (shared by accent + automation toggles) ──── */
input[type="checkbox"].hidden-check,
.accent-toggle input[type="checkbox"],
.automation-header input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch {
  display: inline-block;
  flex-shrink: 0;
  width: 34px;
  height: 20px;
  background: var(--surface3);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s, box-shadow 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  top: 3px;
  left: 3px;
  transition: transform 0.2s, background 0.2s;
}

input[type="checkbox"]:checked + .switch {
  background: var(--accent-lo);
  box-shadow: inset 0 0 0 1px var(--accent);
}

input[type="checkbox"]:checked + .switch::after {
  transform: translateX(14px);
  background: var(--accent);
}

/* ── Tempo display ───────────────────────────────────── */
.tempo-display {
  text-align: center;
  line-height: 1;
  width: 100%;
}

.tempo-name {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  min-height: 1em;
}

.bpm-display {
  font-size: 6.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: color 0.15s;
  display: inline-block;
}

.bpm-display:hover {
  color: var(--accent);
}

.bpm-display:active {
  opacity: 0.7;
}

.bpm-label {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ── Shared range slider ─────────────────────────────── */
.range-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(240, 165, 0, 0.5);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(240, 165, 0, 0.5);
}

/* ── BPM controls ────────────────────────────────────── */
.bpm-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.btn-adjust {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--surface3);
  background: var(--surface2);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  touch-action: none;
}

.btn-adjust:hover  { border-color: var(--accent); }
.btn-adjust:active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* ── Time signature ──────────────────────────────────── */
.time-signature {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.section-label {
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.ts-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.ts-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 2px solid var(--surface3);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.ts-btn:hover          { border-color: var(--accent); color: var(--text); }
.ts-btn.active         { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); font-weight: 600; }

/* ── Subdivision ─────────────────────────────────────── */
.subdivision {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--surface2);
}

.subdiv-buttons {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.subdiv-btn {
  flex: 1;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.subdiv-btn:hover  { border-color: var(--accent); color: var(--text); }
.subdiv-btn.active { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); font-weight: 600; }

/* ── Tempo automation ────────────────────────────────── */
.automation {
  width: 100%;
  border: 1px solid var(--surface3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.automation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.auto-settings {
  display: none;
}

.auto-settings.visible {
  display: block;
}

/* 2×2 grid */
.auto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auto-cell {
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 10px;
  padding: 0.55rem 0.75rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.auto-cell-label {
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.auto-cell input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  outline: none;
  padding: 0;
  min-width: 0;
}

.auto-cell input::placeholder { color: var(--surface3); }

.auto-cell input:focus { color: var(--accent); }

.auto-cell-unit {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ── Action buttons ──────────────────────────────────── */
.actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn-tap {
  flex: 1;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius);
  border: 2px solid var(--surface3);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-tap:hover  { border-color: var(--muted); }
.btn-tap:active { transform: scale(0.96); background: var(--surface3); }

.btn-start {
  flex: 1.4;
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--accent);
  color: #0d0d1a;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-start:hover {
  background: #ffb820;
  box-shadow: 0 0 24px rgba(240, 165, 0, 0.35);
}

.btn-start.playing {
  background: var(--surface2);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-start.playing:hover {
  background: rgba(224, 82, 82, 0.1);
  box-shadow: 0 0 20px rgba(224, 82, 82, 0.2);
}

/* ── Stats display (inline under BPM digit) ──────────── */
.stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--surface3);
  width: 60%;
  margin-left: auto;
  margin-right: auto;
}

.stats.hidden { display: none; }

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--surface3);
}

/* ── Locked controls (automation running) ────────────── */
.btn-adjust:disabled,
.btn-tap:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.range-slider:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.bpm-display.locked {
  cursor: not-allowed;
  opacity: 0.6;
}

.bpm-display.locked:hover { color: var(--text); }

/* ── Setlist Modal ───────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--surface3);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface3);
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text);
}

.btn-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-modal-close:hover { border-color: var(--danger); color: var(--danger); }

/* Export / Import */
.io-wrap {
  position: relative;
  margin-left: auto;
  margin-right: 0.5rem;
}

.btn-io {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-io:hover { border-color: var(--accent); color: var(--accent); }

.io-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 10px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 300;
  min-width: 130px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.io-menu.hidden { display: none; }

.io-menu button {
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.io-menu button:hover { background: var(--surface3); }

/* Add form */
.setlist-add-form {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--surface3);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-shrink: 0;
}

.setlist-name-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  font-family: inherit;
}

.setlist-name-input:focus { border-color: var(--accent); }
.setlist-name-input::placeholder { color: var(--muted); }

.setlist-params {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.7rem;
  align-items: start;
}

.setlist-param-label {
  font-size: 0.63rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  padding-top: 0.38rem;
}

.setlist-num-input {
  width: 62px;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.4rem 0.3rem;
  outline: none;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.setlist-num-input:focus { border-color: var(--accent); }

.setlist-ts-btns,
.setlist-subdiv-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.setlist-ts-btn,
.setlist-subdiv-btn {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--surface3);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.setlist-ts-btn:hover,
.setlist-subdiv-btn:hover  { border-color: var(--accent); color: var(--text); }
.setlist-ts-btn.active,
.setlist-subdiv-btn.active { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); font-weight: 600; }

.btn-add-entry {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  align-self: flex-end;
  transition: background 0.15s;
}

.btn-add-entry:hover { background: #ffb820; }

/* Setlist section header (name above song list) */
.setlist-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem 0.45rem;
  border-bottom: 1px solid var(--surface2);
  flex-shrink: 0;
  min-height: 32px;
}

.setlist-section-name {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.setlist-section-name:hover { color: var(--text); }

.btn-rename-section {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s;
}

.btn-rename-section:hover { color: var(--accent); }

.setlist-section-rename-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-family: inherit;
  outline: none;
  padding: 0 0 2px;
  width: 100%;
}

.setlist-section-rename-input::placeholder { color: var(--muted); }

.btn-rename-confirm {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent-lo);
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-rename-confirm:hover { background: var(--accent); color: #fff; }

/* Entry list */
.setlist-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  min-height: 60px;
}

.setlist-empty {
  padding: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

.setlist-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--surface2);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.15s;
  user-select: none;
}

.setlist-entry:last-child { border-bottom: none; }
.setlist-entry:hover      { background: var(--surface2); }
.setlist-entry.active     { border-left-color: var(--accent); background: var(--accent-lo); }

.setlist-entry-name {
  flex: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.setlist-entry-meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-entry-delete {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  transition: all 0.15s;
}

.btn-entry-delete:hover { border-color: var(--danger); color: var(--danger); }

.btn-entry-edit {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  transition: all 0.15s;
}

.btn-entry-edit:hover { border-color: var(--accent); color: var(--accent); }

/* ── Inline entry edit form ───────────────────────────── */
.setlist-entry.entry-editing {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  cursor: default;
  background: var(--surface2);
  border-left-color: var(--accent);
}

.entry-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.entry-edit-name {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface3);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  outline: none;
  font-family: inherit;
}

.entry-edit-name:focus { border-color: var(--accent); }
.entry-edit-name::placeholder { color: var(--muted); }

.entry-edit-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.entry-edit-bpm {
  width: 56px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--surface3);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.35rem 0.25rem;
  outline: none;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.entry-edit-bpm:focus { border-color: var(--accent); }

.entry-edit-ts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.entry-edit-ts-btn {
  padding: 0.28rem 0.45rem;
  border-radius: 5px;
  border: 1px solid var(--surface3);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.entry-edit-ts-btn:hover,
.entry-edit-subdiv-btn:hover  { border-color: var(--accent); color: var(--text); }
.entry-edit-ts-btn.active,
.entry-edit-subdiv-btn.active { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); font-weight: 600; }

.entry-edit-subdiv {
  display: flex;
  gap: 3px;
}

.entry-edit-subdiv-btn {
  padding: 0.28rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--surface3);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  flex-shrink: 0;
}

.entry-edit-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.btn-entry-save {
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-entry-save:hover { background: #ffb820; }

.btn-entry-cancel {
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  border: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-entry-cancel:hover { border-color: var(--muted); color: var(--text); }

/* Modal footer */
.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--surface3);
  flex-shrink: 0;
}

.btn-delete-section {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s;
}

.btn-delete-section:hover { color: var(--danger); }

.delete-confirm-text {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-delete-cancel {
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-delete-cancel:hover { border-color: var(--muted); color: var(--text); }

.btn-delete-confirm {
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-delete-confirm:hover { background: rgba(224, 82, 82, 0.12); }

.btn-setlist-mode {
  width: 100%;
  padding: 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface3);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-setlist-mode:hover { border-color: var(--accent); color: var(--accent); }
.btn-setlist-mode:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Setlist Mode Overlay ─────────────────────────────── */
.setlist-mode-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.setlist-mode-overlay.hidden { display: none; }

.btn-exit-mode {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--surface3);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-exit-mode:hover { border-color: var(--danger); color: var(--danger); }

.btn-flash-toggle {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--surface3);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.8;
}

.btn-flash-toggle:hover  { opacity: 1; color: var(--text); border-color: var(--text); }
.btn-flash-toggle.active {
  border-color: var(--accent);
  background: var(--accent-lo);
  color: var(--accent);
  opacity: 1;
}


.setlist-mode-body {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 420px;
}

.setlist-mode-counter {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
}

.setlist-mode-name {
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-word;
}

.setlist-mode-bpm {
  font-size: clamp(4rem, 15vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.setlist-mode-ts {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -0.5rem;
}

#setlist-mode-indicators {
  justify-content: center;
  gap: 16px;
}

#setlist-mode-indicators .beat-dot {
  width: 22px;
  height: 22px;
}

.setlist-mode-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  width: 100%;
}

.btn-nav {
  flex: 1;
  padding: 0.8rem;
  border-radius: var(--radius);
  border: 2px solid var(--surface3);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-nav:disabled              { opacity: 0.25; cursor: not-allowed; }

.btn-start-setlist {
  flex: 1.5;
  padding: 0.8rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: var(--accent);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-start-setlist:hover   { background: #ffb820; box-shadow: 0 0 24px rgba(240,165,0,0.35); }
.btn-start-setlist.playing { background: var(--surface2); border-color: var(--danger); color: var(--danger); }
.btn-start-setlist.playing:hover { background: rgba(224,82,82,0.1); }

/* ── Keyboard hint ───────────────────────────────────── */
.keyboard-hint {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-align: center;
}

kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  border: 1px solid var(--surface3);
  border-radius: 4px;
  background: var(--surface2);
  font-size: 0.6rem;
  font-family: inherit;
}

/* ── Setlist Tabs ─────────────────────────────────────── */
.setlist-tabs-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--surface3);
  flex-shrink: 0;
}

.setlist-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.setlist-tabs::-webkit-scrollbar { display: none; }

.setlist-tab {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-right: 1px solid var(--surface3);
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
  position: relative;
}

.setlist-tab:hover  { background: var(--surface2); color: var(--text); }
.setlist-tab.active {
  background: var(--surface2);
  color: var(--accent);
}
.setlist-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.tab-name { cursor: pointer; }

.tab-rename-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
  outline: none;
  width: 80px;
  padding: 0;
}


.btn-tabs-scroll {
  flex-shrink: 0;
  width: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, background 0.1s;
}

.btn-tabs-scroll:hover:not(:disabled) { color: var(--accent); background: var(--surface2); }
.btn-tabs-scroll:disabled { opacity: 0.2; cursor: default; }
.btn-tabs-scroll.hidden   { display: none; }

.btn-new-setlist {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border: none;
  border-left: 1px solid var(--surface3);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.1s;
  font-family: inherit;
}

.btn-new-setlist:hover    { color: var(--accent); background: var(--surface2); }
.btn-new-setlist:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* ── Drag-and-drop ────────────────────────────────────── */
.drag-handle {
  color: var(--muted);
  font-size: 0.9rem;
  cursor: grab;
  flex-shrink: 0;
  opacity: 0.5;
  line-height: 1;
  padding-right: 2px;
}

.drag-handle:active { cursor: grabbing; }

.setlist-entry.dragging        { opacity: 0.35; }
.setlist-entry.drag-over-before { border-top: 2px solid var(--accent); }
.setlist-entry.drag-over-after  { border-bottom: 2px solid var(--accent); }

/* ── Playing entry ────────────────────────────────────── */
.setlist-entry.entry-playing {
  border-left-color: var(--accent);
  background: var(--accent-lo);
}

.btn-entry-stop {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-entry-stop:hover { background: rgba(224, 82, 82, 0.15); }

/* ── Language selector ───────────────────────────────── */
.lang-selector {
  display: flex;
  justify-content: center;
  margin-top: -0.25rem;
}

.lang-dropdown {
  position: relative;
}

.lang-current-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--surface3);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  outline: none;
}

.lang-current-btn:hover,
.lang-current-btn:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.lang-flag {
  width: 20px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.lang-chevron {
  opacity: 0.6;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.lang-current-btn[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

.lang-options {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 8px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  min-width: 130px;
}

.lang-options[hidden] { display: none; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.lang-option:hover   { background: var(--surface3); color: var(--text); }
.lang-option.active  { color: var(--accent); }

/* ── SEO section ─────────────────────────────────────── */
.seo-section {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.seo-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.seo-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
  margin-top: 1.5rem;
}

.seo-content p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.75;
  margin-bottom: 0.5rem;
}

.seo-content strong { color: var(--text); }

.seo-content kbd {
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.8em;
  font-family: inherit;
  color: var(--text);
}

/* ── Site footer ─────────────────────────────────────── */
.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem 2rem;
  border-top: 1px solid var(--surface2);
  color: var(--muted);
  font-size: 0.75rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover { color: var(--accent); }

/* ── Legal pages ─────────────────────────────────────── */
.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

.btn-back {
  align-self: flex-start;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.15s;
  padding: 0.3rem 0;
}

.btn-back:hover { color: var(--accent); }

.legal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.legal-card {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  flex: 1;
}

.legal-section {
  margin-bottom: 1.75rem;
}

.legal-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--surface2);
}

.legal-section p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.75;
  margin-bottom: 0.6rem;
}

.legal-section ul {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.75;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
}

.legal-section strong { color: var(--text); }

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover { text-decoration: underline; }

.legal-update {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
  text-align: right;
  margin-top: 2rem;
}
