:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: rgba(10, 23, 35, 0.94);
  --panel-soft: rgba(15, 31, 46, 0.9);
  --line: rgba(145, 182, 210, 0.16);
  --line-strong: rgba(145, 182, 210, 0.28);
  --text: #ebf5ff;
  --muted: #8ea9bd;
  --accent: #4fe4c1;
  --accent-2: #7bb8ff;
  --warm: #ffbd75;
  --danger: #ff7d7d;
  --radius: 24px;
  --radius-sm: 16px;
  --shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(79, 228, 193, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(123, 184, 255, 0.1), transparent 24%),
    linear-gradient(180deg, #050c13, #071018 42%, #091521);
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body {
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

button,
input {
  font: inherit;
}

.mobile-shell {
  max-width: 720px;
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 16px;
}

.hero,
.card,
.menu-card {
  background: linear-gradient(180deg, var(--panel-soft), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 20px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.card {
  padding: 18px;
}

.menu-card {
  overflow: hidden;
}

.menu-card[open] {
  border-color: var(--line-strong);
}

.menu-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px;
}

.menu-card summary::-webkit-details-marker {
  display: none;
}

.menu-card summary span,
.menu-card summary strong {
  display: block;
}

.menu-card summary span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-card summary::after {
  content: "+";
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.2rem;
  flex: 0 0 auto;
}

.menu-card[open] summary::after {
  content: "-";
}

.menu-body {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Aptos Display", "Bahnschrift", sans-serif;
}

h1 {
  font-size: 1.8rem;
  line-height: 1.05;
}

h2 {
  font-size: 1.08rem;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.helper-copy {
  margin-top: 12px;
}

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

.compact-head {
  margin-bottom: 0;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.field span {
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: rgba(5, 12, 18, 0.72);
  color: var(--text);
}

input[readonly] {
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.actions.two {
  grid-template-columns: 1fr 1fr;
}

.button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  padding: 0 14px;
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

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

.button:disabled {
  cursor: default;
  opacity: 0.55;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #118675);
  color: #032019;
  font-weight: 700;
}

.ghost,
.soft {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.saved-strip {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.saved-strip span {
  color: var(--muted);
  font-size: 0.85rem;
}

.saved-list {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
}

.saved-pill,
.chip {
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.saved-pill {
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
}

.chip.idle {
  color: #b8cad6;
}

.chip.live {
  color: var(--accent);
}

.chip.busy {
  color: var(--warm);
}

.stat-grid,
.preset-grid,
.command-grid,
.meter-stack,
.transport-grid,
.cart-page-grid,
.cart-slot-grid {
  display: grid;
  gap: 10px;
}

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

.monitor-card {
  display: grid;
  gap: 16px;
}

.monitor-summary {
  display: grid;
  gap: 10px;
}

.monitor-status,
.monitor-meter-head {
  margin-top: 0;
}

.stat-card,
.preset,
.status-note,
.audio-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(6, 15, 23, 0.62);
}

.stat-card span,
.preset span,
.status-note span {
  color: var(--muted);
  display: block;
}

.stat-card strong,
.preset strong,
.status-note strong {
  display: block;
  margin-top: 6px;
}

.status-note {
  margin-top: 12px;
}

.command-grid,
.transport-grid {
  grid-template-columns: repeat(2, 1fr);
}

.preset {
  text-align: left;
  cursor: pointer;
}

.preset.is-active {
  background: rgba(79, 228, 193, 0.1);
  border-color: rgba(79, 228, 193, 0.28);
}

.alert-toggle {
  font-weight: 800;
  color: #fff3f3;
  background: linear-gradient(135deg, rgba(255, 125, 125, 0.28), rgba(150, 22, 22, 0.46));
  border: 1px solid rgba(255, 125, 125, 0.3);
}

.alert-toggle.is-on {
  color: #032019;
  background: linear-gradient(135deg, rgba(79, 228, 193, 0.96), rgba(17, 134, 117, 0.94));
  border-color: rgba(79, 228, 193, 0.32);
}

.soundbak-toggle {
  font-weight: 700;
  background: linear-gradient(135deg, rgba(255, 189, 117, 0.2), rgba(129, 77, 27, 0.44));
  border: 1px solid rgba(255, 189, 117, 0.24);
}

.soundbak-toggle.is-on {
  color: #211304;
  background: linear-gradient(135deg, rgba(255, 189, 117, 0.96), rgba(255, 227, 186, 0.94));
}

.cart-page-grid {
  grid-template-columns: repeat(3, 1fr);
}

.cart-slot-grid {
  grid-template-columns: repeat(3, 1fr);
}

.cart-page-button,
.cart-slot-button {
  min-height: 46px;
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
}

.cart-page-button.is-active,
.cart-slot-button.is-active {
  border-color: rgba(79, 228, 193, 0.28);
  background: rgba(79, 228, 193, 0.1);
}

.cart-slot-button {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  align-content: center;
  justify-items: start;
  padding: 10px 12px;
  text-align: left;
}

.cart-slot-button:disabled {
  cursor: default;
  opacity: 0.58;
  border-color: rgba(145, 182, 210, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.cart-slot-button strong,
.cart-slot-button small {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-slot-button strong {
  width: 100%;
}

.cart-slot-button small {
  color: var(--muted);
}

.cart-slot-button.is-empty strong,
.cart-slot-button.is-empty small {
  color: var(--muted);
}

.audio-card {
  display: grid;
  gap: 12px;
}

.audio-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.audio-card-head span,
.audio-card-head small {
  color: var(--muted);
}

.audio-card-head strong {
  display: block;
  margin-top: 4px;
}

.meter-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.meter-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.meter-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(79, 228, 193, 0.16);
  background:
    linear-gradient(90deg, rgba(79, 228, 193, 0.08), rgba(79, 228, 193, 0.02)),
    rgba(4, 11, 17, 0.82);
}

.meter-track.warm {
  border-color: rgba(255, 189, 117, 0.16);
  background:
    linear-gradient(90deg, rgba(255, 189, 117, 0.08), rgba(255, 189, 117, 0.02)),
    rgba(4, 11, 17, 0.82);
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f8f80, #4fe4c1 55%, #c8ffef);
  transition: width 180ms ease;
}

.meter-fill.warm {
  background: linear-gradient(90deg, #9f6326, #ffbd75 55%, #ffe1bd);
}

.activity-feed {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.activity-item {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(6, 15, 23, 0.56);
}

.activity-item strong {
  display: block;
  margin-bottom: 4px;
}

.activity-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 680px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .monitor-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .preset-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .command-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .transport-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .meter-stack {
    grid-template-columns: repeat(2, 1fr);
  }
}
