:root {
  --bg: #0a0c0a;
  --bg2: #111511;
  --card: #161b16;
  --card2: #1d241d;
  --line: #273027;
  --text: #eef3ee;
  --muted: #8f9c8f;
  --green: #1fb04a;
  --green-d: #11803a;
  --yellow: #ffc835;
  --red: #ef4444;
  --orange: #f59e0b;
  --radius: 14px;
  --head: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 50% -200px, rgba(34,197,94,.13), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(76px + var(--safe-b));
}
a { color: var(--green); text-decoration: none; }
h1, h2, h3 { font-family: var(--head); font-stretch: condensed; letter-spacing: .02em; margin: 0; text-transform: uppercase; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; margin: 22px 0 10px; color: var(--yellow); }
h3 { font-size: 17px; font-weight: 700; }
small, .muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(10,12,10,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--head); font-size: 21px; font-weight: 700; letter-spacing: .06em; }
.brand b { color: var(--yellow); font-weight: 800; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 10px, #000 10px 20px); opacity: .85; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 24px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* Tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14,17,14,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--green); }
.tabbar a.active svg { filter: drop-shadow(0 0 6px rgba(34,197,94,.6)); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.hero { background: linear-gradient(135deg, #14301d, #101510 60%); border-color: #24502f; position: relative; overflow: hidden; }
.card.hero::before { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 18px solid rgba(250,204,21,.07); }
.card.link { display: block; color: inherit; }
.card.link:active { background: var(--card2); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Event card */
.ev { display: flex; gap: 12px; align-items: stretch; }
.ev-date { flex: 0 0 52px; text-align: center; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); padding: 6px 0; font-family: var(--head); line-height: 1.05; }
.ev-date .d { font-size: 24px; font-weight: 800; }
.ev-date .m, .ev-date .w { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ev-body { flex: 1; min-width: 0; }
.ev-title { font-weight: 700; font-size: 16px; }
.ev-meta { color: var(--muted); font-size: 13px; }
.ev.cancelled .ev-title { text-decoration: line-through; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--card2); color: var(--muted); vertical-align: middle; }
.tag.training { background: rgba(34,197,94,.15); color: var(--green); }
.tag.game { background: rgba(250,204,21,.16); color: var(--yellow); }
.tag.tournament { background: rgba(250,204,21,.16); color: var(--yellow); }
.tag.event { background: rgba(148,163,184,.15); color: #cbd5e1; }
.tag.red { background: rgba(239,68,68,.16); color: #fca5a5; }
.tag.win { background: var(--green); color: #052e13; }
.tag.loss { background: var(--red); color: #fff; }
.tag.draw { background: #64748b; color: #fff; }

.counts { display: flex; gap: 10px; font-size: 13px; font-weight: 600; margin-top: 6px; flex-wrap: wrap; }
.counts .y { color: var(--green); }
.counts .n { color: var(--red); }
.counts .m { color: var(--orange); }
.counts .g { color: var(--yellow); }
.warn { color: var(--yellow); font-size: 13px; font-weight: 600; }

/* RSVP */
.rsvp { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.rsvp button { padding: 11px 6px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; }
.rsvp button.yes.on { background: var(--green); border-color: var(--green); color: #052e13; }
.rsvp button.no.on { background: var(--red); border-color: var(--red); color: #fff; }
.rsvp button.maybe.on { background: var(--orange); border-color: var(--orange); color: #241500; }
.rsvp.small button { padding: 7px 4px; font-size: 13px; }
.reason { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Buttons & Forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 11px; border: 0; background: var(--green); color: #052e13; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.yellow { background: var(--yellow); color: #1a1500; }
.btn.danger { background: transparent; color: #fca5a5; border: 1px solid rgba(239,68,68,.5); }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.iconbtn { background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; font-size: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: auto; accent-color: var(--green); transform: scale(1.2); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; font-weight: 500; margin: 8px 0; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 14px; overflow-x: auto; }
.seg button { flex: 1; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card2); color: var(--yellow); }
.daypick { display: flex; gap: 5px; }
.daypick label { flex: 1; margin: 0; }
.daypick input { display: none; }
.daypick span { display: block; text-align: center; padding: 9px 0; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); font-weight: 700; }
.daypick input:checked + span { background: var(--green); color: #052e13; border-color: var(--green); }

/* Lists */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); color: inherit; }
.li:first-child { border-top: 0; }
a.li:active { background: var(--card2); }
.num { flex: 0 0 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #000; border: 1.5px solid var(--green); color: var(--yellow); font-family: var(--head); font-weight: 800; font-size: 17px; }
.num.G { border-color: var(--yellow); }
.pos { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.chev { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 10px; }
.dot.yes { background: var(--green); } .dot.no { background: var(--red); } .dot.maybe { background: var(--orange); } .dot.none { background: #3b463b; }

/* Stats */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.kpi b { display: block; font-family: var(--head); font-size: 26px; font-weight: 800; color: var(--yellow); line-height: 1.1; }
.kpi span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { text-align: right; padding: 9px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
tr:last-child td { border-bottom: 0; }
td.hl { color: var(--yellow); font-weight: 800; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 8px; margin-bottom: 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--bg2); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); }
.score { font-family: var(--head); font-size: 44px; font-weight: 800; letter-spacing: .04em; text-align: center; color: var(--yellow); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; font-family: var(--head); font-size: 20px; font-weight: 700; text-transform: uppercase; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal button { aspect-ratio: 1 / 1.05; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 5px 0 0; gap: 3px; cursor: pointer; }
.cal button.out { opacity: .3; }
.cal button.today { border-color: var(--yellow); color: var(--yellow); }
.cal button.sel { background: var(--green-d); border-color: var(--green); color: #fff; }
.cal .dots { display: flex; gap: 2px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.cal .dots i.game, .cal .dots i.tournament { background: var(--yellow); }
.cal .dots i.event { background: #94a3b8; }
.cal .dots i.x { background: var(--red); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 10px 0 16px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* Lineup */
.rink { background: linear-gradient(#123018, #0d200f); border: 2px solid #2b5a33; border-radius: 26px; padding: 14px; }
.line-block { border: 1px dashed #3a6a42; border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.line-block h3 { color: var(--yellow); font-size: 15px; margin-bottom: 8px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { background: rgba(0,0,0,.35); border-radius: 10px; padding: 8px 10px; min-height: 44px; }
.slot .pos { display: block; }
.slot select { padding: 7px 8px; font-size: 15px; margin-top: 3px; background: rgba(0,0,0,.5); }

/* Posts */
.post { white-space: pre-wrap; word-wrap: break-word; }
.post-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.pin { color: var(--yellow); font-weight: 700; }

/* Money */
.money.pos { color: var(--red); font-weight: 700; }
.money.neg { color: var(--green); font-weight: 700; }
.money.zero { color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--bg2); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; border: 1px solid var(--line); padding: 18px 16px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: var(--text); color: #000; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.err { background: var(--red); color: #fff; }

/* Login */
.login { max-width: 380px; margin: 30px auto 0; text-align: center; }
.login img { width: 120px; height: 120px; filter: drop-shadow(0 6px 24px rgba(34,197,94,.35)); }
.login h1 { margin: 14px 0 4px; font-size: 34px; }
.login h1 b { color: var(--yellow); }
.login form { text-align: left; margin-top: 24px; }
.stripe { height: 6px; border-radius: 3px; margin: 14px 0; background: repeating-linear-gradient(-45deg, var(--yellow) 0 8px, #000 8px 16px); }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-grid a { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; color: var(--text); font-weight: 700; }
.menu-grid a span { display: block; font-size: 26px; margin-bottom: 6px; }
.menu-grid a small { display: block; font-weight: 500; margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.bday { border-color: rgba(250,204,21,.4); }
@media (max-width: 380px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
