/* Operatie Kerst - Modern Mobile Game UI - MOBILE FIRST */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-size: 16px;
}

body {
  background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #c41e3a 100%);
  background-image: 
    url('../8bit.png'),
    linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #c41e3a 100%);
  background-blend-mode: overlay;
  background-attachment: fixed;
  background-size: auto, cover;
  background-repeat: no-repeat;
  background-position: center calc(100% - max(0px, env(safe-area-inset-bottom))), center top;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: 0 0 0 0;
}

.game-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px 140px 8px;
  gap: 6px;
  position: relative;
}

/* Header Section */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.game-logo {
  height: 40px;
  width: auto;
}

.header-center {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  flex: 1;
}

h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-align: right;
}

.subtitle {
  font-size: 10px;
  opacity: 0.9;
  margin: 2px 0 0;
  font-weight: 400;
  line-height: 1.2;
}

/* Modern HUD Stats Container - deprecated, keeping for reference */
.hud-container {
  display: none;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 6px 10px;
  min-width: 68px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  align-self: center;
}

.stat-card:active {
  transform: scale(0.95);
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 8px;
  opacity: 0.85;
  margin-top: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.timer-card .stat-value {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Timer warning states */
.timer-card.timer-warning .stat-value {
  color: #ff6b6b;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
  font-weight: 900;
}

.timer-card.timer-critical .stat-value {
  color: #ff0000;
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  animation: timerFlash 0.5s ease-in-out infinite;
}

@keyframes timerFlash {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Game Canvas */
#gameCanvas {
  border-radius: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  background: rgba(215, 223, 200, 0.6);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  width: 90vw;
  height: auto;
  max-width: 95vmin;
  display: block;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  margin: 8px 0;
  aspect-ratio: 384 / 544;
}

/* Status Overlay */
.status-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 20px 30px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  max-width: 80%;
}

.status-overlay:not(:empty) {
  opacity: 1;
}

/* Mobile D-Pad Styles */
.dpad-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 16px 0 20px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 100;
}

.dpad-grid {
  display: inline-grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  pointer-events: auto;
}

.dpad-button {
  width: 56px;
  height: 56px;
  background: rgba(255, 82, 82, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  font-family: 'Arial', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: all 0.15s ease;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 4px 15px rgba(255, 82, 82, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  font-weight: bold;
  backdrop-filter: blur(10px);
  line-height: 1;
}

.dpad-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 82, 82, 0.65);
  box-shadow: 0 6px 20px rgba(255, 82, 82, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dpad-button:active {
  transform: translateY(0);
  background: rgba(255, 82, 82, 0.75);
  box-shadow: 0 2px 8px rgba(255, 82, 82, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dpad-up {
  grid-column: 2;
  grid-row: 1;
}

.dpad-down {
  grid-column: 2;
  grid-row: 2;
}

.dpad-left {
  grid-column: 1;
  grid-row: 2;
}

.dpad-right {
  grid-column: 3;
  grid-row: 2;
}

/* Desktop Help Text */
.help {
  font-size: 12px;
  opacity: 0.9;
  text-align: center;
  display: none;
  width: 100%;
  margin-top: 8px;
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  margin: 0 3px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.status-message {
  margin-top: 8px;
  height: 20px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

/* Scores Modal */
.scores-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.scores-modal.active {
  display: flex;
}

.scores-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 255, 0.95) 100%);
  border-radius: 24px;
  padding: 24px 16px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  color: #333;
}

.scores-content h2 {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 4px 0;
  background: linear-gradient(135deg, #1a472a 0%, #c41e3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.scores-subtitle {
  font-size: 12px;
  color: #666;
  margin: 0 0 16px 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scores-table {
  background: rgba(26, 71, 42, 0.08);
  border-radius: 12px;
  margin: 16px 0;
  overflow: hidden;
  border: 2px solid rgba(26, 71, 42, 0.15);
}

.scores-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(26, 71, 42, 0.12);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a472a;
  border-bottom: 2px solid rgba(26, 71, 42, 0.15);
}

.scores-body {
  max-height: 280px;
  overflow-y: auto;
}

.score-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(26, 71, 42, 0.08);
  font-size: 13px;
  align-items: center;
}

.score-row:last-child {
  border-bottom: none;
}

.score-row.completed {
  background: rgba(26, 71, 42, 0.05);
}

.score-row.failed {
  background: rgba(196, 30, 58, 0.05);
}

.score-level {
  font-weight: 600;
  color: #1a472a;
  text-align: left;
}

.score-count {
  font-weight: 700;
  color: #c41e3a;
  font-size: 15px;
}

.score-status {
  font-size: 13px;
  font-weight: 600;
}

.status-completed {
  color: #1a472a;
}

.status-failed {
  color: #c41e3a;
}

.scores-total {
  margin: 16px 0;
  padding: 12px;
  background: linear-gradient(135deg, rgba(26, 71, 42, 0.1) 0%, rgba(196, 30, 58, 0.1) 100%);
  border-radius: 12px;
  border: 2px solid rgba(26, 71, 42, 0.2);
}

.total-label {
  display: none;
}

.total-value {
  font-size: 18px;
  font-weight: 700;
  color: #1a472a;
}

.scores-button {
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin: 10px 0;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(26, 71, 42, 0.3);
  text-decoration: none;
  text-align: center;
}

.scores-button-link {
  background: linear-gradient(135deg, #c41e3a 0%, #ff4d52 100%);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.scores-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26, 71, 42, 0.4);
}

.scores-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26, 71, 42, 0.3);
}

.scores-button-link:hover {
  box-shadow: 0 6px 16px rgba(196, 30, 58, 0.4);
}

.scores-button-link:active {
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3);
}

.scores-button.secondary {
  background: linear-gradient(135deg, #c41e3a 0%, #ff4d52 100%);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.scores-button.secondary:hover {
  box-shadow: 0 6px 16px rgba(196, 30, 58, 0.4);
}

.scores-button.secondary:active {
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3);
}

/* Tablet Responsive (480px+) */
@media (min-width: 480px) {
  .game-container {
    padding: 16px;
    gap: 14px;
  }

  .game-header {
    padding: 20px 0;
    margin-top: 20px;
  }

  h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 13px;
    margin-top: 8px;
  }

  .hud-container {
    gap: 12px;
    padding: 0;
  }

  .stat-card {
    min-width: 100px;
    padding: 14px 18px;
  }

  .stat-value {
    font-size: 24px;
  }

  #gameCanvas {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    max-width: 95vw;
    margin: 12px 0;
  }

  .dpad-grid {
    grid-template-columns: 64px 64px 64px;
    grid-template-rows: 64px 64px;
    gap: 10px;
    padding: 16px;
  }

  .dpad-button {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }
}

/* Desktop Responsive (768px+) */
@media (min-width: 768px) {
  body {
    min-height: 100vh;
    justify-content: center;
    background-position: left bottom, center top;
  }

  .game-container {
    max-width: 900px;
    padding: 12px 24px 32px 24px;
    gap: 20px;
  }

  .game-header {
    padding: 4px 0;
    margin-top: 60px;
  }

  .help {
    display: block;
  }

  .dpad-container {
    display: none;
  }

  h1 {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 1.5px;
  }

  .subtitle {
    font-size: 15px;
    margin-top: 10px;
  }

  .hud-container {
    gap: 18px;
  }

  .stat-card {
    min-width: 120px;
    padding: 18px 24px;
    border-radius: 20px;
  }

  .stat-value {
    font-size: 28px;
  }

  .stat-label {
    font-size: 11px;
    margin-top: 6px;
  }

  .game-logo {
    height: 80px;
  }

  #gameCanvas {
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 28px;
    max-width: 400px;
    height: auto;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    margin: 20px 0;
  }

  .pill {
    padding: 6px 12px;
    font-size: 12px;
  }

  .status-message {
    font-size: 14px;
    margin-top: 12px;
  }
}

/* Info Button */
.info-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  font-size: 32px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.4);
  }
}

.info-button:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.3);
}

.info-button:active {
  transform: scale(0.95);
}

/* Info Modal - Retro 8bit Style */
.info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.info-modal.active {
  display: flex;
}

.info-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 255, 0.95) 100%);
  border-radius: 24px;
  padding: 24px 16px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  color: #333;
  position: relative;
}

.info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(196, 30, 58, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.info-close:hover {
  background: rgba(196, 30, 58, 1);
  transform: scale(1.1);
}

.info-close:active {
  transform: scale(0.95);
}

.info-title {
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, #1a472a 0%, #c41e3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.info-text {
  color: #333;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 20px 0;
  text-align: center;
}

.info-button-link {
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin: 10px 0 0 0;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #c41e3a 0%, #ff4d52 100%);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.info-button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(196, 30, 58, 0.4);
}

.info-button-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3);
}

@media (max-width: 767px) {
  .info-button {
    bottom: 20px;
    right: 20px;
  }
  
  .info-content {
    padding: 20px;
  }
  
  .info-title {
    font-size: 20px;
  }
  
  .info-text {
    font-size: 14px;
  }
}
