:root {
  --bg: #0e2038;         /* navy del logo RAFASCORE */
  --surface: #ffffff;
  --surface-alt: #f4f6fb;
  --text: #101828;
  --text-muted: #667085;
  --border: #e4e7ec;
  --accent: #0e2038;      /* stesso navy, usato per bottoni/tab attiva */
  --brand-lime: #a3cc23;  /* verde lime del logo, solo per accenti decorativi */
  --live: #4d7600;        /* variante scura del lime, leggibile come testo di stato */
  --live-bg: #eef6d9;
  --finished: #667085;
  --finished-bg: #f2f4f7;
  --scheduled: #f79009;
  --scheduled-bg: #fff6e8;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --success: #12b76a;
  --success-bg: #ecfdf3;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--surface-alt);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  text-align: center;
}

.logo-img {
  height: 34px;
  width: auto;
  display: block;
  margin: 0 auto;
}

#app {
  padding: 20px 16px calc(96px + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
}

.view[hidden] { display: none; }

/* --- Vista Carica --- */
.upload-screen {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 320px;
  line-height: 1.5;
}

.upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(14, 32, 56, 0.28), 0 0 0 4px var(--live-bg);
  border: 2px solid var(--brand-lime);
  transition: transform 0.15s ease;
  user-select: none;
}
.upload-btn:active { transform: scale(0.96); }
.upload-btn-icon { font-size: 44px; }

.upload-status {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Liste / card --- */
.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state {
  display: none;
  text-align: center;
  color: var(--text-muted);
  margin-top: 60px;
  font-size: 15px;
  padding: 0 24px;
}
.empty-state.visible { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
}

.card-status {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.card-status.live { color: var(--live); background: var(--live-bg); }
.card-status.finished { color: var(--finished); background: var(--finished-bg); }
.card-status.won { color: var(--success); background: var(--success-bg); }
.card-status.lost { color: var(--danger); background: var(--danger-bg); }

.card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.card-delete:hover,
.card-delete:active {
  color: var(--danger);
  background: var(--danger-bg);
}

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.match:first-child { border-top: none; }

.match-teams {
  font-size: 14.5px;
  font-weight: 600;
  flex: 1;
}

.match-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 15px;
  min-width: 46px;
  text-align: center;
}

.match-state {
  font-size: 11px;
  font-weight: 700;
  min-width: 58px;
  text-align: right;
}
.match-state.live { color: var(--live); }
.match-state.scheduled { color: var(--scheduled); }
.match-state.finished { color: var(--finished); }
.match-state.unknown { color: var(--finished); font-style: italic; }
.match-state.won { color: var(--success); }
.match-state.lost { color: var(--danger); }

/* --- Tabbar --- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  z-index: 10;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
}
.tab-icon { font-size: 20px; }
.tab[aria-current="true"] { color: var(--accent); }

.tab-badge {
  position: absolute;
  top: 0;
  right: calc(50% - 26px);
  background: var(--brand-lime);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 6px;
}
