* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  background: #0a0a1a;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 100%;
  padding: 40px 20px;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0a0a1a 100%);
}

#landing h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

#landing p {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: #888;
  margin-bottom: 40px;
  text-align: center;
}

.lang-selector {
  margin-bottom: 20px;
}

#lang-select {
  padding: 8px 14px;
  font-size: clamp(1rem, 3vw, 1.3rem);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  cursor: pointer;
  text-align: center;
}

#lang-select option {
  background: #1a1a3a;
  color: #fff;
}

.sites-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  max-width: 600px;
}

.site-btn {
  padding: 18px 30px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  border: 10px solid;
  border-radius: 12px;
  border-style: outset;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 180px;
  text-align: center;
  font-weight: 600;
}

.site-btn:hover {
  transform: scale(1.05);
}

.site-btn:active {
  transform: scale(0.95);
}

.site-btn.elpais { border-color: #ff6b6b; }
.site-btn.elpais:hover { background: #ff6b6b; color: #000; }
.site-btn.eldiario { border-color: #feca57; }
.site-btn.eldiario:hover { background: #feca57; color: #000; }
.site-btn.bbc { border-color: #48dbfb; }
.site-btn.bbc:hover { background: #48dbfb; color: #000; }
.site-btn.xataka { border-color: #00d2d3; }
.site-btn.xataka:hover { background: #00d2d3; color: #000; }
.site-btn.wired { border-color: #ff9ff3; }
.site-btn.wired:hover { background: #ff9ff3; color: #000; }

#game-container {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

#hud > * {
  pointer-events: auto;
}

.hud-item {
  background: rgba(0,0,0,0.7);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: clamp(0.8rem, 3vw, 1rem);
}

#back-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(0.8rem, 3vw, 1rem);
}

#back-btn:hover {
  background: rgba(255,255,255,0.25);
}

#sound-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(0.8rem, 3vw, 1rem);
}

#sound-toggle:hover {
  background: rgba(255,255,255,0.25);
}

#pause-overlay {
  display: none;
  position: absolute;
  bottom: 135px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  padding: 25px;
  border-radius: 16px;
  border-style: ridge;
  text-align: center;
  z-index: 100;
  border: 2px solid #48dbfb;
  min-width: 90vw;
  max-width: 95vw;
}

#pause-overlay h3 {
  margin-bottom: 15px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  color: #48dbfb;
}

#pause-overlay p {
  margin-bottom: 20px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  color: #ccc;
  max-width: 85vw;
  line-height: 1.4;
}

#points-text {
  display: none;
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  color: #feca57;
  font-weight: 600;
  margin: 16px 0 0 0;
  text-align: center;
}

#completion-overlay {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.95);
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  z-index: 500;
  border: 2px solid #48dbfb;
}

#completion-overlay.active {
  display: block;
}

#completion-text {
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  color: #48dbfb;
  font-weight: 600;
  margin: 0 0 20px 0;
}

#completion-continue-btn {
  padding: 12px 28px;
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  background: #48dbfb;
  color: #000;
}

.pause-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.pause-btn {
  padding: 12px 28px;
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

#read-btn {
  background: #48dbfb;
  color: #000;
  border-style: ridge;
}

#read-btn:hover {
  background: #0abde3;
}

#read-btn.read {
  background: #ff6b6b;
  color: #fff;
}

#continue-btn {
  background: #feca57;
  color: #000;
  border-style: ridge;
}

#continue-btn:hover {
  background: #f6b93b;
}

#loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#loading.active {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #48dbfb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading p {
  margin-top: 20px;
  font-size: 1.1rem;
  color: #888;
}

#start-overlay {
  display: none;
  position: absolute;
  bottom: 15vw;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  min-width: 90vw;
  max-width: 95vw;
  text-align: center;
}

#start-overlay.active {
  display: block;
}

#start-game-btn {
  padding: 15px 40px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  background: #000;
  color: #fff;
  border: 2px solid #48dbfb;
  border-radius: 12px;
  border-style: ridge;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  white-space: pre-line;
}

#start-game-btn:hover {
  background: #333;
}

#ball-lost-overlay {
  display: none;
  position: absolute;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

#ball-lost-overlay.active {
  display: block;
}

#ball-continue-btn {
  padding: 15px 40px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  background: #feca57;
  color: #000;
  border: none;
  border-radius: 12px;
  border-style: ridge;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

#ball-continue-btn:hover {
  background: #f6b93b;
}

.speed-selector {
  margin-top: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.speed-label {
  color: #888;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.speed-btn {
  padding: 8px 20px;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  border: 6px solid #555;
  border-radius: 8px;
  border-style: outset;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.speed-btn:hover {
  border-color: #48dbfb;
}

.speed-btn.active {
  border-color: #48dbfb;
  background: #48dbfb;
  color: #000;
}

.ad-banner {
  margin-top: 25px;
  text-align: center;
}

#edit-sites-link {
  margin-top: 30px;
  color: #888;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

#edit-sites-link:hover { color: #fff; }

#edit-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 300;
  justify-content: center;
  align-items: center;
}

#edit-modal.active { display: flex; }

#edit-modal-content {
  background: #1a1a3a;
  padding: 30px;
  border-radius: 12px;
  min-width: 80vw;
  max-width: 90vw;
  width: 90%;
  height: 85vh;
  display: flex;
  flex-direction: column;
  border: 2px solid #48dbfb;
}

#edit-modal-content h3 { margin-bottom: 15px; color: #48dbfb; }
#edit-modal-content p { margin-bottom: 10px; font-size: 1.2rem; color: #ccc; }

#sites-textarea {
  width: 100%;
  flex: 1;
  background: #0a0a1a;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px;
  font-family: monospace;
  font-size: 1rem;
  resize: vertical;
  margin-bottom: 15px;
}

.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

#save-sites-btn { background: #48dbfb; color: #000; }
#cancel-sites-btn { background: #555; color: #fff; }

#game-over {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 150;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#game-over.active {
  display: flex;
}

#game-over h2 {
  font-size: clamp(2rem, 8vw, 3rem);
  margin-bottom: 10px;
  color: #ff6b6b;
}

#game-over .final-score {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  margin-bottom: 30px;
  color: #feca57;
}

#play-again-btn {
  padding: 15px 40px;
  font-size: clamp(1rem, 4vw, 1.3rem);
  background: #48dbfb;
  color: #000;
  border: none;
  border-radius: 12px;
  border-style: ridge;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 15px;
}

#play-again-btn:hover {
  background: #0abde3;
}

#menu-btn {
  padding: 12px 30px;
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 12px;
  border-style: ridge;
  cursor: pointer;
  font-weight: 600;
}

#menu-btn:hover {
  background: rgba(255,255,255,0.1);
}

#lives-display {
  display: flex;
  gap: 5px;
}

.life {
  width: 20px;
  height: 20px;
  background: #ff6b6b;
  border-radius: 50%;
  display: inline-block;
}

.life.lost {
  background: #333;
}

@media (max-width: 500px) and (orientation: portrait) {
  .site-btn {
    min-width: 45%;
    padding: 15px 10px;
    font-size: 0.9rem;
  }
}

.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(20, 20, 20, 0.95);
  color: #ffffff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.5);
}

.consent-text {
  text-align: center;
  line-height: 1.4;
}

.consent-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.consent-btn {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font: inherit;
  cursor: pointer;
  color: #ffffff;
  min-width: 96px;
}

.consent-accept {
  background: #2e7d32;
}

.consent-accept:hover {
  background: #1b5e20;
}

.consent-reject {
  background: #555555;
}

.consent-reject:hover {
  background: #333333;
}
