:root {
  --bg: #071217;
  --panel: rgba(11, 27, 34, 0.84);
  --panel-strong: rgba(14, 32, 40, 0.94);
  --border: rgba(181, 215, 207, 0.22);
  --surface-border: rgba(181, 215, 207, 0.18);
  --surface-border-strong: rgba(181, 215, 207, 0.28);
  --surface-fill: rgba(18, 39, 47, 0.52);
  --surface-fill-strong: rgba(21, 48, 56, 0.64);
  --text: #ecf4ef;
  --muted: #9bb8b1;
  --accent: #f4a261;
  --accent-soft: rgba(244, 162, 97, 0.18);
  --secondary: #6dd3ce;
  --secondary-soft: rgba(109, 211, 206, 0.16);
  --danger: #ff8e72;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(109, 211, 206, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(244, 162, 97, 0.16), transparent 28%),
    linear-gradient(180deg, #071217 0%, #0d1f27 50%, #081118 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

body.sheet-open {
  overflow: hidden;
}

.page-aura,
.page-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-aura {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.07), transparent 18%),
    radial-gradient(circle at 82% 8%, rgba(255, 255, 255, 0.05), transparent 14%);
  opacity: 0.85;
}

.page-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
}

.hero,
.layout {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px 28px 12px;
  animation: rise-in 700ms ease;
}

.hero-copy {
  align-self: center;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--secondary);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lede {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-side {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  width: min(100%, 920px);
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
}

.hero-status {
  min-width: 0;
  margin-right: 2px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-utility-button {
  padding: 8px 13px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.28fr);
  gap: 22px;
  width: 100%;
  max-width: 100vw;
  padding: 0 28px 32px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.wide-column {
  min-width: 0;
}

.card {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(16, 36, 44, 0.82), rgba(8, 20, 26, 0.82)),
    var(--panel);
  backdrop-filter: blur(18px);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 0 0 1px rgba(109, 211, 206, 0.035);
  padding: 22px;
  animation: rise-in 700ms ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
}

.accent-card {
  background:
    linear-gradient(135deg, rgba(109, 211, 206, 0.08), transparent 50%),
    var(--panel-strong);
}

.output-card {
  background:
    linear-gradient(135deg, rgba(244, 162, 97, 0.08), transparent 55%),
    var(--panel-strong);
}

.card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 1.18rem;
}

.control-workspace {
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(16, 37, 45, 0.9), rgba(8, 21, 27, 0.88)),
    var(--panel);
}

.control-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.control-head h2 {
  white-space: nowrap;
}

.status-cluster {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.status-cluster .status-pill {
  background: rgba(181, 215, 207, 0.035);
  border-color: rgba(181, 215, 207, 0.08);
  padding: 6px 9px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-cluster::-webkit-scrollbar {
  display: none;
}

.account-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  width: auto;
  min-width: 0;
  max-width: 260px;
  padding: 8px 12px 8px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  box-shadow: none;
}

.account-trigger:hover:not(:disabled) {
  border-color: rgba(244, 162, 97, 0.28);
}

.account-trigger.is-open {
  border-color: rgba(244, 162, 97, 0.32);
  background: linear-gradient(
    135deg,
    rgba(244, 162, 97, 0.12),
    rgba(109, 211, 206, 0.08)
  );
}

.account-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid rgba(255, 255, 255, 0.55);
  border-bottom: 2px solid rgba(255, 255, 255, 0.55);
  transform: rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.account-trigger.is-open::after {
  transform: rotate(-135deg);
  border-color: rgba(244, 162, 97, 0.8);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(109, 211, 206, 0.24);
  background: rgba(109, 211, 206, 0.12);
  color: var(--secondary);
  font-size: 0.92rem;
  font-weight: 700;
  flex-shrink: 0;
}

.account-trigger[data-auth-state="signed-in"] .account-avatar {
  border-color: rgba(244, 162, 97, 0.24);
  background: rgba(244, 162, 97, 0.14);
  color: var(--accent);
}

.account-trigger-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.account-trigger-label {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.15;
}

.account-trigger-meta {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.15;
}

.account-panel {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(109, 211, 206, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.account-panel[hidden] {
  display: none;
}

.account-panel .info-grid {
  margin-bottom: 18px;
}

.account-panel .button-row:last-child,
.account-panel .message-box:last-child {
  margin-bottom: 0;
}

.hero-account-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  width: min(420px, calc(100vw - 56px));
  margin-bottom: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(4, 11, 15, 0.62);
  backdrop-filter: blur(6px);
}

.sheet-overlay[hidden] {
  display: none;
}

.readme-panel {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 21;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(140deg, rgba(12, 28, 34, 0.98), rgba(7, 18, 23, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.readme-panel[hidden] {
  display: none;
}

.graph-panel {
  position: fixed;
  top: 84px;
  left: 24px;
  z-index: 30;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(780px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 110px));
  min-width: 380px;
  min-height: 310px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: hidden;
  resize: both;
  padding: 14px;
  border-radius: 18px;
  border: 2px solid rgba(244, 162, 97, 0.72);
  background:
    linear-gradient(140deg, rgba(39, 54, 61, 0.98), rgba(20, 29, 36, 0.98)),
    var(--panel);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 6px rgba(244, 162, 97, 0.08);
  backdrop-filter: blur(18px);
}

.graph-panel::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 38%, rgba(244, 162, 97, 0.88) 38% 48%, transparent 48% 100%),
    linear-gradient(135deg, transparent 0 56%, rgba(244, 162, 97, 0.68) 56% 66%, transparent 66% 100%),
    linear-gradient(135deg, transparent 0 74%, rgba(244, 162, 97, 0.48) 74% 84%, transparent 84% 100%);
  opacity: 1;
}

.graph-panel[hidden] {
  display: none;
}

.graph-panel.is-dragging {
  user-select: none;
}

.graph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: -14px -14px 10px;
  padding: 12px 14px;
  cursor: move;
  touch-action: none;
  border-bottom: 1px solid rgba(244, 162, 97, 0.38);
  background:
    linear-gradient(90deg, rgba(244, 162, 97, 0.25), rgba(109, 211, 206, 0.13)),
    rgba(255, 255, 255, 0.045);
}

.graph-head button {
  cursor: pointer;
}

.graph-head h2 {
  margin: 4px 0 0;
  font-size: 1.12rem;
  color: #fff8ee;
}

.graph-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
}

.graph-tab {
  min-height: 0;
  padding: 5px 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.1;
  box-shadow: none;
}

.graph-tab.is-active {
  background: rgba(109, 211, 206, 0.14);
  color: var(--text);
}

.graph-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.graph-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.graph-controls select {
  min-height: 28px;
  width: auto;
  padding: 4px 24px 4px 9px;
  border-radius: 8px;
  border-color: rgba(244, 162, 97, 0.32);
  background-color: rgba(7, 18, 23, 0.78);
  color: var(--text);
  font-size: 0.78rem;
}

.graph-image-frame {
  min-height: 0;
  height: 100%;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(244, 162, 97, 0.3);
  background: #071217;
}

.graph-image-frame img {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.readme-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.readme-head h2 {
  margin: 4px 0 0;
  font-size: 1.5rem;
}

.readme-kicker {
  margin: 0;
  color: var(--secondary);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sheet-close {
  flex-shrink: 0;
}

.readme-sections {
  display: grid;
  gap: 14px;
}

.readme-block {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}

.readme-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.readme-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.readme-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.readme-list li + li {
  margin-top: 8px;
}

.readme-link-list {
  margin-top: 12px;
}

.readme-link-list a {
  color: var(--secondary);
  text-decoration: none;
  border-bottom: 1px solid rgba(109, 211, 206, 0.26);
}

.readme-link-list a:hover {
  color: #a5efe9;
  border-bottom-color: rgba(165, 239, 233, 0.5);
}

.small-copy,
.muted {
  color: var(--muted);
}

.muted {
  margin: 0 0 18px;
  line-height: 1.55;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.compact-button {
  padding: 8px 11px;
  font-size: 0.82rem;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f4a261, #ef7f58);
  color: #081118;
  font-weight: 700;
  padding: 11px 16px;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 12px 30px rgba(239, 127, 88, 0.22);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.ghost {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(109, 211, 206, 0.045));
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(181, 215, 207, 0.26);
}

button.ghost:hover:not(:disabled) {
  border-color: rgba(244, 162, 97, 0.48);
  background:
    linear-gradient(145deg, rgba(244, 162, 97, 0.14), rgba(109, 211, 206, 0.07));
}

button.ghost.is-pending {
  border-color: rgba(244, 162, 97, 0.56);
  background: linear-gradient(135deg, #f4a261, #ef7f58);
  color: #081118;
  box-shadow: 0 12px 30px rgba(239, 127, 88, 0.24);
}

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.workspace-tab {
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  padding: 10px 12px;
}

.workspace-tab.is-active {
  background: linear-gradient(135deg, rgba(244, 162, 97, 0.24), rgba(109, 211, 206, 0.16));
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.performance-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}

.readiness-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.readiness-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.readiness-step::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.readiness-step.is-ready {
  color: var(--text);
  border-color: rgba(109, 211, 206, 0.22);
  background: rgba(109, 211, 206, 0.09);
}

.readiness-step.is-ready::before {
  background: var(--secondary);
}

.global-panic-button {
  flex-shrink: 0;
  padding: 9px 13px;
}

.workspace-panel[hidden] {
  display: none;
}

.panel-stack {
  display: grid;
  gap: 14px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.panel-section {
  min-width: 0;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(109, 211, 206, 0.018)),
    var(--surface-fill);
  border: 1px solid var(--surface-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 10px 26px rgba(0, 0, 0, 0.12);
}

.accent-section {
  background:
    linear-gradient(135deg, rgba(109, 211, 206, 0.12), rgba(255, 255, 255, 0.03)),
    var(--surface-fill-strong);
  border-color: rgba(109, 211, 206, 0.24);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.section-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.view-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(18, 39, 47, 0.58);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.view-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  padding: 9px 14px;
}

.view-tab.is-active {
  background: linear-gradient(135deg, rgba(244, 162, 97, 0.24), rgba(109, 211, 206, 0.16));
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

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

.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(181, 215, 207, 0.09);
  background: rgba(181, 215, 207, 0.035);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label,
.toggle {
  font-size: 0.95rem;
}

select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
}

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

input[type="number"]:disabled {
  opacity: 0.55;
}

input[type="text"]:disabled,
input[type="password"]:disabled {
  opacity: 0.55;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.toggle input {
  accent-color: var(--accent);
}

.compact-toggle {
  font-size: 0.84rem;
  white-space: nowrap;
}

.virtual-keyboard-panel {
  display: grid;
  gap: 10px;
  margin: 6px 0 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(109, 211, 206, 0.07), rgba(244, 162, 97, 0.04)),
    rgba(255, 255, 255, 0.026);
  overflow: hidden;
}

.virtual-keyboard-panel[hidden] {
  display: none;
}

.virtual-keyboard-head,
.virtual-keyboard-controls,
.virtual-keyboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.virtual-keyboard-head strong {
  display: block;
  color: var(--text);
  font-size: 0.94rem;
}

.virtual-keyboard-head span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.virtual-octave-controls {
  display: flex;
  gap: 8px;
}

.velocity-control {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 3ch;
  align-items: center;
  gap: 8px;
  flex: 1 1 210px;
  color: var(--muted);
  font-size: 0.84rem;
}

.velocity-control output {
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.virtual-keyboard-viewport {
  width: 100%;
  height: 108px;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

.virtual-keyboard {
  --white-key-count: 14;
  position: relative;
  width: 100%;
  height: 108px;
  min-width: 0;
  contain: layout paint;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.white-key-row {
  display: grid;
  grid-template-columns: repeat(var(--white-key-count), minmax(0, 1fr));
  height: 100%;
  gap: 2px;
}

.virtual-key {
  display: block;
  position: relative;
  min-width: 0;
  border-radius: 7px;
  padding: 0;
  border: 0;
  box-shadow: none;
  touch-action: none;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
  cursor: pointer;
  transform: translateZ(0);
  transition: background 90ms ease, border-color 90ms ease, box-shadow 90ms ease;
  outline: none;
}

.virtual-key:focus,
.virtual-key:focus-visible {
  outline: none;
}

.white-key:hover {
  transform: translateZ(0);
}

.virtual-key span {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
}

.white-key {
  height: 100%;
  border: 1px solid rgba(8, 17, 24, 0.28);
  background: linear-gradient(180deg, #fffaf0, #d9edf0);
  color: #101820;
}

.white-key.is-active {
  background: linear-gradient(180deg, #f4a261, #6dd3ce);
  border-color: rgba(255, 245, 212, 0.8);
  box-shadow: inset 0 4px 10px rgba(8, 17, 24, 0.22);
}

.black-key-row {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.black-key {
  position: absolute;
  left: var(--key-left);
  top: 0;
  width: calc((100% / var(--white-key-count)) * 0.62);
  height: 62%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, #26333d, #081118);
  color: #f7fbff;
}

.black-key:hover {
  transform: translateX(-50%) translateZ(0);
}

.black-key.is-active {
  background: linear-gradient(180deg, #6dd3ce, #ef7f58);
  border-color: rgba(255, 245, 212, 0.74);
  box-shadow: inset 0 3px 8px rgba(8, 17, 24, 0.34);
}

.black-key span {
  display: none;
}

.virtual-key.is-latched::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff5d4;
  box-shadow: 0 0 9px rgba(255, 245, 212, 0.88);
  transform: translateX(-50%);
}

.virtual-keyboard-actions {
  justify-content: flex-end;
}

.settings-compact {
  margin-bottom: 18px;
}

.settings-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-summary.is-pending {
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(244, 162, 97, 0.24);
  background: rgba(244, 162, 97, 0.08);
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.settings-chip.is-active {
  color: var(--text);
}

.settings-chip.is-warning,
.settings-chip.is-pending {
  border-color: rgba(244, 162, 97, 0.36);
  background: rgba(244, 162, 97, 0.16);
  color: #fff5d4;
}

.settings-panel {
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.settings-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 700;
}

.settings-panel summary::-webkit-details-marker {
  display: none;
}

.settings-panel[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-panel > :not(summary) {
  margin-left: 18px;
  margin-right: 18px;
}

.settings-copy {
  margin-top: 14px;
}

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

.settings-toggle {
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.auth-message-box {
  min-height: 0;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(244, 162, 97, 0.08), rgba(255, 255, 255, 0.02));
}

.head-action {
  padding: 9px 14px;
}

.field-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.phrase-gap-meter {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(109, 211, 206, 0.18);
  background: rgba(109, 211, 206, 0.08);
}

.phrase-gap-meter[hidden] {
  display: none;
}

.phrase-gap-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.phrase-gap-meter-head strong {
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

.phrase-gap-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.phrase-gap-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  transition: width 90ms linear;
}

.phrase-gap-meter.is-server-wait {
  border-color: rgba(244, 162, 97, 0.24);
  background: rgba(244, 162, 97, 0.09);
}

.phrase-gap-meter.is-server-wait .phrase-gap-meter-head strong {
  color: var(--accent);
}

.phrase-gap-meter.is-server-wait .phrase-gap-bar {
  width: 38%;
  animation: server-wait-sweep 1100ms ease-in-out infinite;
}

.faust-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.faust-field {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.faust-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.faust-label-row output {
  color: var(--secondary);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.faust-section-head {
  margin-top: 18px;
}

.faust-editor-actions {
  margin-bottom: 0;
  flex-wrap: wrap;
}

.faust-editor-field {
  margin-bottom: 16px;
}

.faust-code-input {
  width: 100%;
  min-height: 260px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 14, 20, 0.72);
  color: var(--text);
  font: 0.88rem/1.6 "SFMono-Regular", "Fira Code", "IBM Plex Mono", monospace;
  resize: vertical;
}

.faust-code-input:focus {
  outline: 1px solid rgba(109, 211, 206, 0.4);
  border-color: rgba(109, 211, 206, 0.42);
}

.faust-code-input::selection {
  background: rgba(244, 162, 97, 0.28);
}

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

.info-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.info-grid dd {
  margin: 0;
  word-break: break-word;
  font-weight: 600;
}

.message-box {
  min-height: 64px;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(109, 211, 206, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.55;
}

.constraint-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.constraint-status[hidden] {
  display: none;
}

.constraint-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 700;
}

.constraint-pill.is-relaxed {
  border-color: rgba(244, 162, 97, 0.24);
  background: rgba(244, 162, 97, 0.1);
}

.constraint-pill.is-pending {
  border-color: rgba(244, 162, 97, 0.4);
  background: rgba(244, 162, 97, 0.16);
  color: #fff5d4;
}

.constraint-pill.is-off {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.session-save-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(244, 162, 97, 0.18);
  background: rgba(244, 162, 97, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.timeline-card {
  padding-bottom: 18px;
}

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

.timeline-segment {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--surface-border);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(109, 211, 206, 0.018)),
    rgba(18, 39, 47, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.timeline-segment span {
  color: var(--muted);
  font-size: 0.8rem;
}

.timeline-segment strong {
  font-size: 0.94rem;
}

.timeline-segment.is-ready {
  border-color: rgba(109, 211, 206, 0.2);
  background: rgba(109, 211, 206, 0.08);
}

.timeline-segment.is-playing {
  border-color: rgba(244, 162, 97, 0.28);
  background: rgba(244, 162, 97, 0.11);
}

.timeline-segment.is-queued {
  border-color: rgba(255, 245, 212, 0.22);
  background: rgba(255, 245, 212, 0.08);
}

.generation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.generation-field {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.generation-actions {
  margin-bottom: 0;
}

.infinite-transport {
  display: grid;
  gap: 12px;
}

.transport-copy {
  display: grid;
  gap: 4px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(109, 211, 206, 0.16);
  background: rgba(109, 211, 206, 0.07);
}

.transport-copy strong {
  font-size: 0.96rem;
}

.transport-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.transport-actions,
.sound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.route-picker {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
  margin-bottom: 12px;
  border-radius: 18px;
  border: 1px solid rgba(109, 211, 206, 0.18);
  background: rgba(255, 255, 255, 0.045);
}

.route-picker-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.route-picker select {
  min-height: 44px;
  padding: 6px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-weight: 700;
}

.playback-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.playback-status-chip {
  display: inline-grid;
  gap: 2px;
  min-width: 150px;
  padding: 8px 11px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.035);
}

.playback-status-chip span {
  color: var(--muted);
  font-size: 0.72rem;
}

.playback-status-chip strong {
  color: var(--text);
  font-size: 0.88rem;
}

.compact-hint {
  margin-top: 10px;
}

.transport-button {
  min-width: 84px;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(255, 142, 114, 0.28);
  background: rgba(255, 142, 114, 0.12);
}

.danger-button:hover:not(:disabled) {
  border-color: rgba(255, 142, 114, 0.44);
}

.roll-card {
  padding-bottom: 16px;
}

.roll-viewport {
  position: relative;
}

.piano-roll {
  width: 100%;
  height: 244px;
  display: block;
  cursor: pointer;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.12);
}

.piano-roll:hover {
  border-color: rgba(109, 211, 206, 0.24);
}

.piano-roll:focus-visible {
  outline: 2px solid rgba(109, 211, 206, 0.68);
  outline-offset: 4px;
}

.piano-roll.is-roll-playing {
  border-color: rgba(255, 245, 212, 0.42);
  box-shadow: 0 0 0 1px rgba(255, 245, 212, 0.16), 0 0 22px rgba(255, 245, 212, 0.1);
}

.roll-playhead {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 2px;
  border-radius: 999px;
  background: rgba(255, 245, 212, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 245, 212, 0.24), 0 0 16px rgba(255, 245, 212, 0.42);
  pointer-events: none;
  transform: translateX(0);
  transition: transform 30ms linear;
}

.roll-playhead::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 0;
  border-bottom: 8px solid rgba(255, 245, 212, 0.95);
  transform: translateX(-50%);
}

.roll-playhead[hidden] {
  display: none;
}

.piano-roll.is-previewing {
  border-color: rgba(244, 162, 97, 0.55);
  box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.22), 0 0 0 12px rgba(244, 162, 97, 0.08);
  animation: preview-pulse 900ms ease;
}

.history-list {
  display: grid;
  gap: 10px;
}

.memory-hint {
  margin: 12px 0 14px;
  line-height: 1.5;
}

.memory-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16px, 1fr));
  gap: 5px;
  margin-bottom: 12px;
}

.memory-ribbon:empty {
  display: none;
}

.memory-ribbon-cell {
  min-height: 24px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.memory-ribbon-cell.seed {
  background: rgba(109, 211, 206, 0.14);
}

.memory-ribbon-cell.live {
  background: rgba(244, 162, 97, 0.16);
}

.memory-ribbon-cell.is-selected {
  border-color: rgba(244, 162, 97, 0.4);
  box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.2);
}

.memory-item .history-kind {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
}

.memory-list {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}

.history-item.memory-item {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  overflow: hidden;
  padding: 10px;
  border-radius: 14px;
}

.memory-preview-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
}

.memory-preview-button:hover:not(:disabled) {
  transform: none;
}

.memory-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.memory-primary {
  min-width: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

.memory-detail {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.memory-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.memory-actions.has-delete {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-thumbnail {
  position: relative;
  display: block;
  width: 100%;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    rgba(255, 255, 255, 0.025);
  background-size: 100% 14px;
}

.memory-thumbnail span {
  position: absolute;
  height: 5px;
  border-radius: 999px;
  background: var(--secondary);
  box-shadow: 0 0 10px rgba(109, 211, 206, 0.28);
}

.memory-play-button,
.memory-seed-button,
.memory-delete-button {
  width: 100%;
  min-height: 30px;
  margin-left: 0;
  padding: 6px 8px;
  font-size: 0.75rem;
  justify-content: center;
  white-space: nowrap;
}

.memory-item.is-playing {
  border-color: rgba(255, 245, 212, 0.42);
}

.memory-item.is-playing .memory-thumbnail {
  border-color: rgba(255, 245, 212, 0.28);
  box-shadow: 0 0 18px rgba(255, 245, 212, 0.08);
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  box-shadow: none;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.history-item:hover {
  border-color: rgba(244, 162, 97, 0.28);
}

.history-item.is-selected {
  border-color: rgba(244, 162, 97, 0.42);
  background: linear-gradient(135deg, rgba(244, 162, 97, 0.14), rgba(255, 255, 255, 0.03));
}

.history-item.is-previewed:not(.is-selected) {
  border-color: rgba(109, 211, 206, 0.34);
  background: linear-gradient(135deg, rgba(109, 211, 206, 0.1), rgba(255, 255, 255, 0.03));
}

.session-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.session-preview-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
}

.session-preview-button:hover:not(:disabled) {
  transform: none;
}

.session-open-button {
  min-width: 82px;
  align-self: stretch;
  justify-content: center;
  white-space: nowrap;
}

.session-preview-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(109, 211, 206, 0.18);
  background: rgba(109, 211, 206, 0.06);
}

.session-preview-panel[hidden] {
  display: none;
}

.session-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.session-preview-head strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
}

.session-name-editor {
  display: grid;
  gap: 7px;
}

.session-name-editor label {
  color: var(--muted);
  font-size: 0.82rem;
}

.session-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.session-name-row input {
  min-width: 0;
}

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

.session-preview-grid div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.session-preview-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 5px;
}

.session-preview-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.35;
}

.session-item .history-meta {
  gap: 6px;
}

.history-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: capitalize;
}

.history-meta {
  display: grid;
  gap: 4px;
}

.history-meta strong {
  font-size: 0.96rem;
}

.history-meta span {
  color: var(--muted);
  font-size: 0.88rem;
}

.history-index {
  color: var(--accent);
  font-size: 0.85rem;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes preview-pulse {
  0% {
    box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.08), 0 0 0 0 rgba(244, 162, 97, 0);
  }

  40% {
    box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.24), 0 0 0 14px rgba(244, 162, 97, 0.1);
  }

  100% {
    box-shadow: 0 0 0 1px rgba(244, 162, 97, 0.22), 0 0 0 12px rgba(244, 162, 97, 0.08);
  }
}

@keyframes server-wait-sweep {
  from {
    transform: translateX(-120%);
  }

  to {
    transform: translateX(270%);
  }
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    gap: 12px;
    padding-top: 16px;
  }

  .hero-copy,
  .hero-side {
    justify-self: stretch;
  }

  .hero-copy h1 {
    font-size: 1.45rem;
  }

  .hero-side {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-status {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .control-head {
    flex-direction: column;
  }

  .status-cluster {
    justify-content: flex-start;
  }

  .performance-strip {
    position: sticky;
    top: 8px;
    z-index: 5;
    backdrop-filter: blur(16px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .hero,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .hero-copy h1 {
    max-width: 100%;
    font-size: 1.35rem;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .hero-side,
  .account-trigger {
    width: 100%;
    max-width: 100%;
  }

  .hero-account-panel {
    width: calc(100vw - 32px);
  }

  .card {
    width: calc(100% - 16px);
    padding: 16px;
  }

  .control-workspace {
    padding: 14px;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row > button,
  .button-row > .toggle {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .status-cluster .status-pill,
  .readiness-step {
    min-width: 0;
  }

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

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

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

  .workspace-tabs {
    grid-template-columns: 1fr;
  }

  .performance-strip {
    align-items: stretch;
    flex-direction: column;
  }

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

  .global-panic-button {
    width: 100%;
  }

  .phrase-timeline {
    grid-template-columns: 1fr;
  }

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

  .session-item {
    grid-template-columns: 1fr;
  }

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

  .session-open-button {
    width: 100%;
    min-height: 38px;
  }

  .session-preview-head {
    flex-direction: column;
    align-items: stretch;
  }

  .session-name-row {
    grid-template-columns: 1fr;
  }

  .session-preview-grid {
    grid-template-columns: 1fr;
  }

  .memory-item {
    grid-template-columns: 1fr;
  }

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

  .memory-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .section-head {
    flex-direction: column;
  }

  .panel-section {
    padding: 14px;
  }

  .readme-panel {
    top: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: calc(100vh - 32px);
  }

  .graph-panel {
    top: 16px;
    left: 16px;
    width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 32px));
    min-width: 0;
    min-height: 280px;
    max-height: calc(100vh - 32px);
    padding: 12px;
    resize: vertical;
  }

  .graph-head {
    margin: -12px -12px 10px;
    flex-direction: column;
    cursor: default;
  }

  .graph-tabs {
    grid-template-columns: 1fr;
  }

  .graph-controls {
    align-items: stretch;
  }

  .graph-controls label {
    flex: 1 1 150px;
  }

  .graph-controls select {
    flex: 1;
    min-width: 0;
  }

  .graph-image-frame {
    min-height: 0;
    max-height: none;
  }

  .graph-image-frame img {
    min-width: 620px;
  }

  .readme-head {
    flex-direction: column;
  }

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

  .faust-control-grid {
    grid-template-columns: 1fr;
  }

  .virtual-keyboard-panel {
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 12px;
    max-width: 100%;
  }

  .virtual-keyboard-panel * {
    min-width: 0;
  }

  .virtual-keyboard-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
  }

  .virtual-keyboard-controls,
  .virtual-keyboard-actions {
    gap: 8px;
  }

  .virtual-keyboard-head > div:first-child {
    min-width: 0;
  }

  .virtual-keyboard-head strong {
    font-size: 0.88rem;
  }

  .virtual-keyboard-head span {
    font-size: 0.72rem;
  }

  .virtual-octave-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .virtual-octave-controls .compact-button {
    padding-inline: 6px;
    font-size: 0.76rem;
  }

  .virtual-keyboard-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }

  .velocity-control {
    grid-column: 1 / -1;
    min-width: 0;
    grid-template-columns: auto minmax(112px, 1fr) 3ch;
    font-size: 0.78rem;
  }

  .compact-toggle {
    gap: 7px;
    font-size: 0.76rem;
    white-space: normal;
  }

  .virtual-keyboard-viewport {
    height: 96px;
  }

  .virtual-keyboard {
    width: calc(100% - 24px);
    height: 96px;
  }

  .virtual-key span {
    bottom: 5px;
    font-size: 0.54rem;
  }

  .virtual-keyboard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .virtual-keyboard-actions .compact-button {
    width: 100%;
    min-height: 36px;
    padding-inline: 8px;
    font-size: 0.76rem;
    line-height: 1.15;
    white-space: normal;
  }

  .piano-roll {
    height: 206px;
  }
}
