:root {
  --ink: #070a0b;
  --panel: rgba(13, 17, 18, 0.84);
  --panel-heavy: rgba(9, 12, 13, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(232, 214, 183, 0.12);
  --line-strong: rgba(232, 214, 183, 0.24);
  --text: #f0e9dc;
  --text-soft: #c2bbb0;
  --muted: #8d8a82;
  --dim: #66655f;
  --gold: #d8b27c;
  --gold-bright: #efd1a5;
  --gold-deep: #a77d4e;
  --mint: #7fd9c9;
  --rose: #d69a92;
  --danger: #d58d7d;
  --paper: #f3ecdf;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --shadow-deep: 0 36px 90px rgba(0, 0, 0, 0.55), 0 2px 12px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #07090a;
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(ellipse 50% 55% at 67% 28%, rgba(51, 79, 77, 0.26), transparent 67%),
    radial-gradient(ellipse 55% 55% at 30% 18%, rgba(55, 48, 38, 0.22), transparent 70%),
    radial-gradient(ellipse 60% 45% at 55% 72%, rgba(83, 58, 34, 0.2), transparent 66%),
    linear-gradient(155deg, #090d0e 0%, #060809 50%, #050607 100%);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid rgba(232, 196, 139, 0.72);
  outline-offset: 3px;
}

input,
textarea {
  user-select: text;
}

::selection {
  background: rgba(216, 178, 124, 0.28);
  color: #fff;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

#app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.scene-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 5, 6, 0.72) 0%, transparent 16%, transparent 72%, rgba(3, 5, 6, 0.76) 100%),
    radial-gradient(ellipse 90% 85% at 50% 45%, transparent 48%, rgba(2, 4, 5, 0.54) 100%);
}

.scene-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ */
/*  Top bar                                                            */
/* ------------------------------------------------------------------ */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 19px 27px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 8, 9, 0.72) 0%, rgba(5, 8, 9, 0.22) 58%, transparent 100%);
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  justify-self: start;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 178, 124, 0.34);
  border-radius: 13px;
  color: var(--gold-bright);
  background:
    linear-gradient(145deg, rgba(216, 178, 124, 0.15), rgba(216, 178, 124, 0.015) 70%),
    rgba(13, 17, 18, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 30px rgba(0, 0, 0, 0.25);
}

.brand-mark .icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.35;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3em;
  line-height: 1;
  white-space: nowrap;
  color: #f4ecdf;
}

.brand-sub {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

.stage-status {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  padding: 8px 15px 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background: rgba(9, 13, 14, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(216, 178, 124, 0.07), 0 0 12px rgba(216, 178, 124, 0.55);
}

.stage-status.is-playing .status-dot {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(127, 217, 201, 0.08), 0 0 14px rgba(127, 217, 201, 0.65);
  animation: status-pulse 1.8s ease-in-out infinite;
}

.stage-status.is-paused .status-dot {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(214, 154, 146, 0.06), 0 0 10px rgba(214, 154, 146, 0.35);
}

.stage-status.is-countdown .status-dot {
  animation: status-pulse 0.7s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.status-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#statusTitle {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #eee6d8;
  white-space: nowrap;
}

#statusMeta {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 5px;
}

.top-action {
  height: 35px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.top-action .icon {
  width: 16px;
  height: 16px;
}

.top-action:hover {
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.075);
}

.top-action--library {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.top-icon {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid transparent;
}

.top-icon:hover {
  color: var(--gold-bright);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  transition: color 0.22s, background 0.22s, border-color 0.22s;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

/* ------------------------------------------------------------------ */
/*  Library panel                                                      */
/* ------------------------------------------------------------------ */

.library-panel {
  position: fixed;
  z-index: 15;
  top: 91px;
  left: 26px;
  bottom: 150px;
  width: 332px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(152deg, rgba(22, 28, 29, 0.87) 0%, rgba(11, 15, 16, 0.92) 58%, rgba(9, 12, 13, 0.95) 100%);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(30px) saturate(115%);
  -webkit-backdrop-filter: blur(30px) saturate(115%);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 44px));
  transition: transform 0.55s var(--ease), opacity 0.35s var(--ease);
}

.library-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.library-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.24);
}

.panel-top {
  display: flex;
  align-items: center;
  padding: 14px 15px 0 19px;
  flex: 0 0 auto;
}

.panel-tabs {
  display: flex;
  gap: 19px;
  min-width: 0;
}

.panel-tab {
  position: relative;
  padding: 7px 0 13px;
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  transition: color 0.22s;
}

.panel-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(216, 178, 124, 0.12));
  transition: right 0.35s var(--ease);
}

.panel-tab:hover {
  color: var(--text-soft);
}

.panel-tab.is-active {
  color: var(--gold-bright);
}

.panel-tab.is-active::after {
  right: 0;
}

.panel-close {
  margin-left: auto;
  width: 29px;
  height: 29px;
}

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.panel-view {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 17px 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 178, 124, 0.2) transparent;
}

.panel-view[hidden] {
  display: none !important;
}

.panel-view::-webkit-scrollbar,
.song-list::-webkit-scrollbar {
  width: 4px;
}

.panel-view::-webkit-scrollbar-thumb,
.song-list::-webkit-scrollbar-thumb {
  background: rgba(216, 178, 124, 0.18);
  border-radius: 99px;
}

.panel-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 3px 2px 13px;
}

.eyebrow {
  color: rgba(216, 178, 124, 0.72);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-count {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.search-field {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.028);
  transition: border-color 0.25s, background 0.25s;
}

.search-field:focus-within {
  border-color: rgba(216, 178, 124, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.search-field .icon {
  width: 15px;
  height: 15px;
  color: var(--dim);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.search-field input::placeholder {
  color: #5f615d;
}

.search-field input::-webkit-search-cancel-button {
  filter: invert(0.7);
  opacity: 0.6;
}

.filter-chips {
  display: flex;
  gap: 5px;
  margin: 11px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.03em;
  transition: all 0.22s var(--ease);
}

.filter-chip:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
}

.filter-chip.is-active {
  color: #19140e;
  background: linear-gradient(135deg, #e4c18f, #c39a64);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 2px 10px;
}

.song-item {
  position: relative;
  --song-accent: var(--gold);
}

.song-card {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.song-card:hover {
  background: rgba(255, 255, 255, 0.038);
  border-color: rgba(255, 255, 255, 0.055);
}

.song-item.is-selected .song-card {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--song-accent) 15%, transparent), rgba(255, 255, 255, 0.018) 76%);
  border-color: color-mix(in srgb, var(--song-accent) 24%, transparent);
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--song-accent) 80%, transparent);
}

.song-index {
  align-self: start;
  padding-top: 2px;
  color: var(--dim);
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
  text-align: center;
}

.song-item.is-selected .song-index {
  color: var(--gold);
}

.song-main {
  min-width: 0;
}

.song-title-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.song-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #e9e2d6;
}

.song-item.is-selected .song-title {
  color: #f7eee0;
}

.song-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.song-artist {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.song-artist span {
  color: rgba(141, 138, 130, 0.56);
}

.song-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding-left: 4px;
}

.song-duration {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.01em;
}

.difficulty {
  display: flex;
  gap: 2.5px;
  align-items: center;
}

.difficulty i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.difficulty i.is-on {
  background: var(--gold);
  opacity: 0.72;
}

.song-play-hint {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  opacity: 0;
  transform: translateX(-3px);
  transition: all 0.22s var(--ease);
}

.song-play-hint .icon {
  width: 12px;
  height: 12px;
}

.song-card:hover .song-play-hint,
.song-item.is-selected .song-play-hint {
  opacity: 1;
  transform: translateX(0);
}

.song-delete {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--dim);
  background: rgba(8, 11, 12, 0.92);
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
}

.song-delete .icon {
  width: 12px;
  height: 12px;
}

.song-item:hover .song-delete,
.song-item:focus-within .song-delete {
  opacity: 1;
}

@media (hover: none) {
  .song-delete {
    opacity: 0.55;
  }
}

.song-delete:hover {
  color: var(--danger);
  background: rgba(30, 16, 15, 0.95);
}

.song-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.8;
}

.song-empty strong {
  display: block;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 3px;
}

.panel-note {
  display: flex;
  gap: 8px;
  margin: 10px 3px 4px;
  padding: 11px 12px;
  border: 1px solid rgba(216, 178, 124, 0.09);
  border-radius: 11px;
  background: rgba(216, 178, 124, 0.03);
  color: #7f7b72;
  font-size: 9.5px;
  line-height: 1.65;
}

.panel-note .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: rgba(216, 178, 124, 0.56);
}

.panel-disclaimer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: #66655f;
  font-size: 8.5px;
  letter-spacing: 0.03em;
  background: rgba(5, 8, 9, 0.18);
}

.text-button {
  padding: 2px;
  color: var(--gold);
  font-size: inherit;
  letter-spacing: 0.03em;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.text-button:hover {
  color: var(--gold-bright);
  border-color: rgba(216, 178, 124, 0.4);
}

.panel-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 14;
  background: rgba(2, 4, 5, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ------------------------------------------------------------------ */
/*  Import panel                                                       */
/* ------------------------------------------------------------------ */

.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 22px 14px 17px;
  border: 1px dashed rgba(216, 178, 124, 0.22);
  border-radius: 15px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 178, 124, 0.08), transparent 70%),
    rgba(255, 255, 255, 0.016);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-dragging {
  border-color: rgba(216, 178, 124, 0.48);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 178, 124, 0.13), transparent 70%),
    rgba(255, 255, 255, 0.028);
}

.drop-zone.is-dragging {
  transform: scale(0.99);
}

.drop-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 3px;
  color: var(--gold);
  stroke-width: 1.25;
}

.drop-zone strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.drop-zone > span {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.mini-button {
  margin-top: 6px;
  padding: 5px 13px;
  color: var(--gold-bright);
  font-size: 9.5px;
  border: 1px solid rgba(216, 178, 124, 0.22);
  border-radius: 999px;
  background: rgba(216, 178, 124, 0.05);
  transition: background 0.2s, border-color 0.2s;
}

.mini-button:hover {
  background: rgba(216, 178, 124, 0.12);
  border-color: rgba(216, 178, 124, 0.4);
}

.unit-divider {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 14px 2px 11px;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.07em;
}

.unit-divider::before,
.unit-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08));
}

.unit-divider::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent);
}

.notation-input {
  width: 100%;
  height: 150px;
  resize: vertical;
  min-height: 114px;
  max-height: 280px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.23);
  color: #cec6b6;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  outline: none;
  transition: border-color 0.25s, background 0.25s;
}

.notation-input:focus {
  border-color: rgba(216, 178, 124, 0.36);
  background: rgba(0, 0, 0, 0.3);
}

.notation-input::placeholder {
  color: #575a57;
}

.import-helper-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px 13px;
}

.import-helper-row .text-button {
  font-size: 9.5px;
  color: #858077;
}

.import-helper-row .text-button:hover {
  color: var(--gold);
}

.primary-button {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  color: #18130d;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #ecd0a2 0%, #d3a870 55%, #b98d58 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: filter 0.22s, transform 0.22s;
}

.primary-button .icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.4;
}

.primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button.is-loading {
  pointer-events: none;
  filter: saturate(0.5) brightness(0.8);
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(24, 19, 13, 0.28);
  border-top-color: #18130d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.import-result {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgba(127, 217, 201, 0.18);
  border-radius: 13px;
  background: linear-gradient(150deg, rgba(127, 217, 201, 0.075), rgba(255, 255, 255, 0.02));
  animation: rise-in 0.38s var(--ease);
}

.import-result.is-error {
  border-color: rgba(213, 141, 125, 0.25);
  background: rgba(213, 141, 125, 0.06);
}

.result-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--mint);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.import-result.is-error .result-kicker {
  color: var(--danger);
}

.result-title {
  margin: 8px 0 3px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
}

.result-sub {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0 11px;
}

.result-stat {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 8.5px;
}

.result-warning {
  margin: 4px 0 9px;
  color: #b6a17e;
  font-size: 9px;
  line-height: 1.55;
}

.result-actions {
  display: flex;
  gap: 6px;
}

.result-actions .primary-button {
  height: 36px;
  font-size: 10px;
}

.result-actions .ghost-button {
  flex: 0 0 auto;
  height: 36px;
  font-size: 10px;
}

.format-hint {
  margin-top: 16px;
  color: #73736d;
  font-size: 9px;
  line-height: 1.7;
}

.format-hint p {
  margin: 0 0 7px;
}

.format-hint b {
  color: #9f998e;
  font-weight: 500;
}

.format-hint code {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(216, 178, 124, 0.06);
}

.format-hint .muted,
.muted {
  color: var(--dim);
}

/* ------------------------------------------------------------------ */
/*  Keys panel                                                         */
/* ------------------------------------------------------------------ */

.mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.mapping-row-label {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.mapping-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
}

.map-key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  color: #d9d1c2;
  font-family: var(--mono);
  font-size: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.map-key.is-black {
  margin-top: 2px;
  background: linear-gradient(180deg, rgba(10, 13, 14, 0.95), rgba(25, 29, 29, 0.9));
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--gold-bright);
}

.map-key.is-down {
  background: linear-gradient(180deg, #e7c594, #c39a65);
  color: #14100b;
  border-color: rgba(255, 255, 255, 0.2);
}

.map-key-note {
  color: var(--dim);
  font-size: 6.5px;
  letter-spacing: 0.01em;
}

.map-key.is-down .map-key-note {
  color: rgba(20, 16, 11, 0.65);
}

.mapping-hint {
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
  margin: -7px 1px 17px;
}

.shortcut-list {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 5px 0;
  margin-bottom: 16px;
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 1px;
  color: var(--muted);
  font-size: 9.5px;
}

.shortcut-list > div span {
  flex: 1;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  color: #c4b7a2;
  font-family: var(--mono);
  font-size: 8.5px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.16);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 1px 17px;
}

.switch-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.switch-row strong {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
}

.switch-row span {
  color: var(--dim);
  font-size: 8.5px;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.25s, border-color 0.25s;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #a6a196;
  transition: transform 0.28s var(--ease), background 0.25s;
}

.switch.is-on {
  background: rgba(216, 178, 124, 0.22);
  border-color: rgba(216, 178, 124, 0.36);
}

.switch.is-on span {
  transform: translateX(16px);
  background: var(--gold-bright);
}

.tips-card {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.tips-card p {
  margin: 8px 0 0;
  color: #86827a;
  font-size: 9.5px;
  line-height: 1.75;
}

.tips-card kbd {
  height: 16px;
  min-width: 16px;
  font-size: 7.5px;
}

/* ------------------------------------------------------------------ */
/*  Floating hints                                                     */
/* ------------------------------------------------------------------ */

.side-caption {
  position: fixed;
  right: 28px;
  bottom: 165px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(202, 188, 168, 0.34);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  writing-mode: vertical-rl;
  pointer-events: none;
}

.side-caption i {
  display: block;
  width: 1px;
  height: 26px;
  background: rgba(202, 188, 168, 0.2);
}

.key-hint {
  position: fixed;
  left: 50%;
  bottom: 146px;
  z-index: 4;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(5, 9, 10, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #85827b;
  font-size: 9px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.key-hint b {
  color: #c2b7a5;
  font-weight: 500;
}

.key-hint.is-hidden {
  opacity: 0;
}

.hint-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(216, 178, 124, 0.5);
}

.hint-sep {
  width: 1px;
  height: 9px;
  background: rgba(255, 255, 255, 0.12);
}

.keyboard-active-readout {
  position: fixed;
  right: 27px;
  bottom: 147px;
  z-index: 4;
  max-width: 310px;
  text-align: right;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.keyboard-active-readout.is-visible {
  opacity: 0.72;
}

/* ------------------------------------------------------------------ */
/*  Transport                                                          */
/* ------------------------------------------------------------------ */

.transport {
  position: fixed;
  z-index: 16;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(890px, calc(100vw - 54px));
  padding: 12px 18px 13px;
  border: 1px solid rgba(232, 214, 183, 0.15);
  border-radius: 20px;
  background:
    linear-gradient(140deg, rgba(21, 26, 27, 0.94), rgba(10, 13, 14, 0.93) 58%, rgba(8, 11, 12, 0.96));
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.48),
    0 3px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(34px) saturate(115%);
  -webkit-backdrop-filter: blur(34px) saturate(115%);
}

.transport::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse at 20% 0%, rgba(216, 178, 124, 0.075), transparent 45%);
}

.transport-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.transport-song {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.transport-eyebrow {
  flex: 0 0 auto;
  color: rgba(216, 178, 124, 0.55);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.transport-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #eee6d8;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.03em;
}

.transport-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9.5px;
}

.transport-tag {
  flex: 0 0 auto;
  padding: 2px 6px;
  color: #9d8c74;
  font-size: 8px;
  border: 1px solid rgba(216, 178, 124, 0.14);
  border-radius: 99px;
}

.transport-time {
  flex: 0 0 auto;
  color: #9a968e;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  position: relative;
  height: 12px;
  margin: 5px 0 9px;
  cursor: pointer;
  touch-action: none;
}

.progress-track::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-fill {
  position: absolute;
  top: 5px;
  left: 0;
  height: 2px;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #c49b62, #f0cf9b);
  box-shadow: 0 0 10px rgba(216, 178, 124, 0.28);
  transition: width 0.09s linear;
}

.progress-thumb {
  position: absolute;
  top: 1.5px;
  left: 0%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(216, 178, 124, 0.1), 0 2px 7px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s, left 0.09s linear;
}

.progress-track:hover .progress-thumb,
.progress-track.is-seeking .progress-thumb {
  opacity: 1;
}

.transport-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.playback-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.play-button {
  width: 47px;
  height: 47px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #17120c;
  background: linear-gradient(140deg, #f2d7ac, #d8ae78 55%, #bb8d56);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  transition: transform 0.22s var(--ease), filter 0.22s;
}

.play-button:hover {
  transform: scale(1.035);
  filter: brightness(1.05);
}

.play-button:active {
  transform: scale(0.97);
}

.play-button .icon {
  width: 20px;
  height: 20px;
  margin-left: 1px;
}

.play-button .pause-icon {
  display: none;
  margin-left: 0;
}

.play-button.is-playing .play-icon {
  display: none;
}

.play-button.is-playing .pause-icon {
  display: block;
}

.stop-button {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.stop-button .icon {
  width: 14px;
  height: 14px;
}

.track-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-left: 4px;
}

#trackMeta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #aaa298;
  font-size: 9.5px;
}

#transportHint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #636660;
  font-size: 8.5px;
}

.tool-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.octave-stepper {
  height: 33px;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  padding: 0 3px;
}

.octave-stepper button {
  width: 23px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #77776f;
  transition: color 0.2s, background 0.2s;
}

.octave-stepper button:hover {
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.055);
}

.octave-stepper button .icon {
  width: 12px;
  height: 12px;
}

#octaveLabel {
  min-width: 57px;
  text-align: center;
  color: #b4aa9a;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tool-chip {
  height: 33px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #8d8a82;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.tool-chip:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}

.tool-chip[aria-pressed="true"],
.tool-chip.is-active {
  color: var(--mint);
  border-color: rgba(127, 217, 201, 0.25);
  background: rgba(127, 217, 201, 0.075);
}

.pedal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.tempo-glyph {
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1;
}

#tempoChip {
  font-family: var(--mono);
  font-size: 8.5px;
}

.popover-wrap {
  position: relative;
}

.popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 245px;
  padding: 14px;
  border: 1px solid rgba(232, 214, 183, 0.16);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(23, 28, 29, 0.98), rgba(10, 13, 14, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.985);
  transform-origin: bottom right;
  transition: opacity 0.22s var(--ease), visibility 0.22s, transform 0.22s var(--ease);
  z-index: 5;
}

.popover-wrap.is-open .popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.popover-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 9px;
  color: #898981;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.popover-head--spaced {
  margin-top: 13px;
}

.popover-head strong {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.popover-head small {
  color: #817b71;
  font-size: 8px;
  font-weight: 400;
}

.range-input {
  width: 100%;
  height: 22px;
  margin: 9px 0 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.range-input::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(216, 178, 124, 0.65), rgba(255, 255, 255, 0.11));
}

.range-input::-moz-range-track {
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.13);
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(216, 178, 124, 0.12);
}

.range-input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--gold-bright);
}

.range-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  color: #64655f;
  font-size: 8px;
}

.range-scale b {
  color: #9e978c;
  font-weight: 400;
}

.popover-action {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  color: #aba295;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.025);
  transition: color 0.2s, background 0.2s;
}

.popover-action:hover {
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.05);
}

.popover-action .icon {
  width: 12px;
  height: 12px;
}

.volume-off-icon {
  display: none;
}

.volume-popover.is-muted .volume-off-icon,
.is-muted .volume-off-icon {
  display: block;
}

.is-muted .volume-on-icon {
  display: none;
}

.score-button .icon {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------ */
/*  Dialogs                                                            */
/* ------------------------------------------------------------------ */

dialog.modal {
  width: min(1040px, calc(100vw - 48px));
  max-width: none;
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  border: 1px solid rgba(232, 214, 183, 0.18);
  border-radius: 23px;
  background: transparent;
  color: var(--text);
  box-shadow: 0 48px 120px rgba(0, 0, 0, 0.6);
  overflow: visible;
}

dialog.modal::backdrop {
  background: rgba(3, 6, 7, 0.72);
  backdrop-filter: blur(13px) saturate(90%);
  -webkit-backdrop-filter: blur(13px) saturate(90%);
}

dialog.modal[open] {
  animation: modal-in 0.38s var(--ease);
}

@keyframes modal-in {
  from {
    transform: translateY(12px) scale(0.985);
  }
  to {
    transform: translateY(0) scale(1);
  }
}

.modal-shell {
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 75% 0%, rgba(69, 93, 90, 0.18), transparent 42%),
    linear-gradient(145deg, #151a1b 0%, #0b0f10 60%, #080b0c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 27px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.modal-head h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #f3ebdf;
  line-height: 1.2;
}

.modal-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
}

.modal-body {
  padding: 23px 27px 27px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 178, 124, 0.2) transparent;
}

.help-modal {
  width: min(940px, calc(100vw - 48px));
}

.help-body {
  padding-top: 21px;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.help-card {
  position: relative;
  padding: 20px 20px 18px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.018);
}

.help-card--accent {
  border-color: rgba(216, 178, 124, 0.16);
  background:
    linear-gradient(145deg, rgba(216, 178, 124, 0.07), rgba(255, 255, 255, 0.01) 65%);
}

.help-index {
  position: absolute;
  top: 18px;
  right: 18px;
  color: rgba(216, 178, 124, 0.32);
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
}

.help-card h3 {
  margin: 0 0 11px;
  color: #e9e0d2;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.help-card p {
  margin: 0 0 9px;
  color: #89877f;
  font-size: 10.5px;
  line-height: 1.85;
}

.help-card p:last-child {
  margin-bottom: 0;
}

.help-card kbd {
  margin: 0 1px;
}

.shortcut-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 5px;
  margin-top: 16px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.18);
}

.shortcut-strip > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.shortcut-strip kbd {
  width: 25px;
  height: 24px;
  color: var(--gold-bright);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.shortcut-strip span {
  color: #666760;
  font-family: var(--mono);
  font-size: 7px;
}

/* Score dialog */

.score-modal {
  width: min(1100px, calc(100vw - 48px));
}

.score-shell {
  background:
    radial-gradient(ellipse at 80% 0%, rgba(80, 104, 100, 0.17), transparent 35%),
    linear-gradient(145deg, #131819, #090d0e 62%);
}

.score-head {
  align-items: center;
  padding-bottom: 15px;
}

.score-head h2 {
  margin-top: 6px;
  font-size: 27px;
}

.score-meta {
  margin-top: 6px;
  color: #7f7e77;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.score-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-button {
  height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.025);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.ghost-button:hover {
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(216, 178, 124, 0.24);
}

.ghost-button .icon {
  width: 13px;
  height: 13px;
}

.score-play-btn {
  color: #e7d1ad;
  border-color: rgba(216, 178, 124, 0.22);
  background: rgba(216, 178, 124, 0.07);
}

.score-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 27px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.score-tabs {
  display: flex;
  gap: 20px;
}

.score-tab {
  position: relative;
  padding: 12px 0 11px;
  color: #686b65;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.score-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--gold);
  transition: right 0.3s var(--ease);
}

.score-tab:hover {
  color: var(--text-soft);
}

.score-tab.is-active {
  color: var(--gold-bright);
}

.score-tab.is-active::after {
  right: 0;
}

.score-source {
  color: #5f615b;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.score-body {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 59dvh;
  overflow: auto;
  padding: 22px 25px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.015), transparent 30%),
    #eee6d7;
  color: #352f26;
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 47, 36, 0.25) transparent;
}

.score-paper {
  min-width: 760px;
  padding: 8px 2px 2px;
}

.score-paper svg {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(0.9);
}

.score-jianpu-wrap {
  min-width: 520px;
  max-width: 850px;
  margin: 0 auto;
  padding: 16px 8px;
}

.score-jianpu {
  margin: 0;
  color: #3b352a;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2.05;
  letter-spacing: 0.08em;
  white-space: pre-wrap;
  word-break: break-word;
}

.score-caption {
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(60, 51, 40, 0.16);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
}

.score-caption strong {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.score-caption span {
  color: rgba(58, 50, 38, 0.55);
  font-family: var(--mono);
  font-size: 9px;
}

.score-note-text {
  margin-top: 20px;
  color: rgba(58, 50, 38, 0.55);
  font-size: 10px;
  line-height: 1.7;
}

.key-guide-wrap {
  max-width: 900px;
  margin: 0 auto;
}

.key-guide-intro {
  margin-bottom: 16px;
  color: rgba(55, 47, 36, 0.66);
  font-size: 10px;
  line-height: 1.65;
}

.key-guide-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.key-guide-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px 5px 7px;
  border: 1px solid rgba(56, 47, 36, 0.15);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.28);
}

.key-guide-item.is-black {
  background: rgba(44, 38, 30, 0.9);
  border-color: rgba(44, 38, 30, 0.9);
  color: #f1e5d1;
}

.key-guide-item kbd {
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-color: rgba(56, 47, 36, 0.19);
  border-bottom-color: rgba(56, 47, 36, 0.28);
  background: rgba(55, 47, 36, 0.08);
  color: #4b4133;
  font-size: 8px;
  box-shadow: none;
}

.key-guide-item.is-black kbd {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #f0d8b2;
}

.key-guide-item span {
  color: rgba(54, 46, 35, 0.62);
  font-family: var(--mono);
  font-size: 8px;
}

.key-guide-item.is-black span {
  color: rgba(246, 231, 210, 0.62);
}

.key-guide-more {
  margin-top: 14px;
  color: rgba(55, 47, 36, 0.45);
  font-size: 9px;
}

.score-footnote {
  flex: 0 0 auto;
  padding: 10px 27px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: #64665f;
  font-size: 8.5px;
  line-height: 1.6;
  background: rgba(5, 8, 9, 0.18);
}

.score-empty {
  padding: 70px 20px;
  text-align: center;
  color: rgba(53, 47, 38, 0.55);
  font-family: var(--serif);
  font-size: 20px;
}

/* Format dialog */

.format-modal {
  width: min(760px, calc(100vw - 48px));
}

.format-body {
  padding-top: 18px;
}

.format-code {
  padding: 15px 17px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.27);
  overflow-x: auto;
}

.format-code pre,
.format-code code {
  margin: 0;
  color: #d7c5a9;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.8;
}

.format-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.format-table > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 13px;
  background: #0e1213;
}

.format-table b {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

.format-table span {
  color: #797a73;
  font-size: 9px;
  line-height: 1.55;
}

.format-table code {
  color: #b5a58d;
  font-family: var(--mono);
  font-size: 8.5px;
}

.format-note {
  margin: 15px 1px 0;
  color: #6f706a;
  font-size: 9.5px;
  line-height: 1.7;
}

.format-note code {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
}

/* ------------------------------------------------------------------ */
/*  Toasts / loader / error                                            */
/* ------------------------------------------------------------------ */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 150px;
  z-index: 80;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  max-width: min(430px, calc(100vw - 38px));
  padding: 9px 14px;
  border: 1px solid rgba(232, 214, 183, 0.16);
  border-radius: 10px;
  color: #d7cfc1;
  background: rgba(10, 14, 15, 0.93);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-align: center;
  animation: toast-in 0.3s var(--ease);
}

.toast.is-error {
  border-color: rgba(213, 141, 125, 0.28);
  color: #dfb3a9;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.25s, transform 0.25s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background:
    radial-gradient(ellipse 55% 50% at 50% 38%, rgba(36, 54, 53, 0.35), transparent 68%),
    #060809;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.loader-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  border: 1px solid rgba(216, 178, 124, 0.3);
  border-radius: 15px;
  background: rgba(216, 178, 124, 0.05);
}

.loader-mark .icon {
  width: 26px;
  height: 26px;
  stroke-width: 1.2;
}

.loader-brand span {
  color: #ece3d5;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
}

.loader-keys {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 26px;
}

.loader-keys i {
  display: block;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: rgba(216, 178, 124, 0.58);
  animation: loader-wave 1.3s ease-in-out infinite;
}

.loader-keys i:nth-child(2) {
  animation-delay: 0.09s;
  background: rgba(216, 178, 124, 0.8);
}
.loader-keys i:nth-child(3) {
  animation-delay: 0.18s;
}
.loader-keys i:nth-child(4) {
  animation-delay: 0.27s;
  background: rgba(127, 217, 201, 0.6);
}
.loader-keys i:nth-child(5) {
  animation-delay: 0.36s;
}
.loader-keys i:nth-child(6) {
  animation-delay: 0.45s;
  background: rgba(216, 178, 124, 0.8);
}
.loader-keys i:nth-child(7) {
  animation-delay: 0.54s;
}

@keyframes loader-wave {
  0%,
  100% {
    height: 8px;
    opacity: 0.35;
  }
  50% {
    height: 25px;
    opacity: 1;
  }
}

.loading-screen p {
  margin: -8px 0 0;
  color: #6f7069;
  font-size: 9px;
  letter-spacing: 0.18em;
}

.fatal-error {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 8, 0.92);
  backdrop-filter: blur(12px);
}

.fatal-card {
  max-width: 440px;
  padding: 28px;
  border: 1px solid rgba(216, 178, 124, 0.17);
  border-radius: 20px;
  background: #0d1112;
  box-shadow: var(--shadow-deep);
}

.fatal-card h2 {
  margin: 11px 0 10px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
}

.fatal-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.fatal-card .primary-button {
  width: auto;
  padding: 0 18px;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #060809;
  color: var(--text);
  font-family: var(--sans);
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .library-panel {
    width: 340px;
    left: 18px;
    top: 86px;
    bottom: 146px;
  }

  .panel-scrim.is-visible {
    display: block;
  }

  .side-caption {
    display: none;
  }

  .transport {
    width: min(850px, calc(100vw - 36px));
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 13px 17px;
  }

  .stage-status {
    display: none;
  }

  .library-panel {
    width: min(360px, calc(100vw - 28px));
    left: 14px;
    top: 76px;
    bottom: 150px;
  }

  .transport {
    gap: 0;
  }

  .track-meta {
    display: none;
  }

  .key-hint {
    display: none;
  }

  .keyboard-active-readout {
    display: none;
  }

  .tool-cluster {
    margin-left: auto;
  }

  .transport-main {
    gap: 10px;
  }
}

@media (max-width: 760px) {
  #app {
    min-height: 520px;
  }

  .brand-sub {
    display: none;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    border-radius: 11px;
  }

  .brand-name {
    font-size: 14px;
    letter-spacing: 0.25em;
  }

  .top-actions {
    gap: 2px;
  }

  .top-action {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }

  .top-action span {
    display: none;
  }

  .top-action--library {
    border-color: var(--line);
  }

  .library-panel {
    left: 8px;
    width: calc(100vw - 16px);
    top: 68px;
    bottom: 152px;
    border-radius: 17px;
  }

  .transport {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    transform: none;
    padding: 9px 11px 10px;
    border-radius: 16px;
  }

  .transport-head {
    gap: 8px;
  }

  .transport-eyebrow {
    display: none;
  }

  .transport-title {
    font-size: 13px;
  }

  .transport-artist {
    max-width: 100px;
  }

  .transport-tag {
    display: none;
  }

  .transport-time {
    font-size: 8px;
  }

  .transport-main {
    flex-wrap: wrap;
    gap: 7px;
  }

  .playback-cluster {
    width: 100%;
  }

  .play-button {
    width: 41px;
    height: 41px;
  }

  .tool-cluster {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .octave-stepper {
    height: 31px;
    padding: 0 1px;
  }

  .octave-stepper button {
    width: 21px;
  }

  #octaveLabel {
    min-width: 50px;
    font-size: 8px;
  }

  .tool-chip {
    height: 31px;
    padding: 0 8px;
    font-size: 8.5px;
  }

  .tool-chip#sustainBtn {
    padding: 0 8px;
  }

  .tool-cluster > .icon-button {
    width: 31px;
    height: 31px;
  }

  .popover {
    position: fixed;
    right: 12px;
    bottom: 116px;
    width: min(250px, calc(100vw - 24px));
  }

  .side-caption {
    display: none;
  }

  dialog.modal,
  .help-modal,
  .score-modal,
  .format-modal {
    width: calc(100vw - 16px);
    max-height: 94dvh;
  }

  .modal-shell {
    max-height: 94dvh;
    border-radius: 17px;
  }

  .modal-head {
    padding: 17px 16px 13px;
  }

  .modal-head h2 {
    font-size: 24px;
  }

  .modal-body {
    padding: 16px;
  }

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

  .help-card {
    padding: 16px;
  }

  .help-card h3 {
    font-size: 18px;
  }

  .shortcut-strip {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
  }

  .score-head {
    align-items: flex-start;
  }

  .score-head h2 {
    font-size: 21px;
  }

  .score-head-actions {
    gap: 5px;
  }

  .score-play-btn {
    width: 33px;
    height: 33px;
    padding: 0;
    font-size: 0;
  }

  .score-play-btn .icon {
    width: 14px;
    height: 14px;
  }

  .score-toolbar {
    padding: 0 15px;
  }

  .score-tabs {
    gap: 15px;
  }

  .score-source {
    display: none;
  }

  .score-body {
    max-height: 56dvh;
    padding: 13px 10px;
  }

  .score-paper {
    min-width: 660px;
  }

  .score-footnote {
    padding: 8px 15px;
    font-size: 8px;
  }

  .format-table {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    bottom: 202px;
  }

  .library-panel {
    bottom: 191px;
  }

  .panel-disclaimer {
    font-size: 8px;
    padding: 8px 14px 9px;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 12.5px;
    letter-spacing: 0.2em;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .top-action,
  .top-icon {
    width: 31px;
    height: 31px;
  }

  .top-action .icon,
  .top-icon .icon {
    width: 15px;
    height: 15px;
  }

  .transport-title {
    max-width: 145px;
  }

  .transport-artist {
    max-width: 70px;
  }

  .tool-chip#sustainBtn {
    padding: 0 8px;
  }

  .tool-chip#tempoBtn {
    padding: 0 8px;
  }

  .transport-time {
    font-size: 7.5px;
  }
}

@media (max-height: 650px) and (min-width: 761px) {
  .library-panel {
    bottom: 130px;
  }

  .transport {
    bottom: 12px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .key-hint,
  .keyboard-active-readout {
    display: none;
  }

  .toast-stack {
    bottom: 124px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
