:root {
  color-scheme: dark;
  --bg: #0a0f1a;
  --panel: #111827;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #1e94f9;
  --accent-bright: #4ab3fd;
  /* replaced at runtime by theme.js with generated blueprint + grain textures */
  --frame-texture: linear-gradient(90deg, #0874cc, #0666b4);
  --grain-texture: none;
  --rail-width: 64px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* the license gate's content is all position:fixed, which doesn't
     contribute to body's own height - without this, body collapses to 0px
     tall while that screen is up, and its background never actually paints */
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 0 var(--rail-width);
  text-transform: uppercase;
}

/* buttons and selects don't inherit text-transform by default (browsers
   reset form controls to text-transform: none in the UA stylesheet), so the
   uppercase above never reached them without this */
button,
select,
option,
input {
  text-transform: uppercase;
}

/* the matching-patterns dropdown keeps its natural case (mode names and
   descriptor tags read oddly shouted), and so does the footer. The license
   key input stays natural case too - visually forcing it to uppercase would
   make it impossible to tell whether a mixed-case key was actually typed
   correctly, and the error/status messages are full sentences that read
   poorly shouted. */
#patternSelect,
#patternSelect option,
.site-footer,
#licenseInput,
.license-error,
.license-status {
  text-transform: none;
}

.frame-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--rail-width);
  background-image: var(--frame-texture);
  background-size: cover;
  background-position: center;
  z-index: 10;
}

.frame-rail::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain-texture);
  background-repeat: repeat;
  mix-blend-mode: overlay;
  opacity: 0.6;
  pointer-events: none;
}

.frame-rail-left {
  left: 0;
  box-shadow: inset -6px 0 10px rgba(0, 0, 0, 0.45);
}

.frame-rail-right {
  right: 0;
  box-shadow: inset 6px 0 10px rgba(0, 0, 0, 0.45);
}

header {
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #151d30 0%, var(--bg) 100%);
}


header h1 {
  font-family: "Montserrat", -apple-system, sans-serif;
  font-weight: 900;
  /* scales with viewport width but never exceeds 52px, and never drops
     below 28px - paired with nowrap below, this keeps it on one line at
     any reasonable window size instead of wrapping mid-word */
  font-size: clamp(28px, 6vw, 52px);
  white-space: nowrap;
  margin: 0;
  color: #ffffff;
  letter-spacing: 0.01em;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.6),
    0 0 26px rgba(147, 197, 253, 0.5),
    0 0 52px rgba(59, 130, 246, 0.35);
}

.title-accent {
  color: var(--accent);
  text-shadow: none;
}

.subtitle {
  font-family: "Montserrat", -apple-system, sans-serif;
  font-weight: 400;
  color: var(--muted);
  font-size: 18px;
  letter-spacing: 0.03em;
}

main {
  padding: 20px 28px 40px;
  max-width: 1000px;
  margin: 0 auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.control-label {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text);
  font-size: 11px;
}

.pattern-picker {
  flex: 1;
  min-width: 220px;
}

.match-info {
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 8px;
}

.chord-count-picker {
  min-width: 160px;
}

.chord-quality-picker {
  min-width: 170px;
}

.chord-quality-picker .button-group button {
  min-width: 64px;
}

.loop-bars-picker .button-group button {
  min-width: 44px;
}

.tempo-picker {
  min-width: 160px;
}

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

.tempo-label {
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 8px;
  min-width: 60px;
}

#kickBtn {
  background: #0d1424;
  color: var(--text);
  border: 1px solid var(--border);
}

#kickBtn:hover {
  background: #1c2942;
}

#kickBtn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.button-group {
  display: flex;
  gap: 6px;
}

.button-group button {
  background: #0d1424;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  min-width: 34px;
  padding: 7px 10px;
}

.button-group button:hover {
  background: #1c2942;
}

.button-group button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.no-match {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

select {
  background: #0d1424;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-bright);
}

button:disabled {
  background: #334155;
  cursor: not-allowed;
}

#exportBtn {
  background: #16a34a;
}

#exportBtn:hover {
  background: #22c55e;
}

.grid-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  overflow-x: auto;
}

/* thin accent line along the top edge + a very faint diagonal plaid texture
   so the panels read as structured sheets rather than flat gray boxes,
   especially where there's a lot of empty space. Placed after both panels'
   own rules so this always wins over their border/background shorthand. */
.controls,
.grid-wrap,
.license-card {
  position: relative;
  border-top: 3px solid var(--accent);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-image:
    repeating-linear-gradient(45deg, rgba(30, 148, 249, 0.05) 0, rgba(30, 148, 249, 0.05) 1px, transparent 1px, transparent 13px),
    repeating-linear-gradient(-45deg, rgba(30, 148, 249, 0.05) 0, rgba(30, 148, 249, 0.05) 1px, transparent 1px, transparent 13px);
}

.rotate-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 4px;
}

.rotate-row .control-label {
  padding-bottom: 0;
}

.rotate-row button {
  min-width: 34px;
  padding: 6px 10px;
}

.rotate-start-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 56px;
  text-align: center;
}

#pianoRoll {
  width: 100%;
  display: block;
  border-radius: 6px;
}

#pianoRoll[hidden] {
  display: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px 28px 32px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.footer-logo {
  height: 18px;
  width: auto;
  border-radius: 4px;
  opacity: 0.85;
}

.license-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  /* no background of its own - the body's own bg shows through here, so
     the fixed side rails (also on top of the body, at a lower z-index)
     stay visible behind this overlay instead of getting painted over */
  padding: 0 var(--rail-width);
}

/* the browser's own [hidden] default gets overridden by this rule's own
   display:flex above (same issue #pianoRoll ran into earlier) - without
   this, setting the hidden attribute in JS doesn't actually hide it */
.license-gate[hidden] {
  display: none;
}

.license-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.license-logo {
  height: 48px;
  width: auto;
  border-radius: 10px;
  margin-bottom: 14px;
}

.license-title {
  font-family: "Montserrat", -apple-system, sans-serif;
  font-weight: 900;
  /* sized for this card's own fixed width, not reused from the full-page
     header - that clamp's 6vw/34px max was tuned for a full-bleed page
     title and overflowed this much narrower box */
  font-size: clamp(20px, 7vw, 28px);
  white-space: nowrap;
  margin: 0;
  color: #ffffff;
  letter-spacing: 0.01em;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.6),
    0 0 26px rgba(147, 197, 253, 0.5),
    0 0 52px rgba(59, 130, 246, 0.35);
}

.license-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 22px;
}

.license-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

#licenseInput {
  flex: 1;
  min-width: 0;
  background: #0d1424;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
}

#licenseInput:focus {
  outline: none;
  border-color: var(--accent);
}

.license-error {
  color: #f87171;
  font-size: 12px;
  margin: 14px 0 0;
}

.license-status {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 0;
}
