:root {
  --bg: #06070b;
  --bg-glow: #182136;
  --panel: rgba(14, 18, 28, 0.86);
  --panel-strong: rgba(16, 19, 26, 0.92);
  --panel-border: rgba(0, 0, 0, 0.08);
  --ink: #eef3ff;
  --muted: #99a4bf;
  --accent: #65a8ff;
  --accent-2: #8f68ff;
  --danger: #ff8a8a;
  --white-key: #cfd6e2;
  --white-key-edge: #7f8da3;
  --black-key: #05070c;
  --black-key-edge: #000000;
  --active-white: #ffe84a;
  --active-black: #d45cf2;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(30, 34, 42, 0.22), transparent 34%),
    linear-gradient(180deg, #0a0b0f 0%, #050608 52%, #020203 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center top;
}

.app-shell {
  min-height: 100vh;
  padding: 0 20px 20px;
}

.workspace {
  min-height: calc(100vh - 20px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  position: relative;
}

.piano-stage {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.audio-visualizer {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - 318px);
  height: 100%;
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
}

.piano-dock,
.error-log,
.chat-panel {
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow,
.dock-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #8cb9ff;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  max-width: 12ch;
  font-size: clamp(2.6rem, 6vw, 5.3rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.lede,
.muted,
.dock-range,
.status-label {
  color: var(--muted);
}

.lede {
  max-width: 62ch;
  margin-bottom: 22px;
  font-size: 1.05rem;
  line-height: 1.65;
}

.volume-label {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.volume-slider {
  width: min(320px, 100%);
  accent-color: var(--accent);
}

.volume-value {
  min-width: 56px;
}

.soundfont-select {
  width: min(260px, 100%);
  color: #eef4ff;
  background: rgba(21, 28, 41, 0.98);
  color-scheme: dark;
}

.soundfont-select option,
.soundfont-select optgroup {
  color: #eef4ff;
  background: #161d2a;
}

.status-card {
  min-width: 0;
  padding: 11px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  box-shadow: 0 14px 32px rgba(101, 168, 255, 0.24);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.secondary-button.active {
  border-color: rgba(143, 104, 255, 0.5);
  background: linear-gradient(135deg, rgba(101, 168, 255, 0.16), rgba(143, 104, 255, 0.18));
  box-shadow: 0 14px 32px rgba(143, 104, 255, 0.16);
}

.secondary-button.temp-off {
  border-color: rgba(255, 232, 74, 0.42);
  background: rgba(255, 232, 74, 0.08);
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 20px 42px rgba(101, 168, 255, 0.3);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.error-log {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border-color: rgba(255, 138, 138, 0.18);
  background: rgba(66, 14, 20, 0.7);
  color: #ffd3d3;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

.sheet-writer {
  display: none;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(113, 148, 201, 0.2);
  background:
    linear-gradient(180deg, rgba(16, 21, 33, 0.94), rgba(7, 10, 17, 0.96)),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.sheet-writer.visible {
  display: block;
}

.instrument-panel > .sheet-writer {
  margin: 10px 16px 12px;
}

.sheet-writer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sheet-writer-header span {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: none;
}

.sheet-writer-canvas {
  min-height: 130px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  overflow-x: auto;
  overflow-y: hidden;
}

.sheet-writer-canvas svg {
  display: block;
}

.performance-overlay {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9100;
  display: flex;
  gap: 10px;
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(7, 10, 16, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  color: rgba(232, 238, 249, 0.78);
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.soundfont-preload {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9200;
  pointer-events: none;
}

.soundfont-preload[hidden] {
  display: none;
}

.soundfont-preload-card {
  min-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(22, 28, 41, 0.96), rgba(11, 16, 24, 0.96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.soundfont-preload-label {
  display: block;
  margin-bottom: 8px;
  color: #dce6fb;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.soundfont-preload-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.soundfont-preload-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #70a9ff, #7a77ff);
  transition: width 160ms ease;
}

.soundfont-preload-value {
  display: block;
  margin-top: 8px;
  color: #9fc0ff;
  font-size: 0.82rem;
  text-align: right;
}

.nuke-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  pointer-events: none;
  overflow: hidden;
}

.nuke-overlay.active {
  animation: nuke-scene-fade 4.2s ease forwards;
}

.nuke-banner {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(16, 20, 31, 0.78);
  border: 1px solid rgba(255, 120, 120, 0.26);
  color: #ffe3d7;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.nuke-missile {
  position: absolute;
  width: 220px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 246, 214, 0) 0%, rgba(255, 174, 77, 0.75) 28%, #ff7548 100%);
  box-shadow: 0 0 24px rgba(255, 112, 72, 0.42);
  transform-origin: left center;
}

.nuke-missile::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: radial-gradient(circle at 35% 35%, #fff8cf 0%, #ffb655 36%, #ff6132 70%, rgba(255, 97, 50, 0) 100%);
  transform: translateY(-50%) rotate(-45deg);
}

.nuke-missile.one {
  top: 18%;
  left: -18%;
  transform: rotate(16deg);
  animation: nuke-missile-flight-1 2.2s cubic-bezier(0.18, 0.72, 0.24, 1) forwards;
}

.nuke-missile.two {
  top: 34%;
  left: -24%;
  transform: rotate(10deg);
  animation: nuke-missile-flight-2 2.6s cubic-bezier(0.18, 0.72, 0.24, 1) forwards;
}

.nuke-missile.three {
  top: 52%;
  left: -20%;
  transform: rotate(7deg);
  animation: nuke-missile-flight-3 2.9s cubic-bezier(0.18, 0.72, 0.24, 1) forwards;
}

.nuke-blast {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 235, 1) 0%, rgba(255, 179, 84, 0.98) 38%, rgba(255, 92, 51, 0.78) 62%, rgba(255, 92, 51, 0) 100%);
  transform: translateX(-50%) scale(0.2);
  opacity: 0;
  animation: nuke-blast-bloom 1.8s ease-out 1.95s forwards;
}

.nuke-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 72%, rgba(255, 245, 220, 0.86), rgba(255, 172, 88, 0.35) 26%, rgba(255, 120, 64, 0.12) 42%, rgba(0, 0, 0, 0) 62%);
  opacity: 0;
  animation: nuke-flash-pulse 1.2s ease-out 1.95s forwards;
}

@keyframes nuke-missile-flight-1 {
  from { transform: translate3d(0, 0, 0) rotate(16deg) scaleX(0.82); opacity: 0; }
  8% { opacity: 1; }
  to { transform: translate3d(132vw, 24vh, 0) rotate(16deg) scaleX(1); opacity: 0; }
}

@keyframes nuke-missile-flight-2 {
  from { transform: translate3d(0, 0, 0) rotate(10deg) scaleX(0.76); opacity: 0; }
  8% { opacity: 1; }
  to { transform: translate3d(138vw, 18vh, 0) rotate(10deg) scaleX(1); opacity: 0; }
}

@keyframes nuke-missile-flight-3 {
  from { transform: translate3d(0, 0, 0) rotate(7deg) scaleX(0.8); opacity: 0; }
  8% { opacity: 1; }
  to { transform: translate3d(136vw, 14vh, 0) rotate(7deg) scaleX(1); opacity: 0; }
}

@keyframes nuke-blast-bloom {
  0% { opacity: 0; transform: translateX(-50%) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(22); }
}

@keyframes nuke-flash-pulse {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes nuke-scene-fade {
  0%, 90% { opacity: 1; }
  100% { opacity: 0; }
}

.piano-dock {
  margin-top: auto;
  padding: 0 16px 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(18, 20, 27, 0.99), rgba(10, 12, 18, 0.99) 18%, rgba(3, 5, 9, 0.995) 100%),
    var(--panel-strong);
  overflow: hidden;
}

.instrument-panel {
  position: relative;
  margin: 0 -16px 0;
  padding: 0;
  border-radius: 28px 28px 0 0;
  border-bottom: 1px solid rgba(112, 141, 193, 0.18);
  background:
    linear-gradient(180deg, rgba(30, 33, 40, 0.98), rgba(15, 18, 24, 0.99) 28%, rgba(7, 9, 13, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.instrument-controls-shell {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding: 0 16px 0;
  background: linear-gradient(180deg, rgba(10, 13, 19, 0.99), rgba(3, 5, 9, 1));
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    inset 0 -1px 0 rgba(0, 0, 0, 0.62);
  isolation: isolate;
}

.instrument-controls-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 24%, rgba(255, 255, 255, 0.038) 0 1px, transparent 1.4px),
    radial-gradient(circle at 78% 36%, rgba(255, 255, 255, 0.026) 0 1px, transparent 1.5px),
    radial-gradient(circle at 32% 72%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1.6px),
    radial-gradient(circle at 64% 18%, rgba(0, 0, 0, 0.16) 0 1.2px, transparent 1.9px),
    radial-gradient(circle at 46% 56%, rgba(0, 0, 0, 0.12) 0 1px, transparent 1.6px);
  background-size: 26px 26px, 34px 34px, 30px 30px, 38px 38px, 28px 28px;
  background-position: 0 0, 11px 7px, 4px 15px, 8px 10px, 16px 4px;
  opacity: 0.55;
  mix-blend-mode: soft-light;
}

.instrument-topbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 1px;
}

.instrument-topbar-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.instrument-topbar-header {
  grid-template-columns: 1fr;
  justify-items: center;
}

.instrument-topbar-main {
  grid-template-columns: 1fr auto 1fr;
}

.sheet-writer-toggle-button {
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.6);
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.sheet-writer-toggle-button:hover,
.sheet-writer-toggle-button:focus-visible {
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.sheet-writer-toggle-button.active {
  color: rgba(101, 168, 255, 0.8);
}

.instrument-logo {
  display: block;
  width: min(112px, 16vw);
  max-width: 100%;
  height: auto;
  opacity: 0.82;
  filter: brightness(0) invert(1) opacity(0.82);
  user-select: none;
  pointer-events: none;
  justify-self: start;
}

.instrument-branding {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.soundfont-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.instrument-screen {
  min-width: min(400px, 42vw);
  width: min(460px, 42vw);
  height: 104px;
  padding: 14px 18px 13px;
  border-radius: 8px;
  border: 1px solid rgba(112, 145, 196, 0.18);
  background:
    linear-gradient(180deg, rgba(92, 127, 181, 0.1), rgba(17, 29, 50, 0.14)),
    linear-gradient(180deg, rgba(13, 21, 35, 0.98), rgba(4, 9, 18, 1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 12px 22px rgba(0, 0, 0, 0.34);
  color: #dbe9ff;
  justify-self: center;
  overflow: hidden;
  align-self: center;
}

.instrument-screen-header,
.instrument-screen-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.instrument-screen-header {
  margin-bottom: 8px;
}

.instrument-screen-preset,
.instrument-screen-audio,
.instrument-screen-meta {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instrument-screen-preset {
  color: #a8c8ff;
  font-weight: 700;
}

.instrument-screen-audio {
  color: #d4e4ff;
  opacity: 0.84;
}

.instrument-screen-footer {
  margin-top: 8px;
}

.instrument-screen-note {
  color: #f2f7ff;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instrument-screen-meta {
  color: #9cbcff;
  opacity: 0.9;
  text-align: right;
  max-width: 60%;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
}

.instrument-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.15fr);
  gap: 10px;
  align-items: center;
  padding: 2px 0 2px;
}

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

.primary-controls-strip {
  flex-wrap: wrap;
}

.transpose-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.transpose-inline .volume-value {
  min-width: 2.5rem;
  text-align: center;
}

.soundfont-strip {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.soundfont-strip .soundfont-select {
  min-width: 220px;
}

.release-inline-label {
  margin-left: 6px;
}

.release-inline-slider {
  width: min(160px, 100%);
}

.knob-button {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(40, 44, 53, 0.98), rgba(14, 17, 22, 1));
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 18px rgba(0, 0, 0, 0.28);
}

.panel-status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  grid-auto-rows: minmax(0, auto);
}

.status-card.status-velocity {
  grid-column: 1;
  grid-row: 1;
}

.status-card.status-voice {
  grid-column: 2;
  grid-row: 1;
}

.chat-panel {
  min-height: calc(100vh - 48px + 0.5cm);
  max-height: calc(100vh - 48px + 0.5cm);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100% + 0.5cm);
  margin-top: -0.25cm;
  margin-bottom: -0.15cm;
  margin-left: -0.25cm;
  margin-right: -0.25cm;
  padding: 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(22, 28, 41, 0.82), rgba(9, 12, 19, 0.84)),
    var(--panel-strong);
  transform: translateY(0.5cm);
}

.user-list-panel {
  position: absolute;
  top: 22px;
  right: 332px;
  z-index: 2;
  width: min(calc(220px + 2cm), calc(100vw - 380px + 2cm));
  max-height: min(48vh, 420px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 12px;
  border-radius: 22px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
  opacity: 0.8;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-room-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-header h2 {
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-together-modal {
  position: fixed;
  inset: 0;
  z-index: 9050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  pointer-events: none;
}

.watch-together-modal[hidden] {
  display: none;
}

.watch-together-dialog {
  width: min(960px, calc(100vw - 40px));
  max-height: min(88vh, 980px);
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(24, 30, 44, 0.985), rgba(10, 13, 21, 0.985)),
    var(--panel-strong);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  overflow: auto;
  pointer-events: auto;
}

.watch-together-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.watch-together-dialog-header h2 {
  margin: 0;
}

.watch-together-controls,
.watch-together-actions,
.watch-together-queue-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.watch-together-controls {
  margin-bottom: 10px;
}

.watch-together-actions {
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.watch-together-player-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-bottom: 10px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(11, 15, 22, 0.98), rgba(18, 25, 38, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.watch-together-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
}

.watch-together-frame.active {
  display: block;
}

.watch-together-empty {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.watch-together-volume-label {
  margin-left: auto;
}

.watch-together-volume-slider {
  width: min(180px, 100%);
}

.watch-together-queue-header {
  justify-content: space-between;
  margin-bottom: 8px;
}

.watch-together-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(2 * 44px + 6px);
  overflow-y: auto;
}

.watch-together-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.watch-together-item.active {
  border-color: rgba(143, 178, 255, 0.22);
  background: rgba(143, 178, 255, 0.1);
}

.watch-together-item-text {
  min-width: 0;
}

.watch-together-item-title,
.watch-together-item-meta {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-together-item-title {
  font-weight: 700;
}

.watch-together-item-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-settings-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  overflow-y: auto;
}

.chat-settings {
  padding: 14px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-settings[hidden] {
  display: none;
}

.server-info-button {
  width: 100%;
  margin: 12px 0 2px;
  border-color: rgba(101, 255, 171, 0.24);
  color: #8dffb6;
  font-family: Consolas, "Cascadia Code", "Courier New", monospace;
  letter-spacing: 0.04em;
}

.room-menu-panel {
  padding-top: 12px;
}

.room-menu-toggle {
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 150px;
  overflow-y: auto;
}

.room-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.room-list-item.active {
  border-color: rgba(140, 185, 255, 0.24);
  background: rgba(140, 185, 255, 0.1);
}

.room-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-list-count {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.chat-setting-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8cb9ff;
}

.chat-settings-row {
  display: flex;
  gap: 10px;
}

.developer-tools {
  margin-top: 14px;
}

.developer-tool-button {
  width: 100%;
  justify-content: center;
}

.settings-popup-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.midi-device-select {
  width: 100%;
  margin-top: -2px;
  margin-bottom: 10px;
}

.chat-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: #d6def0;
  font-size: 0.92rem;
}

.chat-checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: #8cb9ff;
}

.user-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(5 * 42px);
  overflow-y: auto;
  padding-right: 2px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: transparent;
  border: 0;
}

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

.user-meta-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-name {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 700;
}

.user-name-marquee {
  width: 100%;
  display: block;
  color: inherit;
  font: inherit;
  line-height: 1.2;
  background: transparent;
}

.user-input-indicators {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.input-indicator {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #7d89a4;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.input-indicator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.input-indicator.active {
  color: #9bffbe;
  border-color: rgba(101, 255, 171, 0.38);
  background: rgba(101, 255, 171, 0.14);
  box-shadow: 0 0 18px rgba(101, 255, 171, 0.18);
  transform: translateY(-1px);
}

.role-badge {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9d8ff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.role-badge.developer {
  color: #fff1a5;
  background: rgba(255, 232, 74, 0.12);
  border-color: rgba(255, 232, 74, 0.28);
}

.role-badge.moderator {
  color: #a5d6ff;
  background: rgba(74, 144, 255, 0.12);
  border-color: rgba(74, 144, 255, 0.28);
}

.mute-button {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mute-button.muted {
  border-color: rgba(255, 138, 138, 0.3);
  background: rgba(255, 138, 138, 0.12);
}

.mute-button-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.mute-button-x {
  position: absolute;
  right: 5px;
  top: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 120ms ease, transform 120ms ease;
}

.mute-button.muted .mute-button-x {
  opacity: 1;
  transform: scale(1);
}

.chat-flag-preview {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.35rem;
  min-width: 1.35rem;
  height: 0.95rem;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-variant-emoji: emoji;
  text-rendering: optimizeLegibility;
}

.chat-flag-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.chat-bubble {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-bubble p {
  margin-bottom: 0;
  color: #d6def0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-gif-link {
  display: block;
  margin-top: 10px;
}

.chat-gif {
  display: block;
  width: min(280px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.chat-bubble.incoming {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
}

.chat-bubble.outgoing {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(101, 168, 255, 0.16), rgba(143, 104, 255, 0.18));
}

.chat-bubble.system {
  align-self: center;
  max-width: 100%;
  background: rgba(255, 232, 74, 0.08);
  border-color: rgba(255, 232, 74, 0.16);
}

.chat-name {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8cb9ff;
  font-weight: 700;
}

.clickable-name {
  cursor: pointer;
  transition: color 140ms ease, opacity 140ms ease;
}

.clickable-name:hover,
.clickable-name:focus-visible {
  color: #c0dbff;
  opacity: 0.96;
}

.chat-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-tool-button {
  min-width: 48px;
  padding-left: 0;
  padding-right: 0;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 20, 30, 0.96);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
}

.emoji-picker[hidden] {
  display: none;
}

.emoji-picker-button {
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #f7fbff;
  padding: 8px 0;
  font-size: 1.1rem;
  cursor: pointer;
}

.emoji-picker-button:hover {
  background: rgba(108, 156, 255, 0.18);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
}

.chat-input::placeholder {
  color: #7f8aa2;
}

.chat-send {
  padding-left: 18px;
  padding-right: 18px;
}

.chat-input:disabled,
.secondary-button:disabled,
.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(14px);
}

.terminal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 4, 2, 0.72);
  backdrop-filter: blur(12px);
}

.terminal-modal-backdrop[hidden] {
  display: none;
}

.terminal-modal-card {
  width: min(860px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(89, 255, 166, 0.22);
  background:
    linear-gradient(180deg, rgba(12, 18, 14, 0.985), rgba(4, 9, 6, 0.995)),
    #050805;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.52);
  overflow: hidden;
}

.terminal-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(89, 255, 166, 0.14);
  background: linear-gradient(180deg, rgba(22, 42, 28, 0.55), rgba(7, 14, 9, 0));
}

.terminal-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.terminal-modal-kicker {
  margin: 0 0 6px;
  color: #65ffab;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.terminal-modal-header h2 {
  margin: 0;
  color: #e6ffee;
}

.terminal-output {
  margin: 0;
  padding: 18px 20px 22px;
  overflow: auto;
  color: #8dffb6;
  font-family: Consolas, "Cascadia Code", "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background:
    linear-gradient(180deg, rgba(14, 28, 18, 0.24), rgba(0, 0, 0, 0)),
    repeating-linear-gradient(180deg, rgba(141, 255, 182, 0.028) 0 1px, transparent 1px 28px);
}

.terminal-clear-button {
  border-color: rgba(101, 255, 171, 0.22);
  color: #8dffb6;
  font-family: Consolas, "Cascadia Code", "Courier New", monospace;
}

.terminal-clear-button:disabled {
  opacity: 0.45;
}

.terminal-section-blur {
  display: inline-block;
  width: 100%;
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(22, 28, 41, 0.98), rgba(9, 12, 19, 0.98)),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.user-action-menu {
  position: fixed;
  z-index: 9500;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 24px));
}

.user-action-menu[hidden] {
  display: none;
}

.user-action-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(27, 34, 49, 0.98), rgba(13, 17, 26, 0.98)),
    var(--panel-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.user-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.user-action-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-action-id,
.user-action-copy {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.user-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.user-action-voice {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-action-voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.user-action-voice-title {
  color: #a8c8ff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.user-action-voice-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-action-voice-slider {
  flex: 1;
  min-width: 0;
}

.user-action-voice-value {
  min-width: 3rem;
  text-align: right;
}

.user-action-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.user-action-button:hover,
.user-action-button:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(143, 178, 255, 0.22);
  outline: none;
}

.click-heart {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
  pointer-events: none;
  z-index: 9999;
  animation: heart-float 900ms ease-out forwards;
  filter: drop-shadow(0 8px 16px rgba(255, 80, 120, 0.28));
}

.click-heart-icon {
  font-size: 1.4rem;
}

.click-heart-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffd7e2;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.presence-toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.remote-cursors {
  position: fixed;
  inset: 0;
  z-index: 8500;
  pointer-events: none;
}

.remote-cursor {
  position: fixed;
  transform: translate(12px, 10px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.remote-cursor-pointer {
  width: 14px;
  height: 14px;
  border-radius: 3px 50% 50% 50%;
  background: linear-gradient(135deg, #8fc2ff, #7b6dff);
  transform: rotate(-45deg);
  box-shadow: 0 8px 18px rgba(101, 168, 255, 0.25);
}

.remote-cursor-label {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(14, 20, 33, 0.92);
  border: 1px solid rgba(143, 178, 255, 0.2);
  color: #e9f1ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.presence-toast {
  min-width: 220px;
  max-width: min(320px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(27, 34, 49, 0.98), rgba(13, 17, 26, 0.98)),
    var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  animation: presence-toast-life 3s ease forwards;
}

.presence-toast-name {
  margin: 0 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8cb9ff;
}

.presence-toast p {
  margin: 0;
  color: #d6def0;
}

@keyframes presence-toast-life {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

  12%,
  82% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
}

@keyframes heart-float {
  0% {
    transform: translate(-50%, -50%) scale(0.75);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -130%) scale(1.18);
    opacity: 0;
  }
}

.visualizer {
  position: relative;
  height: 360px;
  margin: 0;
  overflow: hidden;
  border-radius: 18px 18px 10px 10px;
  background:
    radial-gradient(circle at 20% calc(100% - 10px), rgba(117, 166, 255, calc(0.08 + var(--visualizer-chord-energy, 0) * 0.2)), rgba(117, 166, 255, 0) 28%),
    radial-gradient(circle at 50% calc(100% - 8px), rgba(123, 112, 255, calc(0.08 + var(--visualizer-chord-energy, 0) * 0.24)), rgba(123, 112, 255, 0) 34%),
    radial-gradient(circle at 80% calc(100% - 10px), rgba(102, 220, 255, calc(0.06 + var(--visualizer-chord-energy, 0) * 0.18)), rgba(102, 220, 255, 0) 28%),
    linear-gradient(180deg, #101722 0%, #0d121a 36%, #090d13 72%, #07090d 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-visualizer {
  position: absolute;
  inset: 0 0 auto 0;
  height: 360px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 108%, rgba(125, 143, 255, calc(0.08 + var(--visualizer-chord-energy, 0) * 0.18)), rgba(125, 143, 255, 0) 42%),
    linear-gradient(180deg, rgba(21, 29, 41, 0.96) 0%, rgba(11, 15, 23, 0.97) 58%, rgba(8, 11, 17, 0.99) 100%);
  opacity: 1;
}

.visualizer::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 26px;
  background:
    radial-gradient(circle at 50% 0%, rgba(185, 218, 255, 0.26), rgba(185, 218, 255, 0) 58%),
    linear-gradient(180deg, rgba(111, 165, 255, 0.16), rgba(111, 165, 255, 0.03));
  pointer-events: none;
}

.visualizer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%),
    radial-gradient(circle at 50% 120%, rgba(125, 143, 255, calc(0.08 + var(--visualizer-chord-energy, 0) * 0.14)), rgba(125, 143, 255, 0) 44%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.light-note {
  position: absolute;
  bottom: 0;
  border-radius: 999px 999px 18px 18px;
  pointer-events: none;
  transform-origin: center bottom;
  filter: drop-shadow(0 0 14px rgba(110, 170, 255, 0.28));
  will-change: transform, height, opacity;
}

.light-note-core,
.light-note-halo,
.light-note-trail {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.light-note-core {
  background: linear-gradient(180deg, rgba(245, 250, 255, 0.95) 0%, rgba(176, 212, 255, 0.88) 24%, rgba(103, 154, 255, 0.76) 62%, rgba(103, 154, 255, 0.08) 100%);
}

.light-note-halo {
  inset: -8% -28% auto;
  height: 62%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(145, 202, 255, 0.8) 0%, rgba(109, 156, 255, 0.2) 52%, rgba(109, 156, 255, 0) 82%);
  filter: blur(10px);
}

.light-note-trail {
  inset: 18% 28% auto;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(213, 233, 255, calc(0.56 * var(--note-energy, 1))), rgba(103, 154, 255, calc(0.34 * var(--note-energy, 1))) 40%, rgba(103, 154, 255, 0) 100%);
  filter: blur(3px);
}

.light-note.black .light-note-core {
  background: linear-gradient(180deg, rgba(251, 241, 255, 0.96) 0%, rgba(215, 174, 255, 0.88) 24%, rgba(170, 112, 255, 0.78) 62%, rgba(170, 112, 255, 0.08) 100%);
}

.light-note.black .light-note-halo {
  background: radial-gradient(circle, rgba(219, 176, 255, 0.78) 0%, rgba(170, 112, 255, 0.22) 52%, rgba(170, 112, 255, 0) 82%);
}

.light-note.black .light-note-trail {
  background: linear-gradient(180deg, rgba(239, 214, 255, calc(0.56 * var(--note-energy, 1))), rgba(170, 112, 255, calc(0.34 * var(--note-energy, 1))) 40%, rgba(170, 112, 255, 0) 100%);
}

.piano-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  position: relative;
  z-index: 1;
}

.piano {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  height: 220px;
  padding: 0;
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 10%),
    linear-gradient(180deg, #0d1118, #030407);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.key {
  position: relative;
  user-select: none;
  cursor: pointer;
  transition: transform 80ms ease, background 80ms ease, box-shadow 80ms ease;
}

.key:hover {
  transform: translateY(1px);
}

.white-key {
  flex: 1 1 0;
  height: 100%;
  border-radius: 0 0 10px 10px;
  border: 1px solid var(--white-key-edge);
  background: linear-gradient(180deg, #e2e7ef 0%, #c4ccd9 70%, #96a2b6 100%);
  box-shadow: inset 0 -14px 16px rgba(59, 68, 85, 0.26);
}

.white-key.active {
  background: linear-gradient(180deg, #fffbd0 0%, var(--active-white) 76%, #f3cc11 100%);
}

.black-key {
  position: absolute;
  top: 0;
  width: 1.15%;
  height: 132px;
  border-radius: 0 0 9px 9px;
  border: 1px solid var(--black-key-edge);
  background: linear-gradient(180deg, #1f2530 0%, #0b1017 44%, #010203 100%);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.52);
  z-index: 2;
}

.black-key.active {
  background: linear-gradient(180deg, #f5b7ff 0%, var(--active-black) 52%, #6d186f 100%);
}

.key-label,
.key-shortcut {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.key-label {
  bottom: 14px;
  font-size: 0.72rem;
  color: #66738d;
}

.key-shortcut {
  bottom: 34px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1b2330;
}

.key-shortcut:empty {
  display: none;
}

.black-key .key-label {
  bottom: 10px;
  font-size: 0.62rem;
  color: rgba(244, 247, 255, 0.92);
}

.black-key .key-shortcut {
  bottom: 52px;
  color: rgba(255, 255, 255, 0.9);
}

code {
  padding: 0.14rem 0.38rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce9ff;
}

::-webkit-scrollbar {
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(143, 104, 255, 0.45);
  border-radius: 999px;
}

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

  .audio-visualizer {
    width: 100%;
  }

  .instrument-topbar,
  .instrument-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .instrument-topbar {
    display: flex;
  }

  .panel-actions {
    align-items: flex-start;
  }

  .instrument-screen {
    min-width: 0;
    width: 100%;
    flex-basis: auto;
  }

  .control-strip,
  .soundfont-strip,
  .transpose-strip {
    justify-content: flex-start;
  }

  .panel-status-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .chat-panel {
    min-height: 420px;
  }

  .user-list-panel {
    top: auto;
    right: 16px;
    bottom: 18px;
    width: min(calc(240px + 2cm), calc(100vw - 32px + 2cm));
    max-height: 240px;
    opacity: 0.92;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0 10px 10px;
  }

  .piano-dock,
  .error-log,
  .chat-panel {
    border-radius: 20px;
  }

  .piano-dock,
  .chat-panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .sheet-writer {
    border-radius: 14px;
    padding: 10px 12px;
  }

  .user-list-panel {
    right: 10px;
    bottom: 10px;
    width: min(calc(220px + 2cm), calc(100vw - 20px + 2cm));
    border-radius: 18px;
  }

  .instrument-panel {
    margin-left: -14px;
    margin-right: -14px;
    padding: 14px;
    border-radius: 20px 20px 0 0;
  }

  .soundfont-strip .soundfont-select {
    min-width: 0;
    width: 100%;
  }

  .piano {
    height: 190px;
  }

  .instrument-controls-shell {
    margin-top: 0;
  }

  .black-key {
    height: 112px;
  }
}
