:root {
  --green: #215e5f;
  --green-dark: #164546;
  --green-ink: #0f3536;
  --yellow: #fef846;
  --yellow-soft: #fbf6b8;
  --cream: #f6f3ea;
  --paper: #fffdf7;
  --line: #e4dfd0;
  --ink: #12302f;
  --muted: #5d6f6c;
  --red: #e2443b;
  --ok: #2a9d5c;
  --radius: 14px;
  --maxw: 1920px;
  --gutter: clamp(16px, 2vw, 32px);
  --shadow: 0 1px 2px rgba(16, 48, 47, .06), 0 6px 20px rgba(16, 48, 47, .06);
  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  font-stretch: 100%;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 78%;
  letter-spacing: -.01em;
  line-height: 1;
  margin: 0;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.hidden { display: none !important; }

/* ---------- header ---------- */
.topbar {
  background: var(--green);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 10px var(--gutter); min-height: 68px;
}
.brand img { height: 46px; width: auto; }
.nav { display: flex; gap: 6px; margin-left: auto; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 500; opacity: .9;
  position: relative;
}
.nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav a.active { opacity: 1; }
.nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--yellow);
}
.nav .live-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s infinite; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.user-chip {
  display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,.1);
}
.user-chip:hover { background: rgba(255,255,255,.18); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid transparent; border-radius: 10px;
  padding: 10px 18px; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--yellow); color: var(--green-ink); white-space: nowrap;
  transition: transform .06s ease, filter .15s;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.dark { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--green-ink); color: var(--green-ink); }
.btn.ghost-light { background: transparent; border-color: rgba(255,255,255,.7); color: #fff; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.btn.lg { padding: 14px 24px; font-size: 1.15rem; border-radius: 12px; }
.btn .arrow::after { content: "→"; }
.link { color: var(--green); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- layout ---------- */
main { min-height: calc(100vh - 68px); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 110px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 20px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-ok { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 34px 0 16px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 8px 0 0; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1fr 1.35fr; min-height: 380px;
  background: var(--paper); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 0;
}
.hero-copy { padding: 36px 40px 36px 32px; display: flex; flex-direction: column; justify-content: center; gap: 16px; position: relative; z-index: 2; }
.hero-copy h1 { font-size: clamp(2.6rem, 5.4vw, 4.4rem); line-height: .95; color: var(--green-ink); }
.hero-copy .lead { font-size: 1.25rem; margin: 0; }
.hero-photo { position: relative; min-height: 260px; }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-photo::before {
  content: ""; position: absolute; z-index: 1; left: -60px; top: 0; bottom: 0; width: 120px;
  background: var(--paper); border-radius: 0 100% 100% 0 / 0 50% 50% 0;
}
.perks { display: flex; gap: 12px 20px; margin-top: 8px; flex-wrap: wrap; }
.perk { display: flex; gap: 8px; align-items: center; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1.3; color: var(--muted); }
.perk svg { width: 26px; height: 26px; color: var(--green); flex: none; }

/* ---------- session cards ---------- */
.home-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: stretch; }
.session-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.scard { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px; }
.scard-img {
  position: relative; border-radius: 10px; overflow: hidden; min-height: 170px;
  background: var(--green) url(../img/hero.jpg) center/cover;
}
.scard-img.alt { background: var(--green); display: grid; place-items: center; }
.scard-img.alt img { width: 56%; opacity: .95; }
.date-badge {
  position: absolute; top: 0; right: 0; background: var(--paper); text-align: center; padding: 6px 12px 8px; border-bottom-left-radius: 10px;
}
.date-badge b { display: block; font-family: var(--display); font-stretch: 78%; font-weight: 900; font-size: 1.9rem; line-height: 1; }
.date-badge span { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.scard h3 { margin-bottom: 10px; }
.meta { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.meta li { display: flex; gap: 8px; align-items: center; }
.meta svg { width: 16px; height: 16px; flex: none; color: var(--ink); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: #e3ece6; color: var(--green-dark);
}
.tag.live { background: #fde3e1; color: #b3261e; }
.tag.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
.tag.done { background: #ebe7da; color: var(--muted); }
.tag.yellow { background: var(--yellow); color: var(--green-ink); }

/* ---------- live card ---------- */
.live-card {
  background: var(--green); color: #fff; border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.live-card::after {
  content: ""; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.12); box-shadow: 0 0 0 30px rgba(255,255,255,.03);
}
.live-title { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-stretch: 85%; font-size: 1.2rem; letter-spacing: .06em; text-transform: uppercase; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.2); }
.live-title::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
.live-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; }
.live-line + .live-line { border-top: 1px solid rgba(255,255,255,.2); }
.live-line .who { font-family: var(--display); font-weight: 900; font-stretch: 75%; font-size: 2rem; line-height: 1.05; }
.live-line .pts { font-family: var(--display); font-weight: 900; font-stretch: 75%; font-size: 3rem; line-height: 1; }
.live-card .foot { margin-top: auto; padding-top: 12px; }
.live-card a.more { color: var(--yellow); font-weight: 700; text-decoration: none; }
.live-empty { opacity: .85; margin: 16px 0; }

/* ---------- tables / leaderboard ---------- */
.seg { display: inline-flex; background: #efebdf; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.seg button.on { background: var(--yellow); }
table.board { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font-weight: 500; font-size: .82rem; color: var(--muted); padding: 8px 12px; background: #efebdf; }
.board td { padding: 10px 12px; border-top: 1px solid var(--line); }
.board .num { text-align: center; width: 1%; white-space: nowrap; }
.board .pts { font-weight: 800; text-align: center; }
.board tr.top { background: var(--yellow-soft); }
.board tr.me td { font-weight: 700; }
.board a { text-decoration: none; }
.board a:hover { text-decoration: underline; }
.person { display: flex; align-items: center; gap: 10px; }

.avatar {
  --av: #cfe3f1;
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--av); color: var(--green-ink); font-weight: 800; font-size: .8rem; letter-spacing: .02em;
}
.avatar.dark { background: var(--green); color: #fff; }
.avatar.lg { width: 92px; height: 92px; font-size: 2rem; font-family: var(--display); font-stretch: 80%; }
.avatar.md { width: 52px; height: 52px; font-size: 1rem; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; }
.avatars .avatar { width: 30px; height: 30px; font-size: .75rem; background: #c9d7cf; }

/* ---------- members ---------- */
.members-strip { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.members-strip .photo { border-radius: 10px; height: 150px; background: var(--green) url(../img/hero.jpg) 70% center/cover; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.member-card { display: flex; align-items: center; gap: 14px; padding: 14px; text-decoration: none; }
.member-card:hover { border-color: var(--green); }
.member-card b { display: block; }
.search { width: 100%; max-width: 320px; }

/* ---------- profile ---------- */
.profile { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.profile-head h1 { font-size: 3rem; }
.stat-card { background: var(--yellow-soft); border-radius: var(--radius); padding: 22px; }
.stat-main { display: flex; align-items: center; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid rgba(16,48,47,.15); }
.trophy { width: 70px; height: 70px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; flex: none; }
.trophy svg { width: 34px; height: 34px; color: var(--green-ink); }
.big-num { font-family: var(--display); font-weight: 900; font-stretch: 75%; font-size: 4rem; line-height: .9; }
.stat-split { display: grid; grid-template-columns: 1fr 1fr; text-align: center; padding-top: 14px; }
.stat-split > div + div { border-left: 1px solid rgba(16,48,47,.15); }
.stat-split b { display: block; font-family: var(--display); font-weight: 900; font-stretch: 75%; font-size: 2.4rem; line-height: 1; }
.history { display: grid; }
.history a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; border-top: 1px solid var(--line); }
.history a:first-child { border-top: 0; }
.history a:hover { background: #faf7ee; }
.history .plus { font-family: var(--display); font-weight: 900; font-stretch: 80%; font-size: 1.4rem; white-space: nowrap; }
.callout { display: flex; gap: 14px; align-items: center; background: var(--yellow-soft); border-radius: var(--radius); padding: 16px 18px; }
.callout svg { width: 36px; height: 36px; flex: none; padding: 7px; background: var(--paper); border-radius: 50%; color: var(--green); }

/* ---------- session detail ---------- */
.session-banner {
  border-radius: var(--radius); overflow: hidden; position: relative; min-height: 180px; color: #fff;
  background: linear-gradient(90deg, rgba(15,53,54,.92) 0%, rgba(15,53,54,.6) 55%, rgba(15,53,54,.1) 100%), url(../img/hero.jpg) center/cover;
  padding: 28px; display: flex; flex-direction: column; justify-content: end; gap: 12px;
}
.session-banner h1 { color: #fff; }
.session-banner .meta { color: rgba(255,255,255,.85); display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.session-banner .meta svg { color: var(--yellow); }
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; margin-top: 20px; }
.round-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.round-head:first-child { margin-top: 0; }
.sched { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sched td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.sched tr:first-child td { border-top: 0; }
.sched .t { color: var(--muted); width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sched .ct { width: 1%; white-space: nowrap; font-weight: 600; }
.sched .team { text-align: center; }
.sched .team.win { font-weight: 800; }
.sched .vs { width: 1%; text-align: center; }
.vs-badge { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e3ece6; font-size: .75rem; color: var(--muted); }
.score-badge { display: inline-block; min-width: 64px; text-align: center; font-weight: 800; padding: 4px 8px; border-radius: 8px; background: #efebdf; font-variant-numeric: tabular-nums; }
.score-badge.live { background: #fde3e1; color: #b3261e; }
.sched tr.clickable { cursor: pointer; }
.sched tr.clickable:hover td { background: #faf7ee; }
.sched tr.mine td { background: #fffbe0; }
.admin-box { border: 2px dashed #c8d4cc; border-radius: var(--radius); padding: 18px; background: #f9fbf8; }
.admin-box h3 { display: flex; align-items: center; gap: 8px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: grid; gap: 6px; font-weight: 500; font-size: .92rem; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 11px 13px; outline: none;
}
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(33,94,95,.15); }
textarea.input { min-height: 80px; resize: vertical; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.toggle input { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: #c9cfc8; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked { background: var(--green); }
.toggle input:checked::after { transform: translateX(20px); background: var(--yellow); }
.auth-wrap { max-width: 440px; margin: 40px auto; }
.auth-wrap .logo-big { background: var(--green); border-radius: var(--radius) var(--radius) 0 0; padding: 26px; display: grid; place-items: center; }
.auth-wrap .logo-big img { height: 110px; }
.auth-wrap form { border-radius: 0 0 var(--radius) var(--radius); }
.error-msg { background: #fde3e1; color: #8c1d18; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }

/* ---------- live page ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.scoreboard { background: var(--green); color: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.scoreboard .head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.scoreboard .head::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
.scoreboard.done .head::before { background: #9fb7b0; animation: none; }
.scoreboard.next .head::before { background: var(--yellow); animation: none; }
.big-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; margin: 12px 0 4px; }
.big-score .n { font-family: var(--display); font-weight: 900; font-stretch: 75%; font-size: clamp(4rem, 12vw, 6rem); line-height: .9; font-variant-numeric: tabular-nums; }
.big-score .colon { font-family: var(--display); font-weight: 900; font-size: 3rem; padding: 0 6px; opacity: .9; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; }
.teams .t { font-family: var(--display); font-weight: 900; font-stretch: 78%; font-size: 1.5rem; line-height: 1.05; }
.scoreboard .sub { text-align: center; opacity: .75; font-size: .85rem; margin-top: 10px; }
.score-ctrl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.score-ctrl .side { display: flex; gap: 8px; justify-content: center; }
.score-ctrl button {
  border: 0; border-radius: 12px; font-weight: 900; font-size: 1.4rem; cursor: pointer; height: 54px;
}
.score-ctrl .plus { background: var(--yellow); color: var(--green-ink); flex: 1; }
.score-ctrl .minus { background: rgba(255,255,255,.14); color: #fff; width: 54px; }
.scoreboard .actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.mini-board { margin-top: 10px; }
.mini-board .row-item { display: grid; grid-template-columns: 30px 36px 1fr auto; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); }
.mini-board .row-item:first-child { border-top: 0; }
.mini-board .row-item.top { background: var(--yellow-soft); border-radius: 8px; }
.mini-board .row-item b:last-child { font-variant-numeric: tabular-nums; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,30,30,.55); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; }
.modal .scoreboard { box-shadow: none; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--green-ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.err { background: #8c1d18; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty img { width: 60px; margin: 0 auto 12px; opacity: .8; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- bottom tabs (mobile) ---------- */
.tabbar { display: none; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 960px) {
  .home-grid, .detail-grid, .profile { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-photo { order: -1; min-height: 220px; }
  .hero-photo::before { display: none; }
  .section-head.spacer { display: none; }
}

@media (max-width: 760px) {
  .nav, .top-actions .hide-m { display: none; }
  .topbar-inner { min-height: 60px; }
  .brand img { height: 40px; }
  .top-actions { margin-left: auto; }
  .wrap { padding-top: 20px; }
  .hero-copy { padding: 26px 20px; }
  .scard { grid-template-columns: 110px 1fr; }
  .scard-img { min-height: 140px; }
  .form-grid { grid-template-columns: 1fr; }
  .board .hide-m { display: none; }
  .sched .t { display: none; }
  .sched td { padding: 9px 8px; font-size: .92rem; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 30;
    background: var(--green); border-radius: 20px; padding: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .tabbar a { color: #fff; text-decoration: none; display: grid; justify-items: center; gap: 2px; font-size: .74rem; padding: 6px 0; border-radius: 14px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { background: rgba(255,255,255,.12); color: var(--yellow); }
  .profile-head h1 { font-size: 2.4rem; }
  .avatar.lg { width: 76px; height: 76px; font-size: 1.6rem; }
}
