:root {
  color-scheme: light;
  --bg: #edf2f7;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --line: #cbd8e6;
  --line-soft: #e3ebf3;
  --ink: #172033;
  --muted: #5d6c80;
  --blue: #1f5fb8;
  --blue-soft: #eaf2ff;
  --green: #15803d;
  --red: #dc2626;
  --shadow: 0 18px 42px rgba(18, 31, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.vwa2s-standalone-shell {
  min-height: 100vh;
  padding: 14px;
}

.vwa2s-standalone-loading,
.vwa2s-standalone-error {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 760px;
  padding: 20px;
}

.vwa2s-standalone-error {
  border-color: var(--red);
  color: #7f1d1d;
}

.vwa2s-warmup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  inline-size: min(1280px, calc(100vw - 28px));
  margin: 0 auto;
  min-height: calc(100vh - 28px);
  overflow: visible;
  padding: 12px;
  scroll-margin-block-start: 12px;
}

.vwa2s-layout,
.vwa2s-player {
  min-width: 0;
}

.vwa2s-header {
  align-items: start;
  display: grid;
  gap: 8px 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.vwa2s-heading {
  align-self: center;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.vwa2s-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
}

.vwa2s-fullscreen {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.vwa2s-close-app {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.vwa2s-title,
.vwa2s-library-title {
  color: var(--ink);
  font-size: clamp(1.35rem, 0.95rem + 1.45vw, 2.45rem);
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
  overflow-wrap: anywhere;
}

.vwa2s-library-title {
  align-self: center;
}

.vwa2s-warmup.is-library-open .vwa2s-title,
.vwa2s-warmup:not(.is-library-open) .vwa2s-library-title {
  display: none;
}

.vwa2s-library-toggle,
.vwa2s-fullscreen,
.vwa2s-close-app,
.vwa2s-ambitus-toggle,
.vwa2s-tempo-toggle,
.vwa2s-play-options-toggle,
.vwa2s-first-note,
.vwa2s-play,
.vwa2s-ambitus-shift,
.vwa2s-tempo-shift {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  display: inline-flex;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
}

.vwa2s-library-toggle,
.vwa2s-fullscreen,
.vwa2s-close-app,
.vwa2s-first-note,
.vwa2s-play-options-toggle,
.vwa2s-play {
  height: 52px;
  width: 52px;
}

.vwa2s-fullscreen,
.vwa2s-close-app {
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  flex: none;
  height: 44px;
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  width: 44px;
}

.vwa2s-fullscreen {
  background: rgba(40, 44, 90, 0.06);
  border-color: rgba(40, 44, 90, 0.16);
  color: #2b2545;
}

.vwa2s-library-toggle {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.vwa2s-close-app {
  background: #8f3d46;
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.vwa2s-close-app:hover {
  background: #a64852;
}

.vwa2s-library-toggle[aria-expanded="true"],
.vwa2s-fullscreen-exit-icon,
.vwa2s-fullscreen.is-exit .vwa2s-fullscreen-open-icon {
  display: none;
}

.vwa2s-fullscreen.is-exit .vwa2s-fullscreen-exit-icon {
  display: block;
}

.vwa2s-control-icon,
.vwa2s-library-toggle-icon,
.vwa2s-fullscreen-icon,
.vwa2s-close-app-icon,
.vwa2s-tempo-icon {
  fill: none;
  height: 25px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 25px;
}

.vwa2s-fullscreen-icon,
.vwa2s-close-app-icon {
  height: 20px;
  width: 20px;
}

.vwa2s-first-note-icon {
  fill: currentColor;
  stroke: none;
}

.vwa2s-ambitus-toggle,
.vwa2s-tempo-toggle {
  align-items: start;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  height: 52px;
  padding: 5px 12px;
}

.vwa2s-ambitus-toggle {
  min-width: 112px;
}

.vwa2s-tempo-toggle {
  align-items: center;
  gap: 0;
  padding: 4px;
  width: 52px;
}

.vwa2s-ambitus-toggle span,
.vwa2s-tempo-toggle span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.vwa2s-ambitus-toggle strong,
.vwa2s-tempo-toggle strong {
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1;
}

.vwa2s-tempo {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 0 10px;
}

.vwa2s-tempo {
  appearance: textfield;
}

.vwa2s-tempo::-webkit-inner-spin-button,
.vwa2s-tempo::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.vwa2s-tempo-control,
.vwa2s-play-options,
.vwa2s-ambitus-control {
  position: relative;
}

.vwa2s-hidden-note-select {
  height: 1px;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: auto;
  width: 1px;
}

.vwa2s-tempo-panel,
.vwa2s-play-options-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
}

.vwa2s-tempo-control.is-open .vwa2s-tempo-panel,
.vwa2s-play-options.is-open .vwa2s-play-options-menu {
  display: block;
}

.vwa2s-tempo-panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.vwa2s-tempo-panel h3,
.vwa2s-ambitus-card h3 {
  font-size: 1rem;
  margin: 0;
}

.vwa2s-tempo-row {
  align-items: stretch;
  display: grid;
  gap: 6px;
  grid-template-columns: 82px auto;
}

.vwa2s-tempo-arrows,
.vwa2s-ambitus-arrows {
  display: flex;
  gap: 6px;
}

.vwa2s-tempo-arrows {
  flex-direction: column;
  gap: 4px;
}

.vwa2s-ambitus-shift,
.vwa2s-tempo-shift {
  font-size: 1.4rem;
  font-weight: 800;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  width: 36px;
}

.vwa2s-tempo-shift {
  font-size: 0.95rem;
  height: 20px;
  line-height: 1;
  min-height: 20px;
  min-width: 26px;
  width: 26px;
}

.vwa2s-play-part {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  min-width: 190px;
  padding: 10px;
}

.vwa2s-play-part + .vwa2s-play-part {
  margin-top: 6px;
}

.vwa2s-play-part.is-active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}

.vwa2s-play-part-icon {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

.vwa2s-play-part-icon-on,
.vwa2s-play-part.is-active .vwa2s-play-part-icon-off {
  display: none;
}

.vwa2s-play-part.is-active .vwa2s-play-part-icon-on {
  display: block;
}

.vwa2s-play {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.vwa2s-play.is-stopping {
  background: var(--red);
  border-color: var(--red);
}

.vwa2s-play-icon {
  border-bottom: 13px solid transparent;
  border-left: 20px solid currentColor;
  border-top: 13px solid transparent;
  height: 0;
  margin-left: 4px;
  width: 0;
}

.vwa2s-play.is-stopping .vwa2s-play-icon {
  background: currentColor;
  border: 0;
  height: 20px;
  margin: 0;
  width: 20px;
}

.vwa2s-library-panel {
  display: none;
  grid-column: 1 / -1;
}

.vwa2s-warmup.is-library-open .vwa2s-library-panel {
  display: block;
  margin-top: 12px;
}

.vwa2s-warmup.is-library-open .vwa2s-controls,
.vwa2s-warmup.is-library-open .vwa2s-ambitus-panel,
.vwa2s-warmup.is-library-open .vwa2s-status,
.vwa2s-warmup.is-library-open .vwa2s-rail {
  display: none;
}

.vwa2s-library {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  overflow: hidden;
}

.vwa2s-warmup.is-library-list-view .vwa2s-library {
  grid-template-columns: minmax(0, 1fr);
}

.vwa2s-warmup.is-library-grid-view .vwa2s-library {
  background: transparent;
  border: 0;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
}

.vwa2s-warmup-choice {
  background: var(--panel);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 132px;
  padding: 10px 14px 0;
  text-align: left;
  width: 100%;
}

.vwa2s-warmup.is-library-grid-view .vwa2s-warmup-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.vwa2s-warmup-choice:last-child {
  border-bottom: 0;
}

.vwa2s-warmup.is-library-grid-view .vwa2s-warmup-choice:last-child {
  border-bottom: 1px solid var(--line);
}

.vwa2s-warmup-choice:hover,
.vwa2s-warmup-choice:focus {
  background: var(--panel-soft);
  outline: none;
}

.vwa2s-warmup-choice.vwa2s-staff-count-2 {
  height: 176px;
}

.vwa2s-warmup-choice.vwa2s-staff-count-3 {
  height: 224px;
}

.vwa2s-choice-title {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  padding-bottom: 4px;
}

.vwa2s-choice-score {
  align-items: start;
  display: flex;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.vwa2s-choice-score svg {
  display: block;
  flex: 0 0 auto;
  height: 86px;
  max-width: none;
  width: auto;
}

.vwa2s-warmup-choice.vwa2s-staff-count-2 .vwa2s-choice-score svg {
  height: 132px;
}

.vwa2s-warmup-choice.vwa2s-staff-count-3 .vwa2s-choice-score svg {
  height: 180px;
}

.vwa2s-warmup-choice.is-list-preview-clipped .vwa2s-choice-score::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 82%);
  bottom: 0;
  content: "";
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  width: 76px;
}

.vwa2s-ambitus-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: none;
  gap: 14px;
  left: 0;
  margin-top: 0;
  padding: 12px;
  position: absolute;
  top: calc(100% + 8px);
  width: max-content;
  z-index: 30;
}

.vwa2s-warmup.is-ambitus-open .vwa2s-ambitus-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 240px));
  justify-content: start;
}

.vwa2s-ambitus-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.vwa2s-ambitus-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.vwa2s-ambitus-card-score {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  height: 132px;
  justify-content: center;
  margin-top: 10px;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.vwa2s-ambitus-card-score svg {
  display: block;
  height: 118px;
  max-width: 100%;
  width: auto;
}

.vwa2s-ambitus-card-label {
  display: block;
  font-size: 1.25rem;
  margin-top: 8px;
  text-align: center;
}

.vwa2s-status {
  color: var(--muted);
  min-height: 1.4em;
  padding: 8px 0;
}

.vwa2s-status:empty {
  display: none;
}

.vwa2s-rail {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.vwa2s-score {
  background: #fff;
  border: 0;
  border-radius: 0;
  color: #111827;
  display: block;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
}

.vwa2s-score svg {
  display: block;
  flex: 0 0 auto;
  height: auto;
  max-width: none;
  width: auto;
}

.vwa2s-rail-item.is-current {
  min-height: 0;
}

.vwa2s-rail-item.is-next {
  color: #b3bccb;
  opacity: 1;
}

.vwa2s-score.vwa2s-rail-item.is-next {
  color: #b3bccb;
}

.vwa2s-score.vwa2s-rail-item.is-next svg {
  opacity: 1;
}

.vwa2s-rail-item.is-empty {
  display: none;
}

.vwa2s-error {
  color: #7f1d1d;
}

.vwa2s-warmup:fullscreen,
.vwa2s-warmup.is-fullscreen {
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 100vh;
  height: 100dvh;
  inline-size: 100vw;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

@media (max-width: 760px) {
  .vwa2s-standalone-shell {
    padding: 8px;
  }

  .vwa2s-warmup {
    inline-size: calc(100vw - 16px);
    min-height: calc(100vh - 16px);
    padding: 8px;
  }

  .vwa2s-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .vwa2s-controls {
    grid-column: 1;
    grid-row: 2;
  }

  .vwa2s-title,
  .vwa2s-library-title {
    font-size: 1.55rem;
  }

  .vwa2s-fullscreen,
  .vwa2s-close-app {
    height: 40px;
    min-height: 40px;
    min-width: 40px;
    width: 40px;
  }

  .vwa2s-warmup.is-ambitus-open .vwa2s-ambitus-panel {
    grid-template-columns: 1fr;
    max-width: calc(100vw - 32px);
    width: min(280px, calc(100vw - 32px));
  }

  .vwa2s-warmup-choice {
    height: 120px;
  }

  .vwa2s-warmup-choice.vwa2s-staff-count-2 {
    height: 160px;
  }

  .vwa2s-warmup-choice.vwa2s-staff-count-3 {
    height: 210px;
  }

  .vwa2s-warmup.is-library-grid-view .vwa2s-library {
    grid-template-columns: minmax(0, 1fr);
  }
}
