:root {
  color-scheme: dark;
  --bg: #0b0d0e;
  --surface: #171b1d;
  --surface-strong: #22282b;
  --ink: #f6f1e7;
  --muted: #aeb8b3;
  --line: #3a4648;
  --teal: #7bd8c8;
  --gold: #e8c35e;
  --blue: #9ec7ff;
  --rose: #ef8b7b;
  --green: #9bd887;
  --warn: #ffbd75;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, #0b0d0e 0%, #171d1f 52%, #0f1211 100%);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 10px;
  width: calc(100vw - 16px);
  height: calc(100vh - 16px);
  min-height: 660px;
  margin: 8px auto;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(330px, 0.95fr) minmax(260px, 0.72fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.keyboard-panel,
.staff-panel,
.controls {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 29, 0.96);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
}

.keyboard-panel,
.staff-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

video,
canvas {
  display: block;
  width: 100%;
  height: 100%;
}

video {
  position: absolute;
  inset: 0;
  object-fit: contain;
  opacity: 0;
}

canvas {
  position: relative;
  z-index: 1;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #101517 0 8px, transparent 9px),
    conic-gradient(from 28deg, var(--teal), var(--blue), var(--gold), var(--rose), var(--green), var(--teal));
}

.brand h1,
.brand p,
.label,
.summary,
.status,
.readout {
  margin: 0;
}

.eyebrow,
.label {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 760;
  text-transform: uppercase;
}

.brand h1 {
  font-size: 1.38rem;
  line-height: 1.05;
}

.status,
.panel {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.status {
  color: var(--muted);
  line-height: 1.36;
}

.status.is-warning {
  border-color: rgba(255, 189, 117, 0.6);
  color: var(--warn);
}

.panel {
  display: grid;
  gap: 11px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.summary {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.34;
}

.summary.is-warning {
  color: var(--warn);
}

.readout {
  min-height: 1.16em;
  color: var(--ink);
  font-size: 1.48rem;
  font-weight: 780;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.button-stack,
.button-grid {
  display: grid;
  gap: 8px;
}

.button-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

button {
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgba(123, 216, 200, 0.45);
  border-radius: 8px;
  color: #07100f;
  background: var(--teal);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #a4f0df;
}

button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

button[aria-pressed="false"],
.secondary-button {
  color: var(--ink);
  background: transparent;
  border-color: rgba(246, 241, 231, 0.24);
}

button[aria-pressed="true"] {
  border-color: rgba(232, 195, 94, 0.82);
}

.secondary-button:hover:not(:disabled),
button[aria-pressed="false"]:hover:not(:disabled) {
  background: rgba(246, 241, 231, 0.08);
}

.danger-button {
  border-color: rgba(239, 139, 123, 0.48);
}

.control-row {
  display: grid;
  grid-template-columns: auto minmax(44px, auto);
  gap: 8px 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.control-row span {
  color: var(--ink);
  font-weight: 720;
}

.control-row output {
  justify-self: end;
  color: var(--teal);
  font-weight: 760;
}

.control-row input,
.control-row select {
  grid-column: 1 / -1;
  width: 100%;
}

select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(123, 216, 200, 0.38);
  border-radius: 8px;
  color: var(--ink);
  background: #111719;
}

input[type="range"] {
  accent-color: var(--gold);
}

.finger-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.finger-group {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.finger-group legend {
  margin-bottom: 3px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 760;
}

.finger-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.finger-group input {
  accent-color: var(--teal);
}

.copyright-notice {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(620px, 1fr) auto;
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    min-height: 620px;
  }

  .controls {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100vw - 10px);
    margin: 5px auto;
  }

  .button-grid,
  .finger-columns {
    grid-template-columns: 1fr;
  }
}
