:root {
  --paper: #f1e8d8;
  --pale: #fbf7ef;
  --ink: #171c1a;
  --muted: #68706b;
  --line: #303936;
  --red: #e2553f;
  --yellow: #e7b94b;
  --teal: #55a3a8;
  --pink: #d47998;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; z-index: 20; top: .5rem; left: .5rem; padding: .7rem 1rem; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.topbar { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.topbar a { text-decoration: none; }
.topbar p { margin: 0; }
.opening { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: clamp(2rem, 7vw, 8rem); align-items: end; padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 6vw, 7rem); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 1rem; color: #a13e30; font-size: .7rem; font-weight: 850; text-transform: uppercase; }
.opening h1 { margin: 0; max-width: 850px; font: 400 clamp(4rem, 8vw, 8.2rem)/.84 var(--serif); overflow-wrap: anywhere; }
.opening > p { max-width: 540px; margin: 0; font-size: clamp(1rem, 1.5vw, 1.25rem); }
.machine { padding: clamp(1rem, 4vw, 4rem); background: var(--ink); color: #f5eee2; border-bottom: 1px solid var(--line); }
.transport { display: grid; grid-template-columns: 150px minmax(230px, 1fr) minmax(280px, 1fr) 110px; gap: 1px; max-width: 1250px; margin: 0 auto; background: #65706a; border: 1px solid #65706a; }
.transport > * { min-width: 0; margin: 0; background: #222927; }
.play { min-height: 88px; display: flex; align-items: center; justify-content: center; gap: .7rem; border: 0; background: var(--red); color: #fff; font-weight: 850; cursor: pointer; }
.play span:first-child { font-size: 1.2rem; }
.play[aria-pressed="true"] { background: var(--pale); color: var(--ink); }
.tempo { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-content: center; padding: 1rem 1.2rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.tempo input { grid-column: 1 / -1; width: 100%; accent-color: var(--yellow); }
.tempo output { color: var(--yellow); }
.swing { padding: .8rem 1rem 1rem; border: 0; }
.swing legend { padding: 0; margin-bottom: .45rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.swing div { display: grid; grid-template-columns: repeat(3, 1fr); }
.swing button { min-height: 40px; border: 1px solid #78817d; border-right: 0; background: transparent; color: #f5eee2; font-size: .7rem; font-weight: 750; cursor: pointer; }
.swing button:last-child { border-right: 1px solid #78817d; }
.swing button[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }
.position { display: grid; place-content: center; text-align: center; }
.position span { font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.position strong { color: var(--teal); font-size: 1.15rem; }
.sequencer { max-width: 1250px; margin: 2rem auto; padding: clamp(.7rem, 2vw, 1.4rem); border: 1px solid #59625e; background: #111614; box-shadow: 12px 12px 0 rgba(0, 0, 0, .25); }
.count-row { display: grid; grid-template-columns: minmax(105px, 150px) repeat(8, minmax(34px, 1fr)); gap: .45rem; margin-bottom: .45rem; color: #919a95; text-align: center; font-size: .63rem; }
.track { display: grid; grid-template-columns: minmax(105px, 150px) 1fr; gap: .45rem; align-items: stretch; margin-bottom: .55rem; }
.track:last-child { margin-bottom: 0; }
.track-name { display: flex; flex-direction: column; justify-content: center; min-height: 58px; padding: .5rem .75rem; border-left: 5px solid var(--track); background: #222927; }
.track-name strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 400; }
.track-name small { color: #9ba39f; font-size: .62rem; text-transform: uppercase; }
.steps { display: grid; grid-template-columns: repeat(8, minmax(34px, 1fr)); gap: .45rem; }
.step { position: relative; min-width: 0; min-height: 58px; border: 1px solid #56605b; background: #222927; cursor: pointer; }
.step::after { content: ""; position: absolute; inset: 35%; background: #56605b; }
.step:nth-child(4) { margin-right: .35rem; }
.step[aria-pressed="true"] { border-color: var(--track); background: color-mix(in srgb, var(--track) 22%, #222927); }
.step[aria-pressed="true"]::after { inset: 22%; background: var(--track); }
.step.is-current { outline: 3px solid #f8f2e8; outline-offset: -3px; }
.actions { max-width: 1250px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.actions button { min-height: 48px; border: 1px solid #737c77; background: transparent; color: #f5eee2; font-weight: 750; cursor: pointer; }
.actions button:hover { background: #303936; }
.status { max-width: 1250px; min-height: 1.6em; margin: 1rem auto 0; color: #aeb6b1; font-size: .75rem; }
.rules { padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 6vw, 7rem); }
.rules-title, .closing { display: grid; grid-template-columns: 48px minmax(0, 900px); gap: 1rem; }
.rules-title > p, .closing > p { margin: .2rem 0 0; color: #a13e30; font-weight: 900; }
.rules h2, .closing h2 { margin: 0; font: 400 clamp(2.8rem, 5vw, 5.5rem)/.92 var(--serif); }
.rules ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; max-width: 1250px; margin: 4rem auto 0; padding: 0; background: var(--line); border: 1px solid var(--line); list-style: none; }
.rules li { min-height: 230px; display: flex; flex-direction: column; padding: 1.5rem; background: var(--pale); }
.rules li strong { color: #a13e30; font-size: 1.2rem; }
.rules li p { margin: auto 0 0; font: 400 1.35rem/1.25 var(--serif); }
.closing { padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 8vw, 9rem); background: #d9ddd7; }
.closing div > p:last-child { max-width: 720px; color: #4d5651; }
footer { display: flex; justify-content: space-between; gap: 2rem; padding: 2rem clamp(1rem, 4vw, 4rem); border-top: 1px solid var(--line); font-size: .78rem; }
footer p { margin: 0; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
@media (max-width: 900px) {
  .opening { display: block; }
  .opening h1 { margin-bottom: 2rem; }
  .transport { grid-template-columns: 120px 1fr; }
  .swing { grid-column: 1 / -1; }
  .position { grid-column: 2; grid-row: 1; }
}
@media (max-width: 600px) {
  .topbar p { display: none; }
  .opening { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .opening h1 { font-size: 3rem; line-height: .9; overflow-wrap: normal; }
  .machine { padding: 1rem .65rem 1.5rem; }
  .transport { grid-template-columns: 1fr 84px; }
  .tempo { grid-column: 1 / -1; grid-row: 2; }
  .swing { grid-row: 3; }
  .sequencer { margin-top: 1rem; padding: .65rem .45rem; box-shadow: 6px 6px 0 rgba(0, 0, 0, .25); }
  .count-row { grid-template-columns: repeat(8, 1fr); gap: .28rem; padding-left: 0; }
  .count-row span { display: none; }
  .track { display: block; margin-bottom: .9rem; }
  .track-name { min-height: 0; flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
  .steps { gap: .28rem; }
  .step { min-height: 42px; }
  .step:nth-child(4) { margin-right: .18rem; }
  .actions { grid-template-columns: 1fr; }
  .rules-title, .closing { grid-template-columns: 34px minmax(0, 1fr); }
  .rules h2, .closing h2 { font-size: 2.35rem; }
  .rules ol { grid-template-columns: 1fr; }
  .rules li { min-height: 160px; }
  footer { display: block; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
