.first-screen { align-content: start; }

:root {
  color-scheme: dark;
  --bg: #14110e;
  --bg-2: #1c1814;
  --ink: #f4ecdf;
  --muted: #b7a892;
  --line: #3d3428;
  --brass: #e0a45a;
  --brass-2: #f3d7a4;
  --ember: #ef6b4a;
  --pad: #2a241c;
  --pad-2: #1b2421;
  --page: 1160px;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at 8% -10%, rgba(224, 164, 90, 0.14), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(239, 107, 74, 0.08), transparent 46%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

::selection { background: var(--brass); color: #1a1208; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 40;
  background: var(--brass);
  color: #1a1208;
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.skip:focus { top: 8px; }

.frame {
  width: min(var(--page), calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 48px;
  max-height: 48px;
  display: flex;
  align-items: center;
  background: rgba(20, 17, 14, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  min-width: 0;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: none;
}

.topbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  flex: none;
}

select, button, input { font: inherit; color: inherit; }

select {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #241f19;
  color: var(--ink);
  padding: 0 8px;
}

.lang-menu { position: relative; margin-left: auto; flex: none; }

.lang-menu summary {
  list-style: none;
  cursor: pointer;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #241f19;
}

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

.lang-menu summary::after {
  content: "";
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  width: 6px;
  height: 6px;
  transform: translateY(-2px) rotate(45deg);
}

.lang-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 168px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: #241f19;
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 40;
}

.lang-panel a {
  color: var(--ink);
  text-decoration: none;
  padding: 7px 8px;
  border-radius: 7px;
}

.lang-panel a[aria-current="page"] { color: var(--brass-2); }

.lang-panel a:hover { background: rgba(224, 164, 90, 0.12); }

.first-screen {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px 0 8px;
}

h1 {
  margin: 0;
  white-space: nowrap;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: clamp(1.2rem, 1.65vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hint, .footer-line, .noscript, .status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-line { white-space: nowrap; }

.noscript {
  color: var(--brass-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.status:empty { display: none; }

.status { color: var(--ember); }

.presets, .transport, .exports {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.presets button, .transport button, .exports button, .add, .pad, .bar {
  cursor: pointer;
}

.presets button, #play, .exports button {
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #241f19;
  padding: 0 12px;
}

.presets button.is-current {
  border-color: var(--brass);
  color: var(--brass-2);
}

#play[aria-pressed="true"] {
  background: var(--ember);
  border-color: var(--ember);
  color: #1a1208;
  font-weight: 700;
}

.exports button {
  background: var(--brass);
  border-color: var(--brass);
  color: #1a1208;
  font-weight: 700;
}

.exports button:disabled { opacity: 0.6; cursor: progress; }

.transport label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  height: 36px;
}

.bpm input[type="range"] { width: 128px; accent-color: var(--brass); }

#bpm-out { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2.4ch; }

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

.pad-slot { position: relative; min-width: 0; }

.pad {
  width: 100%;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 8px 30px 16px 8px;
  border-radius: 12px;
  border: 1px solid #4a4033;
  background: linear-gradient(180deg, #3a3228 0%, #241e17 100%);
  text-align: left;
  position: relative;
}

.pad-slot:nth-child(n + 9) .pad {
  background: linear-gradient(180deg, #24312d 0%, #161d1b 100%);
  border-color: #3c5248;
}

.pad .roman {
  font-family: Georgia, Palatino, serif;
  color: var(--brass);
  font-size: 13px;
  line-height: 1.1;
}

.pad-slot:nth-child(n + 9) .roman { color: var(--brass-2); }

.chord-name {
  font-weight: 750;
  font-size: 15px;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pad kbd {
  position: absolute;
  left: 8px;
  bottom: 5px;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.4;
}

.pad.is-on {
  border-color: var(--ember);
  box-shadow: inset 0 0 0 1px var(--ember);
}

.add {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid #5a4c38;
  background: rgba(20, 17, 14, 0.72);
  color: var(--brass-2);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

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

.bar {
  min-height: 68px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(224, 164, 90, 0.18) 0 2px, transparent 2px) 0 0 / 12px 100%,
    #1b1713;
  color: inherit;
  text-align: left;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.bar-index { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }

.bar-name { font-weight: 750; font-size: 16px; }

.bar-roman { color: var(--brass); font-family: Georgia, Palatino, serif; font-size: 13px; }

.bar.is-active { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }

.bar.is-playing::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--ember);
}

.guide {
  padding: 8px 0 56px;
  color: #eadfcd;
  font-size: 16.5px;
  line-height: 1.6;
}

.guide h2 {
  font-family: Georgia, Palatino, serif;
  font-size: 1.45rem;
  font-weight: 600;
  margin: 1.35em 0 0.35em;
  letter-spacing: -0.02em;
}

.guide h3 {
  font-size: 1.05rem;
  margin: 0.9em 0 0.2em;
}

.guide p { margin: 0.45em 0; }

.guide ul { margin: 0.4em 0 0.6em; padding-left: 1.15em; }

.guide li { margin: 0.28em 0; }

.qa + .qa { margin-top: 0.2em; }

.partners {
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(28, 24, 20, 0.85);
}

.partners h2 { margin-top: 0; }

.disclosure { color: var(--brass-2); font-size: 14px; }

.partners ul { list-style: none; padding: 0; }

.partners a { color: var(--brass-2); font-weight: 700; }

.partners li { display: grid; gap: 2px; margin: 10px 0; }

.miss {
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px 0 48px;
}

.miss h1 { white-space: normal; }

.miss ul { padding-left: 1.1em; }

.miss a { color: var(--brass-2); }

@media (max-width: 800px) {
  h1 { font-size: clamp(1rem, 4.4vw, 1.45rem); }
}

@media (max-width: 720px) {
  h1, .footer-line { white-space: normal; }
  .pad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .pad { min-height: 78px; padding-right: 28px; }
  .chord-name { font-size: 12px; white-space: normal; line-height: 1.15; }
  .topbar .lbl {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .topbar select { max-width: 108px; }
  .bpm input[type="range"] { width: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
