.beat-page {
  --paper: #f5e8d3;
  --ink: #28241f;
  --red: #a02f21;
  min-height: 100svh;
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
}
.beat-page::before {
  background:
    radial-gradient(ellipse at 7% 6%, #fdf3e4, transparent 56%),
    repeating-linear-gradient(90deg, #7f534007 0 1px, transparent 1px 4px),
    var(--paper);
}
.beat-header, .beat-layout {
  width: min(calc(100% - 2.5rem), 72rem);
  margin-inline: auto;
}
.beat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #6c594e55;
}
.beat-header .wordmark span { color: var(--red); }
.beat-action {
  min-height: 44px;
  padding: .55rem 1rem;
  border: 1px solid #766658;
  border-radius: .25rem;
  color: var(--ink);
  background: #fff8eb;
  font: 750 .9rem system-ui, sans-serif;
  cursor: pointer;
}
.beat-layout {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: clamp(1.5rem, 7vw, 6rem);
  padding-block: clamp(1.5rem, 5vh, 3.5rem);
}
.beat-intro h1 {
  padding: 0;
  color: var(--ink);
  font: 700 clamp(3.35rem, 9vw, 7.4rem)/.84 Georgia, serif;
  letter-spacing: -.105em;
}
.beat-intro h1 span { color: var(--red); }
.beat-intro p {
  max-width: 29ch;
  margin: 1.45rem 0;
  color: #59483c;
  font-size: 1.03rem;
  line-height: 1.5;
}
.beat-action {
  color: #fff8ed;
  min-width: 9rem;
  border-color: #7d261c;
  background: var(--red);
  box-shadow: 0 3px 0 #64271e;
}
.beat-action:hover { background: #84271d; }
.beat-action:disabled { cursor: default; opacity: .64; }
.beat-deck {
  padding: clamp(.65rem, 2vw, 1.15rem);
  border: 1px solid #a5a39b;
  border-radius: .65rem;
  background: #deddd6;
  box-shadow: 0 .4rem 0 #a9a69d, 0 .9rem 1.8rem #51493d2b, inset 0 1px #ffffffa8;
}
.deck-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem .85rem;
  min-height: 2.45rem;
  padding: 0 .1rem .55rem;
}
#status { margin: 0; min-height: 1.35em; font-weight: 750; }
.beat-steps { display: flex; gap: .42rem; }
.beat-steps i {
  display: block;
  width: clamp(.95rem, 3.5vw, 1.3rem);
  aspect-ratio: 1;
  border: 1px solid #89877d;
  border-radius: 50%;
  background: #f0eee7;
}
.beat-steps i.filled {
  border-color: #862d23;
  background: var(--red);
  box-shadow: inset 0 1px #ffffff50;
}
.beat-steps i.missed {
  background: #ffc1a5;
  border-color: var(--red);
  animation: wrong-beat .3s ease-out;
}
.beat-pad.missed { animation: wrong-beat .3s ease-out; }
.deck-loading[hidden], .beat-grid[hidden] { display: none; }
.deck-loading { position: relative; }
.loading-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.4rem, 1.15vw, .7rem);
  padding: clamp(.4rem, .9vw, .65rem);
  border-radius: .34rem;
  background: #adaaa0;
}
.loading-tiles i {
  aspect-ratio: 1;
  border-radius: .32rem;
  background: #c7c5bb;
  transition: background .18s ease;
}
.loading-tiles i.loaded { background: #e8d3b8; }
#load-progress {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(55%, 12rem);
  height: .7rem;
  accent-color: var(--red);
}
@keyframes wrong-beat {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
.beat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.4rem, 1.15vw, .7rem);
  padding: clamp(.4rem, .9vw, .65rem);
  border-radius: .34rem;
  background: #adaaa0;
  box-shadow: inset 0 2px 5px #514d464d;
}
.beat-pad {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid #ffffff50;
  border-radius: .32rem;
  background: #d9bc9c;
  color: var(--ink);
  box-shadow: 0 2px 0 #2d211b, inset 0 1px #ffffff66;
  font: 750 clamp(1.8rem, 5vw, 3.1rem)/1 Georgia, serif;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .13s, box-shadow .13s;
}
.beat-pad img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
  transition: filter .12s;
  pointer-events: none;
}
.beat-pad.has-art img { visibility: visible; }
.beat-pad[aria-disabled="true"] { cursor: default; }
.beat-pad[aria-disabled="false"]:hover { box-shadow: inset 0 0 0 2px #fff4db, 0 2px 0 #2d211b; }
.beat-pad.active {
  z-index: 1;
  transform: translateY(-2px) scale(1.025);
  outline: 3px solid #fff8cf;
  box-shadow: 0 0 1rem #ffe7a8b0;
  background: #fff8cf;
}
.beat-pad.active img { filter: brightness(1.28) saturate(1.17); }
.beat-pad.missed { outline: 3px solid #e14937; }
.beat-pad.missed img { filter: brightness(.83) saturate(.8); }
.beat-page :focus-visible { outline-color: #873423; }
.keyboard-hint { margin: .65rem 0 0; text-align: center; color: #584437; font-size: .85rem; }
.screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 42rem) {
  .beat-layout { grid-template-columns: 1fr; gap: .95rem; padding-block: 1.15rem; }
  .beat-intro h1 { font-size: clamp(2.7rem, 10vw, 4.5rem); letter-spacing: -.08em; }
  .beat-intro h1 br { display: none; }
  .beat-intro p { max-width: 38ch; margin: .65rem 0; }
  .beat-deck { max-width: 27rem; width: 100%; margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .beat-pad, .beat-pad img, .loading-tiles i { transition: none; }
  .beat-pad.active { transform: none; }
  .beat-steps i.missed, .beat-pad.missed { animation: none; }
}
