/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f0f0f;
  --bg2:      #1a1a1a;
  --bg3:      #252525;
  --border:   #2e2e2e;
  --text1:    #f0f0f0;
  --text2:    #b0b0b0;
  --text3:    #707070;
  --gold:     #e8a020;
  --gold-dk:  #c07010;
  --green:    #4ade80;
  --red:      #f87171;
  --radius:   14px;
  --radius-sm:8px;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text1);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  position: relative;
}

/* ── Screens ──────────────────────────────────────── */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 20px 40px;
  animation: fadeIn .2s ease;
}
.hidden { display: none !important; }

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

/* ── Hero / Landing ───────────────────────────────── */
.hero {
  text-align: center;
  padding: 32px 0 24px;
}
.logo {
  font-size: 3rem;
  margin-bottom: 8px;
}
.hero h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 0.95rem;
  color: var(--text2);
  line-height: 1.5;
}

/* ── Match banner (landing) ───────────────────────── */
.match-banner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}
.match-banner .teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.match-banner .team {
  text-align: center;
  flex: 1;
}
.match-banner .team .flag { font-size: 2.2rem; }
.match-banner .team .name { font-size: 0.78rem; color: var(--text2); margin-top: 4px; font-weight: 600; }
.match-banner .vs { font-size: 0.8rem; font-weight: 700; color: var(--text3); padding: 0 8px; }
.match-banner .match-meta {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
}
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ef4444;
  margin-right: 5px;
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Prize preview ────────────────────────────────── */
.prize-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.prize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.prize-item.major { border-left: 3px solid var(--green); }
.prize-item.minor { border-left: 3px solid var(--gold); }
.prize-icon { font-size: 1.4rem; }
.prize-item strong { display: block; font-size: 0.85rem; color: var(--text1); }
.prize-item span   { font-size: 0.75rem; color: var(--text2); margin-top: 2px; display: block; }

/* ── Buttons ──────────────────────────────────────── */
.btn-main {
  width: 100%;
  padding: 15px;
  background: var(--gold);
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-top: auto;
}
.btn-main:hover  { background: var(--gold-dk); }
.btn-main:active { transform: scale(.98); }
.btn-main:disabled { opacity: .5; cursor: not-allowed; }

.btn-back {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 6px;
}
.btn-back:hover { color: var(--text1); }

/* ── Screen header ────────────────────────────────── */
.screen-header { margin-bottom: 20px; }
.screen-header h2 { font-size: 1.3rem; font-weight: 700; }

/* ── Form fields ──────────────────────────────────── */
.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
}
.field .optional { font-weight: 400; color: var(--text3); }
.field input, .field select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text1);
  font-size: 0.95rem;
  transition: border-color .15s;
  width: 100%;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
}
.field small { font-size: 0.72rem; color: var(--text3); }

/* ── Score picker ─────────────────────────────────── */
/* .match-card ahora vive dentro de .predict-card, sin estilo propio */
.match-card { text-align: center; }
.match-card .match-desc { font-size: 0.75rem; color: var(--gold); font-weight: 600; margin-bottom: 4px; }

.predict-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px 20px;
  margin-bottom: 16px;
}

.score-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 0;
}
.score-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 6px;
}
.score-team .flag-img { margin: 0 auto; }
.score-team .name { font-size: 0.72rem; color: var(--text2); font-weight: 600; text-align: center; }

.score-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.score-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text1);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.score-btn:hover { background: var(--border); }
.score-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 36px;
  text-align: center;
  line-height: 1;
}
.score-dash { font-size: 1.4rem; color: var(--text3); }

/* ── Prize reminder ───────────────────────────────── */
.prize-reminder {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.6;
}
.prize-reminder .pr-row { display: flex; gap: 8px; align-items: baseline; }
.prize-reminder .pr-row + .pr-row { margin-top: 4px; }

/* ── Confirm screen ───────────────────────────────── */
.confirm-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 40px;
  flex: 1;
}
.confirm-icon { font-size: 4rem; margin-bottom: 16px; }
.confirm-wrap h2 { font-size: 1.6rem; font-weight: 800; color: var(--gold); margin-bottom: 8px; }
.confirm-wrap > p { font-size: 0.9rem; color: var(--text2); line-height: 1.6; margin-bottom: 24px; }

.ticket {
  background: var(--bg2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 12px;
}
.ticket-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--bg3);
}
.ticket-row:last-child { border: none; }
.ticket-key { color: var(--text3); }
.ticket-val { color: var(--text1); font-weight: 700; }
.ticket-id  { font-family: monospace; font-size: 1rem; color: var(--gold); }

.ticket-note { font-size: 0.75rem; color: var(--text3); }

/* ── Admin ────────────────────────────────────────── */
.admin-wrap { width: 100%; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-header h2 { font-size: 1.2rem; font-weight: 700; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.admin-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.admin-section h3 { font-size: 0.85rem; font-weight: 700; color: var(--gold); margin-bottom: 14px; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg3);
  border-radius: 26px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 4px; top: 4px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.admin-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
.admin-feedback.success { background: #14532d; color: var(--green); }
.admin-feedback.error   { background: #450a0a; color: var(--red);   }

/* ── Admin login ──────────────────────────────────── */
.login-wrap {
  max-width: 320px;
  margin: 80px auto 0;
  text-align: center;
}
.login-wrap .logo { font-size: 2.5rem; margin-bottom: 8px; }
.login-wrap h2   { font-size: 1.3rem; font-weight: 700; margin-bottom: 24px; }
.login-wrap .field { text-align: left; }
.error-msg { color: var(--red); font-size: 0.82rem; margin-top: 8px; }

/* ── Partidos del día ─────────────────────────────── */
.matches-date { font-size:0.8rem; color:var(--text3); text-align:center; margin:-8px 0 16px; text-transform:capitalize; }

.match-day-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  margin-bottom: 14px;
  transition: border-color .2s;
}
.match-day-card:not(.started) { border-color: var(--gold-dk); }

.mdc-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.mdc-team { display:flex; flex-direction:column; align-items:center; gap:6px; flex:1; }
.flag-img { width: 48px; height: auto; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.4); display:block; }
.score-team .flag-img { width: 40px; }
.ticket-val .flag-img { width: 22px; vertical-align: middle; border-radius: 2px; }
.mdc-name { font-size: 0.78rem; font-weight: 600; color: var(--text1); text-align:center; }

.mdc-meta {
  font-size: 0.75rem;
  color: var(--text3);
  text-align: center;
  margin-bottom: 12px;
}

.mdc-prizes {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.mdc-prizes span {
  font-size: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--text2);
}

.mdc-btn { margin: 0; width: 100%; }

.mdc-locked {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text3);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 10px;
  border: 1px solid var(--border);
}
.match-day-card.started { opacity: 0.55; }

/* ── Phone row ────────────────────────────────────── */
.phone-row { display:flex; gap:8px; align-items:stretch; }
.phone-row input { flex:1; width:auto; }

/* ── Country code picker ──────────────────────────── */
.cc-picker { position:relative; flex:0 0 auto; }

.cc-selected {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 10px;
  cursor: pointer;
  height: 100%;
  min-width: 88px;
  transition: border-color .15s;
}
.cc-selected:hover { border-color: var(--gold); }
.cc-flag-img { width:24px; height:auto; border-radius:2px; display:block; flex-shrink:0; }
.cc-selected span { font-size:0.88rem; color:var(--text1); white-space:nowrap; }
.cc-arrow { font-size:0.7rem; color:var(--text3); margin-left:auto; }

.cc-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 210px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
}
.cc-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .1s;
}
.cc-option:hover { background: var(--bg2); }
.cc-option .cc-flag-img { width:28px; }
.cc-opt-name { flex:1; font-size:0.88rem; color:var(--text1); }
.cc-opt-code { font-size:0.82rem; color:var(--text3); }

/* ── Legal footer ─────────────────────────────────── */
.legal { font-size: 0.7rem; color: var(--text3); text-align: center; margin-top: 16px; line-height: 1.5; }

/* ── Spinner ──────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin link ───────────────────────────────────── */
#admin-link {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 1.4rem;
  color: var(--text2);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity .2s;
  z-index: 9999;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#admin-link:hover { opacity: 1; }
