/* Campus Dude — Shared Game Kit CSS (gamekit.css)
   Consistent HUD, controls, overlays, help modal, fullscreen, sound, and juice styling. */

.game-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  user-select: none;
}

/* Immersive Fullscreen Mode for iOS and Standard Fullscreen (docs/22) */
.game-shell.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;   /* dvh, not vh */
  max-width: 100vw !important;
  z-index: 9999 !important;
  background: var(--bg, #0d0d0f) !important;
  margin: 0 !important;
  padding: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* HUD + controls stay compact & visible; canvas dominates stage */
.game-shell.is-fullscreen .gk-hud {
  margin-bottom: 6px;
  padding: 6px 12px;
  max-width: 100%;
}
.game-shell.is-fullscreen .gk-controls {
  margin-top: 6px;
  gap: 6px;
}
.game-shell.is-fullscreen .gk-stage {
  flex: 1;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px !important;
  box-sizing: border-box !important;
}
.game-shell.is-fullscreen .gk-canvas,
.game-shell.is-fullscreen #carrom-canvas,
.game-shell.is-fullscreen .game-stage canvas {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

/* Fullscreen Responsive Sizing for Grid/Board Games */
.game-shell.is-fullscreen .board-2048,
.game-shell.is-fullscreen .chess-board,
.game-shell.is-fullscreen .c4-board-box,
.game-shell.is-fullscreen .memory-grid,
.game-shell.is-fullscreen .ms-grid-board,
.game-shell.is-fullscreen .sudoku-board-box,
.game-shell.is-fullscreen .ttt-grid-board,
.game-shell.is-fullscreen .whack-grid {
  width: min(92vw, calc(100dvh - 160px), 480px) !important;
  height: min(92vw, calc(100dvh - 160px), 480px) !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto !important;
}
.game-shell.is-fullscreen .tetris-grid-layout {
  max-height: min(75dvh, 480px) !important;
  align-items: center !important;
}

/* Header HUD Row */
.gk-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-sizing: border-box;
  font-family: var(--font-display);
}

.gk-hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gk-hud-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

.gk-hud-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.gk-hud-value.accent {
  color: var(--accent);
}

/* Stage & Canvas Area (docs/24 Responsive Canvas Display) */
.gk-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.gk-canvas, #carrom-canvas, .game-stage canvas {
  display: block;
  touch-action: none;
  max-height: min(65vh, 560px);
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Standard Control Toolbar */
.gk-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}

.gk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.gk-btn:hover {
  background: var(--bg);
  border-color: var(--ink);
  transform: translateY(-1px);
}

.gk-btn:active {
  transform: translateY(1px);
}

.gk-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.gk-btn.primary:hover {
  opacity: 0.92;
}

.gk-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Modal Overlay (Pause, Game Over, Win, Help) */
.gk-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(18, 18, 20, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
  z-index: 100;
  animation: gkFadeIn 0.2s ease-out;
}

@keyframes gkFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.gk-overlay-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 340px;
  width: 92%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

.gk-overlay-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 8px;
  color: var(--ink);
}

.gk-overlay-msg {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.4;
}

.gk-help-section {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.gk-help-label {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.gk-stats-row {
  display: flex;
  justify-content: space-around;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 18px;
}

/* Screen Shake Animation */
.gk-shake {
  animation: gkShakeAnim 0.25s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes gkShakeAnim {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* Responsive Mobile Compaction (docs/24) */
@media (max-width: 600px) {
  .game-shell {
    max-width: 100%;
    padding: 0 4px;
  }
  .gk-hud {
    padding: 6px 10px;
    margin-bottom: 8px;
  }
  .gk-hud-label {
    font-size: 0.7rem;
  }
  .gk-hud-value {
    font-size: 1.1rem;
  }
  .gk-controls {
    margin-top: 8px;
    gap: 6px;
  }
  .gk-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .gk-stage {
    padding: 4px;
  }
}

