* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding-bottom: 300px;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  color: #0f172a;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
}

.brand__title {
  font-size: 16px;
  font-weight: 700;
}

.brand__subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

.panel {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.panel__header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.panel__title {
  font-weight: 700;
}

.panel__subtitle {
  opacity: 0.7;
  font-size: 12px;
}

.panel__body {
  padding: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.tab {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}

.tab--active {
  border-color: rgba(79, 70, 229, 0.45);
  background: rgba(99, 102, 241, 0.12);
}

.view {
  display: none;
}

.view--active {
  display: block;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 980px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.card__title {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-weight: 700;
}

.card__content {
  padding: 12px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.85);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  border-color: rgba(79, 70, 229, 0.4);
  background: rgba(99, 102, 241, 0.14);
}

.label {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 700;
}

.formRow {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.formRow select,
.formRow input[type="range"] {
  width: 100%;
}

#sf2Status {
  opacity: 0.75;
  font-size: 12px;
  margin-bottom: 12px;
}

.noteReadout {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.noteReadout__name {
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0.4px;
}

.noteReadout__meta {
  opacity: 0.75;
  font-size: 12px;
}

.staff {
  width: 100%;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
}

.hint {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.hint__title {
  font-weight: 800;
  margin-bottom: 8px;
}

.hint__content {
  display: grid;
  gap: 6px;
}

.card--spaced {
  margin-top: 12px;
}

.scoreControls {
  display: grid;
  gap: 12px;
}

.scoreControls__row {
  display: grid;
  grid-template-columns: 110px 1fr 220px;
  gap: 10px;
  align-items: center;
}

@media (max-width: 980px) {
  .scoreControls__row {
    grid-template-columns: 1fr;
  }
}

.scoreControls__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 800;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
}

.scoreInfo {
  opacity: 0.75;
  font-size: 12px;
}

.scoreControls__grid {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

@media (max-width: 980px) {
  .scoreControls__grid {
    grid-template-columns: 1fr;
  }
}

.control {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  gap: 10px;
  align-items: center;
}

.scoreControls__row--progress {
  grid-template-columns: 1fr 140px;
}

@media (max-width: 980px) {
  .scoreControls__row--progress {
    grid-template-columns: 1fr;
  }
}

.pdfWrap {
  margin-top: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
}

.svgWrap {
  margin-top: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
}

.svgWrap__bar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.svgWrap__hint {
  opacity: 0.75;
  font-size: 12px;
}

.svgWrap__body {
  max-height: 640px;
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.svgPage {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.9);
}

.svgPage svg {
  width: 100%;
  height: auto;
  display: block;
}

.svgWrap svg .note.note--active use,
.svgWrap svg .note.note--active path {
  fill: rgba(99, 102, 241, 0.95) !important;
  stroke: rgba(99, 102, 241, 0.95) !important;
}

.svgWrap svg .note.note--active {
  filter: drop-shadow(0 1px 0 rgba(99, 102, 241, 0.35));
}

.pdfWrap__bar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.pdfWrap__hint {
  opacity: 0.75;
  font-size: 12px;
}

.pdfFrame {
  width: 100%;
  height: 520px;
  border: 0;
  display: block;
  background: rgba(15, 23, 42, 0.02);
}

.metronome__row {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.trainerHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.trainerHeader__score {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  font-weight: 800;
}

.trainerFeedback {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.03);
}

.piano {
  position: relative;
  height: 220px;
  user-select: none;
  touch-action: manipulation;
}

.key {
  position: absolute;
  bottom: 0;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 0 0 10px 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 10px;
  font-weight: 800;
  font-size: 12px;
}

.key--white {
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
  height: 220px;
  z-index: 1;
}

.key--black {
  background: linear-gradient(180deg, #0f172a, #111827);
  height: 140px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 0 0 8px 8px;
}

.key--active.key--white {
  background: linear-gradient(180deg, #fef9c3, #fde68a);
}

.key--active.key--black {
  background: linear-gradient(180deg, #f59e0b, #b45309);
}

.key__label {
  opacity: 0.75;
  pointer-events: none;
}

.footer {
  padding: 14px 16px 20px;
  opacity: 0.75;
}

.pianoDock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  border-top: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(12px);
}

.pianoDock__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.pianoDock__title {
  font-weight: 800;
}

.pianoDock__subtitle {
  opacity: 0.75;
  font-size: 12px;
}

.pianoDock__body {
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.pianoScroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.75);
}
