@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  font-family: "Oswald", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #1a1a1a, #050505 68%);
  min-height: 100%;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  color: #f1f3f5;
  background: radial-gradient(circle at 20% 20%, rgba(54, 54, 54, 0.45) 0, rgba(12, 12, 12, 0) 50%),
    radial-gradient(circle at 80% 10%, rgba(76, 76, 76, 0.3) 0, rgba(10, 10, 10, 0) 45%),
    #060608;
}

.card {
  background: linear-gradient(135deg, rgba(35, 35, 40, 0.92), rgba(18, 18, 22, 0.96));
  backdrop-filter: blur(14px);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: clamp(1.6rem, 2.5vw, 3.2rem);
  width: 100%;
  min-height: calc(100vh - 4rem);
  box-shadow: 0 40px 100px -45px rgba(0, 0, 0, 0.85), inset 0 0 35px rgba(255, 255, 255, 0.02);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.5rem, 2vw, 2.75rem);
  align-content: start;
}

.card h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fefaf6;
  text-shadow: 0 0 18px rgba(255, 102, 0, 0.35), 0 3px 8px rgba(0, 0, 0, 0.85);
}

.tempo-display {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.35rem;
  font-size: clamp(3.2rem, 8vw, 3.8rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 1.2rem;
  color: #f0f4f8;
  text-shadow: 0 0 12px rgba(255, 94, 0, 0.25);
}

.tempo-display span {
  font-size: clamp(0.85rem, 2vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
}

.slider-group {
  margin-bottom: 1.5rem;
}

.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.72);
}

input[type="range"] {
  width: 100%;
  accent-color: #f15524;
}

.tempo-fine-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0.35rem;
}

.tempo-fine-controls button {
  border-radius: 999px;
  border: 1px solid rgba(255, 102, 0, 0.25);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 102, 0, 0.15);
  color: #ffd7c2;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.tempo-fine-controls button:active {
  transform: translateY(1px);
  background: rgba(255, 102, 0, 0.35);
}

.tempo-fine-controls input {
  flex: 1;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(18, 18, 24, 0.85);
  color: #f8f9fa;
}

.tempo-fine-controls input:focus {
  outline: 2px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.card h1,
.tempo-display,
.slider-group,
.controls,
.advanced-controls,
.visualizer,
.subdivision-visualizer,
.measure-counter,
.training-controls {
  grid-column: 1 / -1;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.audio-routing {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: rgba(24, 24, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.3);
}

.audio-routing label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.68);
}

.audio-routing-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.audio-routing select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 26, 0.85);
  color: #f8f9fa;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35);
}

.audio-routing button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(56, 56, 64, 0.95), rgba(32, 32, 40, 0.95));
  color: #f1f3f5;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.audio-routing button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.audio-routing .hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.06em;
  margin: 0;
}

.audio-routing.is-hidden {
  display: none;
}

.controls button,
.controls select {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.1rem;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.controls button.primary {
  background: linear-gradient(135deg, #ff521b, #ff914d);
  color: #fff8f2;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
}

.controls button.secondary {
  background: linear-gradient(135deg, rgba(56, 56, 64, 0.95), rgba(32, 32, 40, 0.95));
  color: #f1f3f5;
}

.controls select {
  background: rgba(22, 22, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8f9fa;
  cursor: pointer;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35);
}

.controls button:active,
.controls select:focus {
  transform: translateY(1px);
  box-shadow: none;
  outline: 2px solid rgba(255, 90, 20, 0.45);
  outline-offset: 2px;
}

.accordion {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(24, 24, 28, 0.92), rgba(16, 16, 20, 0.92));
  box-shadow: 0 26px 60px -38px rgba(0, 0, 0, 0.75);
  padding: 0;
  overflow: hidden;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f8f9fb;
  position: relative;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion-indicator {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 81, 28, 0.6);
  position: relative;
  box-shadow: 0 0 12px rgba(255, 102, 0, 0.35);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.accordion-indicator::after {
  content: "";
  position: absolute;
  inset: 0.2rem;
  border-radius: 50%;
  background: rgba(255, 81, 28, 0.65);
  transform: scale(0);
  transition: transform 0.25s ease;
}

.accordion[open] .accordion-indicator {
  transform: rotate(90deg);
}

.accordion[open] .accordion-indicator::after {
  transform: scale(1);
}

.accordion-content {
  padding: 1.4rem 1.4rem 1.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem;
  background: linear-gradient(140deg, rgba(19, 19, 23, 0.85), rgba(12, 12, 16, 0.9));
}

.advanced-controls .accordion-content,
.training-controls .accordion-content {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.control-block.wide {
  grid-column: 1 / -1;
}

.sound-balance {
  gap: 0.9rem;
}

.sound-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1.25rem;
}

.sound-settings input[type="range"] {
  width: 100%;
  margin: 0;
}

.tempo-dynamics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.tempo-dynamics-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.72);
}

.tempo-dynamics-grid input,
.tempo-dynamics-grid select {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.add-segment-button {
  align-self: stretch;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ff5722, #ff6f3c);
  color: #fffaf5;
  box-shadow: 0 12px 26px -16px rgba(255, 87, 34, 0.6);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.add-segment-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.tempo-sequence-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tempo-sequence-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(30, 30, 36, 0.85), rgba(20, 20, 26, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 15px 30px -20px rgba(0, 0, 0, 0.75);
}

.tempo-sequence-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tempo-sequence-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f3f4f6;
}

.tempo-sequence-meta {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
}

.tempo-sequence-buttons {
  display: flex;
  gap: 0.45rem;
}

.icon-button {
  border: 1px solid rgba(255, 90, 20, 0.35);
  background: rgba(255, 90, 20, 0.12);
  color: #ffa67a;
  border-radius: 50%;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.icon-button:hover {
  background: rgba(255, 90, 20, 0.22);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.icon-button.danger {
  border-color: rgba(220, 53, 69, 0.35);
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.tempo-sequence-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end;
}

.tempo-sequence-actions .secondary {
  border-radius: 12px;
  border: 1px solid rgba(220, 53, 69, 0.35);
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.tempo-sequence-actions .secondary:active {
  transform: translateY(1px);
}

.tempo-sequence-actions .secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(206, 212, 218, 0.3);
  border-color: rgba(206, 212, 218, 0.6);
  color: #868e96;
}

.empty-state {
  margin: 0;
  font-size: 0.8rem;
  color: #868e96;
  letter-spacing: 0.05em;
}

.full-width-panels {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  grid-column: 1 / -1;
}

.rhythm-content {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.8rem;
}

.rhythm-section {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1f2933;
}

.polyrhythm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.polyrhythm-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.72);
}

.polyrhythm-grid input,
.polyrhythm-grid select {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.add-polyr-button {
  align-self: stretch;
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ff512f, #dd2476);
  color: #fff4ef;
  box-shadow: 0 12px 26px -16px rgba(221, 36, 118, 0.6);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.add-polyr-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.polyrhythm-layers {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.polyr-layer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(32, 32, 38, 0.85), rgba(18, 18, 22, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 35px -22px rgba(0, 0, 0, 0.75);
}

.polyr-layer-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f3f4f6;
  letter-spacing: 0.06em;
}

.polyr-layer-actions {
  display: flex;
  gap: 0.4rem;
}

.polyrhythm-visualizer {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.polyr-layer-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.polyr-layer-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

.polyr-layer-visual {
  display: flex;
  gap: 0.35rem;
}

.polyr-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 90, 20, 0.28);
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.polyr-dot.is-on,
.polyr-dot.active {
  background: rgba(255, 90, 20, 0.75);
  opacity: 1;
  box-shadow: 0 0 12px rgba(255, 90, 20, 0.4);
}

.polyr-dot.playing {
  animation: pulseHit 0.25s ease;
}

.pattern-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.pattern-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
}

.pattern-controls input[type="number"],
.pattern-controls select {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.pattern-controls input[type="range"] {
  width: 100%;
  accent-color: #ff6129;
}

.pattern-randomize {
  border-radius: 12px;
  border: 1px solid rgba(255, 90, 20, 0.35);
  padding: 0.6rem 0.9rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(255, 90, 20, 0.14);
  color: #ffb08a;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.pattern-randomize:active {
  transform: translateY(1px);
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 0.4rem;
}

.pattern-step {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(26, 26, 32, 0.85);
  color: #f8f9fb;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.2rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease, border 0.12s ease;
}

.pattern-step.is-on {
  background: rgba(255, 90, 20, 0.2);
  border-color: rgba(255, 90, 20, 0.45);
  color: #ffb08a;
  box-shadow: 0 0 10px rgba(255, 90, 20, 0.35);
}

.pattern-step.playing {
  animation: pulseHit 0.28s ease;
}

.measure-counter.playing {
  color: #ffb08a;
  text-shadow: 0 0 18px rgba(255, 90, 20, 0.55);
}

.pattern-visualizer {
  display: flex;
  gap: 0.4rem;
}

.pattern-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: rgba(31, 41, 51, 0.32);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pattern-dot.is-on {
  background: rgba(255, 90, 20, 0.55);
  box-shadow: 0 0 12px rgba(255, 90, 20, 0.25);
}

.pattern-dot.playing {
  animation: pulseHit 0.25s ease;
}

.range-value {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
}

@keyframes pulseHit {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.35);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
}

.slider-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.68);
}

.control-block label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72);
}

.control-block select,
.control-block input[type="range"] {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.control-block input[type="range"] {
  padding: 0;
}

.control-block select:focus {
  outline: 2px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.hint {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.46);
  letter-spacing: 0.04em;
}

.muted {
  opacity: 0.5;
}

.accent-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.accent-buttons button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(33, 33, 41, 0.85);
  color: #f1f3f5;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.accent-buttons button:focus-visible {
  outline: 2px solid rgba(255, 90, 20, 0.45);
  outline-offset: 2px;
}

.accent-buttons button[data-accent="accent"] {
  background: linear-gradient(135deg, #ff6129, #ff9f46);
  color: #fff2e7;
  box-shadow: 0 10px 22px -12px rgba(255, 90, 20, 0.6);
}

.accent-buttons button[data-accent="ghost"] {
  background: rgba(94, 94, 102, 0.25);
  color: rgba(255, 255, 255, 0.5);
  border-style: dashed;
}

.time-signature {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.time-signature input,
.time-signature select {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.time-signature input:focus,
.time-signature select:focus {
  outline: 2px solid rgba(255, 90, 20, 0.45);
  outline-offset: 2px;
}

.time-divider {
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.65);
}

.subdivision-sounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.subdivision-sounds label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
}

.subdivision-sounds select {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.subdivision-sounds select:focus {
  outline: 2px solid rgba(255, 90, 20, 0.45);
  outline-offset: 2px;
}

.custom-sample-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.45);
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.custom-sample-control.is-active {
  opacity: 1;
  color: #f1f3f5;
}

.custom-file-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(32, 32, 40, 0.85);
  color: #f1f3f5;
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.custom-file-button:hover {
  background: rgba(255, 90, 20, 0.2);
}

.custom-file-button:active {
  transform: translateY(1px);
}

.custom-file-info {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-sample-hint {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.07em;
}

.visualizer {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.visualizer .dot {
  width: 18px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255, 90, 20, 0.3);
  opacity: 0.45;
  box-shadow: 0 0 10px rgba(255, 90, 20, 0.25);
  transition: transform 0.12s ease-out, opacity 0.12s ease-out, background 0.12s ease-out, box-shadow 0.12s ease-out;
}

.visualizer .dot.active {
  transform: scale(1.35);
  opacity: 1;
  background: #ff6129;
  box-shadow: 0 0 16px rgba(255, 90, 20, 0.6);
}

.subdivision-visualizer {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.subdivision-visualizer .tick {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(94, 94, 102, 0.4);
  opacity: 0.4;
  transition: transform 0.12s ease-out, opacity 0.12s ease-out, background 0.12s ease-out, box-shadow 0.12s ease-out;
}

.subdivision-visualizer .tick.active {
  transform: scale(1.2);
  opacity: 1;
  background: #f7b267;
  box-shadow: 0 0 12px rgba(247, 178, 103, 0.45);
}

.subdivision-visualizer.is-hidden {
  display: none;
}

.measure-counter {
  text-align: center;
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 0 10px rgba(255, 90, 20, 0.25);
}

.status-message {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  margin: 0.25rem 0 1.25rem;
  color: rgba(255, 255, 255, 0.7);
}

.status-message.is-error {
  color: #ffe3df;
  background: rgba(255, 75, 51, 0.18);
  border: 1px solid rgba(255, 95, 60, 0.35);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  display: inline-block;
  box-shadow: 0 18px 40px -28px rgba(255, 54, 36, 0.7);
}

.status-message.is-hidden {
  display: none;
}

.training-controls {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  display: grid;
  gap: 1.2rem;
}

.training-controls .toggle {
  gap: 0.4rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #212529;
}

.toggle-label input {
  width: 1.1rem;
  height: 1.1rem;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}

.training-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.7);
}

.training-grid input[type="number"] {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 16, 22, 0.85);
  color: #f8f9fb;
}

.training-grid input[type="number"]:focus {
  outline: 2px solid rgba(255, 90, 20, 0.45);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .card {
    padding: 1.6rem;
    min-height: calc(100vh - 2rem);
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .advanced-controls .accordion-content,
  .training-controls .accordion-content {
    grid-template-columns: 1fr;
  }

  .sound-settings {
    grid-template-columns: 1fr;
  }

  .tempo-dynamics-grid {
    grid-template-columns: 1fr;
  }

  .training-grid,
  .full-width-panels,
  .rhythm-content,
  .polyrhythm-grid,
  .pattern-controls {
    grid-template-columns: 1fr;
  }

  .pattern-grid {
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    padding: 1rem;
  }
}
