* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: block;
  font-family: Arial, sans-serif;
  background: #0f1220;
  color: #e8ebff;
  padding: 24px 0;
}

.app {
  width: min(96vw, 920px);
  margin: 0 auto;
  background: #171b2f;
  border: 1px solid #2a3156;
  border-radius: 14px;
  padding: 20px 24px 24px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
}

.screen-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
  padding: 4px;
  border-radius: 12px;
  background: #0e1430;
  border: 1px solid #2a3156;
}

.screen-tab {
  flex: 1 1 auto;
  min-width: 120px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #9ca7dd;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.screen-tab:hover {
  color: #e8ebff;
  background: rgba(95, 134, 255, 0.12);
}

.screen-tab.is-active {
  background: #25305a;
  border-color: #5f86ff;
  color: #fff;
}

.screen[hidden] {
  display: none !important;
}

.section-title--inline {
  margin-top: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.subtitle {
  margin: 0 0 18px;
  color: #b7c0f5;
}

.start-button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #5f86ff;
  color: #fff;
}

.top-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}

.control select {
  width: 100%;
}

.start-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.panel {
  margin-top: 18px;
  padding: 14px;
  border-radius: 10px;
  background: #10142a;
  border: 1px solid #242c52;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}

.control {
  display: grid;
  gap: 5px;
  color: #b7c0f5;
  font-size: 0.9rem;
}

.score-file-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  margin-bottom: 10px;
}

.score-file-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.control input[type="range"],
.control input[type="number"],
.control select {
  width: 100%;
}

.control input[type="number"],
.control select,
.toolbar-inline input[type="number"],
.toolbar-inline select {
  border: 1px solid #2f3b67;
  background: #101939;
  color: #e8ebff;
  border-radius: 8px;
  padding: 6px 8px;
}

.score-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#spectrum {
  width: 100%;
  height: 210px;
  border-radius: 8px;
  border: 1px solid #25305a;
  background: #0a1021;
  margin-bottom: 8px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.row + .row {
  border-top: 1px solid #1f2648;
}

.label {
  color: #adb7eb;
}

.value {
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.note {
  font-size: 1.5rem;
}

.hint {
  margin: 14px 0 0;
  color: #9ca7dd;
  font-size: 0.92rem;
}

.view-wrap--sheet {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.score-container {
  margin-top: 12px;
  padding: 10px;
  min-height: 160px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #293566;
  background: #ffffff;
}

.score-container.score-container--dark {
  background: #000000;
  border-color: #3a3a48;
}

.score-playback-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 12px 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0e1430;
  border: 1px solid #2a3156;
}

.toolbar-button {
  border: 0;
  border-radius: 8px;
  min-height: 34px;
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: #5f86ff;
  color: #fff;
}

.toolbar-button.secondary {
  background: #3d4a7a;
}

.toolbar-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b7c0f5;
  font-size: 0.9rem;
}

.toolbar-inline input[type="number"] {
  width: 4.2rem;
}

.toolbar-inline input[type="range"] {
  width: 160px;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.toolbar-group-label {
  color: #b7c0f5;
  font-size: 0.9rem;
  font-weight: 600;
}

.value--filechip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #2d3a66;
  background: #141c37;
  color: #d4dcff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-wrap {
  position: relative;
}

.view-wrap--falling {
  margin-top: 12px;
}

.view-wrap.is-hidden {
  display: none;
}

#fallingNotesCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 520px);
  border-radius: 8px;
  border: 1px solid #25305a;
  background: #0a0d18;
}

@media (max-width: 640px) {
  .screen-nav {
    flex-direction: column;
  }

  .top-controls,
  .controls {
    grid-template-columns: 1fr;
  }

  .score-file-bar {
    align-items: stretch;
  }

  .score-file-name {
    min-height: 0;
  }
}
