*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  -webkit-tap-highlight-color: transparent;
}

h1, h3, h4 { font-size: inherit; font-weight: inherit; }

b, strong { font-weight: bolder; }

pre, .font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 1em;
}

button, input, optgroup, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button, select, .capitalize { text-transform: none; }

button,
input:where([type="button"]),
input:where([type="reset"]),
input:where([type="submit"]) {
  -webkit-appearance: button;
  background: transparent;
  background-image: none;
}

:-moz-focusring {
  outline: auto;
}

:-moz-ui-invalid {
  box-shadow: none;
}

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

summary { display: list-item; }

h1, h3, h4, p, pre { margin: 0; }

ul, menu, .list-none {
  list-style: none;
  margin: 0;
  padding: 0;
}

textarea { resize: vertical; }

input::-moz-placeholder,
textarea::-moz-placeholder,
input::placeholder,
textarea::placeholder {
  opacity: 1;
  color: #9ca3af;
}

button, [role="button"], .cursor-pointer { cursor: pointer; }

:disabled { cursor: default; }

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  vertical-align: middle;
}

img, video { max-width: 100%; height: auto; }

[hidden]:where(:not([hidden="until-found"])),
.hidden { display: none; }

/* Utilities */

.fixed { position: fixed; }
.right-0 { right: 0; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mr-4 { margin-right: 1rem; }
.inline { display: inline; }
.flex { display: flex; }
.contents { display: contents; }
.aspect-video { aspect-ratio: 16 / 9; }
.h-full { height: 100%; }
.w-20 { width: 5rem; }
.w-\[150px\] { width: 150px; }
.w-full { width: 100%; }
.max-w-2xl { max-width: 42rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.flex-col { flex-direction: column; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.overflow-y-auto { overflow-y: auto; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.rounded { border-radius: 0.25rem; }
.border-b { border-bottom: 1px solid var(--border); }
.border-none { border: none; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.italic { font-style: italic; }
.text-blue-600 { color: #2563eb; }

:root {
  --link: #6e5f8a;
  --link-hover: #877cb3;
  --bg-page: #f9f9f9;
  --bg-surface: whitesmoke;
  --border: gainsboro;
  --text: #2c2c2c;
  --text-muted: #666;
}

@media (prefers-color-scheme: dark) {
  :root {
    --link: #877cb3;
    --bg-page: #3c403c;
    --bg-surface: #2c2c2c;
    --border: #555;
    --text: #c1c3da;
    --text-muted: #999;
    color-scheme: dark;
  }
}

body {
  font-family: "Noto Sans", "Segoe UI", Roboto, sans-serif;
  font-size: 1.1em;
  color: var(--text);
  background: var(--bg-page);
  margin: 0;
}

.menu {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  position: fixed;
}

.main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

h1 {
  text-transform: capitalize;
  text-align: center;
  font-size: 1.5em;
  font-weight: 600;
}

form {
  display: flex;
  gap: 16px;
}

form:not(.horizontal) {
  flex-direction: column;
}

form.horizontal {
  align-items: center;
}

form label {
  display: flex;
  font-size: 0.8em;
}

form > a {
  text-align: center;
}

label {
  display: flex;
  gap: 4px;
  font-size: 0.8em;
}

label:not(:has(> input[type="checkbox"])) {
  flex-direction: column;
}

label > input,
label > textarea {
  display: block;
}

input,
textarea,
select,
pre {
  border: 1px solid var(--border);
  padding: 8px;
  font-size: inherit;
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid var(--link);
  outline-offset: -1px;
}

button,
.btn,
a.btn {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: filter 0.2s;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

button:hover,
a.btn:hover {
  filter: brightness(110%);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

.functions {
  transition: transform 0.3s ease;
  overflow-x: visible;
  display: flex !important;
  flex-direction: column;
  background-color: var(--bg-surface);
  transform: translateX(calc(100% + 1rem));
  width: 130px;
}

.menu input:checked ~ .functions {
  transform: translateX(0);
}

.functions > button,
.functions > a.btn {
  white-space: nowrap !important;
  padding: 12px 16px;
  justify-content: space-between;
}

.functions a.btn {
  padding: 8px 16px !important;
  border-radius: 4px !important;
}

.functions form label {
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  text-transform: none;
}

.functions form label:has(> input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
}

.functions form input[type="checkbox"] {
  width: auto;
  margin-right: 0.25rem;
}

.functions form select,
.functions form input[type="number"] {
  padding: 6px 8px;
  font-size: 0.875rem;
}

.functions form button[type="submit"] {
  margin-top: 0.25rem;
}

.menu-toggle {
  padding: 8px;
  border-radius: 50%;
  width: 2.3rem;
  height: 2.3rem;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.menu-separator {
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.module-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.viewer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.viewer-controls input[type="range"] {
  width: 100%;
}

.module-menu form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-viewer-scroll {
  width: 100%;
  overflow-x: visible;
}

.chord-data {
  background: var(--bg-surface);
}

.bg-surface {
  background: var(--bg-surface);
}

.text-muted {
  color: var(--text-muted);
}

.error {
  color: #c0392b;
  text-align: center;
}

.border-muted {
  border-color: var(--border);
}

.separator {
  border-top: 2px solid var(--border);
}

.btn-primary {
  background: #28a745 !important;
  color: white !important;
  border-color: #28a745 !important;
}

.btn-action {
  background: #007bff !important;
  color: white !important;
  border-color: #007bff !important;
}

.btn-secondary {
  background: #6c757d !important;
  color: white !important;
  border-color: #6c757d !important;
}

.btn-danger {
  background: #e05c5c !important;
  color: white !important;
  border-color: #e05c5c !important;
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    background: #1e7e34 !important;
    border-color: #1e7e34 !important;
  }

  .btn-action {
    background: #0056b3 !important;
    border-color: #0056b3 !important;
  }

  .btn-secondary {
    background: #545b62 !important;
    border-color: #545b62 !important;
  }

  .btn-danger {
    background: #c0392b !important;
    border-color: #c0392b !important;
  }
}
