/* calcetto_gay — Joga Bonito / Brazil street design system. */

@font-face {
  font-family: "Marker";
  src: url("/static/fonts/permanent-marker.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Anton";
  src: url("/static/fonts/anton.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0a3a26;
  --bg-2: #0e4a30;
  --panel: #0d3b27;
  --panel-2: #103f2b;
  --edge: rgba(255, 212, 41, 0.22);
  --yellow: #ffd429;
  --yellow-2: #ffe66b;
  --blue: #2742d6;
  --blue-2: #3f7bff;
  --cream: #f6f1df;
  --cream-dim: #b9c7ac;
  --ink: #0a2a1c;
  --up: #b6f24a;
  --down: #ff5a4d;
  --star: #ffd429;
  --card-h: 140px;
}

* { box-sizing: border-box; }

html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  padding: 0;
  color: var(--cream);
  font-family: system-ui, -apple-system, sans-serif;
  position: relative;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 196, 60, 0.18), transparent 55%),
    radial-gradient(120% 90% at 100% 110%, rgba(255, 150, 40, 0.12), transparent 50%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 55%, #08311f 100%);
  background-attachment: fixed;
}
/* the centered content column (topbar spans full width separately) */
main {
  display: block;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 14px 64px;
}
/* subtle stadium grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--yellow-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: "Marker", system-ui, sans-serif;
  font-weight: 400;
  color: var(--yellow);
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  line-height: 1.05;
}
h1 { font-size: 34px; margin: 18px 0; }
h2 { font-size: 23px; margin: 26px 0 12px; }
h3 { font-size: 17px; margin: 16px 0 8px; color: var(--cream); }

small { color: var(--cream-dim); }

/* ---- topbar ---- */
.topbar {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(6, 40, 25, 0.96), rgba(6, 40, 25, 0.78));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px;
}
.logo {
  font-family: "Marker", sans-serif;
  font-size: 27px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-2deg);
  display: inline-block;
}
.logo::before { content: "★ "; color: var(--blue-2); font-size: 16px; vertical-align: middle; }
.topbar .user {
  font-size: 13px;
  color: var(--ink);
  background: var(--yellow);
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 700;
}
.topbar .user:hover { text-decoration: none; background: var(--yellow-2); }

/* ---- buttons ---- */
button, .btn {
  display: inline-block;
  font-family: "Marker", sans-serif;
  font-size: 16px;
  letter-spacing: 0.5px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, background 0.15s ease;
}
button:hover, .btn:hover { background: var(--yellow-2); text-decoration: none; }
button:active, .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn.secondary { background: var(--blue); color: #fff; }
.btn.secondary:hover { background: var(--blue-2); }
.btn.danger { background: var(--down); color: #fff; }
.btn.danger:hover { background: #ff7264; }
.danger-zone { margin: 16px 0 4px; }

/* ---- section headers ---- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2::before { content: "★ "; color: var(--blue-2); font-size: 16px; }

/* ---- generic rows (scorers / history) ---- */
.row {
  padding: 8px 10px;
  margin: 5px 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--yellow);
}
.scorer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scorer .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorer .score { flex: none; font-family: "Anton", sans-serif; color: var(--yellow); font-size: 17px; letter-spacing: 1px; }
.history .row::before { content: "★ "; color: var(--blue-2); }
a.row { display: block; color: var(--cream); text-decoration: none; transition: background .12s, border-color .12s; }
a.row:hover { background: rgba(255, 212, 41, 0.10); border-left-color: var(--yellow-2); }
a.row.history-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-link .h-meta { color: var(--cream-dim); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-link .h-score { flex: none; font-family: "Marker", sans-serif; }
.history-link .h-score b { font-family: "Anton", sans-serif; color: var(--cream); letter-spacing: 1px; }
.history-link .h-win { color: var(--yellow); }
.history-link .h-win b { color: var(--yellow); }
.num { font-family: "Anton", sans-serif; color: var(--yellow); }

.error { color: #ffd0cb; }
.flash {
  background: rgba(255, 90, 77, 0.18);
  color: #ffd9d4;
  border: 1px solid var(--down);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 10px 0;
  font-weight: 600;
}

/* ---- cards ---- */
.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: var(--card-h);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
/* two-column card: info on the left, photo filling the right half */
.card-row { display: flex; gap: 12px; align-items: stretch; flex: 1; }
.card-info { flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.card-photo {
  position: relative;
  flex: 0 0 50%;
  align-self: stretch;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--yellow);
}
/* image/placeholder fill the column absolutely so they never drive card height */
.card-photo img,
.card-photo .placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.card-photo img { object-fit: cover; display: block; }
.card-photo .placeholder {
  display: grid;
  place-items: center;
  font-family: "Marker", sans-serif;
  font-size: 38px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--yellow), #f2a900);
}
.card .name {
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--cream);
  letter-spacing: 0.3px;
}
.cap-badge {
  display: inline-grid;
  place-items: center;
  width: 19px; height: 19px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}
.attr { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 3px 0; }
.attr .label {
  width: 66px;
  color: var(--cream-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}
.stars { display: inline-flex; gap: 2px; font-size: 15px; line-height: 1; }
/* Each star is an empty (outline) glyph by default; full = gold; half = gold left
   half clipped over the empty base. No image assets — pure overlay. */
.st { position: relative; display: inline-block; width: 1em; height: 1em; }
.st::before { content: "\2605"; color: rgba(246, 241, 223, .26); }
.st-full::before { color: var(--star); }
.st-half::after {
  content: "\2605";
  position: absolute; left: 0; top: 0;
  width: 50%; overflow: hidden;
  color: var(--star);
}
.trend { font-size: 13px; font-weight: 700; }
.trend-up { color: var(--up); }
.trend-down { color: var(--down); }
.pick { width: 100%; margin-top: 10px; }

/* ---- teams ---- */
.team {
  border-radius: 14px;
  padding: 10px 12px 14px;
  margin: 16px 0;
  border: 1px solid var(--edge);
}
.team h2 { margin: 4px 0 10px; }
.team1 {
  background: linear-gradient(180deg, rgba(255, 212, 41, 0.14), rgba(255, 212, 41, 0.04));
  border-color: rgba(255, 212, 41, 0.45);
}
.team1 h2 { color: var(--yellow); }
.team2 {
  background: linear-gradient(180deg, rgba(63, 123, 255, 0.18), rgba(39, 66, 214, 0.05));
  border-color: rgba(63, 123, 255, 0.5);
}
.team2 h2 { color: var(--blue-2); }

/* winning team: a soft gold glow that breathes out from under the card. It pulses
   entirely from ZERO — at the low point there is no shadow and no border tint, so the
   card is pixel-identical to the losing team's; at the peak a diffuse halo emanates
   from behind the edges. No persistent band: only the box-shadow animates. */
.team.win {
  position: relative;
  animation: win-halo 3s ease-in-out infinite;
}
@keyframes win-halo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 236, 120, 0), 0 0 0 0 rgba(255, 212, 41, 0); }
  50%      { box-shadow: 0 0 10px 0 rgba(255, 236, 120, 0.6), 0 0 18px 1px rgba(255, 212, 41, 0.38); }
}
.team.win::after {
  content: "🏆";
  position: absolute;
  top: -12px; right: 10px;
  font-size: 22px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}
.card.empty {
  display: grid;
  place-items: center;
  min-height: var(--card-h);
  font-family: "Marker", sans-serif;
  font-size: 32px;
  color: var(--cream-dim);
  background: transparent;
  border: 2px dashed var(--edge);
}
/* clickable empty slot (your team, your turn) — overrides default button look */
button.card.empty.slot-pick {
  width: 100%;
  cursor: pointer;
  box-shadow: none;
  transition: border-color .12s, color .12s, background .12s, transform .08s;
}
button.card.empty.slot-pick:hover {
  border-color: var(--yellow);
  border-style: solid;
  color: var(--yellow);
  background: rgba(255, 212, 41, 0.08);
  transform: none;
}
button.card.empty.slot-pick:active { transform: translateY(1px); }

/* ---- match meta + scoreboard ---- */
.match-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: "Marker", sans-serif;
  font-size: 15px;
  color: var(--cream);
  padding: 8px 0;
}
.status {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
}
.status-draft { background: var(--blue); color: #fff; }
.status-live { background: var(--yellow); color: var(--ink); }
.status-finished { background: #0a8c4a; color: #fff; }

.final-stats {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
}
.fs-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 14px;
  color: var(--cream-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.fs-row .num { font-size: 20px; margin-left: auto; }
.fs-row .ic { color: var(--star); }
.final-stats .goals { margin-top: 8px; border-top: 1px dashed var(--edge); padding-top: 8px; }
.final-stats .goals .ghead {
  font-family: "Marker", sans-serif;
  color: var(--yellow);
  font-size: 16px;
}
.final-stats .goals .grow { font-size: 14px; padding: 2px 0; }
.final-stats .goals .grow .balls { letter-spacing: 3px; }

.conclude { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.conclude .inline-form { display: inline; margin: 0; }

/* ---- draft turn banner ---- */
.draft-turn {
  text-align: center;
  font-family: "Marker", sans-serif;
  font-size: 19px;
  padding: 12px;
  margin: 14px 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  border: 2px solid var(--blue-2);
}
.draft-turn.mine { background: var(--yellow); color: var(--ink); border-color: #f2a900; }

/* taken / own cards in the bottom roster during a draft */
.card.dim { opacity: .42; filter: saturate(.7); }

/* ---- pick modal ---- */
[x-cloak] { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 18, 11, 0.74);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 12px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  padding: 14px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-family: "Marker", sans-serif; font-size: 22px; }
.modal-x {
  width: auto; background: none; color: var(--cream); border: none;
  font-size: 20px; line-height: 1; padding: 4px 8px; box-shadow: none;
}
.modal-x:hover { background: none; color: var(--yellow); transform: none; }
.modal-body { display: block; }
.pick-grid { display: flex; flex-direction: column; gap: 10px; }
.modal-empty { text-align: center; color: var(--cream-dim); padding: 16px; }

/* ---- forms ---- */
form.login, form.match-new, form.finish, .profile { display: flex; flex-direction: column; gap: 12px; }
label { font-size: 14px; color: var(--cream); }
input, select {
  width: 100%;
  padding: 11px;
  font-size: 16px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--edge);
  border-radius: 9px;
}
input:focus, select:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 212, 41, 0.2); }
select option { color: #000; }

fieldset {
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px 14px;
}
legend { font-family: "Marker", sans-serif; color: var(--yellow); padding: 0 6px; font-size: 16px; }
.fb { display: flex; gap: 12px; align-items: center; margin: 5px 0; font-size: 14px; }
.fb-label { width: 66px; color: var(--cream-dim); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.fb input[type="radio"] { width: auto; }
.goals-in input { width: 5em; display: inline-block; }

/* ---- feedback (valutazione) cards: player-card look + thumb toggles + goal stepper ---- */
.fb-form .fb-intro { color: var(--cream-dim); font-size: 13px; margin: -4px 0 4px; }
.fb-card .card-info { flex: 1 1 64%; }      /* more room for the thumbs */
.fb-card .card-photo { flex: 0 0 36%; }
.fb-card .attr { gap: 6px; }
.thumbs { display: inline-flex; gap: 5px; margin-left: auto; }
.thumb {
  width: auto;
  padding: 3px 7px;
  font-size: 15px;
  line-height: 1;
  border-radius: 9px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
  filter: grayscale(0.7) opacity(0.55);          /* dim until selected */
  transition: filter .12s, background .12s, border-color .12s, transform .08s;
}
.thumb:hover { filter: grayscale(0.15) opacity(0.95); background: rgba(255, 255, 255, 0.1); transform: none; }
.thumb.on { filter: none; }
.thumb.up.on { background: rgba(182, 242, 74, 0.20); border-color: var(--up); }
.thumb.down.on { background: rgba(255, 90, 77, 0.20); border-color: var(--down); }
.thumb:active { transform: translateY(1px); box-shadow: none; }

.fb-goals {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--edge);
}
.fb-goals .glabel { text-transform: uppercase; font-size: 11px; letter-spacing: 1px; color: var(--cream-dim); }
.fb-goals .goal-n {
  font-family: "Anton", sans-serif;
  color: var(--yellow);
  font-size: 20px;
  min-width: 1.6em;
  text-align: center;
}
.gbtn {
  width: auto;
  padding: 4px 12px;
  font-size: 15px;
  font-family: "Anton", sans-serif;
  letter-spacing: 1px;
  border-radius: 9px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--edge);
  box-shadow: none;
}
.gbtn:hover { background: rgba(255, 212, 41, 0.14); border-color: var(--yellow); transform: none; }
.gbtn:active { transform: translateY(1px); box-shadow: none; }
.fb-submit { align-self: flex-start; margin-top: 6px; }

/* ---- login poster ---- */
.login {
  margin-top: 14vh;
  align-items: stretch;
  text-align: center;
}
.login .brand {
  font-family: "Marker", sans-serif;
  font-size: 46px;
  color: var(--yellow);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
  margin: 0 0 6px;
  line-height: 1;
}
.login .tagline { color: var(--cream-dim); letter-spacing: 2px; text-transform: uppercase; font-size: 12px; margin-bottom: 18px; }
.login .stars { color: var(--blue-2); font-size: 20px; letter-spacing: 6px; display: block; margin-bottom: 18px; }

/* ---- profile ---- */
.photo-form { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 4px; }
.photo-btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.photo-btn input[type="file"] { display: none; }   /* hide the native "Choose file" box */
.photo-hint { color: var(--cream-dim); font-size: 12px; }
.profile-logout { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--edge); }
.home-match a[href^="/match/"] { font-family: "Marker", sans-serif; }

/* ---- admin panel ---- */
.admin-panel { display: flex; flex-direction: column; gap: 12px; }
.admin-panel h1 { margin-bottom: 0; }
.admin-form { display: flex; flex-direction: column; gap: 12px; }
.admin-ratings { display: flex; gap: 10px; }
.admin-ratings label { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--edge); }
.admin-table th { color: var(--cream-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.admin-table td.num { font-family: "Anton", sans-serif; color: var(--yellow); }
