#stage-cube-rush {
  --bg: #0d1020;
  --fg: #f3f1ff;
  --muted: #9a9cc4;
  --accent: #ffb347;
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Chakra Petch", "Trebuchet MS", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#stage-cube-rush[hidden] {
  display: none;
}

#stage-cube-rush * {
  box-sizing: border-box;
}

#stage-cube-rush #cr-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage-cube-rush canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#stage-cube-rush #cr-hud {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  pointer-events: none;
  gap: 10px;
  z-index: 5;
}

#stage-cube-rush #cr-bar {
  flex: 1;
  min-width: 60px;
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
}

#stage-cube-rush #cr-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
}

#stage-cube-rush #cr-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 20px;
  z-index: 4;
}

#stage-cube-rush #cr-msg h1 {
  font-size: clamp(36px, 9vw, 72px);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

#stage-cube-rush #cr-msg p {
  margin: 4px 0;
  color: var(--muted);
  font-size: clamp(14px, 3.4vw, 18px);
}

#stage-cube-rush #cr-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: rgba(10, 12, 28, 0.92);
  text-align: center;
  z-index: 10;
}

#stage-cube-rush #cr-menu h1 {
  font-size: clamp(44px, 11vw, 88px);
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.02em;
}

#stage-cube-rush #cr-menu .sub {
  color: var(--muted);
  margin: 0 0 8px;
  font-size: clamp(14px, 3.4vw, 18px);
}

#stage-cube-rush #cr-levels {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, 100%);
  max-height: 52vh;
  overflow: auto;
}

#stage-cube-rush .cr-card {
  font: inherit;
  color: var(--fg);
  background: #1a1f3d;
  border: 2px solid #343a70;
  border-radius: 10px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  text-align: left;
  cursor: pointer;
}

#stage-cube-rush .cr-card b {
  font-size: 19px;
}

#stage-cube-rush .cr-card span {
  color: var(--accent);
}

#stage-cube-rush .cr-card em {
  grid-column: 1 / 3;
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
}

#stage-cube-rush .cr-card:hover,
#stage-cube-rush .cr-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

#stage-cube-rush #cr-menu .how {
  color: var(--muted);
  font-size: 13px;
  max-width: 380px;
  margin: 6px 0 0;
  line-height: 1.5;
}

#stage-cube-rush #cr-mbtn,
#stage-cube-rush .cr-hb {
  pointer-events: auto;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

#stage-cube-rush .cr-hb[hidden] {
  display: none;
}

#stage-cube-rush .cr-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, 100%);
  align-items: stretch;
}

#stage-cube-rush .cr-view[hidden] {
  display: none;
}

#stage-cube-rush .cr-card.big {
  font-size: 20px;
  text-align: center;
  display: block;
}

#stage-cube-rush .cr-card.arcade-exit {
  border-color: rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.12);
  color: var(--accent);
}

#stage-cube-rush .cr-back {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}

#stage-cube-rush .cr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #1a1f3d;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  text-align: left;
}

#stage-cube-rush .cr-row input[type="range"] {
  width: 150px;
  accent-color: var(--accent);
}

#stage-cube-rush .cr-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

#stage-cube-rush #cr-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
  z-index: 6;
}

#stage-cube-rush #cr-tip[hidden] {
  display: none;
}

#stage-cube-rush #cr-pause {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: rgba(10, 12, 28, 0.88);
  z-index: 12;
}

#stage-cube-rush #cr-pause[hidden] {
  display: none;
}

#stage-cube-rush #cr-pause h1 {
  font-size: clamp(36px, 9vw, 64px);
  margin: 0;
  color: var(--accent);
}

#stage-cube-rush #cr-toast {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 15;
}
