/*
Theme Name: Drum Practice Toolkit
Theme URI: https://example.com/
Author:
Author URI:
Description: Полноэкранная тема-инструмент для тренировок на барабанах: таймер интервалов, метроном, выбор рудиментов и синхронизированная бегущая дорожка сможите. Экран разделён на 4 равные части, без хедера и футера.
Version: 1.0
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: drum-practice
*/

/* ==========================================================================
   Base / reset
   ========================================================================== */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e0f12;
  color: #eef0f3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Hide admin bar completely and prevent it from pushing layout */
#wpadminbar {
  display: none !important;
}
html {
  margin-top: 0 !important;
}
html.wp-toolbar {
  padding-top: 0 !important;
}

button, input, select {
  font-family: inherit;
}

h2 {
  margin: 0 0 clamp(4px, 1vh, 10px);
  font-size: clamp(11px, min(1.5vw, 2.2vh), 18px);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #9aa4b2;
  flex-shrink: 0;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: clamp(5px, 1vh, 10px) clamp(8px, 1.3vw, 16px);
  font-size: clamp(11px, min(1.2vw, 1.8vh), 15px);
  font-weight: 600;
  background: #23262e;
  color: #eef0f3;
  transition: background .15s ease, transform .1s ease;
  white-space: nowrap;
}
button:hover {
  background: #2f333d;
}
button:active {
  transform: scale(.97);
}
button.primary {
  background: #3d7bfd;
  color: #fff;
}
button.primary:hover {
  background: #5a8dff;
}
button.danger {
  background: #4a2530;
}
button.danger:hover {
  background: #5c2e3b;
}
button.active {
  background: #3d7bfd;
  color: #fff;
}

input[type="number"], select {
  background: #1a1c22;
  border: 1px solid #33363f;
  color: #eef0f3;
  border-radius: 6px;
  padding: clamp(4px, 0.8vh, 6px) 8px;
  font-size: clamp(11px, min(1.1vw, 1.6vh), 14px);
  width: 100%;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: clamp(9px, min(0.9vw, 1.3vh), 12px);
  color: #9aa4b2;
}

/* ==========================================================================
   Grid layout — 4 quadrants
   ========================================================================== */

#app.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100vw;
  height: 100vh;
  gap: 2px;
  background: #33363f;
}

.quadrant {
  background: #16181d;
  padding: clamp(8px, 1.8vh, 18px) clamp(10px, 2vw, 20px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.quadrant .controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: clamp(5px, 0.9vh, 10px) clamp(6px, 1.1vw, 14px);
  margin-bottom: clamp(4px, 1vh, 12px);
  flex-shrink: 0;
}

.quadrant .buttons {
  display: flex;
  gap: clamp(5px, 0.8vw, 8px);
  margin-top: auto;
  padding-top: clamp(5px, 0.9vh, 10px);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.quadrant .display {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.6vh, 6px);
  text-align: center;
  overflow: hidden;
}

/* ---- Timer quadrant ---- */

.timer .phase {
  font-size: clamp(12px, min(2.1vw, 2.8vh), 24px);
  font-weight: 700;
  color: #9aa4b2;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.timer .phase.work { color: #4fd68c; }
.timer .phase.break { color: #f4b740; }

.timer .time {
  font-size: clamp(28px, min(9vw, 12vh), 100px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer .progress-info {
  color: #9aa4b2;
  font-size: clamp(9px, min(1.1vw, 1.6vh), 14px);
}

.timer .progress-bar {
  width: 100%;
  max-width: 420px;
  height: clamp(4px, 0.8vh, 8px);
  background: #23262e;
  border-radius: 5px;
  overflow: hidden;
  margin-top: clamp(2px, 0.4vh, 4px);
  flex-shrink: 0;
}
.timer .progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3d7bfd, #4fd68c);
  transition: width .2s linear;
}

.timer .total-remaining {
  color: #676e7a;
  font-size: clamp(8px, min(0.95vw, 1.3vh), 12px);
  margin-top: clamp(2px, 0.4vh, 4px);
}

/* ---- Metronome quadrant ---- */

.metronome .bpm-row {
  display: flex;
  align-items: baseline;
  gap: clamp(6px, 1vw, 10px);
  margin-bottom: clamp(2px, 0.5vh, 4px);
  flex-wrap: wrap;
}
.metronome .bpm-row .bpm-big {
  font-size: clamp(24px, min(5vw, 6.5vh), 48px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.metronome .bpm-buttons {
  display: flex;
  gap: clamp(3px, 0.6vw, 6px);
}
.metronome .bpm-buttons button {
  padding: clamp(2px, 0.5vh, 4px) clamp(5px, 0.9vw, 10px);
}

.metronome .beat-indicator {
  width: clamp(32px, min(7vw, 9vh), 76px);
  height: clamp(32px, min(7vw, 9vh), 76px);
  border-radius: 50%;
  background: #23262e;
  border: 3px solid #33363f;
  transition: background .05s ease, border-color .05s ease, transform .05s ease;
  flex-shrink: 0;
}
.metronome .beat-indicator.on {
  background: #3d7bfd;
  border-color: #5a8dff;
  transform: scale(1.08);
}
.metronome .beat-indicator.accent {
  background: #f4b740;
  border-color: #ffce6b;
}

.metronome .beat-count {
  font-size: clamp(11px, min(1.4vw, 2vh), 18px);
  color: #9aa4b2;
  font-variant-numeric: tabular-nums;
}

/* ---- Rudiments quadrant ---- */

.rudiment-filters {
  display: flex;
  gap: clamp(4px, 0.6vw, 6px);
  flex-wrap: wrap;
  margin-bottom: clamp(5px, 1vh, 10px);
  flex-shrink: 0;
}
.rudiment-filters button {
  padding: clamp(4px, 0.7vh, 6px) clamp(7px, 1vw, 12px);
  font-size: clamp(9px, min(1vw, 1.4vh), 12px);
}

.rudiment-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #33363f transparent;
}
.rudiment-list::-webkit-scrollbar {
  width: 6px;
}
.rudiment-list::-webkit-scrollbar-track {
  background: transparent;
}
.rudiment-list::-webkit-scrollbar-thumb {
  background: #33363f;
  border-radius: 3px;
}

.rudiment-item {
  text-align: left;
  background: #1a1c22;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: clamp(6px, 1vh, 9px) clamp(8px, 1.2vw, 12px);
  font-size: clamp(10px, min(1.2vw, 1.6vh), 13px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.rudiment-item:hover {
  background: #23262e;
}
.rudiment-item.selected {
  border-color: #3d7bfd;
  background: #1c2740;
}
.rudiment-item .cat-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #676e7a;
  flex-shrink: 0;
}

/* ---- Track quadrant ---- */

.track .track-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(6px, 1vw, 10px);
  margin-bottom: clamp(5px, 1.2vh, 14px);
  flex-wrap: wrap;
  font-size: clamp(10px, min(1.2vw, 1.6vh), 13px);
  color: #9aa4b2;
  flex-shrink: 0;
}
.track .track-controls label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.track-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #1a1c22;
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  padding: 0 clamp(8px, 1.6vw, 20px);
  /* Прокрутка нужна для длинных рудиментов, но полоса прокрутки скрыта визуально */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.track-viewport::-webkit-scrollbar {
  display: none;
}

.track-strip {
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, 0.6vw, 6px);
  padding: clamp(10px, 2.2vh, 30px) 0;
  margin: 0 auto;
}

.note-cluster {
  display: flex;
  align-items: flex-end;
  position: relative;
}

.note {
  width: clamp(22px, min(3.6vw, 5.5vh), 48px);
  height: clamp(22px, min(3.6vw, 5.5vh), 48px);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(11px, min(1.6vw, 2.2vh), 19px);
  background: #23262e;
  color: #676e7a;
  flex-shrink: 0;
  transition: background .08s ease, color .08s ease, transform .08s ease;
}
.note.hand-R {
  color: #6db8ff;
  box-shadow: inset 0 0 0 2px #2a4a70;
}
.note.hand-L {
  color: #ffb56d;
  box-shadow: inset 0 0 0 2px #70502a;
}
.note.accent {
  font-size: clamp(14px, min(2vw, 2.8vh), 24px);
}
.note.hand-R.accent {
  box-shadow: inset 0 0 0 3px #6db8ff;
}
.note.hand-L.accent {
  box-shadow: inset 0 0 0 3px #ffb56d;
}
.note.grace {
  width: clamp(14px, min(2.2vw, 3.2vh), 28px);
  height: clamp(14px, min(2.2vw, 3.2vh), 28px);
  font-size: clamp(8px, min(1.1vw, 1.5vh), 12px);
  opacity: .8;
  margin-bottom: 10px;
  margin-right: -8px;
  z-index: 1;
}
.note.current {
  background: #3d7bfd;
  color: #fff !important;
  box-shadow: none !important;
  transform: translateY(-6px);
}
.note.grace.current {
  background: #5a8dff;
}

.track-title-name {
  color: #eef0f3;
}

.track .sticking-readout {
  margin-top: clamp(4px, 1vh, 10px);
  font-size: clamp(9px, min(1.1vw, 1.5vh), 13px);
  color: #676e7a;
  letter-spacing: .08em;
  word-break: break-all;
  flex-shrink: 0;
  max-height: 2.6em;
  overflow: hidden;
}

/* ==========================================================================
   Responsive: stack on narrow screens
   ========================================================================== */

@media (max-width: 760px) {
  html, body {
    overflow-y: auto;
    height: auto;
  }
  #app.grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    min-height: 100vh;
  }
  .quadrant {
    min-height: 60vh;
    overflow: visible;
  }
}
