/* Command piano validation */
.command-piano-screen {
  min-height: 100svh;
  height: 100svh;
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 12px 16px;
  background:
    radial-gradient(circle at 18% 14%, rgba(214, 179, 100, 0.14), rgba(214, 179, 100, 0) 28%),
    radial-gradient(circle at 82% 82%, rgba(120, 85, 31, 0.16), rgba(120, 85, 31, 0) 24%),
    linear-gradient(180deg, rgba(14, 14, 15, 0.98), rgba(8, 8, 9, 1));
}

.command-piano-card {
  width: min(1840px, calc(100vw - 24px));
  min-height: min(878px, calc(100svh - 12px));
  padding: 10px 12px 8px;
  display: grid;
  grid-template-columns: minmax(210px, 248px) minmax(0, 1fr) minmax(124px, 152px);
  grid-template-areas: "copy instrument status";
  align-items: stretch;
  column-gap: clamp(12px, 1.6vw, 22px);
}

.command-piano-copy,
.command-piano-status,
.command-piano-validation {
  position: relative;
  z-index: 1;
}

.command-piano-copy {
  grid-area: copy;
  align-self: start;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  padding: 24px 0 0 10px;
  max-width: none;
  overflow: visible;
}

.command-piano-comms-bar {
  width: min(232px, 100%);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.command-piano-comms-status {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: rgba(223, 195, 133, 0.74);
  font-size: 0.64rem;
  line-height: 1;
  white-space: nowrap;
}

.command-piano-comms-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8fffbd;
  box-shadow: 0 0 12px rgba(143, 255, 189, 0.52);
}

.command-piano-hq-return-button {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(214, 179, 101, 0.42);
  background:
    linear-gradient(180deg, rgba(55, 46, 31, 0.82), rgba(20, 18, 15, 0.92));
  color: #f5e5bf;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 188, 0.1),
    0 10px 20px rgba(0, 0, 0, 0.18);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.command-piano-hq-return-button:hover {
  border-color: rgba(240, 206, 132, 0.7);
  background:
    linear-gradient(180deg, rgba(83, 65, 32, 0.9), rgba(37, 29, 16, 0.96));
  color: #fff0cf;
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 188, 0.14),
    0 12px 22px rgba(0, 0, 0, 0.22);
}

.command-piano-hq-return-button:focus-visible {
  outline: 2px solid rgba(255, 217, 148, 0.85);
  outline-offset: 3px;
}

.command-piano-status {
  grid-area: status;
  align-self: end;
  justify-self: stretch;
  min-width: 0;
  padding: 0 8px 14px 0;
}

.command-piano-kicker,
.command-piano-subtitle,
.command-piano-feedback,
.command-piano-progress,
.command-piano-validation-label,
.command-piano-validation-success,
.command-piano-validation-feedback {
  margin: 0;
}

.command-piano-kicker {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(223, 195, 133, 0.82);
}

.command-piano-title {
  margin: 8px 0 0;
  font-family: "Cormorant Garamond", serif;
  max-width: min(260px, 100%);
  font-size: clamp(1.8rem, 2vw, 2.24rem);
  line-height: 0.98;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff1d0;
}

.command-piano-subtitle {
  max-width: min(232px, 100%);
  margin-top: 12px;
  font-family: "Rajdhani", sans-serif;
  font-size: clamp(0.74rem, 0.82vw, 0.8rem);
  line-height: 1.28;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(239, 223, 188, 0.76);
}

.command-piano-instrument {
  grid-area: instrument;
  position: relative;
  width: min(1520px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 10px 6px;
  border-radius: 28px 28px 22px 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 227, 177, 0.08), rgba(255, 227, 177, 0) 36%),
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(57, 37, 22, 0.98), rgba(18, 12, 10, 0.98));
  background-size:
    100% 100%,
    cover,
    100% 100%;
  background-position:
    center,
    center,
    center;
  background-blend-mode: screen, multiply, normal;
  border: 1px solid rgba(184, 149, 83, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 208, 0.1),
    inset 0 -16px 20px rgba(0, 0, 0, 0.18),
    0 26px 54px rgba(0, 0, 0, 0.28);
}

.command-piano-instrument::before {
  content: "";
  position: absolute;
  inset: 12px 12px auto;
  height: 26px;
  border-radius: 999px 999px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 226, 178, 0.12), rgba(255, 226, 178, 0));
  pointer-events: none;
}

.command-piano-fallboard {
  width: min(1330px, calc(100% - 8px));
  height: 12px;
  margin: 0 auto 4px;
  border-radius: 14px 14px 6px 6px;
  background:
    linear-gradient(180deg, rgba(255, 232, 192, 0.08), rgba(255, 232, 192, 0) 48%),
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(70, 43, 22, 0.98), rgba(31, 18, 12, 0.98));
  background-size:
    100% 100%,
    cover,
    100% 100%;
  background-position:
    center,
    center,
    center;
  background-blend-mode: screen, multiply, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 196, 0.08),
    0 6px 10px rgba(0, 0, 0, 0.12);
}

.command-piano-stand {
  position: relative;
  width: min(1340px, calc(100% - 8px));
  margin: 0 auto 0;
  min-height: clamp(244px, 25vw, 328px);
  perspective: 1800px;
  z-index: 2;
  border: 1px solid rgba(186, 152, 86, 0.28);
  border-radius: 26px;
  overflow: hidden;
  background:
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(66, 40, 18, 0.97), rgba(29, 17, 11, 0.98));
  background-size:
    cover,
    100% 100%;
  background-position:
    center,
    center;
  background-blend-mode: multiply, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 229, 185, 0.08),
    inset 0 -16px 20px rgba(0, 0, 0, 0.16),
    0 12px 22px rgba(0, 0, 0, 0.18);
}

.command-piano-stand::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -18px;
  height: 26px;
  border-radius: 0 0 22px 22px;
  background:
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(72, 43, 18, 0.98), rgba(28, 17, 10, 0.98));
  background-size:
    cover,
    100% 100%;
  background-position:
    center,
    center;
  background-blend-mode: multiply, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 192, 0.08),
    0 12px 22px rgba(0, 0, 0, 0.24);
}

.command-piano-bridge-status {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 24px;
  margin: 4px auto 8px;
  width: min(320px, 100%);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.command-piano-stand-notes {
  position: absolute;
  inset: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  background: transparent;
  z-index: 3;
  pointer-events: none;
}

.command-piano-book-bay {
  position: absolute;
  left: 50%;
  top: 18px;
  width: min(456px, calc(100% - 220px));
  height: calc(100% - 44px);
  transform: translateX(-50%);
  border-radius: 22px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  background: transparent;
  box-shadow: none;
  transition: none;
  z-index: 1;
}

.command-piano-book-bay-flash {
  position: absolute;
  left: 50%;
  top: 18px;
  width: min(456px, calc(100% - 220px));
  height: calc(100% - 44px);
  transform: translateX(-50%);
  border-radius: 22px;
  border: 2px solid rgba(112, 244, 173, 0);
  box-shadow:
    0 0 0 rgba(92, 232, 150, 0),
    inset 0 0 0 rgba(171, 255, 207, 0);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

.command-piano-book-bay-flash::before,
.command-piano-book-bay-flash::after {
  content: none;
}

.command-piano-book-bay::before {
  content: "";
  position: absolute;
  inset: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(20, 18, 17, 0.78), rgba(7, 7, 8, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(186, 152, 86, 0.16),
    inset 0 0 26px rgba(0, 0, 0, 0.34);
  opacity: 0;
}

.command-piano-book-bay-track {
  position: absolute;
  inset: 18px 26px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(9, 9, 10, 0.78), rgba(28, 26, 24, 0.26)),
    linear-gradient(90deg, rgba(164, 132, 74, 0.06), rgba(92, 74, 40, 0.03));
  box-shadow:
    inset 0 0 0 1px rgba(170, 140, 82, 0.1),
    inset 0 12px 16px rgba(255, 237, 201, 0.04),
    inset 0 -12px 16px rgba(0, 0, 0, 0.3);
  opacity: 0;
}

.command-piano-book-bay-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  transform: translateX(0);
  background:
    linear-gradient(180deg, rgba(255, 228, 186, 0.04), rgba(255, 228, 186, 0) 42%),
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(57, 37, 22, 0.98), rgba(18, 12, 10, 0.98));
  background-size:
    100% 100%,
    cover,
    100% 100%;
  background-position:
    center,
    center,
    center;
  background-blend-mode: screen, multiply, normal;
  box-shadow:
    inset 0 0 0 1px rgba(121, 96, 54, 0.18),
    inset 0 18px 20px rgba(255, 234, 202, 0.03),
    inset 0 -18px 20px rgba(0, 0, 0, 0.22);
  opacity: 1;
  transition: transform 1000ms cubic-bezier(0.18, 0.8, 0.2, 1) 80ms;
  will-change: transform;
  z-index: 3;
}

.command-piano-book-bay-door-left {
  left: 0;
  border-right: 1px solid rgba(21, 12, 8, 0.56);
}

.command-piano-book-bay-door-right {
  right: 0;
  border-left: 1px solid rgba(21, 12, 8, 0.56);
}

.command-piano-book-stage {
  position: absolute;
  left: 50%;
  top: 18px;
  width: min(456px, calc(100% - 220px));
  height: calc(100% - 44px);
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 4;
}

.command-piano-book-art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(1345px, calc(100% - 10px));
  height: 360px;
  background: url("../../assets/textures/optimized/altesbuch.webp");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.34));
  transform-origin: center 68%;
  will-change: transform, opacity;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.command-piano-book-title,
.command-piano-book-subtitle {
  position: absolute;
  left: 53%;
  z-index: 1;
  display: block;
  pointer-events: none;
  width: clamp(150px, 16.5%, 218px);
  color: rgba(246, 214, 154, 0.86);
  text-shadow:
    0 1px 0 rgba(255, 239, 208, 0.12),
    0 2px 10px rgba(48, 22, 7, 0.28);
  transform: translateX(-50%);
  text-align: center;
}

.command-piano-book-title {
  top: 28%;
  font-family: "Citadel of Blackrose", "Cormorant Garamond", serif;
  font-size: clamp(0.98rem, 1.22vw, 1.46rem);
  line-height: 0.84;
  letter-spacing: 0.015em;
}

.command-piano-book-subtitle {
  top: 51.5%;
  font-family: "Citadel of Blackrose", "Cormorant Garamond", serif;
  font-size: clamp(0.66rem, 0.78vw, 0.92rem);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: none;
}

.command-piano-book-art::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 4px;
  height: 20px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0));
  filter: blur(7px);
  z-index: -1;
}

.command-piano-stand-core {
  position: absolute;
  inset: 0;
  background: transparent;
  overflow: hidden;
  z-index: 1;
}

.command-piano-stand.is-open .command-piano-book-bay {
  opacity: 1;
}

.command-piano-stand.is-arming .command-piano-book-bay-track,
.command-piano-stand.is-arming .command-piano-book-bay-door {
  opacity: 0;
}

.command-piano-stand.is-open .command-piano-book-bay::before {
  opacity: 1;
}

.command-piano-stand.is-open .command-piano-book-bay-door {
  opacity: 1;
}

.command-piano-stand.is-open .command-piano-book-bay-door-left {
  transform: translateX(-102%);
}

.command-piano-stand.is-open .command-piano-book-bay-door-right {
  transform: translateX(102%);
}

.command-piano-stand.is-open .command-piano-book-bay-track {
  opacity: 1;
}

.command-piano-stand.is-arming .command-piano-book-bay-flash {
  animation: commandPianoBayFlash 900ms cubic-bezier(0.2, 0.78, 0.2, 1) forwards;
}

.command-piano-stand.is-open .command-piano-book-art {
  animation: commandPianoBookVault 3460ms cubic-bezier(0.2, 0.78, 0.2, 1) forwards;
}

.command-piano-shell {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 18px 8px 8px;
  border: 1px solid rgba(182, 145, 80, 0.26);
  background:
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(49, 36, 22, 0.5), rgba(14, 11, 8, 0.82)),
    radial-gradient(circle at top, rgba(247, 223, 168, 0.08), rgba(247, 223, 168, 0) 58%);
  background-size:
    cover,
    100% 100%,
    100% 100%;
  background-position:
    center,
    center,
    center;
  background-blend-mode: multiply, normal, normal;
  border-radius: 24px 24px 28px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255, 234, 204, 0.08),
    inset 0 0 0 1px rgba(50, 34, 14, 0.4),
    0 16px 34px rgba(0, 0, 0, 0.24);
}

.command-piano-shell::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 10px;
  height: 10px;
  border-radius: 999px 999px 10px 10px;
  background: linear-gradient(180deg, rgba(255, 225, 176, 0.08), rgba(255, 225, 176, 0));
}

.command-piano-cheek {
  position: absolute;
  top: 20px;
  bottom: 16px;
  width: 12px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 228, 186, 0.08), rgba(255, 228, 186, 0) 42%),
    url("../../assets/textures/optimized/wood.webp"),
    linear-gradient(180deg, rgba(74, 47, 25, 0.98), rgba(28, 18, 12, 0.98));
  background-size:
    100% 100%,
    cover,
    100% 100%;
  background-position:
    center,
    center,
    center;
  background-blend-mode: screen, multiply, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 196, 0.06),
    0 10px 14px rgba(0, 0, 0, 0.18);
}

.command-piano-cheek-left {
  left: 8px;
}

.command-piano-cheek-right {
  right: 8px;
}

.command-piano-keyboard {
  --white-key-count: 21;
  --white-key-width: calc(100% / var(--white-key-count));
  position: relative;
  width: min(1040px, 100%);
  margin: 0 auto;
  aspect-ratio: 3 / 1;
  border-radius: 24px;
  padding: 14px 14px 12px;
  background:
    linear-gradient(180deg, rgba(44, 30, 18, 0.98), rgba(13, 10, 8, 0.98)),
    radial-gradient(circle at top, rgba(255, 220, 152, 0.12), rgba(255, 220, 152, 0) 42%);
  box-shadow:
    inset 0 2px 1px rgba(255, 236, 210, 0.06),
    inset 0 -12px 18px rgba(0, 0, 0, 0.34),
    0 18px 36px rgba(0, 0, 0, 0.26);
}

.command-piano-white-keys,
.command-piano-black-keys {
  position: absolute;
  inset: 14px 14px 12px;
}

.command-piano-white-keys {
  display: block;
  z-index: 1;
}

.command-piano-black-keys {
  pointer-events: none;
  z-index: 3;
}

.command-piano-key {
  position: absolute;
  appearance: none;
  border: 0;
  padding: 0;
  transition:
    transform 120ms ease,
    filter 120ms ease,
    box-shadow 120ms ease;
}

.command-piano-key-playable {
  cursor: pointer;
  z-index: 2;
}

.command-piano-key:disabled {
  cursor: default;
}

.command-piano-key-white {
  left: calc(var(--white-key-index) * var(--white-key-width));
  width: var(--white-key-width);
  height: 100%;
  border-radius: 0 0 18px 18px;
  border-left: 1px solid rgba(54, 44, 35, 0.7);
  border-right: 1px solid rgba(31, 24, 18, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 254, 249, 1), rgba(246, 239, 224, 1) 42%, rgba(213, 196, 168, 1) 78%, rgba(184, 164, 136, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -14px 18px rgba(98, 74, 45, 0.24),
    0 1px 0 rgba(0, 0, 0, 0.18);
}

.command-piano-key-white:first-child {
  border-top-left-radius: 16px;
}

.command-piano-key-white:last-child {
  border-top-right-radius: 16px;
}

.command-piano-key-black {
  top: 0;
  left: calc((var(--black-key-after-index) + 1) * var(--white-key-width) - (var(--white-key-width) * 0.32));
  width: calc(var(--white-key-width) * 0.64);
  height: 58%;
  border-radius: 0 0 10px 10px;
  background:
    linear-gradient(180deg, rgba(96, 96, 96, 0.95), rgba(23, 23, 24, 1) 12%, rgba(5, 5, 7, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 12px rgba(0, 0, 0, 0.42),
    0 10px 18px rgba(0, 0, 0, 0.34),
    0 2px 0 rgba(0, 0, 0, 0.48);
  z-index: 3;
}

.command-piano-octave-left,
.command-piano-octave-right {
  filter: saturate(0.55) brightness(0.8);
}

.command-piano-key-white.command-piano-octave-center {
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 1), rgba(252, 244, 230, 1) 46%, rgba(231, 212, 178, 1) 80%, rgba(198, 176, 142, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -16px 20px rgba(131, 95, 39, 0.28),
    0 0 0 1px rgba(234, 197, 126, 0.06);
}

.command-piano-key-black.command-piano-octave-center {
  background:
    linear-gradient(180deg, rgba(118, 118, 121, 0.98), rgba(28, 28, 30, 1) 14%, rgba(8, 8, 10, 1) 100%);
}

.command-piano-key-playable.command-piano-octave-center:hover:not(:disabled),
.command-piano-key-playable.command-piano-octave-center:focus-visible {
  transform: translateY(3px);
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -10px 16px rgba(131, 95, 39, 0.24),
    0 0 0 1px rgba(234, 197, 126, 0.06);
}

.command-piano-key.is-pressed {
  transform: translateY(8px) scaleY(0.988);
  filter: brightness(0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -8px 14px rgba(92, 64, 24, 0.22),
    0 0 0 1px rgba(214, 179, 103, 0.05);
}

.command-piano-key.is-correct {
  background:
    linear-gradient(180deg, rgba(243, 255, 246, 1), rgba(221, 255, 228, 1) 44%, rgba(168, 232, 181, 1) 82%, rgba(131, 196, 145, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    inset 0 -8px 14px rgba(54, 109, 63, 0.26),
    0 0 0 1px rgba(125, 228, 152, 0.38),
    0 0 18px rgba(84, 224, 132, 0.56),
    0 0 42px rgba(84, 224, 132, 0.4);
  filter: brightness(1.02) saturate(1.18);
  animation: commandPianoCorrectFlash 260ms ease-out;
}

.command-piano-key.is-wrong {
  background:
    linear-gradient(180deg, rgba(255, 245, 245, 1), rgba(255, 218, 218, 1) 44%, rgba(244, 161, 161, 1) 82%, rgba(208, 112, 112, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 244, 0.9),
    inset 0 -8px 14px rgba(128, 35, 35, 0.3),
    0 0 0 1px rgba(255, 114, 114, 0.38),
    0 0 18px rgba(255, 82, 82, 0.56),
    0 0 42px rgba(255, 82, 82, 0.38);
  filter: brightness(1) saturate(1.22);
  animation: commandPianoWrongFlash 260ms ease-out;
}

.command-piano-key-decorative {
  pointer-events: none;
}

.command-piano-status {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  align-items: flex-start;
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 100%;
}

.command-piano-status-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.command-piano-instrument > .command-piano-status-side {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
}

.command-piano-feedback {
  max-width: 150px;
  font-size: 0.76rem;
  line-height: 1.28;
  color: rgba(240, 227, 196, 0.82);
}

.command-piano-feedback[data-state="progress"] {
  color: rgba(255, 227, 154, 0.94);
}

.command-piano-feedback[data-state="success"] {
  color: rgba(177, 255, 201, 0.94);
}

.command-piano-feedback[data-state="error"] {
  color: rgba(255, 130, 130, 0.94);
}

.command-piano-progress {
  font-size: 0.82rem;
  color: rgba(223, 195, 133, 0.84);
  white-space: nowrap;
}

.command-piano-test-drawer-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(192, 156, 90, 0.36);
  background: linear-gradient(180deg, rgba(57, 41, 24, 0.92), rgba(23, 18, 14, 0.96));
  color: rgba(242, 227, 195, 0.86);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.command-piano-reset-drawer-button {
  border-color: rgba(145, 128, 95, 0.3);
  color: rgba(228, 215, 188, 0.8);
}

.command-piano-test-drawer-button:hover,
.command-piano-test-drawer-button:focus-visible {
  border-color: rgba(233, 195, 121, 0.5);
  color: #fff1d0;
}

.command-piano-validation {
  display: grid;
  gap: 14px;
  position: absolute;
  inset: 16px 18px 18px;
  transform: none;
  z-index: 2;
  align-content: center;
  padding: 12px 8px;
  background: transparent;
  border-radius: 22px;
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
  transition: none;
}

.command-piano-stand.is-open .command-piano-validation {
  pointer-events: auto;
}

.command-piano-stand.is-resetting .command-piano-validation {
  transition: none;
  opacity: 1;
  transform: none;
  pointer-events: none;
}

@keyframes commandPianoBookVault {
  0% {
    transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.34));
  }

  58% {
    transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.34));
  }

  80% {
    transform: translate(-50%, -50%) translate3d(0, 0, -220px) scale(0.7);
    opacity: 1;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
  }

  100% {
    transform: translate(-50%, -50%) translate3d(312px, 0, -220px) scale(0.7);
    opacity: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
  }
}

@keyframes commandPianoBayFlash {
  0% {
    opacity: 0;
    border-color: rgba(106, 238, 166, 0);
    box-shadow:
      0 0 0 rgba(106, 238, 166, 0),
      inset 0 0 0 rgba(171, 255, 207, 0);
  }

  18% {
    opacity: 1;
    border-color: rgba(112, 244, 173, 0.94);
    box-shadow:
      0 0 26px rgba(92, 232, 150, 0.82),
      0 0 72px rgba(92, 232, 150, 0.38),
      inset 0 0 12px rgba(171, 255, 207, 0.12);
  }

  56% {
    opacity: 1;
    border-color: rgba(116, 246, 176, 0.98);
    box-shadow:
      0 0 32px rgba(92, 232, 150, 0.9),
      0 0 88px rgba(92, 232, 150, 0.44),
      inset 0 0 16px rgba(171, 255, 207, 0.14);
  }

  82% {
    opacity: 0.72;
    border-color: rgba(110, 242, 171, 0.48);
    box-shadow:
      0 0 14px rgba(92, 232, 150, 0.34),
      0 0 38px rgba(92, 232, 150, 0.14),
      inset 0 0 8px rgba(171, 255, 207, 0.06);
  }

  100% {
    opacity: 0;
    border-color: rgba(106, 238, 166, 0);
    box-shadow:
      0 0 0 rgba(106, 238, 166, 0),
      inset 0 0 0 rgba(171, 255, 207, 0);
  }
}

.command-piano-validation-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: flex-start;
}

.command-piano-validation-success {
  max-width: 100%;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.88rem;
  line-height: 1.22;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(186, 246, 205, 0.92);
}

.command-piano-validation-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(100%, 292px);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(223, 195, 133, 0.84);
}

.command-piano-validation-input,
.command-piano-validation-form input {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(190, 157, 90, 0.42);
  background: rgba(10, 10, 10, 0.78);
  color: #f7edd7;
  font: inherit;
}

.command-piano-validation-form button {
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid rgba(227, 191, 121, 0.5);
  background: linear-gradient(180deg, rgba(132, 92, 39, 0.88), rgba(76, 49, 16, 0.94));
  color: #fff2d6;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.command-piano-validation-feedback {
  font-family: "Rajdhani", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 130, 130, 0.94);
}

.command-piano-pedals {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}

.command-piano-pedal {
  width: 18px;
  height: 48px;
  border-radius: 0 0 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 240, 205, 0.46), rgba(217, 176, 84, 0.98) 30%, rgba(103, 69, 16, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 228, 0.34),
    0 8px 12px rgba(0, 0, 0, 0.18);
}

@keyframes commandPianoCorrectFlash {
  0% {
    filter: brightness(1.16) saturate(1.3);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.96),
      inset 0 -8px 14px rgba(54, 109, 63, 0.3),
      0 0 0 1px rgba(125, 228, 152, 0.48),
      0 0 26px rgba(84, 224, 132, 0.7),
      0 0 56px rgba(84, 224, 132, 0.52);
  }

  100% {
    filter: brightness(1.02) saturate(1.18);
  }
}

@keyframes commandPianoWrongFlash {
  0% {
    filter: brightness(1.14) saturate(1.32);
    box-shadow:
      inset 0 1px 0 rgba(255, 244, 244, 0.94),
      inset 0 -8px 14px rgba(128, 35, 35, 0.32),
      0 0 0 1px rgba(255, 114, 114, 0.5),
      0 0 26px rgba(255, 82, 82, 0.72),
      0 0 56px rgba(255, 82, 82, 0.5);
  }

  100% {
    filter: brightness(1) saturate(1.22);
  }
}

@media (max-width: 1540px), (max-height: 860px) {
  .command-piano-screen {
    align-items: center;
    overflow: hidden;
    padding: 8px 12px 10px;
  }

  .command-piano-card {
    position: relative;
    width: min(1600px, calc(100vw - 16px));
    min-height: min(690px, calc(100svh - 14px));
    padding: 4px 8px 2px;
    grid-template-columns: minmax(184px, 214px) minmax(0, 1fr) minmax(118px, 140px);
    grid-template-areas: "copy instrument status";
    align-items: stretch;
    column-gap: 12px;
  }

  .command-piano-copy {
    padding: 0 0 0 6px;
  }

  .command-piano-comms-bar {
    width: min(202px, 100%);
    min-height: 30px;
    margin-bottom: 10px;
  }

  .command-piano-comms-status {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .command-piano-hq-return-button {
    min-width: 50px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.66rem;
  }

  .command-piano-status {
    align-self: end;
    justify-content: flex-end;
    padding: 0 8px 0 0;
    gap: 8px;
  }

  .command-piano-title {
    max-width: min(220px, 100%);
    font-size: clamp(1.42rem, 1.76vw, 1.9rem);
    line-height: 1;
  }

  .command-piano-subtitle {
    max-width: min(202px, 100%);
    margin-top: 10px;
    font-size: clamp(0.68rem, 0.78vw, 0.76rem);
    line-height: 1.22;
  }

  .command-piano-instrument {
    width: min(1320px, 100%);
    padding: 4px 8px 2px;
    border-radius: 22px 22px 16px 16px;
  }

  .command-piano-fallboard {
    width: calc(100% - 10px);
    height: 8px;
    margin-bottom: 2px;
  }

  .command-piano-stand {
    width: calc(100% - 12px);
    min-height: clamp(180px, 18vw, 236px);
  }

  .command-piano-book-bay,
  .command-piano-book-bay-flash,
  .command-piano-book-stage {
    top: 20px;
    width: min(390px, calc(100% - 128px));
    height: calc(100% - 48px);
  }

  .command-piano-book-art {
    width: min(980px, calc(100% - 8px));
    height: clamp(150px, 15vw, 198px);
  }

  .command-piano-shell {
    padding: 10px 6px 4px;
    border-radius: 20px 20px 24px 24px;
  }

  .command-piano-keyboard {
    width: min(920px, 100%);
    aspect-ratio: 3.65 / 1;
    padding: 10px 10px 8px;
    border-radius: 18px;
  }

  .command-piano-white-keys,
  .command-piano-black-keys {
    inset: 10px 10px 8px;
  }

  .command-piano-feedback {
    max-width: 124px;
    font-size: 0.66rem;
    line-height: 1.16;
  }

  .command-piano-progress {
    font-size: 0.74rem;
  }

  .command-piano-status-side {
    gap: 8px;
  }

  .command-piano-test-drawer-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.64rem;
  }

  .command-piano-validation {
    inset: 12px 14px 14px;
    gap: 10px;
  }

  .command-piano-validation-label {
    gap: 6px;
    min-width: min(100%, 250px);
    font-size: 0.72rem;
  }

  .command-piano-validation-input,
  .command-piano-validation-form input,
  .command-piano-validation-form button {
    min-height: 44px;
  }

  .command-piano-validation-form button {
    padding: 0 16px;
    font-size: 0.88rem;
  }

  .command-piano-validation-success,
  .command-piano-validation-feedback {
    font-size: 0.82rem;
    line-height: 1.16;
  }

  .command-piano-pedals {
    display: none;
  }
}

@media (max-width: 1240px), (max-height: 760px) {
  .command-piano-card {
    width: min(1220px, 100%);
    padding: 18px 14px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "instrument"
      "status";
    row-gap: 18px;
  }

  .command-piano-copy,
  .command-piano-status {
    padding: 0;
  }

  .command-piano-title,
  .command-piano-subtitle,
  .command-piano-feedback {
    max-width: none;
  }

  .command-piano-status {
    min-height: auto;
  }

  .command-piano-status-side {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .command-piano-card {
    width: min(1220px, 100%);
    min-height: auto;
    padding: 24px 18px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "instrument"
      "status";
    row-gap: 18px;
  }

  .command-piano-copy,
  .command-piano-status {
    padding: 0;
  }

  .command-piano-subtitle,
  .command-piano-feedback {
    max-width: none;
  }

  .command-piano-instrument {
    padding: 14px 10px 20px;
    border-radius: 26px 26px 20px 20px;
    width: 100%;
    margin: 0 auto;
  }

  .command-piano-fallboard {
    width: calc(100% - 12px);
    height: 18px;
    margin-bottom: 6px;
  }

  .command-piano-stand {
    width: calc(100% - 14px);
    margin-bottom: -18px;
    min-height: 180px;
  }

  .command-piano-shell {
    padding: 14px;
    padding-top: 24px;
  }

  .command-piano-book-art {
    width: calc(100% - 6px);
    height: 136px;
  }

  .command-piano-cheek {
    top: 20px;
    bottom: 16px;
    width: 12px;
  }

  .command-piano-cheek-left {
    left: 8px;
  }

  .command-piano-cheek-right {
    right: 8px;
  }

  .command-piano-keyboard {
    aspect-ratio: 2 / 1;
    padding: 14px 10px 10px;
  }

  .command-piano-white-keys,
  .command-piano-black-keys {
    inset: 14px 10px 10px;
  }

  .command-piano-octave-left,
  .command-piano-octave-right {
    opacity: 0.2;
  }

  .command-piano-key-playable.command-piano-octave-center {
    width: calc(var(--white-key-width) * 1.45);
    left: calc(
      ((var(--white-key-index) - 7) * (var(--white-key-width) * 1.45))
      + (var(--white-key-width) * 5.45)
    );
    z-index: 4;
  }

  .command-piano-status {
    min-height: auto;
  }

  .command-piano-status-side {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }

  .command-piano-pedals {
    gap: 10px;
    margin-top: 6px;
  }

  .command-piano-pedal {
    width: 13px;
    height: 34px;
  }

  .command-piano-validation-form {
    flex-direction: column;
    align-items: stretch;
  }
}
