/* Tic-tac-toe */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 300px;
  margin: 0 auto;
}

.ttt-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ttt-cell:hover:not(:disabled) {
  border-color: var(--border-hot);
  background: rgba(45, 212, 191, 0.08);
}

.ttt-cell.x {
  color: var(--cyan);
}

.ttt-cell.o {
  color: var(--coral);
}

.ttt-cell.win {
  box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(251, 191, 36, 0.35);
}

.game-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 12rem;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-loading-spin {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid rgba(45, 212, 191, 0.2);
  border-top-color: var(--teal);
  animation: game-spin 0.7s linear infinite;
}

@keyframes game-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Canvas games */
#snake-canvas,
#sh-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  touch-action: none;
  background: #04070e;
}

.snake-progress {
  max-width: 360px;
  margin: 0 auto 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
}

.snake-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.snake-progress-meta strong {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.snake-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.snake-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.35);
  transition: width 0.25s ease;
}

.snake-progress-sub {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--dim);
  font-family: var(--mono);
}

/* Space shooter stage — always centered (phone + desktop) */
.shooter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.shooter-wrap .game-hud,
.shooter-wrap .game-hint,
.shooter-wrap .game-actions {
  width: 100%;
  max-width: 420px;
}

.sh-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  box-sizing: border-box;
}

.sh-stage #sh-canvas,
#sh-canvas {
  display: block;
  width: 100% !important;
  max-width: 420px;
  height: auto !important;
  aspect-ratio: 420 / 520;
  margin: 0 auto;
  box-sizing: border-box;
}

.sh-hit-flash {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(251, 113, 133, 0.55), rgba(127, 29, 29, 0.75));
  opacity: 0;
  z-index: 2;
}

.sh-hit-flash.play {
  animation: sh-flash 0.75s ease-out forwards;
}

.sh-life-banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 3;
  pointer-events: none;
  text-align: center;
  padding: 0.85rem 1.4rem;
  border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, 0.55);
  background: rgba(8, 10, 18, 0.88);
  box-shadow: 0 0 40px rgba(251, 113, 133, 0.35);
  opacity: 0;
}

.sh-life-banner.play {
  animation: sh-banner 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sh-life-banner-main {
  display: block;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  color: #fecdd3;
}

.sh-life-banner-sub {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: #fb7185;
}

.sh-lives.lost {
  color: #fb7185 !important;
  animation: sh-lives-pop 0.7s ease;
}

/* Fixed height so stacking powerups never shoves the canvas down mid-run */
.sh-powers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 0.35rem;
  max-width: 420px;
  width: 100%;
  margin: 0 auto 0.55rem;
  min-height: 3.5rem;
  max-height: 3.5rem;
  overflow: hidden;
  box-sizing: border-box;
}

.sh-power-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--pc) 55%, transparent);
  background: color-mix(in srgb, var(--pc) 14%, rgba(0, 0, 0, 0.35));
  color: var(--pc);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1.15;
  max-width: 100%;
}

.sh-power-chip small {
  opacity: 0.75;
  font-weight: 500;
}

.sh-power-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--dim);
  font-family: var(--mono);
  text-align: center;
  line-height: 1.3;
}

.sh-pickup-toast {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: rgba(8, 12, 22, 0.9);
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0;
}

.sh-pickup-toast.play {
  animation: sh-pickup 0.85s ease forwards;
}

@keyframes sh-pickup {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1);
  }
}

@keyframes sh-flash {
  0% {
    opacity: 0.95;
  }
  35% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
  }
}

@keyframes sh-banner {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.02);
  }
}

/* Pulse Grid (jubeat-style charts) */
.jubeat-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 0.55rem;
}

.jubeat-wrap * {
  letter-spacing: 0;
}

.jb-setup,
.jb-playfield {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.jb-setup {
  max-width: 640px;
}

.jb-setup[hidden],
.jb-playfield[hidden] {
  display: none;
}

.jb-fullscreen-row {
  display: flex;
  justify-content: flex-end;
  width: min(100%, 640px);
  min-height: 0;
}

.jb-fullscreen-row:empty {
  display: none;
}

.jb-fullscreen-row .fullscreen-btn {
  position: static;
  flex: 0 0 auto;
}

.jb-select-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0.55rem 0.15rem;
  border-top: 1px solid var(--border-hot);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}

.jb-select-header span,
.jb-setup-label {
  color: var(--muted);
  font: 700 0.67rem var(--mono);
  letter-spacing: 0.1em;
}

.jb-select-header strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 1rem;
}

.jb-setup-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  width: 100%;
  padding: 0.38rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.jb-setup-panel {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0;
  border: 0;
}

.jb-setup-label {
  margin: 0;
}

.jb-difficulty {
  display: grid;
  grid-template-columns: repeat(3, 2rem);
  gap: 0.16rem;
  width: max-content;
  max-width: 100%;
  padding: 0.16rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.jb-difficulty-btn {
  width: 2rem;
  min-width: 2rem;
  min-height: 1.7rem;
  border: 0;
  border-radius: 6px;
  padding: 0.22rem 0.12rem;
  background: transparent;
  color: var(--jb-difficulty-color, var(--dim));
  font: 800 0.68rem/1 var(--mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0.68;
  cursor: pointer;
}

.jb-difficulty-btn.is-active {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px currentColor;
  opacity: 1;
}

.jb-difficulty-btn[data-difficulty="easy"] {
  --jb-difficulty-color: #4ade80;
}

.jb-difficulty-btn[data-difficulty="medium"] {
  --jb-difficulty-color: #fbbf24;
}

.jb-difficulty-btn[data-difficulty="extreme"] {
  --jb-difficulty-color: #f87171;
}

.jb-difficulty-btn[data-difficulty="custom"] {
  --jb-difficulty-color: var(--teal);
}

.jb-difficulty-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.jb-marker-mode {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.18rem;
  width: 100%;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.jb-marker-btn {
  min-width: 0;
  min-height: 1.8rem;
  border: 0;
  border-radius: 7px;
  padding: 0.24rem 0.18rem;
  background: transparent;
  color: var(--dim);
  font: 700 0.56rem/1.1 var(--mono);
  cursor: pointer;
}

.jb-marker-btn.is-active {
  background: rgba(56, 189, 248, 0.16);
  color: var(--cyan);
}

.jb-marker-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.jb-song-browser {
  display: grid;
  grid-template-columns: minmax(8.5rem, 0.68fr) minmax(0, 1.72fr);
  width: 100%;
  min-height: 15rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.jb-song-bar {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  width: 100%;
  max-height: 16rem;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.45rem;
  border-right: 1px solid var(--border);
  scrollbar-color: var(--muted) transparent;
  scrollbar-width: thin;
}

.jb-song-chip {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 2.55rem;
  overflow: hidden;
  text-align: left;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: inherit;
  border-radius: 4px;
  padding: 0.5rem 0.55rem;
  font: inherit;
  cursor: pointer;
}

.jb-song-chip span {
  display: block;
  overflow: hidden;
  color: var(--text);
  font: 700 0.72rem/1.25 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jb-song-chip:hover {
  background: rgba(255, 255, 255, 0.05);
}

.jb-song-chip.is-active {
  border-left-color: var(--sc);
  background: color-mix(in srgb, var(--sc) 14%, rgba(255, 255, 255, 0.03));
}

.jb-song-chip.is-active span {
  color: var(--sc);
}

.jb-song-chip:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.jb-song-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.jb-song-detail {
  display: grid;
  grid-template-columns: minmax(8rem, 0.88fr) minmax(0, 1.12fr);
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  padding: 0.8rem;
}

.jb-song-jacket {
  width: 100%;
  max-width: 13.5rem;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--border-hot);
  background: #080a0d;
}

.jb-song-jacket img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jb-song-detail-copy {
  min-width: 0;
}

.jb-song-detail-copy > p {
  margin: 0 0 0.25rem;
  overflow: hidden;
  color: var(--dim);
  font: 700 0.62rem/1.3 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jb-song-detail-copy h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.2;
}

.jb-song-detail-copy dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.55rem;
  margin: 1rem 0 0;
}

.jb-song-detail-copy dl div {
  min-width: 0;
}

.jb-song-detail-copy dt {
  color: var(--muted);
  font: 700 0.54rem/1.2 var(--mono);
  text-transform: uppercase;
}

.jb-song-detail-copy dd {
  margin: 0.18rem 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font: 700 0.66rem/1.3 var(--mono);
}

.jb-timing-calibration {
  display: grid;
  gap: 0.38rem;
  margin-top: 0.72rem;
  padding-top: 0.62rem;
  border-top: 1px solid var(--border);
}

.jb-timing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font: 700 0.54rem/1.2 var(--mono);
}

.jb-timing-head output {
  color: var(--gold);
  text-align: right;
}

.jb-timing-calibration input[type="range"] {
  width: 100%;
  min-height: 1.2rem;
  margin: 0;
  accent-color: var(--gold);
  cursor: ew-resize;
}

.jb-timing-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.28rem;
}

.jb-timing-actions .btn {
  min-width: 0;
  padding-inline: 0.28rem;
  font-size: 0.56rem;
}

.jb-timing-calibration small {
  color: var(--dim);
  font: 0.52rem/1.35 var(--mono);
}

.jb-local-audio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.jb-local-audio[hidden] {
  display: none;
}

.jb-local-audio-pick {
  justify-content: center;
  cursor: pointer;
}

.jb-local-audio-offset {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font: 700 0.5rem var(--mono);
}

.jb-local-audio-offset input {
  width: 3.5rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 700 0.62rem var(--mono);
  text-align: right;
}

.jb-local-audio small {
  grid-column: 1 / -1;
  color: var(--muted);
  font: 0.54rem/1.4 var(--mono);
}

.jb-local-audio-source {
  grid-column: 1 / -1;
  width: max-content;
  color: var(--cyan);
  font: 700 0.57rem/1.3 var(--mono);
  text-underline-offset: 0.16em;
}

.jb-local-audio-source[hidden] {
  display: none;
}

.jb-custom-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  width: 100%;
}

.jb-custom-actions [hidden],
.jb-recorder-actions [hidden] {
  display: none;
}

.jb-custom-actions .jb-custom-delete {
  color: #fb7185;
}

.jb-chart-editor {
  width: 100%;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-hot);
  border-bottom: 1px solid var(--border);
}

.jb-chart-editor[hidden] {
  display: none;
}

.jb-chart-editor > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.jb-chart-editor > header p {
  margin-bottom: 0.18rem;
}

.jb-chart-editor > header strong {
  font-size: 0.95rem;
}

.jb-editor-close {
  display: grid;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--dim);
  font: 1.1rem/1 var(--mono);
  cursor: pointer;
}

.jb-editor-fields {
  display: grid;
  grid-template-columns: minmax(8rem, 1.5fr) minmax(8rem, 1.4fr) minmax(4.5rem, 0.55fr) minmax(6.5rem, 0.8fr);
  gap: 0.5rem;
}

.jb-editor-fields label {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.jb-editor-fields label > span,
.jb-editor-step-head span {
  color: var(--muted);
  font: 700 0.58rem var(--mono);
}

.jb-editor-fields input,
.jb-editor-fields select {
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 0.55rem;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: 0.72rem var(--mono);
}

.jb-editor-recorder {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.jb-editor-recorder[hidden],
.jb-editor-sequence[hidden],
.jb-editor-save-actions[hidden] {
  display: none;
}

.jb-recorder-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, 23rem);
  margin: 0 auto;
}

.jb-recorder-head > div {
  display: grid;
  gap: 0.15rem;
}

.jb-recorder-head > div:last-child {
  text-align: right;
}

.jb-recorder-head span {
  color: var(--muted);
  font: 700 0.58rem var(--mono);
}

.jb-recorder-head strong {
  color: var(--cyan);
  font: 700 0.8rem var(--mono);
}

.jb-record-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
  width: min(100%, 23rem);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 0.4rem;
  border: 1px solid var(--border);
  background: #05090f;
  touch-action: none;
  user-select: none;
}

.jb-record-grid button {
  display: grid;
  min-width: 0;
  place-items: center;
  border: 1px solid #2a3a4e;
  border-radius: 5px;
  background: #101a26;
  color: #7f95ae;
  font: 0.67rem var(--mono);
  cursor: default;
  touch-action: none;
}

.jb-record-grid:not(.is-recording) button {
  opacity: 0.55;
}

.jb-record-grid.is-recording button {
  cursor: pointer;
}

.jb-record-grid button.is-hit {
  border-color: #a5f3fc;
  background: #0891b2;
  color: #fff;
  box-shadow: inset 0 0 0 3px rgba(103, 232, 249, 0.42);
}

.jb-record-grid button.is-overlap,
.jb-editor-grid button.is-overlap {
  border-color: #fda4af;
  background: #be123c;
  color: #fff;
  box-shadow:
    inset 0 0 0 3px rgba(253, 164, 175, 0.48),
    0 0 12px rgba(225, 29, 72, 0.72);
  animation: jb-overlap-rejected 110ms ease-in-out 2 alternate;
}

@keyframes jb-overlap-rejected {
  to {
    background: #fb7185;
    transform: scale(0.94);
  }
}

.jb-record-progress {
  width: min(100%, 23rem);
  height: 0.25rem;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.jb-record-progress > div {
  width: 0;
  height: 100%;
  background: var(--cyan);
}

.jb-recorder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.jb-record-stop {
  background: #fb7185;
  color: #070a10;
}

.jb-editor-sequence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem;
  gap: 0.6rem 0.85rem;
  margin-top: 0.8rem;
}

.jb-editor-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
}

.jb-editor-step-head strong {
  font: 700 0.7rem var(--mono);
}

.jb-editor-timeline {
  display: flex;
  grid-column: 1;
  gap: 0.22rem;
  min-width: 0;
  overflow-x: auto;
  padding: 0.2rem 0 0.4rem;
  scrollbar-width: thin;
}

.jb-editor-timeline button {
  position: relative;
  flex: 0 0 2.65rem;
  width: 2.65rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font: 0.58rem var(--mono);
  cursor: pointer;
}

.jb-editor-timeline button.has-note::after {
  position: absolute;
  right: 0.22rem;
  bottom: 0.2rem;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: var(--cyan);
  content: "";
}

.jb-editor-timeline button.is-active {
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.18);
  color: var(--text);
}

.jb-editor-grid {
  display: grid;
  grid-row: 1 / span 3;
  grid-column: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.24rem;
  align-self: start;
  width: 12rem;
  aspect-ratio: 1;
  padding: 0.3rem;
  border: 1px solid var(--border);
  background: #070b12;
}

.jb-editor-grid button {
  min-width: 0;
  border: 1px solid #263548;
  border-radius: 4px;
  background: #101a26;
  color: var(--muted);
  font: 0.6rem var(--mono);
  cursor: pointer;
  touch-action: manipulation;
}

.jb-editor-grid button.is-active {
  border-color: var(--cyan);
  background: #0e7490;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(103, 232, 249, 0.35);
}

.jb-editor-step-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1;
  gap: 0.35rem;
}

.jb-editor-beat-jump {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  height: 2.3rem;
  padding: 0 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: 700 0.56rem var(--mono);
}

.jb-editor-beat-jump input {
  width: 3.8rem;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 0.68rem var(--mono);
}

.jb-editor-step-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.jb-editor-status {
  min-height: 1.2em;
  margin: 0.55rem 0 0;
  color: #fb7185;
  font: 0.65rem var(--mono);
}

.jb-editor-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.jb-difficulty.is-custom {
  grid-template-columns: minmax(5.75rem, auto);
}

.jb-difficulty.is-custom .jb-difficulty-btn {
  width: auto;
  min-width: 5.75rem;
}

.jb-practice-row {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.7rem;
  padding-top: 0.62rem;
  border-top: 1px solid var(--border);
}

.jb-marker-practice {
  width: 4.4rem;
  aspect-ratio: 1;
}

.jb-practice-cell {
  width: 100%;
  height: 100%;
}

.jb-practice-feedback {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  font-family: var(--mono);
}

.jb-practice-feedback span {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.jb-practice-feedback strong {
  color: var(--cyan);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.jb-practice-feedback strong[data-grade="miss"] {
  color: #fb7185;
}

.jb-practice-feedback strong[data-grade="great"] {
  color: #fbbf24;
}

.jb-practice-feedback strong[data-grade="good"] {
  color: #60a5fa;
}

.jb-practice-feedback strong.is-centered {
  color: #fff;
  text-shadow: 0 0 10px rgba(103, 232, 249, 0.9);
}

.jb-practice-feedback small {
  color: var(--dim);
  font-size: 0.7rem;
}

.jb-selection-hint {
  min-height: 1.35em;
  margin: 0;
}

.jb-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.jb-meta .jb-diff {
  color: #fb7185;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.jb-meta .jb-diff.easy {
  color: var(--teal);
}

.jb-meta .jb-diff.medium {
  color: var(--cyan);
}

.jb-stage {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
}

.jb-live-track {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  margin-bottom: 0.48rem;
  padding: 0.42rem 0.48rem 0.48rem;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.055), transparent 70%),
    rgba(3, 8, 16, 0.92);
  box-shadow: inset 0 0 18px rgba(37, 99, 235, 0.055);
}

.jb-live-track-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  color: var(--muted);
  font: 700 0.55rem/1 var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.jb-live-track-head > strong {
  color: #dbeafe;
  font-size: 0.6rem;
}

.jb-live-track-count b {
  color: #fde68a;
  font-size: 0.62rem;
}

.jb-live-track-legend {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.jb-live-track-legend i {
  display: inline-block;
  width: 0.42rem;
  height: 0.18rem;
  margin-left: 0.16rem;
  border-radius: 1px;
}

.jb-live-track-legend .is-expected {
  background: #60a5fa;
  box-shadow: 0 0 4px rgba(96, 165, 250, 0.72);
}

.jb-live-track-legend .is-hit {
  background: #fbbf24;
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.78);
}

.jb-tap-map {
  position: relative;
  width: 100%;
  height: 1.62rem;
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 3px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(12.5% - 1px),
      rgba(148, 163, 184, 0.08) calc(12.5% - 1px) 12.5%
    ),
    repeating-linear-gradient(
      180deg,
      rgba(96, 165, 250, 0.025) 0 24%,
      rgba(96, 165, 250, 0.08) 24% 25%
    ),
    rgba(2, 6, 14, 0.96);
}

.jb-tap-map-past {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(45, 212, 191, 0.13));
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.jb-tap-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
}

.jb-tap-map-playhead {
  position: absolute;
  inset: -1px auto -1px 0%;
  z-index: 4;
  width: 2px;
  background: #e0f2fe;
  box-shadow:
    0 0 4px #38bdf8,
    0 0 9px rgba(45, 212, 191, 0.9);
  transform: translateX(-1px);
}

.jb-start-sequence {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border-hot);
  border-radius: 8px;
  background: rgba(4, 9, 17, 0.97);
  text-align: center;
}

.jb-start-sequence[hidden] {
  display: none;
}

.jb-start-sequence p {
  margin: 0;
  color: var(--cyan);
  font: 900 1.45rem var(--mono);
  letter-spacing: 0.12em;
}

.jb-start-sequence strong {
  max-width: 100%;
  color: var(--text);
  font: 700 0.72rem var(--mono);
  overflow-wrap: anywhere;
}

.jb-loading-mark {
  display: grid;
  grid-template-columns: repeat(2, 1rem);
  grid-template-rows: repeat(2, 1rem);
  gap: 0.2rem;
  width: 2.2rem;
  height: 2.2rem;
}

.jb-loading-mark i {
  background: var(--cyan);
  animation: jb-loading-cell 0.8s ease-in-out infinite alternate;
}

.jb-loading-mark i:nth-child(2) {
  animation-delay: -0.6s;
}

.jb-loading-mark i:nth-child(3) {
  animation-delay: -0.2s;
}

.jb-loading-mark i:nth-child(4) {
  animation-delay: -0.4s;
}

.jb-start-sequence.is-ready .jb-loading-mark i {
  background: #fbbf24;
  animation-duration: 0.32s;
}

.jb-start-sequence.is-ready p {
  color: #fbbf24;
  animation: jb-rank-reveal 0.42s cubic-bezier(0.2, 0.85, 0.3, 1.2);
}

.jb-start-sequence.is-start .jb-loading-mark i {
  background: #2dd4bf;
  animation: none;
}

.jb-start-sequence.is-start p {
  color: #2dd4bf;
  animation: jb-start-burst 0.62s ease-out both;
}

@keyframes jb-loading-cell {
  to {
    opacity: 0.22;
    transform: scale(0.72);
  }
}

@keyframes jb-start-burst {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  55% {
    opacity: 1;
    transform: scale(1.12);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.jb-results {
  position: absolute;
  inset: 0;
  z-index: 10;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.32rem;
  padding: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--jb-accent, #fbbf24) 60%, transparent);
  border-radius: 8px;
  background: #050a13;
  box-shadow: inset 0 0 48px color-mix(in srgb, var(--jb-accent, #fbbf24) 16%, transparent);
  text-align: center;
  overflow: hidden;
}

.jb-results[hidden] {
  display: none;
}

.jb-results.is-open {
  animation: jb-results-enter 0.32s ease-out both;
}

.jb-results > :not(.jb-results-fx) {
  position: relative;
  z-index: 2;
}

.jb-results::before,
.jb-results::after,
.jb-results-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0;
}

.jb-results::before {
  inset: -55%;
  background: conic-gradient(
    from 0deg,
    transparent 0 8%,
    rgba(45, 212, 191, 0.42) 10%,
    transparent 15% 25%,
    rgba(251, 191, 36, 0.5) 28%,
    transparent 34% 50%,
    rgba(103, 232, 249, 0.42) 53%,
    transparent 59% 74%,
    rgba(253, 230, 138, 0.46) 77%,
    transparent 83%
  );
  mix-blend-mode: screen;
}

.jb-results::after {
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 22%, rgba(103, 232, 249, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 24% 78%, rgba(253, 230, 138, 0.9) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 74% 72%, rgba(255, 255, 255, 0.85) 0 1px, transparent 2px),
    radial-gradient(circle at center, rgba(45, 212, 191, 0.22), transparent 58%);
}

.jb-results-fx i {
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 3px;
  height: 52%;
  border-radius: 999px;
  background: linear-gradient(transparent, #fff 65%, #fbbf24);
  box-shadow: 0 0 8px rgba(253, 230, 138, 0.9);
  opacity: 0;
  transform: translateX(-50%) rotate(var(--ray)) scaleY(0.04);
  transform-origin: 50% 100%;
}

.jb-results.is-full-combo {
  border-color: rgba(253, 230, 138, 0.95);
  background:
    radial-gradient(circle at 50% 42%, rgba(180, 83, 9, 0.22), transparent 48%),
    linear-gradient(145deg, #07151a, #120d08 58%, #071117);
  animation: jb-full-combo-board 3.2s cubic-bezier(0.16, 0.8, 0.22, 1) both;
}

.jb-results.is-full-combo::before {
  animation: jb-results-halo 3.2s ease-out both;
}

.jb-results.is-full-combo::after {
  animation: jb-results-stars 3.2s ease-out both;
}

.jb-results.is-full-combo .jb-results-fx {
  opacity: 1;
}

.jb-results.is-full-combo .jb-results-fx i {
  animation: jb-full-combo-ray 1.8s var(--delay) cubic-bezier(0.12, 0.72, 0.2, 1) both;
}

.jb-results.is-full-combo.is-rank-visible .jb-results-rank {
  color: #fff7c2;
  animation: jb-full-combo-rank 1.45s cubic-bezier(0.12, 0.78, 0.2, 1.2) forwards;
}

.jb-results.is-full-combo .jb-results-combo {
  color: #fff;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.95);
}

.jb-results.is-fail {
  border-color: rgba(248, 113, 113, 0.88);
  background:
    radial-gradient(circle at 50% 28%, rgba(127, 29, 29, 0.34), transparent 44%),
    linear-gradient(165deg, #160708, #090507 58%, #130609);
  box-shadow:
    inset 0 0 64px rgba(127, 29, 29, 0.42),
    0 0 18px rgba(239, 68, 68, 0.18);
  animation: jb-fail-board 1.8s cubic-bezier(0.2, 0.7, 0.25, 1) both;
}

.jb-results.is-fail::before {
  inset: 0;
  background:
    linear-gradient(112deg, transparent 0 21%, rgba(248, 113, 113, 0.18) 22% 23%, transparent 24% 55%, rgba(185, 28, 28, 0.2) 56% 57%, transparent 58%),
    linear-gradient(102deg, transparent 0 37%, rgba(239, 68, 68, 0.12) 38% 39%, transparent 40% 76%, rgba(252, 165, 165, 0.14) 77% 78%, transparent 79%);
  background-size: 7rem 9rem, 9rem 12rem;
  mix-blend-mode: screen;
  animation: jb-fail-rain 2.8s linear both;
}

.jb-results.is-fail::after {
  background: radial-gradient(circle at 50% 45%, rgba(239, 68, 68, 0.18), transparent 60%);
  animation: jb-fail-vignette 2.4s ease-out both;
}

.jb-results.is-fail.is-rank-visible .jb-results-rank {
  color: #fecaca;
  animation: jb-fail-rank 1.35s cubic-bezier(0.22, 0.72, 0.28, 1) forwards;
}

.jb-results.is-fail .jb-results-kicker,
.jb-results.is-fail .jb-results-arcade {
  color: #f87171;
}

.jb-results.is-fail .jb-results-score,
.jb-results.is-fail .jb-results-accuracy strong {
  color: #fee2e2;
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}

.jb-results.is-exc {
  border-color: rgba(255, 255, 255, 0.98);
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.2), transparent 23%),
    radial-gradient(circle at 18% 78%, rgba(168, 85, 247, 0.3), transparent 46%),
    radial-gradient(circle at 82% 18%, rgba(34, 211, 238, 0.3), transparent 48%),
    linear-gradient(145deg, #071328, #16082a 55%, #041c24);
  animation: jb-exc-board 5.6s cubic-bezier(0.12, 0.72, 0.18, 1) both;
}

.jb-results.is-exc::before {
  background: conic-gradient(
    from 0deg,
    transparent 0 6%,
    rgba(255, 255, 255, 0.72) 8%,
    transparent 12% 20%,
    rgba(34, 211, 238, 0.76) 23%,
    transparent 28% 38%,
    rgba(168, 85, 247, 0.78) 41%,
    transparent 47% 57%,
    rgba(251, 191, 36, 0.78) 60%,
    transparent 66% 76%,
    rgba(244, 114, 182, 0.72) 79%,
    transparent 84%
  );
  animation: jb-exc-halo 5.6s ease-in-out both;
}

.jb-results.is-exc::after {
  animation: jb-exc-stars 5.6s ease-in-out both;
}

.jb-results.is-exc .jb-results-fx i {
  background: linear-gradient(transparent, #fff 58%, #67e8f9 80%, #f0abfc);
  box-shadow:
    0 0 8px #fff,
    0 0 14px rgba(103, 232, 249, 0.92);
  animation: jb-exc-ray 4.8s var(--delay) cubic-bezier(0.12, 0.7, 0.18, 1) both;
}

.jb-results.is-exc.is-rank-visible .jb-results-rank {
  color: #fff;
  font-size: 3rem;
  animation: jb-exc-rank 3.8s cubic-bezier(0.12, 0.78, 0.18, 1) forwards;
}

.jb-results.is-exc .jb-results-score,
.jb-results.is-exc .jb-results-accuracy strong {
  color: #fff;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.95),
    0 0 24px rgba(34, 211, 238, 0.82);
}

.jb-results.is-exc .jb-results-combo {
  color: #f5d0fe;
  text-shadow:
    0 0 10px rgba(244, 114, 182, 0.95),
    0 0 20px rgba(34, 211, 238, 0.72);
}

.jb-results-kicker,
.jb-results-score,
.jb-results-rank,
.jb-results-combo,
.jb-results-stats,
.jb-results-arcade {
  margin: 0;
}

.jb-results-kicker {
  color: var(--muted);
  font: 700 0.7rem var(--mono);
  letter-spacing: 0.14em;
}

.jb-results-score {
  color: #fff;
  font: 800 2.8rem var(--mono);
  line-height: 1;
  text-shadow: 0 0 18px color-mix(in srgb, var(--jb-accent, #fbbf24) 55%, transparent);
}

.jb-results-rank {
  min-height: 1.3em;
  color: var(--jb-accent, #fbbf24);
  font: 900 2rem var(--mono);
  letter-spacing: 0.1em;
  opacity: 0;
  transform: scale(0.6);
}

.jb-results.is-rank-visible .jb-results-rank {
  animation: jb-rank-reveal 0.42s cubic-bezier(0.2, 0.85, 0.3, 1.2) forwards;
}

.jb-results-combo {
  min-height: 1.15em;
  color: #fde68a;
  font: 900 0.82rem var(--mono);
  letter-spacing: 0.12em;
  opacity: 0;
}

.jb-results.is-combo-visible .jb-results-combo {
  animation: jb-results-rise 0.32s ease-out forwards;
}

.jb-results-stats,
.jb-results-arcade,
.jb-results-accuracy,
.jb-accuracy-timeline,
.jb-results-actions {
  opacity: 0;
  transform: translateY(0.4rem);
}

.jb-results.is-stats-visible .jb-results-stats,
.jb-results.is-stats-visible .jb-results-arcade,
.jb-results.is-stats-visible .jb-results-accuracy,
.jb-results.is-stats-visible .jb-accuracy-timeline {
  animation: jb-results-rise 0.32s ease-out forwards;
}

.jb-results-accuracy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding-top: 0.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font: 700 0.62rem var(--mono);
  letter-spacing: 0.08em;
}

.jb-results-accuracy strong {
  color: #fff;
  font-size: 0.9rem;
}

.jb-accuracy-timeline {
  display: block;
  width: 100%;
  height: 1.15rem;
}

.jb-results.is-exc .jb-accuracy-timeline {
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.72));
}

.jb-results-stats {
  max-width: 18rem;
  color: var(--muted);
  font: 0.62rem/1.45 var(--mono);
}

.jb-results-arcade {
  color: var(--teal);
  font: 800 0.75rem var(--mono);
  letter-spacing: 0.08em;
}

.jb-results-actions {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.jb-results-actions[hidden] {
  display: none;
}

.jb-results.is-ready .jb-results-actions {
  animation: jb-results-rise 0.32s ease-out forwards;
}

@keyframes jb-results-enter {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes jb-rank-reveal {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes jb-results-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes jb-fail-board {
  0% {
    filter: saturate(0.7) brightness(0.72);
    transform: translateY(-2px);
  }
  16% {
    filter: saturate(1.5) brightness(1.05);
    transform: translateX(5px);
  }
  26% {
    transform: translateX(-4px);
  }
  36% {
    transform: translateX(3px);
  }
  48% {
    transform: translateX(-2px);
  }
  100% {
    filter: saturate(0.92) brightness(0.82);
    transform: translateY(3px);
  }
}

@keyframes jb-fail-rain {
  0% {
    opacity: 0;
    background-position: 0 -8rem, 2rem -12rem;
  }
  22% {
    opacity: 0.72;
  }
  100% {
    opacity: 0.26;
    background-position: 0 10rem, 2rem 12rem;
  }
}

@keyframes jb-fail-vignette {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  32% {
    opacity: 0.68;
  }
  100% {
    opacity: 0.28;
    transform: scale(1.08);
  }
}

@keyframes jb-fail-rank {
  0% {
    opacity: 0;
    filter: blur(7px);
    transform: translateY(-1.2rem) scale(0.72);
  }
  32% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1.08);
  }
  52% {
    transform: translateY(-0.12rem) scale(0.98) rotate(-2deg);
  }
  100% {
    opacity: 0.9;
    filter: blur(0);
    transform: translateY(0.42rem) scale(0.96) rotate(1deg);
    text-shadow:
      0 2px 0 #450a0a,
      0 0 18px rgba(239, 68, 68, 0.72);
  }
}

@keyframes jb-full-combo-board {
  0% {
    transform: scale(0.96);
    box-shadow: inset 0 0 0 rgba(251, 191, 36, 0);
  }
  20% {
    transform: scale(1.025);
    box-shadow:
      inset 0 0 76px rgba(251, 191, 36, 0.28),
      0 0 30px rgba(45, 212, 191, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow:
      inset 0 0 48px rgba(251, 191, 36, 0.16),
      0 0 16px rgba(45, 212, 191, 0.18);
  }
}

@keyframes jb-results-halo {
  0% {
    opacity: 0;
    transform: rotate(-35deg) scale(0.35);
  }
  24% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.18;
    transform: rotate(145deg) scale(1);
  }
}

@keyframes jb-results-stars {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0.32;
    transform: scale(1.14);
  }
}

@keyframes jb-full-combo-ray {
  0% {
    opacity: 0;
    transform: translateX(-50%) rotate(var(--ray)) scaleY(0.04);
  }
  26% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) rotate(var(--ray)) scaleY(1.24);
  }
}

@keyframes jb-full-combo-rank {
  0% {
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.35) rotate(-7deg);
  }
  48% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1.2) rotate(2deg);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1) rotate(0);
    text-shadow:
      0 0 8px #fff,
      0 0 24px rgba(251, 191, 36, 0.92);
  }
}

@keyframes jb-exc-board {
  0% {
    filter: saturate(0.6) brightness(0.7);
    transform: scale(0.9);
  }
  12% {
    filter: saturate(1.65) brightness(1.28);
    transform: scale(1.045);
    box-shadow:
      inset 0 0 90px rgba(255, 255, 255, 0.24),
      0 0 44px rgba(103, 232, 249, 0.72);
  }
  35% {
    transform: scale(0.99);
  }
  58% {
    filter: saturate(1.4) brightness(1.14);
    transform: scale(1.018);
    box-shadow:
      inset 0 0 70px rgba(168, 85, 247, 0.28),
      0 0 36px rgba(244, 114, 182, 0.5);
  }
  100% {
    filter: saturate(1.18) brightness(1.04);
    transform: scale(1);
    box-shadow:
      inset 0 0 54px rgba(34, 211, 238, 0.18),
      0 0 24px rgba(168, 85, 247, 0.36);
  }
}

@keyframes jb-exc-halo {
  0% {
    opacity: 0;
    transform: rotate(-90deg) scale(0.15);
  }
  16% {
    opacity: 1;
  }
  52% {
    opacity: 0.82;
    transform: rotate(170deg) scale(0.92);
  }
  100% {
    opacity: 0.2;
    transform: rotate(330deg) scale(1.18);
  }
}

@keyframes jb-exc-stars {
  0% {
    opacity: 0;
    filter: blur(5px);
    transform: scale(0.45) rotate(-8deg);
  }
  18% {
    opacity: 1;
    filter: blur(0);
  }
  58% {
    opacity: 0.9;
    transform: scale(1.18) rotate(4deg);
  }
  100% {
    opacity: 0.42;
    transform: scale(1.28) rotate(0);
  }
}

@keyframes jb-exc-ray {
  0%,
  44% {
    opacity: 0;
    transform: translateX(-50%) rotate(var(--ray)) scaleY(0.03);
  }
  15%,
  58% {
    opacity: 1;
  }
  34%,
  100% {
    opacity: 0;
    transform: translateX(-50%) rotate(var(--ray)) scaleY(1.34);
  }
}

@keyframes jb-exc-rank {
  0% {
    opacity: 0;
    filter: blur(12px);
    transform: scale(0.18) rotate(-12deg);
  }
  24% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1.32) rotate(3deg);
  }
  43% {
    transform: scale(0.94) rotate(-1deg);
  }
  62% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
    text-shadow:
      0 0 8px #fff,
      0 0 22px #67e8f9,
      0 0 42px rgba(244, 114, 182, 0.95);
  }
}

.jb-grid-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.jb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  width: 100%;
  height: 100%;
  touch-action: none;
  --jb-accent: #fbbf24;
}

.jb-grid-combo {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  pointer-events: none;
  color: rgba(224, 242, 254, 0.1);
  opacity: 0.62;
  text-align: center;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(56, 189, 248, 0.35);
}

.jb-grid-combo strong {
  font: 900 clamp(4rem, 21vw, 6rem) / 0.78 var(--mono);
  letter-spacing: -0.1em;
  transform: translateX(-0.05em);
}

.jb-grid-combo span {
  margin-top: 0.62rem;
  font: 900 0.78rem/1 var(--mono);
  letter-spacing: 0.28em;
}

.jb-grid-combo.is-active {
  color: rgba(224, 242, 254, 0.18);
  opacity: 1;
}

/* Near-black idle faces keep incoming markers vivid without losing the 4×4 grid. */
.jb-cell {
  --jb-panel-idle:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.035), transparent 44%),
    linear-gradient(145deg, #15191d 0%, #0d1013 48%, #080a0d 100%);
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 6px;
  background-color: #090b0e;
  background-image: var(--jb-panel-idle);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 0 0 1px rgba(15, 23, 42, 0.38),
    0 2px 8px rgba(0, 0, 0, 0.42);
  transition: background-image 0.05s linear, box-shadow 0.12s ease, transform 0.08s ease;
}

/*
 * Classic jubeat SHUTTER marker (full redesign)
 * — 4 solid doors slam from N/S/E/W
 * — 6 metallic iris blades spiral closed
 * — TOUCH halves meet from top + bottom
 * --jb-p: 0 = fully open, 1 = closed (hit timing)
 */
.jb-shutter {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  border-radius: inherit;
  background: transparent;
}

.jb-cell.is-approach .jb-shutter,
.jb-cell.is-armed .jb-shutter {
  opacity: 1;
}

.jb-alt-marker {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.jb-marker-surface[data-marker="ring"] .jb-shutter,
.jb-marker-surface[data-marker="sweep"] .jb-shutter,
.jb-marker-surface[data-marker="flower"] .jb-shutter,
.jb-marker-surface[data-marker="shutter"] .jb-shutter,
.jb-marker-surface[data-marker="stealth"] .jb-shutter {
  display: none;
}

.jb-marker-surface[data-marker="iris"] .jb-shutter {
  --jb-door-size: var(--jb-iris-door-size, 0%);
  --jb-touch-opacity: var(--jb-iris-touch-opacity, 0);
  --jb-touch-gap: var(--jb-iris-touch-gap, 2.8em);
}

.jb-marker-surface[data-marker="ring"] .jb-cell.is-approach .jb-alt-marker,
.jb-marker-surface[data-marker="ring"] .jb-cell.is-armed .jb-alt-marker,
.jb-marker-surface[data-marker="sweep"] .jb-cell.is-approach .jb-alt-marker,
.jb-marker-surface[data-marker="sweep"] .jb-cell.is-armed .jb-alt-marker {
  opacity: 1;
}

.jb-flower-marker,
.jb-original-shutter {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.jb-marker-surface[data-marker="flower"] .jb-cell.is-approach .jb-flower-marker,
.jb-marker-surface[data-marker="flower"] .jb-cell.is-armed .jb-flower-marker {
  opacity: var(--jb-flower-opacity, 0);
}

.jb-marker-surface[data-marker="shutter"] .jb-cell.is-approach .jb-original-shutter,
.jb-marker-surface[data-marker="shutter"] .jb-cell.is-armed .jb-original-shutter {
  opacity: 1;
}

.jb-flower-marker {
  background:
    radial-gradient(circle at center, rgba(255, 122, 150, 0.28), transparent 56%),
    rgba(7, 64, 77, 0.24);
}

.jb-flower-guide {
  position: absolute;
  inset: 7%;
  border: 3px solid rgba(255, 132, 52, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 104, 39, 0.72);
  transform: rotate(var(--jb-flower-guide-turn, 210deg)) scale(var(--jb-flower-ring-scale, 0.35));
}

.jb-flower-guide-outer {
  border-style: dashed;
}

.jb-flower-guide-inner {
  inset: 22%;
  border-width: 2px;
  border-color: rgba(255, 214, 92, 0.9);
  border-style: dotted;
  transform: rotate(var(--jb-flower-guide-inner-turn, -284deg))
    scale(var(--jb-flower-core-scale, 0.2));
}

.jb-flower-head {
  position: absolute;
  inset: 0;
  transform: rotate(var(--jb-flower-turn, -24deg)) scale(var(--jb-flower-scale, 0.08));
  transform-origin: center;
}

.jb-flower-petal,
.jb-flower-leaf {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform:
    translateX(-50%)
    rotate(calc(var(--flower-angle, 0deg) + var(--jb-flower-petal-turn, -38deg)))
    translateY(var(--jb-flower-petal-rise, 28%))
    scaleX(var(--jb-flower-petal-scale, 0.38));
  transform-origin: 50% 100%;
}

.jb-flower-petal {
  width: 34%;
  height: 45%;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 66% 34% 62% 38%;
  background: linear-gradient(165deg, #fff 0%, #ff9fbd 32%, #e94b83 72%, #a21959 100%);
  box-shadow:
    inset 0 0 8px rgba(255, 255, 255, 0.7),
    0 0 8px rgba(255, 87, 140, 0.72);
}

.jb-flower-petal.is-orange {
  width: 30%;
  height: 41%;
  background: linear-gradient(165deg, #fff5cb 0%, #ffb142 38%, #ef5f2f 78%, #9d2447 100%);
}

.jb-flower-petal.is-white {
  width: 27%;
  height: 38%;
  background: linear-gradient(165deg, #fff 0%, #ffd8e7 52%, #ff8fb5 100%);
}

.jb-flower-leaf {
  width: 25%;
  height: 43%;
  border: 1px solid rgba(199, 255, 98, 0.72);
  border-radius: 70% 30% 70% 30%;
  background: linear-gradient(165deg, #d9ff67 0%, #54c544 48%, #08794c 100%);
  box-shadow: 0 0 7px rgba(78, 220, 79, 0.68);
  transform:
    translateX(-50%)
    rotate(calc(var(--flower-angle, 0deg) - var(--jb-flower-petal-turn, -38deg)))
    translateY(var(--jb-flower-petal-rise, 28%))
    scale(var(--jb-flower-petal-scale, 0.38));
}

.jb-flower-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 252, 196, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle, #fffbd1 0 16%, #f6db38 18% 42%, #ec6b34 45% 68%, #c12d67 72%);
  box-shadow:
    0 0 8px #fff,
    0 0 15px rgba(255, 117, 77, 0.9);
  transform: translate(-50%, -50%) scale(var(--jb-flower-core-scale, 0.2));
}

.jb-flower-touch {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  color: #fff;
  font: 900 0.76rem/1 var(--mono);
  opacity: var(--jb-flower-touch-opacity, 0);
  text-shadow:
    0 0 5px rgba(192, 29, 88, 1),
    0 0 10px rgba(255, 255, 255, 0.95);
  transform: translate(-50%, -50%);
}

.jb-original-shutter {
  background: rgba(8, 26, 38, 0.34);
}

.jb-original-door {
  position: absolute;
  z-index: 1;
  box-shadow:
    inset 0 0 0 1px rgba(178, 232, 241, 0.42),
    inset 0 0 12px rgba(51, 225, 212, 0.16);
}

.jb-original-door-n,
.jb-original-door-s {
  left: 0;
  right: 0;
  height: var(--jb-door-size, 0%);
}

.jb-original-door-w,
.jb-original-door-e {
  top: 0;
  bottom: 0;
  width: var(--jb-door-size, 0%);
}

.jb-original-door-n {
  top: 0;
  border-bottom: 2px solid rgba(255, 203, 78, 0.86);
  clip-path: polygon(0 0, 100% 0, 63% 100%, 37% 100%);
  background:
    linear-gradient(90deg, transparent 46%, rgba(255, 191, 62, 0.86) 48% 52%, transparent 54%),
    linear-gradient(180deg, #708594 0%, #334955 58%, #13232d 100%);
}

.jb-original-door-s {
  bottom: 0;
  border-top: 2px solid rgba(255, 203, 78, 0.86);
  clip-path: polygon(37% 0, 63% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, transparent 46%, rgba(255, 191, 62, 0.86) 48% 52%, transparent 54%),
    linear-gradient(0deg, #708594 0%, #334955 58%, #13232d 100%);
}

.jb-original-door-w {
  left: 0;
  border-right: 2px solid rgba(77, 229, 218, 0.78);
  clip-path: polygon(0 0, 100% 37%, 100% 63%, 0 100%);
  background:
    linear-gradient(180deg, transparent 46%, rgba(77, 229, 218, 0.8) 48% 52%, transparent 54%),
    linear-gradient(90deg, #708594 0%, #334955 58%, #13232d 100%);
}

.jb-original-door-e {
  right: 0;
  border-left: 2px solid rgba(77, 229, 218, 0.78);
  clip-path: polygon(0 37%, 100% 0, 100% 100%, 0 63%);
  background:
    linear-gradient(180deg, transparent 46%, rgba(77, 229, 218, 0.8) 48% 52%, transparent 54%),
    linear-gradient(270deg, #708594 0%, #334955 58%, #13232d 100%);
}

.jb-original-cross {
  position: absolute;
  inset: 46%;
  z-index: 3;
  border: 1px solid rgba(255, 235, 176, 0.92);
  box-shadow:
    0 0 8px rgba(255, 190, 52, 0.9),
    0 0 15px rgba(45, 212, 191, 0.7);
  opacity: var(--jb-touch-opacity, 0);
}

.jb-original-touch {
  position: absolute;
  inset: 0;
  z-index: 5;
  color: #fff;
  font: 900 0.8rem/1 var(--mono);
  opacity: var(--jb-touch-opacity, 0);
  text-shadow:
    0 0 8px rgba(255, 190, 52, 0.96),
    0 0 14px rgba(45, 212, 191, 0.78);
}

.jb-original-touch-a,
.jb-original-touch-b {
  position: absolute;
  left: 50%;
  top: 50%;
  white-space: nowrap;
}

.jb-original-touch-a {
  clip-path: inset(0 0 50% 0);
  transform: translate(-50%, calc(-50% - var(--jb-touch-gap, 2.8em)));
}

.jb-original-touch-b {
  clip-path: inset(50% 0 0 0);
  transform: translate(-50%, calc(-50% + var(--jb-touch-gap, 2.8em)));
}

.jb-ring-marker {
  position: absolute;
  inset: 13%;
  border: 4px solid #22d3ee;
  border-radius: 50%;
  box-shadow:
    0 0 10px rgba(34, 211, 238, 0.95),
    inset 0 0 12px rgba(45, 212, 191, 0.65);
  opacity: var(--jb-ring-opacity, 0.28);
  transform: scale(var(--jb-ring-scale, 1.9)) rotate(var(--jb-ring-turn, 0deg));
}

.jb-ring-marker::before,
.jb-ring-marker::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px dashed rgba(103, 232, 249, 0.75);
  border-radius: 50%;
}

.jb-ring-marker::after {
  display: none;
}

.jb-marker-surface[data-marker="ring"] .jb-alt-marker::before {
  content: "";
  position: absolute;
  inset: 13%;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  box-shadow:
    0 0 7px rgba(255, 255, 255, 0.6),
    inset 0 0 8px rgba(34, 211, 238, 0.32);
}

.jb-marker-surface[data-marker="ring"] .jb-alt-marker::after {
  content: "PRESS";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  color: #fff;
  font: 900 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  opacity: var(--jb-ring-ready-opacity, 0);
  text-shadow:
    0 0 6px #22d3ee,
    0 0 12px rgba(34, 211, 238, 0.95);
  transform: translate(-50%, -50%) scale(var(--jb-ring-ready-scale, 0.72));
}

.jb-marker-surface[data-marker="ring"] .jb-sweep-line,
.jb-marker-surface[data-marker="sweep"] .jb-ring-marker {
  display: none;
}

.jb-marker-surface[data-marker="sweep"] .jb-alt-marker {
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(255, 255, 255, 0.12) 49.5% 50.5%, transparent 50.5%),
    linear-gradient(transparent 49.5%, rgba(255, 255, 255, 0.12) 49.5% 50.5%, transparent 50.5%),
    rgba(22, 8, 30, 0.28);
}

.jb-marker-surface[data-marker="sweep"] .jb-alt-marker::before,
.jb-marker-surface[data-marker="sweep"] .jb-alt-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  pointer-events: none;
  opacity: var(--jb-sweep-core-opacity, 0);
  transform: translate(-50%, -50%) scale(var(--jb-sweep-core-scale, 0.35));
}

.jb-marker-surface[data-marker="sweep"] .jb-alt-marker::before {
  width: 25%;
  aspect-ratio: 1;
  border: 2px solid #fff4b5;
  background: rgba(244, 63, 94, 0.72);
  box-shadow:
    0 0 8px rgba(251, 191, 36, 0.95),
    0 0 16px rgba(244, 63, 94, 0.86);
  transform: translate(-50%, -50%) rotate(45deg) scale(var(--jb-sweep-core-scale, 0.35));
}

.jb-marker-surface[data-marker="sweep"] .jb-alt-marker::after {
  width: 8%;
  aspect-ratio: 1;
  background: #fff;
  box-shadow: 0 0 10px #facc15;
}

.jb-sweep-line {
  position: absolute;
  z-index: 1;
  background: linear-gradient(90deg, #f43f5e, #fff7c2 48% 52%, #fbbf24);
  box-shadow:
    0 0 6px rgba(244, 63, 94, 0.95),
    0 0 12px rgba(251, 191, 36, 0.78);
}

.jb-sweep-top,
.jb-sweep-bottom {
  left: 4%;
  right: 4%;
  height: 4px;
}

.jb-sweep-left,
.jb-sweep-right {
  top: 4%;
  bottom: 4%;
  width: 4px;
  background: linear-gradient(180deg, #f43f5e, #fff7c2 48% 52%, #fbbf24);
}

.jb-sweep-line::before,
.jb-sweep-line::after {
  content: "";
  position: absolute;
  background: #fff7c2;
  box-shadow: 0 0 7px rgba(251, 191, 36, 0.95);
}

.jb-sweep-top::before,
.jb-sweep-bottom::before,
.jb-sweep-top::after,
.jb-sweep-bottom::after {
  top: -4px;
  width: 2px;
  height: 12px;
}

.jb-sweep-top::before,
.jb-sweep-bottom::before {
  left: 17%;
}

.jb-sweep-top::after,
.jb-sweep-bottom::after {
  right: 17%;
}

.jb-sweep-left::before,
.jb-sweep-right::before,
.jb-sweep-left::after,
.jb-sweep-right::after {
  left: -4px;
  width: 12px;
  height: 2px;
}

.jb-sweep-left::before,
.jb-sweep-right::before {
  top: 17%;
}

.jb-sweep-left::after,
.jb-sweep-right::after {
  bottom: 17%;
}

.jb-sweep-top {
  top: var(--jb-sweep-position, 0%);
}

.jb-sweep-bottom {
  bottom: var(--jb-sweep-position, 0%);
}

.jb-sweep-left {
  left: var(--jb-sweep-position, 0%);
}

.jb-sweep-right {
  right: var(--jb-sweep-position, 0%);
}

.jb-marker-surface[data-marker="stealth"] .jb-alt-marker,
.jb-marker-surface[data-marker="stealth"] .jb-flower-marker,
.jb-marker-surface[data-marker="stealth"] .jb-original-shutter,
.jb-marker-surface[data-marker="stealth"] .jb-shutter {
  display: none !important;
}

/* No CSS transitions on marker geometry — progress is JS-timed (--jb-p) */
.jb-door,
.jb-blade,
.jb-touch,
.jb-touch-a,
.jb-touch-b {
  transition: none !important;
}

/* Four opaque shutter doors */
.jb-door {
  position: absolute;
  background:
    linear-gradient(
      180deg,
      #6b7c94 0%,
      #3d4d63 22%,
      #243040 55%,
      #151d28 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(200, 220, 255, 0.28),
    inset 0 2px 6px rgba(255, 255, 255, 0.12),
    0 0 8px rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.jb-door-n {
  top: 0;
  left: 0;
  right: 0;
  height: var(--jb-door-size, 0%);
  border-bottom: 1px solid rgba(220, 235, 255, 0.35);
  background:
    linear-gradient(180deg, #7a8ba3 0%, #3a4a60 40%, #1e2a38 100%);
}

.jb-door-s {
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--jb-door-size, 0%);
  border-top: 1px solid rgba(220, 235, 255, 0.35);
  background:
    linear-gradient(0deg, #7a8ba3 0%, #3a4a60 40%, #1e2a38 100%);
}

.jb-door-w {
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--jb-door-size, 0%);
  border-right: 1px solid rgba(220, 235, 255, 0.35);
  background:
    linear-gradient(90deg, #7a8ba3 0%, #3a4a60 40%, #1e2a38 100%);
}

.jb-door-e {
  top: 0;
  bottom: 0;
  right: 0;
  width: var(--jb-door-size, 0%);
  border-left: 1px solid rgba(220, 235, 255, 0.35);
  background:
    linear-gradient(270deg, #7a8ba3 0%, #3a4a60 40%, #1e2a38 100%);
}

/* Iris blades over doors */
.jb-iris {
  position: absolute;
  inset: -12%;
  z-index: 2;
  border-radius: 50%;
  overflow: visible;
}

.jb-blade {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 85%;
  height: 85%;
  margin: -42.5% 0 0 -42.5%;
  clip-path: polygon(50% 50%, 2% 0%, 98% 0%);
  background:
    linear-gradient(
      170deg,
      rgba(210, 225, 245, 0.95) 0%,
      rgba(100, 125, 160, 0.97) 35%,
      rgba(40, 55, 80, 0.99) 70%,
      rgba(15, 22, 34, 1) 100%
    );
  border: 1px solid rgba(230, 240, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: rotate(calc(var(--blade-angle, 0deg) + var(--jb-iris-turn, 0deg)))
    scale(var(--jb-iris-scale, 0.15));
  transform-origin: 50% 50%;
  opacity: var(--jb-marker-opacity, 0.25);
}

/* TOUCH halves approach from top + bottom, overlap at hit */
.jb-touch {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--mono), ui-monospace, monospace;
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  color: #fff;
  text-shadow:
    0 0 10px rgba(140, 200, 255, 1),
    0 0 20px rgba(80, 150, 255, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.9);
  opacity: var(--jb-touch-opacity, 0);
}

.jb-touch-a,
.jb-touch-b {
  position: absolute;
  left: 50%;
  top: 50%;
  line-height: 1;
  white-space: nowrap;
}

.jb-touch-a {
  clip-path: inset(0 0 50% 0);
  transform: translate(-50%, calc(-50% - var(--jb-touch-gap, 2.8em)));
}

.jb-touch-b {
  clip-path: inset(50% 0 0 0);
  transform: translate(-50%, calc(-50% + var(--jb-touch-gap, 2.8em)));
}

.jb-cell.is-hit {
  transform: scale(0.96);
}

.jb-cell.is-judge-excellent:not(.is-approach) .jb-shutter,
.jb-cell.is-judge-great:not(.is-approach) .jb-shutter,
.jb-cell.is-judge-good:not(.is-approach) .jb-shutter,
.jb-cell.is-judge-miss:not(.is-approach) .jb-shutter,
.jb-cell.is-judge-excellent:not(.is-approach) .jb-alt-marker,
.jb-cell.is-judge-great:not(.is-approach) .jb-alt-marker,
.jb-cell.is-judge-good:not(.is-approach) .jb-alt-marker,
.jb-cell.is-judge-miss:not(.is-approach) .jb-alt-marker,
.jb-cell.is-judge-excellent:not(.is-approach) .jb-flower-marker,
.jb-cell.is-judge-great:not(.is-approach) .jb-flower-marker,
.jb-cell.is-judge-good:not(.is-approach) .jb-flower-marker,
.jb-cell.is-judge-miss:not(.is-approach) .jb-flower-marker,
.jb-cell.is-judge-excellent:not(.is-approach) .jb-original-shutter,
.jb-cell.is-judge-great:not(.is-approach) .jb-original-shutter,
.jb-cell.is-judge-good:not(.is-approach) .jb-original-shutter,
.jb-cell.is-judge-miss:not(.is-approach) .jb-original-shutter {
  opacity: 0 !important;
}

/* Judgments tint the same dark face; no legacy brown panel art or videos. */
.jb-cell.is-judge-excellent {
  background-image:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.32), rgba(45, 212, 191, 0.14) 48%, transparent 72%),
    var(--jb-panel-idle);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 18px rgba(255, 255, 255, 0.35);
}

.jb-cell.is-judge-great {
  background-image:
    radial-gradient(circle at center, rgba(251, 191, 36, 0.28), transparent 70%),
    var(--jb-panel-idle);
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.45),
    0 0 16px rgba(251, 191, 36, 0.4);
}

.jb-cell.is-judge-good {
  background-image:
    radial-gradient(circle at center, rgba(56, 189, 248, 0.25), transparent 70%),
    var(--jb-panel-idle);
  box-shadow:
    inset 0 0 0 1px rgba(56, 189, 248, 0.4),
    0 0 14px rgba(56, 189, 248, 0.35);
}

.jb-cell.is-judge-miss {
  background-image:
    radial-gradient(circle at center, rgba(251, 113, 133, 0.23), transparent 70%),
    var(--jb-panel-idle);
  box-shadow:
    inset 0 0 0 1px rgba(251, 113, 133, 0.45),
    0 0 14px rgba(251, 113, 133, 0.35);
}

/* Empty-tap flash — must clear instantly (JS removes after ~90ms) */
.jb-cell.is-miss:not([class*="is-judge-"]) {
  box-shadow:
    inset 0 0 0 2px rgba(251, 113, 133, 0.65),
    0 0 10px rgba(251, 113, 133, 0.25);
}

/* Per-panel judge text on top of panel art */
.jb-cell-judge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 6;
  margin: 0;
  padding: 0.12rem;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.5);
}

.jb-cell-judge[hidden] {
  display: none !important;
}

.jb-cell-judge.excellent {
  color: #ffffff;
  font-size: 0.58rem;
}

.jb-cell-judge.great {
  color: #fde68a;
}

.jb-cell-judge.good {
  color: #bae6fd;
}

.jb-cell-judge.miss {
  color: #fecdd3;
}

/* Screen-reader only last judge (visual judges are on cells) */
.jb-sr-judge {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#jb-miss.is-danger {
  color: #fb7185;
}

.jb-progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.1);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12);
}

.jb-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 58%, #fbbf24 100%);
  box-shadow: 0 0 7px rgba(56, 189, 248, 0.62);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.jb-audio {
  /* Hidden transport — chart drives playback; no native controls */
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.jb-music {
  width: min(100%, 360px);
  margin: 0.15rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.jb-music-note {
  margin: 0;
  font-size: 0.68rem;
  color: var(--dim);
  text-align: center;
}

.jb-meta .jb-bgm {
  color: var(--teal);
}

.jb-meta .jb-timing-meta {
  color: var(--gold);
}

@media (max-width: 600px) {
  .jb-setup-controls {
    grid-template-columns: 1fr;
  }

  .jb-song-browser {
    grid-template-columns: 7.75rem minmax(0, 1fr);
  }

  .jb-song-detail {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 0.55rem;
    padding: 0.65rem;
  }

  .jb-song-jacket {
    max-width: 10rem;
  }

  .jb-song-detail-copy dl {
    gap: 0.5rem 0.4rem;
    margin-top: 0.7rem;
  }

  .jb-local-audio {
    grid-template-columns: 1fr;
  }

  .jb-local-audio small {
    grid-column: 1;
  }

  .jb-marker-btn {
    padding-inline: 0.08rem;
    font-size: 0.48rem;
  }

  .jb-marker-mode {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .jb-practice-row {
    grid-template-columns: 4.2rem minmax(0, 1fr);
  }

  .jb-marker-practice {
    width: 4.2rem;
  }

  .jb-editor-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jb-editor-sequence {
    grid-template-columns: minmax(0, 1fr) 9.5rem;
  }

  .jb-editor-grid {
    width: 9.5rem;
  }

  .jb-live-track,
  .jb-grid-shell {
    contain: layout paint style;
  }

  .jb-live-track,
  .jb-progress,
  .jb-progress-fill {
    box-shadow: none;
  }

  .jb-cell {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.045),
      inset 0 0 0 1px rgba(15, 23, 42, 0.34);
    transition: none;
  }

  .jb-grid-combo {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  }

  .jb-tap-map-playhead {
    box-shadow: 0 0 4px rgba(56, 189, 248, 0.75);
  }

  .jb-cell-judge {
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.94);
  }

  .jb-flower-guide,
  .jb-flower-petal,
  .jb-flower-leaf,
  .jb-flower-core,
  .jb-original-door,
  .jb-original-cross,
  .jb-ring-marker,
  .jb-sweep-line,
  .jb-sweep-line::before,
  .jb-sweep-line::after,
  .jb-door,
  .jb-blade {
    box-shadow: none;
  }

  .jb-results-score {
    font-size: 2.25rem;
  }

  .jb-results-rank {
    font-size: 1.65rem;
  }
}

@media (max-width: 380px) {
  .jb-song-browser {
    grid-template-columns: 7rem minmax(0, 1fr);
  }

  .jb-song-chip {
    padding-inline: 0.4rem;
  }

  .jb-song-detail {
    padding: 0.5rem;
  }

  .jb-song-detail-copy dl {
    grid-template-columns: 1fr;
    gap: 0.38rem;
  }

  .jb-select-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .jb-select-header strong {
    text-align: left;
  }

  .jb-editor-sequence {
    grid-template-columns: 1fr;
  }

  .jb-editor-step-head,
  .jb-editor-timeline,
  .jb-editor-step-actions {
    grid-column: 1;
  }

  .jb-editor-grid {
    grid-row: auto;
    grid-column: 1;
    width: min(100%, 12rem);
    margin: 0 auto;
  }
}

/* Circuit Breaker */
.breaker-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.br-stage {
  width: min(100%, 420px);
  margin: 0 auto;
}

#br-canvas {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #05080f;
  touch-action: none;
}

@keyframes sh-lives-pop {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.45);
  }
  100% {
    transform: scale(1);
  }
}

/* Reaction */
.rx-pad {
  width: 100%;
  min-height: 260px;
  border: none;
  border-radius: 18px;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.rx-pad.wait {
  background: #7f1d1d;
  color: #fecaca;
}

.rx-pad.go {
  background: #065f46;
  color: #a7f3d0;
  animation: pulse-go 0.6s ease infinite alternate;
}

.rx-pad.result {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
}

.rx-pad.foul {
  background: #431407;
  color: #fdba74;
}

@keyframes pulse-go {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.01);
  }
}

/* Memory */
.mem-status {
  display: flex;
  justify-content: space-between;
  max-width: 420px;
  margin: 0 auto 0.65rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
}

.mem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.mem-grid.mem-grid-dense {
  gap: 4px;
  max-width: 460px;
}

.mem-grid.mem-grid-dense .mem-card {
  border-radius: 8px;
  font-size: clamp(0.7rem, 2.4vw, 1.05rem);
}

.mem-card {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  font-size: clamp(0.95rem, 3.2vw, 1.5rem);
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
  min-width: 0;
}

.mem-card:hover:not(:disabled) {
  border-color: var(--border-hot);
}

.mem-card.face-up {
  background: rgba(45, 212, 191, 0.1);
}

.mem-card.matched {
  opacity: 0.55;
  border-color: rgba(45, 212, 191, 0.35);
}

.mem-hp {
  letter-spacing: 0.06em;
  font-size: 1rem !important;
  line-height: 1.2;
}

.mem-hp.low {
  filter: saturate(1.2);
}

.mem-hp.dead {
  opacity: 0.7;
}

.mem-hp.hit {
  animation: mem-hp-hit 0.45s ease;
}

@keyframes mem-hp-hit {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--dim);
  font-size: 0.82rem;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-version {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--dim);
  opacity: 0.9;
}

.footer a:hover {
  color: var(--teal);
}

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 80;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.95);
  border: 1px solid var(--border-hot);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.82rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
