/* ============================================================
   TRAFFIC RULES ADVENTURE — KIDSGURU CANVAS GAME STYLES
   ============================================================ */
:root {
  --font-family: 'Fredoka', 'Poppins', sans-serif;
  --bg: #0f172a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ── App Header ── */
.game-app-header {
  position: relative;
  z-index: 50;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.app-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 6px 14px;
  border-radius: 50px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
}

.app-back-btn:active {
  transform: scale(0.93);
  background: rgba(255, 255, 255, 0.28);
}

.game-app-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.4px;
}

/* ── Canvas Wrapper ── */
.canvas-container {
  flex-grow: 1;
  width: 100%;
  height: calc(100vh - 52px);
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}


/* =================================================================
   3D GLOSSY ARCADE BUTTON STYLES FOR GAME UI
   ================================================================= */
.app-back-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 7px 20px !important;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 55%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-radius: 50px !important;
  border: 3px solid #7dd3fc !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.85),
    inset 0 -3.5px 0 rgba(3, 105, 161, 0.7),
    0 6px 14px rgba(2, 132, 199, 0.4) !important;
  font-family: 'Fredoka', 'Poppins', sans-serif !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: 0.6px !important;
  text-transform: uppercase !important;
  text-decoration: none !important;
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.4) !important;
  position: relative !important;
  overflow: hidden !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  min-height: 40px !important;
  user-select: none !important;
  touch-action: manipulation !important;
}

.app-back-btn::before {
  content: '' !important;
  position: absolute !important;
  top: 2px !important;
  left: 10px !important;
  right: 10px !important;
  height: 38% !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.1) 100%) !important;
  border-radius: 50px 50px 20px 20px !important;
  pointer-events: none !important;
}

.app-back-btn:hover {
  background: linear-gradient(180deg, #56c6f8 0%, #0390d9 55%, #0278b8 100%) !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -3.5px 0 rgba(3, 105, 161, 0.7),
    0 8px 18px rgba(2, 132, 199, 0.5) !important;
  transform: translateY(-2px) !important;
}

.app-back-btn:active {
  transform: translateY(2px) !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1.5px 0 rgba(3, 105, 161, 0.7),
    0 3px 6px rgba(2, 132, 199, 0.3) !important;
}

/* 3D Glossy Arcade Action & Game Buttons */
button,
.btn,
.btn-primary,
.btn-secondary,
.game-btn,
.play-btn,
.start-btn,
.restart-btn,
.next-btn,
.action-btn,
.option-btn,
.choice-btn,
.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(180deg, #8ae629 0%, #5cb811 55%, #469a08 100%);
  color: #ffffff;
  font-family: 'Fredoka', 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 50px;
  border: 3.5px solid #abf250;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.85),
    inset 0 -4px 0 rgba(35, 75, 5, 0.55),
    0 6px 16px rgba(70, 154, 8, 0.45);
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

button::before,
.btn::before,
.btn-primary::before,
.btn-secondary::before,
.game-btn::before,
.play-btn::before,
.start-btn::before,
.restart-btn::before,
.next-btn::before,
.action-btn::before,
.option-btn::before,
.choice-btn::before,
.control-btn::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 10px;
  right: 10px;
  height: 38%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.1) 100%);
  border-radius: 50px 50px 20px 20px;
  pointer-events: none;
}

button:hover,
.btn:hover,
.btn-primary:hover,
.game-btn:hover,
.play-btn:hover,
.start-btn:hover,
.restart-btn:hover,
.next-btn:hover,
.action-btn:hover,
.option-btn:hover,
.choice-btn:hover,
.control-btn:hover {
  background: linear-gradient(180deg, #96f033 0%, #68cf15 55%, #4ea809 100%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.95),
    inset 0 -4px 0 rgba(35, 75, 5, 0.55),
    0 9px 22px rgba(70, 154, 8, 0.6);
  transform: translateY(-2px);
}

button:active,
.btn:active,
.btn-primary:active,
.game-btn:active,
.play-btn:active,
.start-btn:active,
.restart-btn:active,
.next-btn:active,
.action-btn:active,
.option-btn:active,
.choice-btn:active,
.control-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(35, 75, 5, 0.55),
    0 3px 8px rgba(70, 154, 8, 0.3);
}

/* Secondary Button Blue Variant */
.btn-secondary,
.btn-blue {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 55%, #0369a1 100%) !important;
  border-color: #7dd3fc !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.85),
    inset 0 -3.5px 0 rgba(3, 105, 161, 0.7),
    0 6px 14px rgba(2, 132, 199, 0.4) !important;
}

.btn-secondary:hover,
.btn-blue:hover {
  background: linear-gradient(180deg, #56c6f8 0%, #0390d9 55%, #0278b8 100%) !important;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -3.5px 0 rgba(3, 105, 161, 0.7),
    0 8px 18px rgba(2, 132, 199, 0.5) !important;
}