* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --red-primary: #C8102E;
  --red-dark: #9B0A20;
  --red-light: #E8384F;
  --gold: #FFD700;
  --dark: #1A1A2E;
  --dark-bg: #0F0F1A;
  --white: #FFFFFF;
  --gray-light: #E0E0E0;
  --gray: #888;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Open Sans', sans-serif;
  background: var(--dark-bg);
  color: var(--white);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Screens */
.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* Buttons */
.btn {
  font-family: 'Russo One', sans-serif;
  font-size: 16px;
  padding: 14px 32px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  color: var(--white);
  box-shadow: 0 4px 20px rgba(200, 16, 46, 0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
}

.btn-secondary:active {
  background: rgba(255,255,255,0.1);
}

.btn-full {
  width: 100%;
  margin-top: 12px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 14px;
  margin-top: 16px;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
}

/* SPLASH SCREEN */
#screen-splash {
  background: url('assets/images/Fondo_.webp') center/cover no-repeat;
}

.splash-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 11.3vh 24px 40px;
  text-align: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.3) 0%,
    rgba(0,0,0,0.6) 50%,
    rgba(0,0,0,0.85) 100%
  );
  gap: 12px;
}

.splash-logo {
  width: 634px;
  max-width: 100%;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
  animation: floatIn 0.8s ease-out;
}

.splash-subtitle-img {
  width: 275px;
  max-width: 75%;
  margin-top: -65px;
}

.splash-tagline {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  max-width: 320px;
  line-height: 1.5;
  margin: 12vh 0 20px;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(-30px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* FORM SCREENS */
.form-container, .tutorial-container, .results-container, .ranking-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 40px 24px;
  background: linear-gradient(160deg, var(--dark-bg) 0%, #1A0A15 100%);
}

.form-container h2, .tutorial-container h2, .results-container h2, .ranking-container h2 {
  font-family: 'Russo One', sans-serif;
  font-size: 24px;
  color: var(--white);
  margin-bottom: 8px;
}

.form-subtitle, .tutorial-subtitle, .results-subtitle, .ranking-subtitle {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 24px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-light);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: var(--white);
  font-size: 15px;
  font-family: 'Open Sans', sans-serif;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--red-primary);
}

.form-group select option {
  background: var(--dark);
  color: var(--white);
}

.form-note {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* TUTORIAL */
.tutorial-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.tutorial-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  padding: 16px;
  border-radius: 12px;
}

.tutorial-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.tutorial-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.tutorial-item p {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.4;
}

.tutorial-tip {
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 16px;
  font-style: italic;
}

/* GAME */
#screen-game {
  background: #000;
}

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

/* RESULTS */
.results-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.results-scores {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 20px 0;
}

.score-box {
  background: rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.score-box-total {
  background: linear-gradient(135deg, rgba(200,16,46,0.3), rgba(200,16,46,0.1));
  border: 1px solid rgba(200,16,46,0.4);
}

.score-label {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 4px;
}

.score-value {
  font-family: 'Russo One', sans-serif;
  font-size: 36px;
  color: var(--gold);
}

.results-stats {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 16px;
}

.results-footer {
  font-size: 12px;
  color: var(--gray);
  margin-top: 16px;
  font-style: italic;
}

/* RANKING */
.ranking-player-pos {
  background: linear-gradient(135deg, rgba(200,16,46,0.25), rgba(200,16,46,0.08));
  border: 1px solid rgba(200,16,46,0.4);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
  margin-bottom: 16px;
  display: none;
}

.ranking-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: transparent;
  color: var(--gray);
  font-size: 13px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  border-color: var(--red-primary);
  color: var(--white);
  background: rgba(200,16,46,0.15);
}

.ranking-table-wrapper {
  width: 100%;
  max-height: 45vh;
  overflow-y: auto;
  border-radius: 12px;
  margin-bottom: 16px;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ranking-table thead th {
  position: sticky;
  top: 0;
  background: var(--dark);
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--gray);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ranking-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ranking-table tbody tr.current-player {
  background: rgba(200,16,46,0.15);
}

.ranking-table tbody td {
  padding: 10px 8px;
  color: var(--gray-light);
}

.ranking-table tbody td:first-child {
  font-family: 'Russo One', sans-serif;
  color: var(--gold);
}

.ranking-table tbody tr:nth-child(1) td:first-child { color: #FFD700; }
.ranking-table tbody tr:nth-child(2) td:first-child { color: #C0C0C0; }
.ranking-table tbody tr:nth-child(3) td:first-child { color: #CD7F32; }

/* Loading spinner */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray);
}

/* Error toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-dark);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 999;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.form-error-message {
  background: rgba(200, 16, 46, 0.15);
  border: 1px solid var(--red-primary);
  color: var(--red-light);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* T&C and Privacy Links */
.link-tc {
  display: inline-block;
  font-size: 12px;
  color: var(--gray);
  text-decoration: underline;
  margin-top: 16px;
  cursor: pointer;
  transition: color 0.2s;
}

.link-tc:hover {
  color: var(--white);
}

.link-inline {
  color: var(--gray-light);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.link-inline:hover {
  color: var(--white);
}

.footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  width: 100%;
}

