/* Pinpop Toybox: Bolt Sort — Indigo Arcade Gloss 16:9 Widescreen Stylesheet (100% Offline, ZERO Google Fonts, ZERO backdrop-filter blur) */

:root {
  --font-display: 'Fredoka', 'Trebuchet MS', 'Segoe UI Rounded', 'Arial Rounded MT Bold', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Segoe UI', 'Noto Sans', 'Hiragino Kaku Gothic ProN', 'Malgun Gothic', system-ui, sans-serif;
  --ink-dark: #16133A;
  --ink-light: #F8FAFC;
  --gold-accent: #FFD54F;
  --cyan-accent: #5CE1FF;
  --emerald-accent: #28D97C;
  --coral-accent: #FF5B73;
  --indigo-deep: #18153B;
  --indigo-mid: #27225E;
}

*, *::before, *::after {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #67D6EE;
  font-family: var(--font-body);
  color: var(--ink-light);
}

img {
  -webkit-user-drag: none;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * FULL-BLEED GAMEPLAY STAGE & IDLE-HIDDEN OVERLAY CANVASES
 * ============================================================================ */
#stage-root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: url('../assets/art/arena_bg.jpg') center center / cover no-repeat;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  cursor: pointer;
}

#ui-motion-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 65;
  display: none;
}

#cutin-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 85;
  display: none;
}

/* ============================================================================
 * HEROIC NO-BOX TITLE SCREEN (FULL-BLEED, ZERO OPAQUE LOGIN CARD!)
 * ============================================================================ */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 36px;
  background: url('../assets/art/title_bg.jpg') center center / cover no-repeat;
  transition: opacity 280ms ease;
}

.title-top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.title-util-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 52px;
  height: 44px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  overflow: visible;
}

.title-util-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.title-hero-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  margin-top: -12px;
}

.title-hero-emblem {
  width: clamp(130px, 16vh, 178px);
  height: clamp(130px, 16vh, 178px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.title-hero-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.title-heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(44px, 5.8vw, 76px);
  line-height: 1.02;
  letter-spacing: 0.02em;
  text-align: center;
  color: #FFFFFF;
  -webkit-text-stroke: 2.5px #1B184B;
  text-shadow: 0 6px 0 #1B184B, 0 12px 24px rgba(24, 21, 59, 0.38);
}

.title-sub {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 2.4vw, 30px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FFF4B8;
  -webkit-text-stroke: 1.5px #1B184B;
  text-shadow: 0 4px 0 #1B184B;
}

.title-cta-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-height: 112px;
  justify-content: center;
}

.title-loader-wrap {
  width: min(400px, 78vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.title-loader-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #1B184B;
}

.title-loader-track {
  width: 100%;
  height: 36px;
  padding: 2px 4px;
  display: flex;
  align-items: center;
}

.title-loader-fill {
  height: 100%;
  width: 0%;
  min-width: 28px;
  transition: width 140ms ease-out;
}

#btn-title-play {
  min-width: 248px;
  height: 76px;
  padding: 0 36px;
  font-size: clamp(22px, 2.2vw, 28px);
  letter-spacing: 0.06em;
  color: #FFFFFF;
  -webkit-text-stroke: 1.2px rgba(14, 12, 42, 0.88);
  paint-order: stroke fill;
  text-shadow: 0 2.5px 0 rgba(14, 12, 42, 0.88), 0 0 6px rgba(14, 12, 42, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* High-Contrast Crisp White Text on Glossy Green/Blue Arcade Buttons & Tabs (User Ticket #12!) */
.uiv-indigo_arcade_gloss-btn-primary,
.uiv-indigo_arcade_gloss-btn-secondary,
.uiv-indigo_arcade_gloss-tab-active {
  color: #FFFFFF;
  -webkit-text-stroke: 1px rgba(14, 12, 42, 0.86);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(14, 12, 42, 0.88), 0 0 4px rgba(14, 12, 42, 0.42);
}

.uiv-indigo_arcade_gloss-btn-disabled {
  color: #E2E8F0;
  text-shadow: 0 1.5px 0 rgba(14, 12, 42, 0.82);
}

/* ============================================================================
 * FLOATING GAMEPLAY HUD (ZERO SIDEBAR BLOAT, 100% 720p NON-WRAPPING)
 * ============================================================================ */
#hud-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 14px 10px;
}

#hud-top {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  pointer-events: none;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  pointer-events: auto;
  min-width: 0;
}

.hud-pill-box {
  height: 48px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(10, 8, 30, 0.8);
  cursor: default;
}

.hud-pill-box img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hud-pill-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
}

.hud-stage-pill {
  max-width: 310px;
}

.hud-stage-name {
  display: inline-block;
  max-width: 136px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #FFF4B8;
  font-size: 14px;
}

.hud-bolt-pill {
  color: #A9F0FF;
}

.hud-fever-pill {
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.05;
  color: #FFFFFF;
  -webkit-text-stroke: 1.1px rgba(14, 12, 42, 0.90);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(14, 12, 42, 0.90), 0 0 6px rgba(92, 225, 255, 0.55);
  white-space: nowrap;
}

.hud-fever-pill.is-fever {
  filter: hue-rotate(162deg) saturate(1.95) brightness(1.10) drop-shadow(0 3px 10px rgba(255, 122, 24, 0.65));
  color: #FFFFFF;
  -webkit-text-stroke: 1.25px #381000;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #381000, 0 0 8px rgba(255, 232, 120, 0.72);
  animation: feverPillPulse 0.85s ease-in-out infinite;
}

@keyframes feverPillPulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.06; }
}

.hud-nav-btn {
  position: relative;
  overflow: visible !important;
  height: 48px;
  min-width: 48px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
  color: #FFFFFF;
}

.hud-nav-btn img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hud-nav-btn .btn-txt {
  display: inline-block;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

#btn-nav-shop {
  flex: 0 0 auto;
  min-width: 118px;
  padding: 0 20px 0 10px;
  color: #FFFFFF;
}

#btn-nav-shop > .notify-badge {
  top: -16px;
  right: -5px;
}

#btn-nav-shop .btn-txt {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

#btn-quit-game {
  min-width: 48px;
  padding: 0 6px;
  color: #FFFFFF;
  font-size: 13px;
}

.notify-badge,
.hud-nav-btn > .notify-badge,
[class*='uiv-'][class*='-btn-'] > .notify-badge,
[class*='uiv-'][class*='-slot-tile'] > .notify-badge {
  position: absolute;
  top: -12px;
  right: -4px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 11px;
  background: #FF3355;
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 30;
  pointer-events: none;
  box-shadow: none !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.42));
}

/* ============================================================================
 * RIGHT FLOATING INSPECT STRIP (COMPACT 72px, ZERO SIDEBAR BLOAT)
 * ============================================================================ */
#inspect-strip {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-54%);
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.inspect-btn {
  position: relative;
  overflow: visible !important;
  width: 76px;
  height: 76px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 800;
}

.inspect-btn img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.inspect-btn .inspect-lbl {
  display: block;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1.05;
  color: #FFFFFF;
  text-shadow: 0 1px 2px #141030;
}

.inspect-btn.is-on {
  filter: brightness(1.18) drop-shadow(0 0 8px rgba(92, 225, 255, 0.85));
}

.inspect-btn.is-urgent-flip {
  filter: brightness(1.16) drop-shadow(0 0 10px rgba(255, 213, 79, 0.95));
  animation: feverPillPulse 0.95s ease-in-out infinite;
}

.hotkey-pip {
  position: absolute;
  top: -5px;
  left: -4px;
  min-width: 20px;
  height: 19px;
  padding: 0 4px;
  border-radius: 7px;
  background: #1B184B;
  border: 2px solid #5CE1FF;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
  z-index: 25;
}

/* Compact Edge-Docked Multi-Face Flip Cue (<= 44px height, 0 hitbox jitter — Bug #4070) */
@keyframes flipCueGlow {
  0%, 100% { filter: drop-shadow(0 4px 8px rgba(14, 12, 42, 0.45)) brightness(1.0); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 224, 102, 0.92)) brightness(1.10); }
}

.flip-cue-btn {
  position: fixed;
  left: 50%;
  bottom: 126px;
  transform: translateX(-50%);
  z-index: 26;
  pointer-events: auto;
  height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
  animation: flipCueGlow 1.15s ease-in-out infinite;
}

.flip-cue-btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* ============================================================================
 * BOTTOM WORKBENCH DOCK (COLLECTOR TRAYS + HOLDING DOCK + COMPACT 72px BOOSTERS)
 * ============================================================================ */
#hud-bottom {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  padding-bottom: 2px;
}

.workbench-dock-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 14px;
  max-width: calc(100vw - 240px);
  flex-wrap: nowrap;
}

.collector-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collector-tray {
  position: relative;
  width: 112px;
  height: 72px;
  border-radius: 16px;
  border: 3px solid #1B184B;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 7px;
  box-shadow: 0 6px 0 rgba(27, 24, 75, 0.45), inset 0 3px 0 rgba(255, 255, 255, 0.38);
  transition: transform 180ms ease;
}

.collector-tray.sealing {
  transform: scale(1.12);
}

.collector-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.collector-holes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.collector-hole {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(20, 16, 48, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collector-hole.filled {
  background: rgba(255, 255, 255, 0.92);
  border-color: #1B184B;
}

.bolt-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(22, 19, 58, 0.65);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.dock-divider {
  width: 2px;
  height: 52px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 2px;
  flex: 0 0 auto;
}

.holding-dock {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hold-slot {
  width: 48px;
  height: 54px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
}

.hold-slot-bolt {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #1B184B;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.48), 0 3px 0 rgba(22, 19, 58, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.hold-slot.warning-pulse {
  filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.9));
}

.booster-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.booster-btn {
  position: relative;
  overflow: visible !important;
  width: 72px;
  height: 72px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.booster-btn img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.booster-btn.is-empty-undo {
  opacity: 0.62;
  filter: grayscale(0.32);
}

.tool-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  min-width: 24px;
  height: 21px;
  padding: 0 5px;
  border-radius: 11px;
  background: #22C55E;
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  text-shadow: 0 1px 0 rgba(14, 12, 42, 0.85);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 25;
  pointer-events: none;
}

.tool-count.is-free {
  background: #0EA5E9;
  color: #FFFFFF;
}

.tool-count.is-gem {
  background: #F59E0B;
  color: #FFFFFF;
}

.tool-count.is-flip-count {
  top: -5px;
  right: -4px;
  bottom: auto;
  background: #FF5722;
  color: #FFFFFF;
}

/* ============================================================================
 * VISUAL SPOTLIGHT & ANIMATED POINTER HAND FTUE (ZERO PROSE WALL!)
 * ============================================================================ */
#tut-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}

#tut-spotlight {
  position: fixed;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 5px solid #FFD54F;
  background: rgba(255, 213, 79, 0.14);
  box-shadow: 0 0 18px rgba(255, 213, 79, 0.85);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: tutPulse 1.1s ease-in-out infinite;
}

#tut-hand {
  position: fixed;
  width: 58px;
  height: 58px;
  pointer-events: none;
  z-index: 47;
  animation: tutBounce 0.95s ease-in-out infinite;
}

#tut-pill {
  position: fixed;
  z-index: 48;
  padding: 6px 16px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: #16133A;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

#btn-tut-skip {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 49;
  pointer-events: auto;
  height: 44px;
  padding: 0 18px;
  font-size: 14px;
  color: #16133A;
}

@keyframes tutPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1.0); }
  50% { transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes tutBounce {
  0%, 100% { transform: translate(0, 0) rotate(-12deg); }
  50% { transform: translate(-6px, 10px) rotate(-4deg); }
}

/* ============================================================================
 * STRICT FLEX-SCROLL MODALS + ANTI-SAAS 60/25/15 CARDS (ZERO 720p CLIPPING!)
 * ============================================================================ */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(14, 12, 36, 0.74);
  padding: 16px;
}

#modal-root.is-open {
  display: flex;
}

#active-modal-card,
.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(980px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  padding: 10px 14px 14px;
  cursor: default;
}

#active-modal-card.modal-compact,
.modal-card.modal-compact {
  width: min(620px, 92vw);
}

#active-modal-card.modal-victory,
.modal-card.modal-victory {
  width: min(540px, 92vw);
  max-width: 550px;
}

.modal-header {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 2px 98px 10px;
}

.modal-title-ribbon {
  flex: 0 1 auto;
  min-width: 210px;
  max-width: 100%;
  height: 54px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 900;
  line-height: 1.05;
  color: #16133A;
  text-shadow: 0 1px 0 rgba(255, 250, 210, 0.72);
  white-space: nowrap;
  cursor: default;
}

.modal-title-ribbon span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-header-actions {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-56%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-help-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  color: #FFFFFF;
}

.modal-close-x {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close-x img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.modal-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 4px 10px;
}

.modal-tab-btn {
  position: relative;
  overflow: visible !important;
  height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
  color: #FFFFFF;
}

.modal-tab-btn.uiv-indigo_arcade_gloss-btn-secondary {
  opacity: 0.78;
  filter: saturate(0.72) brightness(0.90) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.28));
}

.modal-tab-btn.uiv-indigo_arcade_gloss-tab-active {
  filter: saturate(1.22) brightness(1.08) drop-shadow(0 4px 10px rgba(92, 225, 255, 0.45));
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden !important;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 4px 8px 8px;
  overscroll-behavior: contain;
}

.modal-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 4px 2px;
}

/* Visual-First Card Grids (strict minmax(0,1fr) + CF-25 0px horizontal scroll/jitter!) */
.card-grid-4,
.sm-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding: 14px 14px 10px;
  overflow-x: hidden;
  box-sizing: border-box;
}

.card-grid-3,
.sm-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding: 14px 14px 10px;
  overflow-x: hidden;
  box-sizing: border-box;
}

.card-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding: 14px 14px 10px;
  overflow-x: hidden;
  box-sizing: border-box;
}

.card-grid-4 > *,
.sm-grid-4 > *,
.card-grid-3 > *,
.sm-grid-3 > *,
.card-grid-2 > * {
  min-width: 0;
  max-width: 100%;
}

/* Anti-SaaS 60/25/15 Visual Card */
.vf-card-portrait {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 8px 10px;
  min-height: 222px;
  text-align: center;
  cursor: default;
  overflow: visible;
}

.vf-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 10px;
  background: #FACC15;
  border: 2px solid #18153B;
  color: #16133A;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  z-index: 12;
}

.vf-art-wrap {
  width: 100%;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.vf-art-img {
  max-width: 92%;
  max-height: 112px;
  width: auto;
  height: 108px;
  object-fit: contain;
}

.vf-heading {
  width: 100%;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(10, 8, 30, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vf-chip-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.vf-cur-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(20, 17, 54, 0.65);
  border: 1px solid rgba(92, 225, 255, 0.35);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #FFF4B8;
  white-space: nowrap;
}

.vf-cur-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.vf-cta {
  width: 100%;
  height: 44px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.vf-cta img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.vf-cta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Progress bar inside Quest/Pass cards */
.vf-prog-bar {
  width: 92%;
  height: 16px;
  border-radius: 8px;
  background: rgba(16, 13, 44, 0.72);
  border: 2px solid #3B5BDB;
  overflow: hidden;
  position: relative;
}

.vf-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #22C55E, #5CE1FF);
  transition: width 240ms ease;
}

.vf-prog-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 2px #000000;
}

/* Settings Clean Panel (non-card class names!) */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 6px;
}

.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(24, 21, 66, 0.78);
  border: 2px solid rgba(92, 225, 255, 0.28);
}

.setting-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
}

.setting-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid #5CE1FF;
  background: #1B184B;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.setting-range {
  width: 132px;
  accent-color: #22C55E;
  cursor: pointer;
}

.setting-toggle-btn {
  min-width: 78px;
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 3-Icon Visual Flow Feature Guide */
.guide-flow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 8px 4px;
}

.guide-step-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  text-align: center;
  cursor: default;
}

.guide-step-card img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.guide-step-lbl {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
}

.guide-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 4px 2px;
}

.guide-tool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 800;
  color: #FFFFFF;
  cursor: default;
}

.guide-tool-chip img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Victory / Defeat / Exit banners */
.outcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 8px;
  text-align: center;
}

.victory-star-stage {
  position: relative;
  width: 268px;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 2px;
  overflow: visible;
}

@keyframes victorySunburstSpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.victory-sunburst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 224px;
  height: 224px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle, rgba(255, 240, 148, 0.56) 0%, rgba(255, 200, 62, 0.24) 38%, rgba(255, 190, 48, 0) 68%),
    repeating-conic-gradient(
      from 0deg,
      rgba(255, 224, 96, 0.34) 0deg 14deg,
      rgba(255, 224, 96, 0.0) 14deg 30deg
    );
  -webkit-mask-image: radial-gradient(circle, #000 0%, #000 34%, transparent 69%);
  mask-image: radial-gradient(circle, #000 0%, #000 34%, transparent 69%);
  animation: victorySunburstSpin 18s linear infinite;
}

.outcome-stars {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
}

.outcome-star {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(14, 10, 42, 0.65));
}

.outcome-star.is-center {
  width: 72px;
  height: 72px;
  transform: translateY(-7px);
}

.outcome-star.is-dim {
  opacity: 0.25;
  filter: grayscale(1);
}

.outcome-ribbons {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.outcome-ribbon-chip {
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #34E885 0%, #16A34A 100%);
  border: 2px solid #0E1038;
  color: #FFFFFF;
  -webkit-text-stroke: 0.8px rgba(14, 12, 42, 0.85);
  paint-order: stroke fill;
  text-shadow: 0 1.5px 0 rgba(14, 12, 42, 0.85);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.05;
}

.victory-reward-strip {
  position: relative;
  z-index: 2;
  gap: 12px;
}

.victory-reward-strip .vf-cur-chip {
  padding: 5px 14px;
  font-size: 15px;
}

.outcome-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

.outcome-btn {
  height: 52px;
  padding: 0 16px;
  font-size: 16px;
  line-height: 1.05;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.vic-double-btn {
  position: relative;
  z-index: 2;
  min-width: 260px;
  max-width: 100%;
  height: 50px;
  padding: 0 16px;
  font-size: 15.5px;
  white-space: nowrap;
}

.vic-double-btn > img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 3px rgba(14, 12, 42, 0.55));
}

.vic-ticket-pill {
  padding: 3px 9px;
  font-size: 12.5px;
  color: #FFF4B8;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 1px rgba(14, 12, 42, 0.85);
}

.pass-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.pass-cycle-group,
.pass-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.pass-cycle-btn {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.pass-cycle-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}

.pass-prem-chip {
  height: 34px;
  padding: 0 10px;
}

/* Toast Notification */
#toast-stack {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast-pill {
  padding: 8px 18px;
  border-radius: 14px;
  background: rgba(24, 21, 59, 0.92);
  border: 2px solid #5CE1FF;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* Preview-Only Debug Pill (strictly mounted ONLY when !window.__MS_RELEASE__) */
#dev-f2-pill {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 130;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 2px solid #5CE1FF;
  background: rgba(20, 17, 54, 0.88);
  color: #5CE1FF;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#debug-panel {
  position: fixed;
  bottom: 48px;
  left: 10px;
  z-index: 135;
  width: 248px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(20, 17, 54, 0.95);
  border: 2px solid #5CE1FF;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#debug-panel button {
  height: 30px;
  border-radius: 7px;
  border: 1px solid #3B5BDB;
  background: #27225E;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Responsive adjustments for 1280x720 and narrow windows */
@media (max-width: 1360px) {
  .hud-cluster {
    gap: 5px;
  }
  .hud-pill-box {
    height: 44px;
    padding: 0 8px;
    gap: 5px;
  }
  .hud-fever-pill {
    height: 42px;
    padding: 0 10px;
    font-size: 13.5px;
  }
  .hud-stage-name {
    max-width: 96px;
  }
  .hud-nav-btn {
    height: 44px;
    min-width: 42px;
    padding: 0 5px;
  }
  #btn-nav-shop {
    min-width: 114px;
    padding: 0 18px 0 8px;
  }
  #btn-quit-game {
    min-width: 44px;
    padding: 0 5px;
  }
  .flip-cue-btn {
    bottom: 118px;
  }
  .hud-nav-btn .btn-txt {
    max-width: 68px;
  }
  #btn-nav-shop .btn-txt {
    max-width: none;
  }
  .collector-tray {
    width: 102px;
    height: 68px;
  }
  .hold-slot {
    width: 44px;
    height: 50px;
  }
  .booster-btn {
    width: 68px;
    height: 68px;
  }
  .booster-btn img {
    width: 42px;
    height: 42px;
  }
}

@media (max-height: 820px) {
  #active-modal-card,
  .modal-card {
    max-height: 94vh;
    padding: 6px 12px 10px;
  }
  .modal-header {
    padding: 0 4px 4px;
  }
  .modal-title-ribbon {
    height: 46px;
  }
  .modal-tabs {
    padding: 0 4px 6px;
  }
  .modal-tab-btn {
    height: 38px;
  }
  .card-grid-4,
  .sm-grid-4,
  .card-grid-3,
  .sm-grid-3 {
    gap: 8px;
  }
  .vf-card-portrait {
    min-height: 184px;
    padding: 4px 6px 6px;
    gap: 3px;
  }
  .vf-art-wrap {
    height: 82px;
    padding: 2px;
  }
  .vf-art-img {
    max-height: 78px;
    height: 76px;
  }
  .vf-cta {
    height: 38px;
  }
}

@media (max-width: 900px) {
  .card-grid-4,
  .sm-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-grid-3,
  .sm-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workbench-dock-inner {
    max-width: 98vw;
    gap: 6px;
    padding: 4px 8px;
  }
  #inspect-strip {
    right: 8px;
  }
}
