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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1117;
  color: #e8e8e8;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.8rem;
  color: #4fc3f7;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 4px;
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
}

.view.active {
  display: flex;
}

.country-selector, .platform-select {
  margin-bottom: 16px;
  text-align: center;
}

.country-selector label, .platform-select label {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 6px;
}

select {
  background: #1e2230;
  color: #e8e8e8;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1rem;
  cursor: pointer;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-tabs .tab {
  flex: 1;
  background: #1a1e2a;
  color: #888;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px 0;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tabs .tab:hover {
  background: #2a3040;
  color: #ccc;
}

.filter-tabs .tab.active {
  background: #4fc3f7;
  color: #0f1117;
  border-color: #4fc3f7;
}

.platform-selector {
  margin-bottom: 16px;
  text-align: center;
}

.platform-selector label {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 6px;
}

.ranking-list {
  flex: 1;
  margin-bottom: 20px;
}

.ranking-list .loading {
  text-align: center;
  color: #888;
  padding: 20px;
}

.partidos-list {
  flex: 1;
  margin-bottom: 20px;
}

.partidos-list .loading {
  text-align: center;
  color: #888;
  padding: 20px;
}

.match-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: #1a1e2a;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.match-card:hover {
  background: #2a3040;
}

.match-card .match-teams {
  font-size: 1.1rem;
  font-weight: bold;
  color: #e8e8e8;
}

.match-card .match-league {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 2px;
}

.match-card .match-meta {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

.match-card .countdown {
  color: #4fc3f7;
  font-weight: bold;
}

.match-card .live-time {
  color: #f44336;
  font-weight: bold;
}

.match-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-match {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-calibrar {
  background: #1a2332;
  color: #4fc3f7;
  border-color: #2a4055;
}

.btn-calibrar:hover {
  background: #243350;
  border-color: #4fc3f7;
}

.btn-stats {
  background: #1a2332;
  color: #aaa;
  border-color: #333;
}

.btn-stats:hover {
  background: #243350;
  color: #ccc;
  border-color: #555;
}

.btn-disabled {
  background: #1a1e2a;
  color: #555;
  border-color: #2a2a2a;
  cursor: not-allowed;
  font-size: 0.75rem;
  opacity: 0.7;
}

.btn-disabled:hover {
  background: #1a1e2a;
  border-color: #2a2a2a;
}

.match-info {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  color: #4fc3f7;
  padding: 10px 14px;
  background: #1a1e2a;
  border-radius: 8px;
  margin-bottom: 12px;
}

.rank-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #1a1e2a;
  border-radius: 8px;
  margin-bottom: 6px;
}

.rank-pos {
  font-weight: bold;
  color: #4fc3f7;
  min-width: 28px;
}

.rank-offset {
  font-weight: bold;
}

.rank-offset.negative { color: #66bb6a; }
.rank-offset.positive { color: #ef5350; }

.rank-platform {
  font-size: 0.8rem;
  color: #888;
}

.empty-ranking {
  text-align: center;
  color: #888;
  padding: 30px 20px;
}

.btn-primary {
  background: #4fc3f7;
  color: #0f1117;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #29b6f6;
}

.btn-secondary {
  background: transparent;
  color: #888;
  border: none;
  padding: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 12px;
}

.btn-secondary:hover {
  color: #ccc;
}

.instruction {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.offset-display {
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  color: #4fc3f7;
  margin: 10px 0;
  transition: color 0.15s;
}

.offset-display.negative { color: #66bb6a; }
.offset-display.positive { color: #ef5350; }

.mitad-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.mitad-btn {
  flex: 1;
  padding: 12px;
  background: #1a1e2a;
  border: 1px solid #2a3040;
  border-radius: 10px;
  color: #888;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mitad-btn.active {
  background: #4fc3f7;
  color: #0d1117;
  border-color: #4fc3f7;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 6px;
  text-align: center;
}

.input-group input {
  width: 100%;
  background: #1e2230;
  color: #e8e8e8;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.3rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.input-group input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.resultado-texto {
  text-align: center;
  font-size: 1.3rem;
  margin: 30px 0;
  line-height: 1.6;
}

.resultado-texto .puesto {
  font-size: 2rem;
  font-weight: bold;
  color: #4fc3f7;
  display: block;
  margin: 10px 0;
}

.result-stats {
  text-align: left;
  margin: 16px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #1a1e2a;
  border-radius: 8px;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.9rem;
  color: #ccc;
}

.stat-value {
  font-weight: bold;
  color: #4fc3f7;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-telegram {
  background: #2aabe2;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  display: block;
}

.btn-telegram:hover {
  background: #229ed9;
}

/* ── Community Survey Styles ── */

.stat-block {
  background: #161a24;
  border: 1px solid #2a3040;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.stat-title {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: #e0e0e0;
}

.stat-block .stat-row {
  background: #1a1e2a;
  margin-bottom: 4px;
  padding: 8px 12px;
}

.stat-block .stat-value {
  color: #4fc3f7;
}

.disclaimer {
  font-size: 0.8rem;
  color: #888;
  line-height: 1.5;
  margin: 12px 0;
  padding: 10px 14px;
  background: #11141c;
  border-radius: 8px;
  border-left: 3px solid #444;
}

.outlier-warning {
  background: #2a1a1a;
  border: 1px solid #5a3030;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: #e0a0a0;
  margin: 8px 0;
}

.plataformas-teaser {
  margin: 16px 0;
}

.teaser-title {
  font-size: 0.95rem;
  font-weight: bold;
  color: #ccc;
  margin-bottom: 8px;
}

.teaser-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #1a1e2a;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: #aaa;
}

.teaser-lock {
  font-size: 0.8rem;
  color: #666;
  text-align: center;
  margin-top: 8px;
  padding: 8px;
  background: #11141c;
  border-radius: 6px;
}

.metodologia-texto {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #ccc;
  padding: 16px;
  background: #161a24;
  border-radius: 12px;
  margin-bottom: 16px;
}

.link-metodologia {
  color: #4fc3f7;
  text-decoration: none;
  font-size: 0.85rem;
}

.link-metodologia:hover {
  text-decoration: underline;
}

footer {
  text-align: center;
  padding: 16px 0 8px;
}

.country-selector {
  margin: 12px 0;
}

.country-selector label {
  font-size: 0.9rem;
  color: #ccc;
  margin-right: 8px;
}

.country-selector select,
.platform-select select {
  background: #1a1e2a;
  color: #e0e0e0;
  border: 1px solid #2a3040;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.platform-select {
  margin: 12px 0;
}

.platform-select label {
  display: block;
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 6px;
}

.filtros-partidos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filtro-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 120px;
}

.filtro-group label {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 4px;
}

.filtro-group select {
  background: #1a1e2a;
  color: #e0e0e0;
  border: 1px solid #2a3040;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  width: 100%;
}

.filtro-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #ccc;
  cursor: pointer;
  white-space: nowrap;
  padding-bottom: 8px;
}

.filtro-toggle input {
  accent-color: #4fc3f7;
  cursor: pointer;
}
