/* Master Design Stylesheet - Load Runner Logistics Arcade */

/* CSS Variable Palette matching Rainbow Plastics */
:root {
  --color-primary: #090d4e;
  --color-primary-light: #1b206b;
  --color-gray-bg: #efefef;
  --color-gray-border: rgba(9, 13, 78, 0.15);
  --color-white: #ffffff;
  --color-black: #1e1e1e;
  --color-accent: #2e8b57; /* soft green for collectibles */
  
  --font-primary: "Poppins", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-gray-bg);
  font-family: var(--font-primary);
  color: var(--color-black);
}

/* Outer game container scaling */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f8fa 0%, var(--color-white) 100%);
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Sound Toggle Button */
#sound-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-gray-border);
  background-color: var(--color-white);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(9, 13, 78, 0.05);
}
#sound-toggle:hover {
  background-color: var(--color-gray-bg);
  transform: scale(1.05);
}

/* Game Views */
.game-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
  text-align: center;
}
.game-screen.active {
  display: flex;
}

/* Menu View */
#menu-screen {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
}
.menu-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.menu-subtitle {
  font-size: 13px;
  color: #555;
  margin-bottom: 20px;
  max-width: 320px;
  line-height: 1.4;
}
.btn-primary {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
  color: var(--color-white);
  background-color: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(9, 13, 78, 0.15);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(9, 13, 78, 0.2);
  background-color: var(--color-primary-light);
}

/* HUD Panel */
#hud-screen {
  pointer-events: none;
}
.hud-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 20px;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(9, 13, 78, 0.08);
  backdrop-filter: blur(2px);
}
.hud-item {
  display: flex;
  flex-direction: column;
}
.hud-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: #777;
  letter-spacing: 1px;
}
.hud-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
}

/* PARALLAX INFINITE SCROLLING BACKGROUND */
.parallax-layer {
  position: absolute;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 1;
}

.clouds-layer {
  top: 15px;
  height: 45px;
  opacity: 0.45;
}
.cloud-asset {
  position: absolute;
  width: 80px;
  height: 25px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 80 25' fill='%23c7c9ca' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 20 A10 10 0 0 1 30 20 A8 8 0 0 1 44 18 A12 12 0 0 1 68 18 A6 6 0 0 1 80 20 L80 25 L0 25 Z' /%3E%3C/svg%3E") no-repeat;
}

.hills-layer {
  bottom: 35px;
  height: 40px;
  opacity: 0.25;
}
.hill-asset {
  position: absolute;
  width: 160px;
  height: 40px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 40' fill='%23949599' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40 C40 10, 120 10, 160 40 Z' /%3E%3C/svg%3E") no-repeat;
}

.factories-layer {
  bottom: 35px;
  height: 48px;
  opacity: 0.18;
}
.factory-asset {
  position: absolute;
  width: 140px;
  height: 48px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 48' fill='%23090d4e' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='10' y='18' width='45' height='30' rx='1' /%3E%3Cpolygon points='10,18 20,8 30,18 40,8 55,18' /%3E%3Crect x='70' y='6' width='16' height='42' /%3E%3Crect x='67' y='3' width='22' height='3' /%3E%3Cline x1='78' y1='6' x2='78' y2='25' stroke='white' stroke-width='2' /%3E%3Crect x='100' y='22' width='35' height='26' /%3E%3C/svg%3E") no-repeat;
}

/* Ground scrolling element */
#ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35px;
  background-color: var(--color-gray-bg);
  border-top: 2px solid var(--color-primary);
  z-index: 5;
}
.ground-line {
  position: absolute;
  width: 40px;
  height: 1.5px;
  background-color: rgba(9, 13, 78, 0.4);
}

/* ENTITIES BASE */
.game-entity {
  position: absolute;
  z-index: 8;
  display: block;
}

/* TRUCK STYLING */
#truck {
  transition: transform 0.08s ease-out;
  transform-origin: bottom center;
}

/* Crouch effect scale */
#truck.crouched {
  transform: scaleY(0.7);
}

.truck-flip-wrapper {
  transform: scaleX(-1);
  transform-origin: center;
  width: 100%;
  height: 100%;
}

/* Level Up Reward animation */
@keyframes levelUpUpgrade {
  0% { transform: scale(1.0); filter: brightness(1); }
  50% { transform: scale(1.22); filter: brightness(1.6) drop-shadow(0 0 8px var(--color-primary)); }
  100% { transform: scale(1.0); filter: brightness(1); }
}
.level-up-anim {
  animation: levelUpUpgrade 0.48s ease-out 1;
}

/* Bouncing suspension micro-interaction */
@keyframes suspensionBounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(1.2px); }
  100% { transform: translateY(0); }
}
.suspension-bounce {
  animation: suspensionBounce 0.16s ease-in-out infinite;
}

/* Spinnng wheel keyframe rotation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* DUST PUFF PARTICLES */
.dust-particle {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(148, 149, 153, 0.5);
  pointer-events: none;
  z-index: 6;
  filter: blur(1px);
}

/* COLLECTIBLES POP ANIMATION */
@keyframes collectPop {
  0% { transform: scale(1.0); opacity: 1.0; }
  100% { transform: scale(1.7) translateY(-25px); opacity: 0; }
}
.collected-pop {
  animation: collectPop 0.28s cubic-bezier(0.18, 0.89, 0.32, 1.28) 1 forwards !important;
}

/* FLOATING SCORE POP */
.score-pop {
  position: absolute;
  color: var(--color-accent);
  font-weight: 700;
  font-size: 11px;
  pointer-events: none;
  animation: scoreFloat 0.6s ease-out 1 forwards;
  z-index: 15;
}
@keyframes scoreFloat {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-35px); opacity: 0; }
}

/* MILESTONE FLASH */
#milestone-container {
  position: absolute;
  top: 55px;
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 30;
}
.milestone-message {
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(9, 13, 78, 0.2);
  animation: milestoneFlash 1.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards;
}
@keyframes milestoneFlash {
  0% { transform: scale(0.6) translateY(-20px); opacity: 0; }
  15% { transform: scale(1.0) translateY(0); opacity: 1; }
  80% { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(0.9) translateY(10px); opacity: 0; }
}

/* GAMEOVER VIEW */
#gameover-screen {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(6px);
  justify-content: flex-start;
  padding-top: 15px;
  overflow-y: auto;
}
.gameover-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 2px;
}
.results-grid {
  display: flex;
  gap: 15px;
  margin-bottom: 12px;
  background-color: var(--color-gray-bg);
  padding: 8px 18px;
  border-radius: 8px;
}
.results-item {
  display: flex;
  flex-direction: column;
}
.new-best-badge {
  display: inline-block;
  background-color: var(--color-accent);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  0% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* BONUS INTEGRATION DESIGN */
#bonus-simulator-integration {
  width: 100%;
  max-width: 320px;
  margin-bottom: 15px;
}
.bonus-integration-card {
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-border);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(9, 13, 78, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bonus-intro-text {
  font-size: 9.5px;
  color: #666;
}
.bonus-vehicle-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 1px;
}
.bonus-svg-wrapper {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
}
.bonus-tip {
  font-size: 7.5px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Action row */
.action-row {
  display: flex;
  gap: 12px;
  z-index: 25;
}
.btn-secondary {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  color: var(--color-primary);
  background-color: var(--color-white);
  border: 1.5px solid var(--color-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background-color: var(--color-gray-bg);
}

/* REDUCED MOTION CAPABILITY */
@media (prefers-reduced-motion: reduce) {
  .suspension-bounce, .spinning-wheel, .dust-particle, .score-pop, .milestone-message, .collected-pop {
    animation: none !important;
    transition: none !important;
  }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
  .menu-title {
    font-size: 22px;
  }
  .menu-subtitle {
    font-size: 11px;
    max-width: 260px;
    margin-bottom: 14px;
  }
  .btn-primary {
    padding: 12px 28px;
    font-size: 15px;
  }
  .hud-panel {
    gap: 12px;
    padding: 5px 10px;
  }
  .hud-label {
    font-size: 8px;
  }
  .hud-value {
    font-size: 13px;
  }
  .gameover-title {
    font-size: 18px;
  }
  .results-grid {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }
  .results-item {
    border-left: none !important;
    padding-left: 0 !important;
  }
  .action-row {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
    text-align: center;
  }
  #bonus-simulator-integration {
    max-width: 100%;
  }
  .bonus-svg-wrapper {
    height: 30px;
  }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
  .menu-title {
    font-size: 22px;
  }
  .menu-subtitle {
    font-size: 11px;
    max-width: 260px;
    margin-bottom: 14px;
  }
  .btn-primary {
    padding: 12px 28px;
    font-size: 15px;
  }
  .hud-panel {
    gap: 12px;
    padding: 5px 10px;
  }
  .hud-label {
    font-size: 8px;
  }
  .hud-value {
    font-size: 13px;
  }
  .gameover-title {
    font-size: 18px;
  }
  .results-grid {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }
  .results-item {
    border-left: none !important;
    padding-left: 0 !important;
  }
  .action-row {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
    text-align: center;
  }
  #bonus-simulator-integration {
    max-width: 100%;
  }
  .bonus-svg-wrapper {
    height: 30px;
  }
}
