:root {
  --bg: #08111d;
  --panel: rgba(12, 21, 36, 0.84);
  --panel-strong: rgba(12, 21, 36, 0.96);
  --card: rgba(19, 31, 50, 0.92);
  --card-strong: rgba(27, 42, 68, 0.96);
  --text: #eef4ff;
  --muted: #98a8c6;
  --primary: #7ea6ff;
  --danger: #ff7b7b;
  --success: #61e3a7;
  --dark: rgba(14, 22, 35, 0.92);
  --highlight: #87e0ff;
  --highlight-strong: #f5be70;
  --line: rgba(173, 205, 255, 0.16);
  --line-strong: rgba(173, 205, 255, 0.24);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(126, 166, 255, 0.18), transparent 26%),
    radial-gradient(circle at left 18%, rgba(97, 227, 167, 0.12), transparent 22%),
    linear-gradient(180deg, #06101b 0%, #0a1423 52%, #0d192b 100%);
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: none;
}

.app {
  padding: 10px 10px calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 1100px;
  margin: 0 auto;
}

.header,
.modal-content {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 34%),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header {
  padding: 12px;
  border-radius: 22px;
}

.main {
  margin-top: 10px;
}

.site-author {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 calc(18px + env(safe-area-inset-bottom, 0px));
}

.site-author a {
  color: rgba(152, 168, 198, 0.82);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .18s ease;
}

@media (hover: hover) and (pointer: fine) {
  .site-author a:hover {
    color: rgba(197, 210, 232, 0.96);
  }
}

.site-author a:focus-visible {
  color: rgba(197, 210, 232, 0.96);
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.row.tiny { margin-bottom: 6px; justify-content: center; }
.row.faq-top { margin-bottom: 10px; }
.row.icon-row { gap: 10px; }
.row.groups-toggle-row {
  margin-top: 0;
  margin-bottom: 0;
}
.row.action-row {
  gap: 8px;
  justify-content: center;
}
.row.midi-mode-row {
  justify-content: center;
  margin-bottom: 10px;
}
.row.midi-status-row {
  margin-top: -2px;
  margin-bottom: 10px;
}
.row.space { justify-content: space-between; }

.full-toolbar {
  justify-content: center;
  align-items: center;
}

.input {
  flex: 1;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(173, 205, 255, 0.14);
  background: rgba(4, 11, 22, 0.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input::placeholder,
.import-text::placeholder {
  color: #8ea0c0;
}

.input:focus,
.import-text:focus {
  border-color: rgba(126, 166, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(126, 166, 255, 0.14);
  background: rgba(5, 13, 26, 0.9);
}

.btn {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 46%),
    rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  appearance: none;
}

.btn:focus {
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(-1px);
    border-color: rgba(173, 205, 255, 0.2);
    background:
      linear-gradient(180deg, rgba(255,255,255,0.11), transparent 46%),
      rgba(255,255,255,0.08);
  }
}

.btn:active {
  transform: translateY(0);
}

.btn.is-active,
.btn[aria-pressed="true"] {
  border-color: rgba(126, 166, 255, 0.48);
  background:
    linear-gradient(180deg, rgba(182, 209, 255, 0.18), transparent 46%),
    rgba(78, 112, 204, 0.28);
  box-shadow: 0 12px 28px rgba(44, 74, 150, 0.2);
}

.btn.btn-primary { background: linear-gradient(135deg, rgba(126, 166, 255, 0.78), rgba(73, 116, 231, 0.72)); }
.btn.btn-danger { background: linear-gradient(135deg, rgba(255, 123, 123, 0.42), rgba(135, 43, 53, 0.78)); }
.btn.btn-success { background: linear-gradient(135deg, rgba(97, 227, 167, 0.42), rgba(21, 119, 85, 0.84)); }
.btn.btn-dark { background: linear-gradient(135deg, rgba(19, 28, 45, 0.94), rgba(7, 13, 22, 0.94)); }
.btn.btn-print {
  background: linear-gradient(135deg, rgba(97, 227, 167, 0.34), rgba(20, 108, 79, 0.84));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.midi-mode-btn {
  width: min(320px, calc(100% - 120px));
  min-height: 38px;
  padding-inline: 18px;
}

.midi-status {
  min-height: 18px;
  max-width: min(540px, 100%);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.midi-status.is-ready {
  color: var(--success);
}

.midi-status.is-error {
  color: #ffb3b3;
}

.groups-toggle-btn {
  width: min(320px, calc(100% - 100px));
  min-height: 34px;
  padding-inline: 16px;
  font-size: 12px;
  white-space: nowrap;
}

.icon-btn {
  flex: 1;
  height: 50px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-width: 1px;
  transform-origin: center;
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  filter: none;
}

.icon-img-wide {
  width: 40px;
  height: 24px;
}

.icon-yellow,
.icon-yellow.is-active,
.icon-yellow[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 220, 102, 0.92), rgba(246, 165, 42, 0.66));
}

.icon-purple,
.icon-purple.is-active,
.icon-purple[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(198, 98, 255, 0.96), rgba(123, 60, 221, 0.72));
}

.icon-cyan,
.icon-cyan.is-active,
.icon-cyan[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(92, 240, 255, 0.98), rgba(0, 186, 255, 0.74));
}

.icon-red,
.icon-red:focus,
.icon-red:active,
.icon-red.is-active,
.icon-red[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 122, 122, 0.9), rgba(208, 45, 66, 0.64));
}

@media (hover: hover) and (pointer: fine) {
  .icon-red:hover {
    background: linear-gradient(135deg, rgba(255, 122, 122, 0.9), rgba(208, 45, 66, 0.64));
  }
}

.icon-blue,
.icon-blue.is-active,
.icon-blue[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(112, 142, 255, 0.94), rgba(28, 87, 228, 0.72));
}

.icon-green,
.icon-green.is-active,
.icon-green[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(97, 241, 163, 0.9), rgba(7, 164, 97, 0.64));
}

.icon-btn.is-active,
.icon-btn[aria-pressed="true"] {
  border-color: rgba(255,255,255,0.26);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08) inset,
    0 14px 28px rgba(0,0,0,0.22);
  filter: saturate(1.1) brightness(1.02);
}

.selected {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 40%),
    rgba(5, 12, 22, 0.45);
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
