:root {
  --bg: #0d0d10;
  --surface: #16161c;
  --surface-2: #1e1e26;
  --border: #2a2a35;
  --gold: #d4a843;
  --gold-dim: #8a6f2e;
  --text: #e8e6e0;
  --text-dim: #9a978f;
  --green: #4caf7d;
  --red: #c75450;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px 60px;
}

header { text-align: center; padding: 28px 0 12px; }
h1 { font-size: 1.6rem; letter-spacing: 0.5px; }
.subtitle { color: var(--gold); font-size: 0.85rem; margin-top: 4px; }

#auth-box { margin-top: 16px; }
#login-form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#login-form input {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 0.95rem; width: 150px;
}
#login-pin { width: 110px !important; }
button {
  background: var(--gold); color: #14130d; border: none; padding: 9px 18px;
  border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
button:hover { filter: brightness(1.1); }
#logged-in { display: flex; gap: 12px; justify-content: center; align-items: center; }
#logged-in.hidden, #login-form.hidden { display: none; }
#player-name { color: var(--gold); font-weight: 600; }
#logout-btn { background: var(--surface-2); color: var(--text-dim); padding: 6px 14px; }
#auth-msg { font-size: 0.85rem; margin-top: 8px; color: var(--red); min-height: 1.2em; }
#auth-msg.ok { color: var(--green); }

#tabs {
  display: flex; gap: 4px; margin: 18px 0 14px; border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: none; color: var(--text-dim); border-radius: 8px 8px 0 0;
  padding: 10px 14px; font-size: 0.9rem; white-space: nowrap;
}
.tab.active { color: var(--gold); border-bottom: 2px solid var(--gold); }

.panel { display: none; }
.panel.active { display: block; }

.filters { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filters select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 8px; font-size: 0.9rem;
}
.toggle { font-size: 0.85rem; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }

.day-header {
  color: var(--gold); font-size: 0.85rem; text-transform: capitalize;
  margin: 22px 0 8px; letter-spacing: 0.5px; font-weight: 600;
}

.match {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
}
.match.closed { opacity: 0.85; }
.match-top { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 8px; }
.match-stage { color: var(--gold-dim); font-weight: 600; }
.match-row { display: flex; align-items: center; gap: 8px; }
.team { flex: 1; font-size: 0.95rem; display: flex; align-items: center; gap: 7px; }
.team.away { justify-content: flex-end; text-align: right; }
.team .flag { font-size: 1.3rem; }
.team.tbd { color: var(--text-dim); font-style: italic; }
.score-box { display: flex; align-items: center; gap: 5px; }
.score-box input {
  width: 42px; height: 38px; text-align: center; font-size: 1.05rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px;
}
.score-box input:focus { border-color: var(--gold); outline: none; }
.score-box input:disabled { opacity: 0.45; }
.score-sep { color: var(--text-dim); }
.result-line {
  margin-top: 8px; font-size: 0.82rem; color: var(--text-dim);
  display: flex; justify-content: space-between; align-items: center;
}
.final-score { color: var(--text); font-weight: 700; }
.pts { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; }
.pts-3 { background: var(--gold); color: #14130d; }
.pts-1 { background: var(--green); color: #0d1410; }
.pts-0 { background: var(--surface-2); color: var(--text-dim); }
.save-state { font-size: 0.78rem; min-width: 80px; text-align: right; }
.save-state.saved { color: var(--green); }
.save-state.error { color: var(--red); }

table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--gold); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
td.num, th.num { text-align: right; }
tr.me td { color: var(--gold); font-weight: 600; }
.rank { color: var(--text-dim); width: 30px; }

.note { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 14px; }
.pick-match-header { margin: 20px 0 6px; font-size: 0.92rem; font-weight: 600; }
.pick-line { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--surface); border-radius: 8px; margin-bottom: 4px; font-size: 0.88rem; }

.rules { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.rules h2 { color: var(--gold); font-size: 1.1rem; margin-bottom: 12px; }
.rules li { margin: 10px 0 10px 18px; line-height: 1.5; font-size: 0.92rem; }

.hidden { display: none !important; }

.pot-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 18px;
}
.pot-form textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: 8px; font-size: 0.92rem;
  font-family: inherit; resize: vertical;
}
.pot-form textarea:focus { border-color: var(--gold); outline: none; }
.pot-form-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.file-label { cursor: pointer; color: var(--text-dim); font-size: 0.85rem; }
.file-label input { display: none; }
.file-label span { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; display: inline-block; }
.file-label:hover span { border-color: var(--gold-dim); color: var(--text); }
#pot-msg { font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }
#pot-msg.ok { color: var(--green); }
#pot-msg.error { color: var(--red); }

#pot-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pot-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.pot-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.pot-card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pot-desc { font-size: 0.9rem; line-height: 1.4; flex: 1; }
.pot-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--text-dim); }
.pot-meta strong { color: var(--gold); font-weight: 600; }
.pot-remove { background: none; border: none; color: var(--red); font-size: 0.78rem; padding: 2px 4px; cursor: pointer; }

.bet-form-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 0.9rem; color: var(--text-dim); }
.bet-form-row select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 8px; font-size: 0.9rem; flex: 1;
}
.bet-section { color: var(--gold); font-size: 0.95rem; margin: 22px 0 10px; }
.bet-card {
  background: var(--surface); border: 1px solid var(--gold-dim); border-radius: 12px;
  padding: 14px; margin-bottom: 10px; font-size: 0.9rem;
}
.bet-card.pending { border-color: var(--border); }
.bet-terms {
  background: var(--surface-2); border-radius: 8px; padding: 10px 12px;
  margin: 8px 0; font-size: 0.9rem; line-height: 1.4;
}
.bet-actions { display: flex; gap: 10px; margin-top: 8px; }
.bet-decline, .bet-withdraw { background: var(--surface-2); color: var(--text-dim); }
#bet-msg { font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }
#bet-msg.ok { color: var(--green); }
#bet-msg.error { color: var(--red); }

footer { text-align: center; color: var(--text-dim); font-size: 0.75rem; margin-top: 50px; }

.empty { color: var(--text-dim); text-align: center; padding: 30px 0; font-size: 0.9rem; }

@media (max-width: 480px) {
  .team { font-size: 0.85rem; }
  .team .flag { font-size: 1.1rem; }
  .score-box input { width: 38px; height: 36px; }
}
