/* =========================================================================
   STAGE 6-4 : 디지털 서고 레일 러너 (대분수의 뺄셈 · 3레인 러너)
   - 1920x1080 디자인 좌표 직접 배치 (#game-shell 이 스케일)
   - 모든 클래스 .s64- 접두사 · s61- 재사용 금지
   - #dialogue-panel / 인벤토리 등 공통 UI 규칙 작성 금지
   ========================================================================= */

.s64-rail-stage {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  color: #eaf6ff;
  font-family: inherit;
}

/* --------------------------------------------------------------- 배경 */

.s64-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 12, 20, 0.06), rgba(6, 12, 20, 0.2)),
    url("../assets/images/s6.png") center / cover no-repeat;
  filter: saturate(0.98) brightness(0.96);
}

.s64-shelves {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(120, 150, 210, 0.08) 0 4px, transparent 4px 96px),
    repeating-linear-gradient(0deg, rgba(120, 150, 210, 0.06) 0 3px, transparent 3px 150px);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 55%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 55%);
  opacity: 0.4;
}

.s64-glitch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 40, 70, 0.18) 0 2px, transparent 2px 5px);
  mix-blend-mode: screen;
}

.s64-glitch.is-active { animation: s64-glitch 0.34s steps(2) 1; }

@keyframes s64-glitch {
  0% { opacity: 0; transform: translateX(0); }
  30% { opacity: 0.9; transform: translateX(-7px); }
  60% { opacity: 0.6; transform: translateX(6px); }
  100% { opacity: 0; transform: translateX(0); }
}

/* 멀리 보이는 잠긴 도서관 문 */
.s64-far-door {
  position: absolute;
  left: 960px;
  top: 250px;
  width: 360px;
  height: 240px;
  transform: translate(-50%, -50%);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(40, 80, 140, 0.5), rgba(18, 36, 70, 0.4));
  border: 2px solid rgba(120, 200, 255, 0.3);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6);
  opacity: 0.55;
  z-index: 1;
}

.s64-far-door::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: rgba(120, 200, 255, 0.4);
}

.s64-far-door.is-open { animation: s64-door-open 1.4s ease forwards; }

@keyframes s64-door-open {
  0% { filter: brightness(1); }
  100% { filter: brightness(2.4); opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* --------------------------------------------------------- 상단 HUD */
/* topbar padding은 공통 ui.css(18px) 유지 — 메뉴 높이/위치를 다른 스테이지와 통일 */

.s64-hud {
  position: absolute;
  top: 64px; /* 메뉴(18px + 42px) 아래 + 여백 */
  left: 50%;
  width: 1360px;
  max-width: calc(100% - 40px);
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 19px 22px; /* 세로 +약 0.5cm(18px) */
  border-radius: 14px;
  background: rgba(7, 15, 28, 0.86);
  border: 1px solid rgba(120, 210, 255, 0.32);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.s64-hud-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.s64-hud-mission {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  min-width: 0;
}

.s64-hud-title {
  font-size: 17px;
  font-weight: 950;
  letter-spacing: 0.02em;
  color: #9bedff;
}


.s64-mission-label {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(200, 222, 240, 0.88);
  white-space: nowrap;
}

.s64-mission-label b {
  color: #9bedff;
  font-size: 20px;
  margin-left: 2px;
}

.s64-mission-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.s64-mission-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(38, 52, 72, 0.85);
  border: 1px solid rgba(70, 92, 118, 0.55);
}

.s64-mission-dot.is-current {
  background: #5fe0ff;
  border-color: #9bedff;
  box-shadow: 0 0 10px rgba(95, 224, 255, 0.9);
}

.s64-mission-dot.is-pending {
  background: rgba(32, 44, 62, 0.9);
  border-color: rgba(58, 78, 102, 0.5);
}

.s64-mission-dot.is-done {
  background: rgba(95, 224, 255, 0.42);
  border-color: rgba(126, 224, 255, 0.62);
}

.s64-hud-problem {
  margin-left: 8px;
  font-size: 30px;
  font-weight: 950;
  color: #ffffff;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  scrollbar-width: none;
}

.s64-hud-problem::-webkit-scrollbar {
  display: none;
}

.s64-hud-ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  color: rgba(180, 210, 235, 0.75);
  font-size: 0.9em;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.s64-hud-problem .s64-fraction {
  gap: 2px;
  align-items: center;
}

.s64-hud-problem .s64-int.s64-slot {
  min-width: 22px;
  padding: 2px 3px;
  vertical-align: middle;
}

.s64-hud-problem .s64-op-pending {
  opacity: 0.78;
}

.s64-hud-problem .s64-int,
.s64-hud-problem .s64-num,
.s64-hud-problem .s64-den {
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
  color: #ffffff;
}

.s64-hud-problem .s64-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.s64-hud-problem .s64-frac-slots {
  align-items: stretch;
  gap: 5px;
  position: relative;
}

.s64-hud-problem .s64-slot {
  display: inline-block;
  min-width: 30px;
  min-height: 26px;
  padding: 2px 6px;
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  color: transparent;
  background: #e8dcc8;
  border: none;
  border-radius: 4px;
  box-shadow: none;
}

/* 빈칸 분수만 가로선 (::after) — 일반 분수 num/den에는 적용 안 함 */
.s64-hud-problem .s64-frac-slots::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1px;
  background: #ffffff;
  border-radius: 1px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.55);
  z-index: 2;
  pointer-events: none;
}

.s64-hud-problem .s64-frac-slots .s64-slot:first-child {
  border-radius: 4px 4px 2px 2px;
}

.s64-hud-problem .s64-frac-slots .s64-den {
  color: #ffffff;
  font-size: 34px;
  font-weight: 950;
  text-align: center;
  min-width: 30px;
  padding: 2px 6px;
}

.s64-hud-problem .s64-frac-slots .s64-slot:last-child {
  border-radius: 2px 2px 4px 4px;
}

.s64-hud-problem .s64-num {
  border-bottom: 2px solid #ffffff;
  padding: 0 2px 2px;
}

/* 통분 단계: 변환식의 분자 빈칸(위쪽 네모)만 옅게 — 분모 빈칸은 유지 */
.s64-hud-problem.is-common-denom .s64-frac-slots .s64-slot:first-child {
  background: rgba(232, 214, 170, 0.28);
  border-color: rgba(255, 230, 160, 0.22);
  box-shadow: none;
  opacity: 0.55;
}

.s64-hud-problem .s64-den {
  padding: 2px 2px 0;
}

.s64-hud-problem .s64-op {
  font-size: 30px;
  color: #ffffff;
  padding: 0 6px;
}

.s64-hud-problem.is-extended {
  font-size: 26px;
}

.s64-hud-problem.is-long {
  font-size: 18px;
}

.s64-hud-problem.is-long .s64-int,
.s64-hud-problem.is-long .s64-num,
.s64-hud-problem.is-long .s64-den,
.s64-hud-problem.is-long .s64-slot {
  font-size: 20px;
}

.s64-hud-problem.is-long .s64-op {
  font-size: 18px;
  padding: 0 2px;
}

.s64-hud-problem.is-long .s64-frac-slots .s64-den {
  font-size: 20px;
}

.s64-hud-problem.is-extended .s64-int,
.s64-hud-problem.is-extended .s64-num,
.s64-hud-problem.is-extended .s64-den,
.s64-hud-problem.is-extended .s64-slot {
  font-size: 28px;
}

.s64-hud-problem.is-extended .s64-op {
  font-size: 26px;
  padding: 0 4px;
}

.s64-hud-problem.is-extended .s64-frac-slots .s64-den {
  font-size: 28px;
}

.s64-hud-problem .s64-decompose {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  color: #ffffff;
}

.s64-hud-problem .s64-decompose .s64-int,
.s64-hud-problem .s64-decompose .s64-num,
.s64-hud-problem .s64-decompose .s64-den {
  font-size: inherit;
  color: #ffffff;
}

.s64-hud-problem.is-extended .s64-decompose .s64-int,
.s64-hud-problem.is-extended .s64-decompose .s64-num,
.s64-hud-problem.is-extended .s64-decompose .s64-den {
  font-size: 28px;
}

.s64-hud-stats { display: none; }
.s64-hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 280px;
}

.s64-meter-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* s33 시간 게이지와 동일 구조 — 전체 80% 스케일 */
.s64-time-pack,
.s64-energy-pack {
  display: grid;
  gap: 6px;
  width: 144px;
  min-width: 144px;
}

.s64-energy-pack {
  width: 120px;
  min-width: 120px;
}

.s64-score-pack {
  display: grid;
  gap: 3px;
  min-width: 58px;
  padding: 2px 3px 0 2px;
  text-align: right;
  color: rgba(200, 222, 240, 0.88);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.s64-score-pack strong {
  color: #9bedff;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.s64-time-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #7ed8ff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.s64-energy-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #ffe08a;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.s64-time-copy strong {
  color: #eafbff;
  font-size: 12px;
  font-weight: 950;
  min-width: 0;
  text-align: right;
}

.s64-energy-copy strong {
  color: #fff4d0;
  font-size: 12px;
  font-weight: 950;
  min-width: 0;
  text-align: right;
}

.s64-timer-track,
.s64-energy-track {
  position: relative;
  width: 100%;
  height: 11px;
  margin: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(6, 20, 34, 0.92);
  box-sizing: border-box;
}

.s64-timer-track {
  border: 1px solid rgba(100, 200, 255, 0.28);
}

.s64-energy-track {
  border: 1px solid rgba(255, 200, 90, 0.3);
}

.s64-timer-track span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3ec2ff, #6ef0ff);
  box-shadow: 0 0 12px rgba(70, 200, 255, 0.45);
  transition: width 80ms linear;
}

.s64-energy-track span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb84a, #ffe36a);
  box-shadow: 0 0 12px rgba(255, 190, 70, 0.42);
  transition: width 80ms linear;
}

.s64-timer-track span.warning {
  background: linear-gradient(90deg, #5ad0ff, #ffd45f);
}

.s64-energy-track span.warning {
  background: linear-gradient(90deg, #ff9b45, #ffd45f);
}

.s64-timer-track span.danger {
  background: linear-gradient(90deg, #ff9b5f, #ff395d);
}

.s64-energy-track span.danger {
  background: linear-gradient(90deg, #ff7a3a, #ff395d);
}

.s64-gauge { display: none; }
.s64-gauge i { font-style: normal; font-size: 17px; font-weight: 800; color: rgba(190, 214, 235, 0.85); }
.s64-gauge i b { color: #ffd98a; }

.s64-bar {
  width: 225px;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid rgba(120, 180, 220, 0.3);
}

.s64-bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #46c0ff, #7fe0ff);
  transition: width 0.25s ease;
}

.s64-bar span.is-low { background: linear-gradient(90deg, #ff5b5b, #ff9a6b); }

/* --------------------------------------------------------- 좌측 풀이 단계 */

.s64-flow-rail {
  position: absolute;
  left: 1517px;
  top: 216px; /* HUD(64px) 아래로 맞춤 */
  width: 332px;
  z-index: 35;
  pointer-events: none;
}

.s64-flow-steps {
  list-style: none;
  margin: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 16px;
  background: rgba(7, 15, 28, 0.78);
  border: 1px solid rgba(120, 210, 255, 0.24);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.38);
}

.s64-flow-step {
  font-size: 21px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: rgba(175, 200, 225, 0.52);
  transition: color 0.2s ease, font-size 0.2s ease, text-shadow 0.2s ease;
}

.s64-flow-step.is-active {
  color: #9ef5ff;
  font-size: 24px;
  font-weight: 950;
  text-shadow: 0 0 16px rgba(95, 224, 255, 0.65);
}

.s64-flow-step.is-done {
  color: rgba(130, 210, 255, 0.62);
}

.s64-flow-step.is-pending {
  color: rgba(165, 190, 215, 0.44);
}

.s64-flow-step.is-skip {
  color: rgba(140, 160, 185, 0.4);
  text-decoration: line-through;
  text-decoration-color: rgba(160, 185, 210, 0.7);
  text-decoration-thickness: 2px;
}

/* --------------------------------------------------------- 트랙 / 5레인 */

.s64-track {
  position: absolute;
  left: 275px;
  top: 162px; /* HUD 아래로 맞춤 */
  width: 1370px;
  bottom: 60px;
  z-index: 10;
  overflow: hidden;
  /* 트랙 클릭으로 레인 이동 (자식 노트·플레이어는 각각 pointer-events:none 유지) */
  pointer-events: auto;
}

.s64-lanes { position: absolute; inset: 0; }

.s64-lane {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(120, 200, 255, 0.16);
  border-right: 1px solid rgba(120, 200, 255, 0.16);
  background: linear-gradient(180deg, transparent 0%, rgba(60, 130, 230, 0.04) 60%, rgba(70, 150, 255, 0.1) 100%);
  transition: background 0.15s ease, box-shadow 0.15s ease;
  pointer-events: none;
}

.s64-lane::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  background: repeating-linear-gradient(180deg, rgba(120, 200, 255, 0.14) 0 2px, transparent 2px 26px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000);
  mask-image: linear-gradient(180deg, transparent, #000);
  opacity: 0.5;
  animation: s64-rail-flow 0.9s linear infinite;
}

@keyframes s64-rail-flow {
  from { background-position: 0 0; }
  to { background-position: 0 26px; }
}

.s64-lane.is-active {
  background: linear-gradient(180deg, rgba(80, 170, 255, 0.08) 0%, rgba(80, 180, 255, 0.16) 60%, rgba(120, 220, 255, 0.26) 100%);
  box-shadow: inset 0 0 22px rgba(100, 200, 255, 0.28);
}

.s64-lane.s64-lane-burst { animation: s64-lane-burst 0.6s ease; }

@keyframes s64-lane-burst {
  0% { background: rgba(90, 235, 187, 0.05); box-shadow: inset 0 0 0 rgba(89, 235, 187, 0); }
  35% { background: rgba(90, 235, 187, 0.4); box-shadow: inset 0 0 60px rgba(89, 235, 187, 0.85); }
  100% { background: rgba(90, 235, 187, 0.05); box-shadow: inset 0 0 0 rgba(89, 235, 187, 0); }
}

.s64-lane.s64-lane-glitch { animation: s64-lane-glitch 0.6s steps(3) 1; }

@keyframes s64-lane-glitch {
  0% { background: rgba(255, 70, 80, 0.05); }
  30% { background: rgba(255, 70, 80, 0.42); box-shadow: inset 0 0 50px rgba(255, 70, 80, 0.7); transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  100% { background: rgba(255, 70, 80, 0.05); box-shadow: inset 0 0 0 rgba(255, 70, 80, 0); transform: translateX(0); }
}

.s64-track-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 90px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 200, 255, 0.16) 0 2px, transparent 2px 90px),
    linear-gradient(180deg, transparent, rgba(40, 90, 160, 0.25));
}

/* --------------------------------------------------------- 판정선 */

.s64-judge-line {
  position: absolute;
  height: 6px;
  z-index: 14;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(95, 235, 255, 0.1), rgba(95, 235, 255, 0.95), rgba(95, 235, 255, 0.1));
  box-shadow: 0 0 20px rgba(95, 235, 255, 0.85), 0 0 44px rgba(72, 200, 255, 0.45);
  animation: s64-judge-pulse 1.1s ease-in-out infinite;
}

@keyframes s64-judge-pulse {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}

/* --------------------------------------------------------- 노트 */

.s64-note-layer { position: absolute; inset: 0; z-index: 13; pointer-events: none; }

.s64-gate-note {
  position: absolute;
  left: 0;
  top: 0;
  width: 84px;
  min-height: 44px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 10px;
  text-align: center;
  color: #eaf6ff;
  background: linear-gradient(180deg, rgba(28, 56, 96, 0.96), rgba(14, 30, 58, 0.96));
  border: 2px solid rgba(120, 200, 255, 0.6);
  box-shadow: 0 0 12px rgba(60, 140, 230, 0.4), inset 0 0 8px rgba(80, 150, 230, 0.22);
  animation: s64-note-bob 0.7s ease-in-out infinite alternate;
  will-change: transform, top;
}

.s64-gate-note::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 7px;
  border: 1px dashed rgba(140, 210, 255, 0.4);
  pointer-events: none;
}

.s64-gate-note.is-passed {
  opacity: 0.22;
  filter: grayscale(0.45);
  transition: opacity 0.3s ease;
}

/* 판정선 도달 후 폭발·소멸 */
.s64-gate-note.is-exploding {
  pointer-events: none;
  animation: s64-note-explode 0.42s ease-out forwards !important;
}

.s64-gate-note.is-exploding-vanish {
  animation: s64-note-explode 0.36s ease-out forwards !important;
}

.s64-gate-note.is-exploding-grab {
  animation: s64-note-explode-grab 0.4s ease-out forwards !important;
}

.s64-gate-note.is-exploding-wrong {
  animation: s64-note-explode-wrong 0.4s ease-out forwards !important;
}

.s64-gate-note.is-exploding-correct {
  animation: s64-note-explode-correct 0.52s ease-out forwards !important;
}

@keyframes s64-note-explode {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; filter: none; }
  35% { transform: translate(-50%, -50%) scale(1.14); opacity: 0.95; filter: brightness(1.35); }
  100% { transform: translate(-50%, -50%) scale(0.15); opacity: 0; filter: blur(5px) brightness(1.8); }
}

@keyframes s64-note-explode-grab {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.9; filter: brightness(1.5); }
  100% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; filter: blur(6px); }
}

@keyframes s64-note-explode-wrong {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  20% { transform: translate(-50%, -50%) scale(1.08) translateX(-6px); }
  40% { transform: translate(-50%, -50%) scale(1.08) translateX(6px); }
  100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; filter: blur(8px) brightness(2); }
}

@keyframes s64-note-explode-correct {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1.22); opacity: 1; filter: brightness(1.6); }
  100% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; filter: blur(4px) brightness(2.2); }
}

/* 특수 카드 (가속 / 감속 / 깨진 파일) */
.s64-gate-note.s64-note-special {
  width: 100px;
  min-height: 60px;
}

.s64-note-label.is-special {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1;
}

.s64-sp-icon { font-size: 17px; font-weight: 950; letter-spacing: -1px; }
.s64-sp-name { font-size: 15px; font-weight: 950; }
.s64-sp-sub { font-size: 9px; font-weight: 800; color: rgba(235, 246, 255, 0.82); }

.s64-note-special.is-fast {
  border-color: #ffb04a;
  background: linear-gradient(180deg, rgba(150, 84, 22, 0.96), rgba(92, 46, 10, 0.96));
  box-shadow: 0 0 16px rgba(255, 160, 60, 0.5);
}
.s64-note-special.is-fast .s64-sp-icon, .s64-note-special.is-fast .s64-sp-name { color: #ffd08a; }

.s64-note-special.is-slow {
  border-color: #5fe0c0;
  background: linear-gradient(180deg, rgba(20, 122, 102, 0.96), rgba(10, 72, 60, 0.96));
  box-shadow: 0 0 16px rgba(95, 224, 192, 0.5);
}
.s64-note-special.is-slow .s64-sp-icon, .s64-note-special.is-slow .s64-sp-name { color: #a8ffe6; }

.s64-note-special.is-broken {
  border-color: #b98aff;
  background: linear-gradient(180deg, rgba(72, 40, 112, 0.96), rgba(40, 20, 70, 0.96));
  box-shadow: 0 0 16px rgba(160, 110, 255, 0.5);
}
.s64-note-special.is-broken .s64-sp-icon, .s64-note-special.is-broken .s64-sp-name { color: #d8c0ff; }

.s64-gate-note.is-grabbed {
  filter: brightness(1.45);
  animation: s64-note-open 0.45s ease;
}

@keyframes s64-note-bob {
  0% { box-shadow: 0 0 14px rgba(60, 140, 230, 0.35), inset 0 0 10px rgba(80, 150, 230, 0.2); }
  100% { box-shadow: 0 0 22px rgba(90, 180, 255, 0.6), inset 0 0 14px rgba(110, 180, 255, 0.32); }
}

.s64-gate-note.is-near {
  border-color: rgba(150, 225, 255, 0.95);
  box-shadow: 0 0 26px rgba(110, 200, 255, 0.8), inset 0 0 16px rgba(130, 200, 255, 0.4);
  filter: brightness(1.12);
}

.s64-gate-note.is-word {
  width: auto;
  min-width: 120px;
  max-width: 190px;
  min-height: 48px;
  padding: 6px 12px;
  white-space: nowrap;
}

.s64-note-label {
  position: relative;
  z-index: 1;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.02;
}

/* 노트 분수: 자연수·분수 숫자 크기 통일 */
.s64-gate-note .s64-fraction {
  gap: 5px;
  align-items: center;
}

.s64-gate-note .s64-int,
.s64-gate-note .s64-num,
.s64-gate-note .s64-den {
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.s64-gate-note .s64-num {
  border-bottom: 2px solid currentColor;
  padding: 0 2px 2px;
}

.s64-gate-note .s64-den {
  padding: 2px 2px 0;
}

.s64-note-label.is-word { font-size: 14px; line-height: 1.2; white-space: nowrap; }
.s64-note-label.is-word b { display: inline; font-size: 15px; color: #ffe6a6; font-weight: 950; white-space: nowrap; }

.s64-gate-note.is-correct {
  border-color: #59ebbb;
  background: linear-gradient(180deg, rgba(40, 165, 122, 0.96), rgba(20, 110, 90, 0.96));
  box-shadow: 0 0 36px rgba(89, 235, 187, 0.95);
  animation: s64-note-open 0.5s ease;
}

@keyframes s64-note-open {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(1.16); filter: brightness(1.5); }
  100% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.85; }
}

.s64-gate-note.is-wrong {
  border-color: #ff6b6b;
  background: linear-gradient(180deg, rgba(172, 52, 62, 0.96), rgba(110, 24, 36, 0.96));
  box-shadow: 0 0 30px rgba(255, 70, 80, 0.9);
  animation: s64-note-wrong 0.45s ease;
}

@keyframes s64-note-wrong {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  25% { transform: translate(-50%, -50%) translateX(-9px); }
  75% { transform: translate(-50%, -50%) translateX(9px); }
}

/* --------------------------------------------------------- 판정/콤보 텍스트 */

.s64-judge-text {
  position: absolute;
  left: 50%;
  top: 430px;
  transform: translate(-50%, 10px);
  z-index: 24;
  font-size: 62px;
  font-weight: 950;
  letter-spacing: 0.04em;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}

.s64-judge-text.is-show { animation: s64-judge-text 0.72s ease; }

@keyframes s64-judge-text {
  0% { opacity: 0; transform: translate(-50%, 24px) scale(0.7); visibility: visible; }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(1); visibility: visible; }
}

.s64-judge-text[data-kind="perfect"] { color: #8affc4; }
.s64-judge-text[data-kind="glitch"] { color: #ff7b7b; }
.s64-judge-text[data-kind="miss"] { color: #ffc46b; }
.s64-judge-text[data-kind="fast"] { color: #ffb04a; }
.s64-judge-text[data-kind="slow"] { color: #6fe9c4; }

.s64-combo-pop {
  position: absolute;
  left: 50%;
  top: 360px;
  transform: translate(-50%, 0);
  z-index: 23;
  font-size: 34px;
  font-weight: 950;
  letter-spacing: 0.06em;
  color: #ffe14a;
  text-shadow: 0 0 16px rgba(255, 200, 60, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.s64-combo-pop.is-show { animation: s64-combo-pop 0.76s ease; }

@keyframes s64-combo-pop {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.8); visibility: visible; }
  30% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1); visibility: visible; }
}

/* --------------------------------------------------------- 플레이어 드론 */

.s64-player {
  position: absolute;
  left: 0;
  top: 0;
  width: 74px;
  height: 74px;
  transform: translate(-50%, -50%);
  z-index: 18;
  transition: left 0.08s ease-out;
  pointer-events: none;
}

.s64-player-body {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 42% 34%, #d6f3ff 0%, #4a9ff0 55%, #1c50b0 100%);
  border: 3px solid rgba(170, 220, 255, 0.85);
  box-shadow: 0 0 26px rgba(70, 150, 255, 0.8), inset 0 0 16px rgba(190, 230, 255, 0.45);
}

.s64-player-eye {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 32px;
  height: 13px;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: #06121f;
  box-shadow: 0 0 10px rgba(120, 230, 255, 0.9);
}

.s64-player-thruster {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 40px;
  height: 30px;
  transform: translate(-50%, -20%);
  border-radius: 0 0 50% 50%;
  background: radial-gradient(circle at 50% 0%, rgba(160, 230, 255, 0.9), rgba(70, 160, 255, 0) 70%);
  animation: s64-thrust 0.4s ease-in-out infinite alternate;
}

@keyframes s64-thrust {
  0% { opacity: 0.5; transform: translate(-50%, -20%) scaleY(0.8); }
  100% { opacity: 1; transform: translate(-50%, -10%) scaleY(1.2); }
}

.s64-player.is-dash .s64-player-body { animation: s64-dash 0.4s ease; }

@keyframes s64-dash {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.8) drop-shadow(0 0 18px rgba(120, 230, 255, 1)); }
  100% { filter: brightness(1); }
}

.s64-player.is-hit .s64-player-body { animation: s64-hit 0.45s ease; }

@keyframes s64-hit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); border-color: #ff6b6b; }
  55% { transform: translateX(3px); border-color: #ff6b6b; }
}

.s64-player.is-boost .s64-player-thruster {
  animation: s64-thrust 0.16s ease-in-out infinite alternate;
  filter: brightness(1.6);
}

/* --------------------------------------------------------- 중앙 단계 문구 */

.s64-prompt {
  position: absolute;
  left: 960px;
  top: 250px;
  transform: translate(-50%, -10px);
  z-index: 26;
  padding: 14px 36px;
  border-radius: 999px;
  font-size: 38px;
  font-weight: 950;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #eaf6ff;
  background: rgba(8, 18, 34, 0.92);
  border: 2px solid rgba(126, 224, 255, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.s64-prompt.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.s64-prompt[data-color="violet"] { border-color: rgba(186, 150, 255, 0.75); color: #ede2ff; }
.s64-prompt[data-color="amber"] { border-color: rgba(255, 206, 90, 0.85); color: #fff0cf; }
.s64-prompt[data-color="green"] { border-color: rgba(120, 255, 190, 0.8); color: #dafff0; }

/* --------------------------------------------------------- 토스트 / 결과 */

.s64-toast {
  position: absolute;
  left: 960px;
  top: 596px;
  transform: translate(-50%, -8px);
  padding: 12px 30px;
  border-radius: 14px;
  font-size: 28px;
  font-weight: 950;
  white-space: nowrap;
  color: #eaf6ff;
  background: rgba(7, 17, 31, 0.95);
  border: 1px solid rgba(120, 210, 255, 0.5);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  z-index: 32;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.s64-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.s64-toast[data-type="bad"] { border-color: rgba(255, 120, 120, 0.75); color: #ffd2d2; }
.s64-toast[data-type="good"] { border-color: rgba(120, 255, 190, 0.75); color: #c7ffe6; }
.s64-toast .s64-toast-sub { display: block; margin-top: 4px; font-size: 18px; font-weight: 800; opacity: 0.9; }
.s64-toast-math {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.15;
}
.s64-toast-math .s64-fraction { gap: 6px; }
.s64-toast-math .s64-int { font-size: 1em; }
.s64-toast-math .s64-num,
.s64-toast-math .s64-den { font-size: 0.62em; }
.s64-toast-math .s64-op { font-size: 0.85em; padding: 0 2px; }
.s64-unified-card .s64-toast-math {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 4px;
}

.s64-round-clear {
  position: absolute;
  left: 960px;
  top: 470px;
  transform: translate(-50%, 0);
  z-index: 34;
  padding: 20px 40px;
  border-radius: 18px;
  text-align: center;
  background: rgba(6, 14, 28, 0.96);
  border: 2px solid rgba(120, 255, 190, 0.65);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.s64-round-clear.is-visible { opacity: 1; visibility: visible; }
.s64-round-clear h3 { margin: 0 0 8px; color: #b6ffd9; font-size: 30px; font-weight: 950; }
.s64-round-clear p { margin: 2px 0; font-size: 19px; font-weight: 850; color: rgba(220, 235, 250, 0.92); }
/* --------------------------------------------------------- 분수 렌더 */

.s64-fraction { display: inline-flex; align-items: center; gap: 8px; color: inherit; }
.s64-int { font-size: 1em; font-weight: 950; line-height: 1; }
.s64-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.s64-num, .s64-den { font-size: 0.56em; font-weight: 900; padding: 0 5px; }
.s64-num { border-bottom: 3px solid currentColor; padding-bottom: 3px; }
.s64-den { padding-top: 3px; }
.s64-op { font-size: 0.8em; font-weight: 950; color: #9edcff; padding: 0 4px; }

/* --------------------------------------------------------- 오버레이 */

.s64-overlay {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 18, 0.74);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.s64-overlay.is-visible { opacity: 1; visibility: visible; }

.s64-overlay-card {
  padding: 40px 56px;
  border-radius: 22px;
  text-align: center;
  background: rgba(8, 20, 36, 0.97);
  border: 1px solid rgba(120, 210, 255, 0.4);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: s64-card-pop 0.45s cubic-bezier(0.34, 1.5, 0.5, 1);
}

@keyframes s64-card-pop {
  from { transform: scale(0.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.s64-overlay-card h2 { margin: 0 0 18px; color: #eef7ff; font-size: 30px; font-weight: 950; line-height: 1.3; }
.s64-overlay-card p { margin: 0 0 18px; color: rgba(200, 222, 240, 0.8); font-size: 16px; }
.s64-clear-kicker { color: #7fe0ff; font-size: 17px; font-weight: 950; letter-spacing: 0.18em; margin: 0 0 12px; }
.s64-danger-title { color: #ff9a9a !important; }
.s64-clear-stats { margin: 14px 0 20px; display: flex; flex-direction: column; gap: 6px; color: rgba(200, 222, 240, 0.92); font-size: 18px; font-weight: 850; }

.s64-overlay-actions { display: flex; gap: 14px; justify-content: center; }

.s64-btn {
  min-width: 150px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.s64-btn:hover { transform: translateY(-2px); }
.s64-btn-retry { color: #06121f; background: linear-gradient(180deg, #9bedff, #5fd0ff); border: 1px solid rgba(154, 240, 255, 0.7); }
.s64-btn-restart { color: #e6dcff; background: rgba(38, 28, 64, 0.92); border: 1px solid rgba(170, 140, 255, 0.42); }
.s64-btn-exit { color: #dbeeff; background: rgba(16, 34, 56, 0.9); border: 1px solid rgba(120, 200, 255, 0.32); }

/* 아이템창/도구 패널 표현은 body.stage5-ui-active(다른 스테이지와 동일한 공통 훅)로 통일.
   s64.js enter()에서 해당 클래스를 추가하므로 여기서 별도 복제하지 않는다. */

/* --------------------------------------------------------- 고정 뷰포트 */

body.s64-fixed-viewport-active #game-root,
body.s64-fixed-viewport-active #game-shell { overflow: hidden; }
