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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --primary: #e94560;
  --primary-hover: #c73a52;
  --text: #eee;
  --text-muted: #999;
  --border: #333;
  --success: #4ecca3;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

/* Screens */
.screen {
  display: none;
  min-height: 100dvh;
  padding: 1rem;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1.3rem;
  min-width: 120px;
}

.btn-small {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn-stepper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-stepper:active { background: var(--border); }

/* Inputs */
input[type="password"],
select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
}

select {
  max-width: 100%;
}

.input-measure {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 6px;
  width: 60px;
  text-align: center;
  -moz-appearance: textfield;
}
.input-measure::-webkit-inner-spin-button,
.input-measure::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* Player layout */
#screen-player {
  padding: 0;
}

#screen-player header {
  background: var(--surface);
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
#screen-player header h1 {
  font-size: 1.3rem;
}

.control-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.control-section > label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* Track checkboxes */
#track-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

/* Loop controls */
.loop-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#total-measures-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Tempo controls */
.tempo-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

#tempo-display {
  font-size: 1.3rem;
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

/* Playback section */
.playback-section {
  padding: 1.5rem 1rem;
  text-align: center;
}

.measure-display {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.playback-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Footer */
footer {
  padding: 1rem;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
footer a {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Utilities */
.hidden { display: none !important; }
.error { color: var(--primary); font-size: 0.9rem; }

/* Loading */
#loading-indicator {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
