/* Play the shapes (tech/board.js). Load after draft.css. Each pad carries its product's colour in --accent
   and how loud its part is right now in --lvl (0..1). */
.section-board { padding-top: 40px; }
.board {
  margin-top: 44px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background:
    radial-gradient(1100px 420px at 50% -18%, rgba(79, 209, 197, 0.07), transparent 70%),
    var(--panel);
}
.board:not(.is-ready) { display: none; }

/* ---------- Play, the song, and the controls ---------- */
.board-top { display: flex; align-items: center; gap: 22px; }
.board-play {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s, background .18s, box-shadow .3s;
}
.board-play:hover { transform: scale(1.04); background: #fff; }
.board-play:focus-visible, .pad-hit:focus-visible, .pad-turn:focus-visible { outline: 2px solid var(--buy); outline-offset: 3px; }
.board-play svg, .board-i-wait { position: absolute; inset: 0; margin: auto; width: 28px; height: 28px; fill: currentColor; transition: opacity .15s, transform .15s; }
.board-i-play { transform: translateX(2px); }
.board-i-stop, .board-i-wait { opacity: 0; transform: scale(0.6); }
.board-i-wait { border: 3px solid rgba(7, 9, 12, 0.18); border-top-color: var(--ink); border-radius: 50%; }
.is-playing .board-play { box-shadow: 0 0 0 8px rgba(244, 246, 249, 0.07); }
.is-playing .board-i-play, .is-loading .board-i-play { opacity: 0; transform: translateX(2px) scale(0.6); }
.is-playing .board-i-stop { opacity: 1; transform: none; }
.is-loading .board-i-wait { opacity: 1; transform: none; animation: board-wait 0.8s linear infinite; }
@keyframes board-wait { to { rotate: 360deg; } }

.board-song { flex: 1; min-width: 0; }
.board-title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-meta { margin: 6px 0 0; font: 500 13px/1.2 var(--label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.board-tools { display: flex; align-items: center; gap: 8px; }
.board-step { width: 40px; height: 40px; padding: 0; }
.board-step svg { width: 16px; height: 16px; }
.board-number { min-width: 62px; text-align: center; font: 600 13px/1 var(--label); letter-spacing: 0.08em; color: var(--text-2); font-variant-numeric: tabular-nums; }
.board-auto { height: 40px; padding: 0 16px 0 14px; font-size: 14px; gap: 9px; }
.board-auto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-hi); transition: background .2s, box-shadow .2s; }
.board-auto.is-on { border-color: color-mix(in srgb, var(--buy) 55%, transparent); color: var(--text); }
.board-auto.is-on::before { background: var(--buy); box-shadow: 0 0 0 4px color-mix(in srgb, var(--buy) 22%, transparent); }

/* ---------- The cycle: one bar after another, and a dot for every scene ---------- */
.board-time { display: flex; align-items: center; gap: 18px; margin: 26px 0 12px; }
.board-bars { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.board-bars i { position: relative; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.board-bars i::after { content: ""; position: absolute; inset: 0; background: var(--text); transform-origin: left; transform: scaleX(var(--fill, 0)); }
.board-scenes { display: flex; gap: 6px; }
.board-scenes i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-hi); transition: background .2s, transform .2s; }
.board-scenes i.is-now { background: var(--buy); transform: scale(1.35); }
.board-status { min-height: 22px; margin: 0 0 16px; font-size: 15px; color: var(--text-2); }

/* ---------- The pads ---------- */
.board-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.pad {
  position: relative;
  aspect-ratio: 1 / 1.18;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-2);
  /* (a card can turn over: tech/minis.js puts a small version of the product on its back) */
  transform: perspective(1100px) rotateY(0deg);
  transform-style: preserve-3d;
  transition: border-color .2s, background .25s, box-shadow .25s, translate .18s, transform .62s cubic-bezier(.3, .1, .2, 1);
}
.pad:hover { border-color: var(--line-hi); translate: 0 -2px; }
.pad-hit {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 14px 8px 38px;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.pad-glow {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  opacity: 0;
  scale: calc(0.7 + var(--lvl, 0) * 0.9);
  transition: opacity .25s;
  pointer-events: none;
}
.pad-shape {
  position: relative;
  width: 44%;
  aspect-ratio: 1;
  margin-bottom: 8px;
  opacity: 0.3;
  filter: grayscale(1) brightness(1.3);
  scale: calc(1 + var(--lvl, 0) * 0.16);
  transition: opacity .25s, filter .25s;
  user-select: none;
}
/* the shape of the part's sound, along the foot of the pad */
.pad-wave { position: absolute; left: 12px; right: 12px; bottom: 10px; width: calc(100% - 24px); height: 22px; }
.pad-name { position: relative; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; color: var(--text-2); transition: color .2s; }
.pad-name .pname-letter, .pad-name .pname-all { color: inherit; }
.pad-job { position: relative; font: 500 11px/1.2 var(--label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pad-key {
  position: absolute;
  left: 11px;
  top: 10px;
  min-width: 22px;
  padding: 4px 6px;
  border: 1px solid var(--line-hi);
  border-radius: 7px;
  font: 600 11px/1 var(--label);
  text-align: center;
  color: var(--muted);
}
/* the corner that turns the card over */
.pad-turn {
  position: absolute;
  right: 7px;
  top: 7px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  transition: opacity .2s, color .2s, background .2s, rotate .4s;
}
.pad-turn svg { width: 15px; height: 15px; }
.pad:hover .pad-turn, .pad-turn:focus-visible, .pad.is-on .pad-turn { opacity: 1; }
.pad-turn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); rotate: 180deg; }

.pad.is-on {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, var(--panel-2)), var(--panel-2) 78%);
  box-shadow: 0 22px 60px -30px var(--accent);
}
.pad.is-on .pad-glow { opacity: calc(0.16 + var(--lvl, 0) * 0.5); }
.pad.is-on .pad-shape { opacity: 1; filter: none; }
.pad.is-on .pad-name { color: var(--text); }
.pad.is-on .pad-name .pname-letter, .pad.is-on .pad-name .pname-all { color: var(--accent); }
.pad.is-on .pad-key { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: color-mix(in srgb, var(--accent) 80%, white); }

/* coming in on the next beat; still loading; not in this song */
.pad.is-waiting { border-color: color-mix(in srgb, var(--accent) 45%, transparent); animation: pad-wait 0.4s ease-in-out infinite alternate; }
@keyframes pad-wait { from { background: var(--panel-2); } to { background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); } }
.pad.is-waiting .pad-shape { opacity: 0.75; filter: none; }
.pad.is-loading::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat;
  background-size: 50% 100%;
  animation: pad-load 0.9s linear infinite;
}
@keyframes pad-load { from { background-position: -100% 0; } to { background-position: 200% 0; } }
.pad.is-missing { opacity: 0.35; pointer-events: none; }

.pad-dice { border-style: dashed; background: none; }
.pad-dice .pad-hit { padding-bottom: 14px; }
.pad-dice .pad-shape { opacity: 0.55; filter: none; fill: currentColor; color: var(--text-2); scale: 1; }
.pad-dice:hover .pad-shape { opacity: 0.95; }

.board-what { min-height: 22px; margin: 18px 4px 0; font-size: 15px; line-height: 1.45; color: var(--muted); }

@media (hover: none) {
  .pad-key { display: none; }
  .pad-turn { opacity: 1; }
}
@media (max-width: 1100px) {
  .board-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .board-top { flex-wrap: wrap; }
  .board-tools { width: 100%; justify-content: space-between; }
}
@media (max-width: 640px) {
  .board { margin-top: 30px; padding: 16px; border-radius: 24px; }
  .board-top { gap: 14px; }
  .board-play { flex-basis: 60px; width: 60px; height: 60px; }
  .board-title { font-size: 21px; }
  .board-meta { font-size: 11px; }
  .board-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pad { border-radius: 16px; aspect-ratio: 1 / 1.24; }
  .pad-hit { padding: 10px 4px 28px; }
  .pad-wave { left: 8px; right: 8px; width: calc(100% - 16px); height: 16px; bottom: 8px; }
  .pad-name { font-size: 13px; }
  .pad-job { font-size: 9px; letter-spacing: 0.1em; }
  .board-time { margin: 18px 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .pad, .board-play { transition: none; }
  .pad:hover { translate: none; }
  .pad-glow, .pad-shape { scale: 1; }
  .pad.is-waiting, .pad.is-loading::after { animation: none; }
}

/* ---------- The small versions (tech/minis.js): a card turns over, and on its back is a little of the
   product to play with. Everything on a back is sized from the card (cqw: hundredths of its width). ---------- */
.pad-hit { touch-action: manipulation; }
.pad.is-flipped { transform: perspective(1100px) rotateY(180deg); }
.pad.is-flipped:hover { translate: none; }
.pad-hit, .pad-turn { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.pad.is-flipped .pad-hit, .pad.is-flipped .pad-turn { pointer-events: none; }
.pad-back {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  transform: rotateY(180deg) translateZ(1px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  container-type: size;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 64%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--panel)), var(--panel));
}
.pad:not(.is-flipped) .pad-back { pointer-events: none; }
/* a ghost of the plugin's own window behind the control */
.pad-back::before { content: ""; position: absolute; inset: 0; background: var(--shot) center / cover no-repeat; opacity: 0.13; filter: saturate(1.2); pointer-events: none; }
.back-in { position: relative; display: flex; flex-direction: column; gap: 2cqw; height: 100%; padding: 4.5cqw 5.5cqw 5.5cqw; }
.back-top { display: flex; align-items: center; gap: 3.2cqw; flex: 0 0 auto; }
.back-power { flex: 0 0 auto; width: clamp(11px, 6.6cqw, 15px); aspect-ratio: 1; padding: 0; border: 1.5px solid var(--line-hi); border-radius: 50%; background: none; cursor: pointer; transition: background .2s, border-color .2s, box-shadow .2s; }
.back-power[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent); }
.back-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(10px, 7.6cqw, 16px); font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; color: var(--text); text-decoration: none; }
.back-name b { font-weight: inherit; color: var(--accent); }
.back-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.back-turn { flex: 0 0 auto; display: grid; place-items: center; width: clamp(20px, 13cqw, 30px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: color .2s, background .2s, rotate .4s; }
.back-turn svg { width: 54%; height: 54%; }
.back-turn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); rotate: -180deg; }
.back-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.2cqw; transition: opacity .2s; }
.pad-back.is-loading .back-main { opacity: 0.35; pointer-events: none; }
.back-foot { flex: 0 0 auto; display: flex; align-items: baseline; justify-content: space-between; gap: 2cqw; margin: 0; font: 500 clamp(8px, 5cqw, 11px)/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.back-foot b { font: 700 clamp(11px, 8cqw, 17px)/1 var(--label); letter-spacing: 0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.back-foot kbd { font: inherit; letter-spacing: 0.1em; opacity: 0.8; }
.pad-back button:focus-visible, .pad-back a:focus-visible, .dial:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* one dial */
.dial { position: relative; flex: 0 1 auto; height: 100%; max-height: 64cqw; max-width: 100%; aspect-ratio: 1; border-radius: 50%; cursor: ns-resize; touch-action: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial-track, .dial-value { fill: none; stroke-width: 7; stroke-linecap: round; }
.dial-track { stroke: rgba(255, 255, 255, 0.1); }
.dial-value { stroke: var(--accent); stroke-dasharray: 100 100; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 75%, transparent)); }
.dial-hand circle { fill: var(--text); transition: r .15s; }
.dial.is-turning .dial-hand circle { r: 6.5px; }
.dial-shape { position: absolute; inset: 27%; width: 46%; height: 46%; opacity: calc(0.3 + var(--v, 1) * 0.7); filter: saturate(calc(0.15 + var(--v, 1) * 0.85)); scale: calc(0.94 + var(--lvl, 0) * 0.14); pointer-events: none; user-select: none; }
.back-room { flex: 0 0 auto; max-width: 100%; padding: 1.8cqw 4.4cqw; border: 1px solid var(--line-hi); border-radius: 999px; background: rgba(7, 9, 12, 0.45); color: var(--text-2); font: 600 clamp(8.5px, 5.4cqw, 12px)/1.25 inherit; cursor: pointer; transition: color .2s, border-color .2s; }
.back-room span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-room:hover { color: var(--text); border-color: var(--accent); }
.back-room.is-hit { animation: back-room .4s ease-out; }
@keyframes back-room { 0% { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); } }

/* Kinetik: four drums */
.back-drums { display: grid; grid-template-columns: 1fr 1fr; align-content: center; justify-items: center; gap: 3.4cqw 5cqw; width: 100%; height: 100%; }
.drum { display: flex; flex-direction: column; align-items: center; gap: 2cqw; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.drum i { width: min(27cqw, 100%); aspect-ratio: 1; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 42%, var(--panel)), var(--panel) 76%); box-shadow: inset 0 0 0 4px rgba(7, 9, 12, 0.5); transition: scale .12s; }
.drum:hover i { scale: 1.05; }
.drum span { font: 500 clamp(7px, 4.3cqw, 9.5px)/1 var(--label); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; color: var(--muted); }
.drum.is-hit i { animation: back-drum .34s ease-out; }
@keyframes back-drum {
  0% { scale: 0.9; background: var(--accent); box-shadow: inset 0 0 0 4px rgba(7, 9, 12, 0.5), 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent); }
  100% { scale: 1; box-shadow: inset 0 0 0 4px rgba(7, 9, 12, 0.5), 0 0 0 4cqw transparent; }
}

/* Sora: six strings */
.back-strings { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 5cqw; background: rgba(7, 9, 12, 0.45); cursor: grab; touch-action: none; user-select: none; }
.back-strings:active { cursor: grabbing; }
.string { position: relative; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: inherit; -webkit-tap-highlight-color: transparent; }
.string i { position: absolute; left: 50%; top: 5cqw; bottom: 12cqw; width: var(--w, 2px); translate: -50% 0; border-radius: 1px; background: linear-gradient(180deg, transparent, var(--accent) 14%, var(--accent) 86%, transparent); }
.string span { position: absolute; left: 0; right: 0; bottom: 3.6cqw; font: 600 clamp(7px, 4.6cqw, 10px)/1 var(--label); letter-spacing: 0.04em; text-align: center; color: var(--muted); pointer-events: none; }
.string.is-hit i { animation: back-string .5s ease-out; }
.string.is-hit span { color: var(--text); }
@keyframes back-string {
  0% { width: calc(var(--w, 2px) + 6px); filter: blur(1px) brightness(1.7); }
  35% { width: calc(var(--w, 2px) + 3px); }
  100% { width: var(--w, 2px); filter: none; }
}

/* Helios and Marea: four notes to hold */
.back-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3cqw; width: 100%; height: 100%; }
.key { position: relative; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 4.5cqw; border: 1px solid var(--line-hi); border-radius: 5cqw; background: rgba(7, 9, 12, 0.45); color: inherit; font: inherit; cursor: pointer; overflow: hidden; touch-action: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: border-color .15s; }
.key i { position: absolute; inset: 0; background: linear-gradient(0deg, color-mix(in srgb, var(--accent) 62%, transparent), transparent 90%); opacity: 0; transition: opacity .5s; }
.key span { position: relative; font-size: clamp(10px, 7.4cqw, 16px); font-weight: 800; letter-spacing: -0.01em; color: var(--text-2); }
.key:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.key.is-held { border-color: var(--accent); }
.key.is-held i { opacity: 1; transition-duration: .12s; }
.key.is-held span { color: var(--text); }

@container (max-width: 150px) {
  .drum span, .back-foot kbd { display: none; }
  .drum i { width: min(33cqw, 100%); }
  .back-foot { justify-content: center; gap: 4cqw; }
}
@media (hover: none) { .back-foot kbd { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .drum.is-hit i, .string.is-hit i, .back-room.is-hit { animation: none; }
}
