@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ═══════════════════════════════════════════════
   RESET & TOKENS
═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple:      #552583;
  --purple-dark: #3d1a61;
  --purple-light:#7b3bbf;
  --gold:        #FDB927;
  --gold-dark:   #d49610;
  --black:       #000000;
  --white:       #ffffff;

  --bg:          #f5f5f7;
  --surface:     #ffffff;
  --border:      #e2e2e8;
  --border2:     #d0d0da;

  --text:        #111111;
  --text2:       #555568;
  --text3:       #999aaa;

  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --radius-xl:   24px;
}

html { height: 100%; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--purple);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

.screen { display: none; flex-direction: column; flex: 1; min-height: 100dvh; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-bottom: 12px;
  padding-left: 20px;
  padding-right: 20px;
  background: var(--purple);
  position: relative;
}

.app-logo {
  font-family: 'Nunito', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.back-btn {
  position: absolute;
  left: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.round-badge {
  position: absolute;
  right: 16px;
  background: rgba(253,185,39,0.2);
  border: 1px solid rgba(253,185,39,0.4);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════
   BODY & FOOTER
═══════════════════════════════════════════════ */
.screen-body {
  flex: 1;
  padding: 20px 20px 8px;
  overflow-y: auto;
}

.screen-footer {
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 16px);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
}
.screen-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
}

.section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════════════
   TELA 1 — REGRAS
═══════════════════════════════════════════════ */
.rule-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.rule-icon {
  width: 44px; height: 44px;
  background: rgba(85,37,131,0.1);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--purple);
  font-size: 22px;
  flex-shrink: 0;
}

.rule-info { flex: 1; }
.rule-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.rule-hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--purple);
  background: transparent;
  color: var(--purple);
  font-size: 20px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s;
}
.step-btn:active { background: var(--purple); color: var(--white); transform: scale(0.9); }
.step-val {
  font-size: 26px;
  font-weight: 900;
  color: var(--gold-dark);
  min-width: 36px;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   TELA 2 — TIMES
═══════════════════════════════════════════════ */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.team-slot {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
}
.team-slot:active { transform: scale(0.96); }
.team-slot.selected {
  border-color: var(--purple);
  background: rgba(85,37,131,0.05);
}

.slot-jersey { flex-shrink: 0; display: flex; align-items: center; }

.team-name-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}

.check-badge {
  width: 20px; height: 20px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 11px;
  flex-shrink: 0;
}

.count-badge {
  background: var(--purple);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: none;
  letter-spacing: 0;
}

/* Fila preview */
.queue-section { margin-bottom: 12px; }
.queue-list { display: flex; flex-direction: column; gap: 6px; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.queue-pos {
  width: 22px; height: 22px;
  background: var(--purple);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.queue-name { font-size: 14px; font-weight: 700; color: var(--text); }
.queue-empty { font-size: 13px; color: var(--text3); }

/* ═══════════════════════════════════════════════
   BOTÕES
═══════════════════════════════════════════════ */
.btn-primary {
  width: 100%; padding: 15px;
  background: var(--purple);
  color: var(--white);
  border: none; border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 16px; font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.btn-secondary {
  width: 100%; padding: 13px;
  background: transparent;
  color: var(--purple);
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 800;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:active { background: rgba(85,37,131,0.08); }

/* ═══════════════════════════════════════════════
   TELA 3 — PARTIDA
═══════════════════════════════════════════════ */

/* Timer */
.timer-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 20px 12px;
}
.timer-ring {
  position: relative;
  width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.timer-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: rgba(85,37,131,0.1);
  stroke-width: 8;
}
.ring-fill {
  fill: none;
  stroke: var(--purple);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-inner {
  text-align: center;
  z-index: 1;
}
.timer-big {
  font-family: 'Nunito', sans-serif;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--purple);
  line-height: 1;
  transition: color 0.3s;
}
.timer-big.warning { color: #d97706; animation: blink-warn 1s ease-in-out infinite; }
.timer-big.done    { color: #dc2626; }
@keyframes blink-warn { 0%,100% { opacity:1; } 50% { opacity:0.55; } }
.timer-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Placar */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 36px 1fr;
  gap: 8px;
  padding: 0 16px 14px;
  align-items: stretch;
}
.team-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; overflow: hidden;
  border-top-color: var(--team-color, var(--border));
  border-top-width: 4px;
}
.jersey-wrap { display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.team-nm {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text2);
}
.team-score-num {
  font-family: 'Nunito', sans-serif;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}
.score-btns { display: flex; gap: 6px; margin-top: 4px; }
.score-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: all 0.1s; font-weight: 800;
  -webkit-tap-highlight-color: transparent;
}
.score-btn:active { transform: scale(0.82); }
.score-btn.add {
  background: var(--gold);
  border-color: var(--gold-dark);
  color: var(--black);
}
.score-btn.minus { font-size: 22px; }
.vs-col { display: flex; align-items: center; justify-content: center; }
.vs-label {
  font-family: 'Nunito', sans-serif;
  font-size: 20px; font-weight: 900; color: var(--text3);
}

/* Controles do timer */
.timer-controls { display: flex; gap: 10px; padding: 0 16px 12px; }
.ctrl-btn {
  flex: 1; padding: 13px 10px; border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 800; letter-spacing: 0.5px;
  cursor: pointer; border: 2px solid var(--border);
  background: var(--bg); color: var(--text2);
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:active { transform: scale(0.97); }
.ctrl-btn.start {
  background: rgba(85,37,131,0.08);
  border-color: var(--purple);
  color: var(--purple);
}
.ctrl-btn.pause {
  background: rgba(253,185,39,0.12);
  border-color: var(--gold-dark);
  color: #92640a;
}
.ctrl-btn.end-game {
  background: rgba(220,38,38,0.06);
  border-color: rgba(220,38,38,0.4);
  color: #dc2626;
}

/* Info strips */
.info-strip {
  margin: 0 16px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.info-strip-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 7px;
}
.next-teams { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.next-name { font-size: 14px; font-weight: 700; color: var(--text); }
.vs-mini { font-size: 11px; color: var(--text3); font-weight: 800; }
.queue-chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.q-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 20px;
}

/* ═══════════════════════════════════════════════
   TELA 4 — RESULTADO
═══════════════════════════════════════════════ */
.result-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.result-hero { text-align: center; padding-bottom: 16px; }
.result-icon-big { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.result-title {
  font-size: 34px;
  font-weight: 900;
  color: var(--purple);
  margin-bottom: 4px;
}
.result-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
}

.result-scoreline {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 0; margin-bottom: 14px;
  border-top: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
}
.res-team { text-align: center; }
.res-jersey { display: flex; justify-content: center; margin-bottom: 6px; }
.res-name {
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--text2); margin-bottom: 4px;
}
.res-score-num {
  font-family: 'Nunito', sans-serif;
  font-size: 52px; font-weight: 900; line-height: 1;
  color: var(--text);
}
.res-vs { font-size: 22px; font-weight: 900; color: var(--text3); }

.info-card {
  background: rgba(85,37,131,0.05);
  border: 1px solid rgba(85,37,131,0.15);
  border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 14px;
  font-size: 14px; color: var(--text2); line-height: 1.6;
}
.info-card strong { color: var(--purple); font-weight: 800; }

/* Próximo jogo box */
.next-game-box {
  background: var(--bg);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  text-align: center;
}
.next-game-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 12px;
}
.next-game-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.next-game-team {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 800; color: var(--text);
}
.next-vs {
  font-size: 18px; font-weight: 900; color: var(--purple);
}

/* Sorteio */
.sorteio-note { font-size: 13px; color: var(--text2); margin-bottom: 10px; text-align: center; }
.btn-shuffle {
  width: 100%; padding: 14px;
  background: rgba(85,37,131,0.08); color: var(--purple);
  border: 2px solid var(--purple); border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px;
  cursor: pointer; margin-bottom: 10px; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-shuffle:active { transform: scale(0.98); opacity: 0.85; }
.sorteio-result-card {
  background: rgba(85,37,131,0.05);
  border: 1px solid rgba(85,37,131,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}

/* ═══════════════════════════════════════════════
   SORTEADOR DE COLETES
═══════════════════════════════════════════════ */
.draft-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1.5px solid var(--border);
}
.draft-hint {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 14px;
  margin-top: -6px;
}
.draft-main-btn {
  width: 100%;
  padding: 18px;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 14px;
}
.draft-main-btn:active { transform: scale(0.97); opacity: 0.9; }
.draft-main-btn:disabled {
  background: var(--border);
  color: var(--text3);
  cursor: not-allowed;
  transform: none;
}

.draft-result {
  background: rgba(85,37,131,0.06);
  border: 2px solid var(--purple);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  animation: pop-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop-in {
  0%   { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
.draft-result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.draft-result-name {
  font-size: 24px;
  font-weight: 900;
  color: var(--purple);
}
.draft-result-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.5px;
}

.draft-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.draft-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.draft-list-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}
.draft-list-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  min-width: 28px;
  text-align: right;
}
.draft-dots {
  display: flex;
  gap: 4px;
  margin-left: 4px;
}
.draft-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}

.draft-reset-btn {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--text3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.draft-reset-btn:active { background: var(--bg); }
