/* ============================================================
   Caterpillar Crawl — game-only styles
   Uses site tokens from styles.css
   ============================================================ */

.cc-game {
  position: relative;
  overflow: visible;
  padding-bottom: 20px;
}

.cc-help {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
}

.cc-game kbd {
  display: inline-block;
  padding: 0 5px;
  font-family: 'VT323', monospace;
  font-size: 0.95em;
  line-height: 1.2;
  color: var(--text-dark);
  background: var(--bg-window-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 1px 1px 0 var(--shadow);
}

.cc-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
}

.cc-stat {
  min-width: 80px;
  min-height: 48px;
  padding: 6px 12px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--shadow);
}

.cc-stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}

.cc-stat-value {
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.cc-status {
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
}

.cc-stage-shell {
  width: 100%;
  max-width: min(400px, calc(100vw - 48px));
  margin: 0 auto 13px;
  padding: 6px 6px 8px;
  overflow: visible;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.92) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 86%, rgba(255, 255, 255, 0.75) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(255, 214, 234, 0.82), rgba(203, 182, 240, 0.74));
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.75), 3px 3px 0 var(--shadow);
  border-radius: 4px;
}

.cc-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, #efe6fb 0%, #ffe1f0 55%, #f5e8ff 100%);
  overflow: hidden;
  border-radius: 6px;
}

.cc-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cc-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px var(--pink-deep);
}

.cc-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  background: rgba(243, 238, 252, 0.62);
  animation: cc-fade-in 220ms ease-out;
}

.cc-overlay[hidden] { display: none !important; }

.cc-overlay-inner {
  width: 100%;
  max-width: 280px;
  margin: auto;
  padding: 18px 14px 14px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  animation: cc-card-pop 260ms ease-out;
  border-radius: 6px;
}

.cc-overlay-title {
  margin: 0 0 10px;
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.cc-overlay-msg {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.3;
}

.cc-overlay-new {
  margin: 0 0 6px;
  color: var(--pink-deep);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

.cc-overlay-new[hidden] { display: none; }

.cc-overlay-inner .lb-prompt { margin-top: 8px; }

.cc-overlay-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

@keyframes cc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cc-card-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  70%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

.cc-mobile {
  display: none;
  flex-direction: column;
  gap: 8px;
  max-width: 220px;
  margin: 0 auto 12px;
}

.cc-mobile-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.cc-pad-spacer {
  min-width: 56px;
  min-height: 48px;
}

.cc-pad {
  min-width: 56px;
  min-height: 48px;
  padding: 8px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--text-dark);
  background: linear-gradient(180deg, var(--pink-soft) 0%, var(--lavender) 100%);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 1px 1px 0 #ffeef8, 2px 2px 0 var(--shadow);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.cc-pad:active {
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 0 #ffeef8, 1px 1px 0 var(--shadow);
}

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.cc-actions .btn[disabled] {
  opacity: 0.55;
  cursor: url("../assets/cursor-pink.png?v=3") 13 6, auto;
}

.cc-back-btn {
  display: inline-block;
  text-decoration: none;
  font-size: 8px !important;
}

.cc-keys {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.cc-keys-mobile { display: none; }

@media (max-width: 560px) {
  .cc-help { font-size: 17px; }
  .cc-stage-shell { padding: 4px 4px 6px; }
  .cc-mobile { display: flex; }
  .cc-keys { display: none; }
  .cc-keys-mobile { display: block; margin-top: 8px; font-size: 15px; }
}

@media (max-width: 380px) {
  .cc-game { padding-left: 4px; padding-right: 4px; }
  .cc-help { font-size: 16px; }
  .cc-stat { min-width: 64px; padding: 5px 8px; }
  .cc-stat-value { font-size: 10px; }
  .cc-pad { min-width: 48px; min-height: 44px; font-size: 11px; }
  .cc-pad-spacer { min-width: 48px; min-height: 44px; }
  .cc-stage-shell { max-width: min(340px, calc(100vw - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
  .cc-overlay,
  .cc-overlay-inner { animation: none !important; }
}

.os-body.cc-game {
  overflow: visible;
  padding-bottom: 20px;
}
