/* Македонска Игра - Ретро Аркаден Стил */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #0a0a0a;
  color: #f5f5f5;
  font-family: 'Rubik', sans-serif;
  user-select: none;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
}

.font-pixel {
  font-family: 'Press Start 2P', monospace;
}

.container {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
header {
  width: 100%;
  background: #171717;
  border: 1px solid #262626;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 22px;
  animation: pulse 2s infinite;
}

.brand-title {
  font-size: 13px;
  color: #facc15;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  letter-spacing: 0.5px;
}

.brand-title .red {
  color: #ef4444;
}

.brand-sub {
  font-size: 10px;
  color: #a3a3a3;
  font-family: monospace;
}

.btn-help {
  background: #262626;
  color: #e5e5e5;
  border: 1px solid #404040;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-family: monospace;
}
.btn-help:active {
  transform: scale(0.96);
}

/* Game Tabs */
.tabs-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: #09090b;
  border: 1px solid #262626;
  border-top: none;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  padding: 6px;
  margin-bottom: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

@media (min-width: 480px) {
  .tabs-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.tab-btn {
  background: #171717;
  border: 1px solid #262626;
  color: #a3a3a3;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s;
}

.tab-btn .tab-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.tab-btn .tab-name {
  font-size: 11px;
  font-weight: bold;
  line-height: 1.2;
}

.tab-btn .tab-sub {
  font-size: 9px;
  font-family: monospace;
  margin-top: 2px;
}

.tab-btn.active-snake {
  background: rgba(6, 78, 59, 0.8);
  border-color: #10b981;
  color: #a7f3d0;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.tab-btn.active-tetris {
  background: rgba(127, 29, 29, 0.8);
  border-color: #ef4444;
  color: #fecaca;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.tab-btn.active-pacman {
  background: rgba(120, 53, 15, 0.8);
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.tab-btn.active-bratce {
  background: rgba(88, 28, 135, 0.8);
  border-color: #a855f7;
  color: #e9d5ff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.tab-btn.active-tender {
  background: rgba(131, 24, 67, 0.8);
  border-color: #ec4899;
  color: #fbcfe8;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.tab-btn.active-race {
  background: rgba(30, 58, 138, 0.8);
  border-color: #3b82f6;
  color: #bfdbfe;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* Subtitle ribbon */
.subtitle-ribbon {
  width: 100%;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
}

/* Top HUD */
.hud-bar {
  width: 100%;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hud-box {
  background: #0d0d0d;
  border: 1px solid #333;
  padding: 4px 10px;
  border-radius: 8px;
}

.hud-label {
  font-size: 9px;
  font-family: monospace;
  color: #a3a3a3;
  text-transform: uppercase;
}

.hud-val {
  font-size: 16px;
  font-weight: bold;
}

/* Canvas Area */
.canvas-wrapper {
  position: relative;
  border: 2px solid #333;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: none;
}

/* CRT scanlines effect */
.crt-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  z-index: 5;
}

/* Game Over / Pause Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  z-index: 10;
}

.overlay-title {
  font-size: 14px;
  margin-bottom: 8px;
}

.overlay-desc {
  font-size: 11px;
  color: #d4d4d4;
  margin-bottom: 14px;
  max-width: 240px;
  line-height: 1.4;
  font-family: monospace;
}

.btn-restart {
  background: #eab308;
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn-restart:active {
  transform: scale(0.95);
}

/* Mobile Controls */
.controls-wrapper {
  width: 100%;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 16px;
  padding: 12px 16px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
}

.dpad-btn {
  background: #262626;
  border: 1px solid #404040;
  color: #fff;
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.dpad-btn:active {
  background: #404040;
  transform: scale(0.92);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-center { grid-column: 2; grid-row: 2; background: #171717; border-color: #333; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-action {
  width: 80px;
  height: 48px;
  background: #3b82f6;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.btn-action:active {
  transform: scale(0.94);
}

.btn-pause {
  background: #262626;
  border: 1px solid #404040;
  color: #d4d4d4;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 10px;
  cursor: pointer;
  font-family: monospace;
}

/* Footer */
footer {
  width: 100%;
  border-top: 1px solid #1f1f1f;
  margin-top: 14px;
  padding: 10px 4px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #737373;
  font-family: monospace;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #171717;
  border: 1px solid #404040;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}
