:root {
  --g: #126b43;
  --g-dark: #0b422b;
  --g-soft: #e7f4eb;
  --bg: #f4f7f5;
  --card: #fff;
  --ink: #18251e;
  --mut: #5f6f66;
  --line: #dce5df;
  --warn-bg: #fff7df;
  --warn-line: #f0dfaa;
  --warn-ink: #6f520f;
  --danger: #b42318;
  --vang: #f2b705;
  --vang-soft: #fff5d1;
  --do: #d33b2c;
  --do-soft: #fde6e3;
  --tran: #3d5a80;
  --tran-soft: #e6edf5;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--g); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Header */
header.site {
  background: linear-gradient(120deg, var(--g-dark), #19764a);
  color: #fff;
  padding: 18px 16px 16px;
}
.wrap { max-width: 1040px; margin: 0 auto; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 26px; background: #ffffff22; border-radius: 14px; padding: 6px 9px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; opacity: .8; font-weight: 800; }
h1 { margin: 0; font-size: clamp(23px, 5vw, 32px); line-height: 1.15; }
.tagline { margin: 2px 0 0; color: #d6e9dc; font-size: 14px; }
.contact { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.contact a {
  color: #fff; text-decoration: none; background: #ffffff1c; border: 1px solid #ffffff38;
  padding: 7px 12px; border-radius: 999px; font-size: 14px;
}

/* Tabs */
nav.tabs {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px max(16px, calc((100% - 1040px) / 2 + 16px));
  border-bottom: 1px solid var(--line);
}
nav.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; cursor: pointer; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  padding: 8px 14px; font-weight: 700; font-size: 15px; white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--g); color: #fff; border-color: var(--g); }

main { max-width: 1040px; margin: 0 auto; padding: 14px 16px 48px; }
.page[hidden] { display: none; }

/* Cards & text */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: 0 2px 10px #193b2710;
}
h2 { font-size: 20px; margin: 0 0 4px; line-height: 1.25; }
h3 { font-size: 16px; margin: 0 0 8px; }
.sub { color: var(--mut); font-size: 14px; margin: 0 0 12px; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.notice {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0;
}
.notice.ok { background: var(--g-soft); border-color: #bfe0c9; color: #1d5a39; }
.empty {
  border: 1px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center;
  color: var(--mut); font-size: 14px;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }

/* Forms */
label { display: block; font-size: 14px; font-weight: 700; margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; border: 1px solid #c6d4ca; border-radius: 10px; padding: 11px 12px; background: #fff;
  min-height: 46px;
}
textarea { min-height: 260px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a7d9b8; border-color: var(--g); }
.btn {
  cursor: pointer; border: 0; background: var(--g); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-weight: 700; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #edf4ef; color: var(--g); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--g); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f2c6c1; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.sm { min-height: 36px; padding: 6px 11px; font-size: 14px; }

/* Lists */
.list { display: grid; gap: 8px; }
.item {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.item .meta { font-size: 13px; color: var(--mut); }
.pill {
  display: inline-block; background: #edf3ef; color: #365746; border-radius: 99px; padding: 3px 9px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.pill.green { background: #def3e5; color: #17643d; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.red { background: var(--do-soft); color: #8f2117; }

/* Session summary */
.event { display: grid; gap: 4px; font-size: 16px; }
.event strong { font-size: 20px; }
.weather { font-size: 15px; }
.weather.rainy { color: #8a4b00; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--g-soft); padding: 10px; border-radius: 12px; text-align: center; }
.stat strong { display: block; font-size: 24px; color: var(--g); line-height: 1.1; }
.stat span { font-size: 12px; color: #42634e; }

/* Day vote */
.day {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px;
}
.day.confirmed { border-color: var(--g); background: #f4fbf6; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.day-name { font-weight: 800; font-size: 17px; }
.toggle {
  cursor: pointer; border: 2px solid var(--g); color: var(--g); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-weight: 800; min-height: 44px; white-space: nowrap;
}
.toggle[aria-pressed="true"] { background: var(--g); color: #fff; }
.names { font-size: 14px; color: var(--mut); }

/* Nickname picker */
.picker { display: flex; flex-wrap: wrap; gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.chip {
  cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-weight: 600; min-height: 42px;
}
.chip[aria-pressed="true"] { background: var(--g); border-color: var(--g); color: #fff; }
.chip:disabled { opacity: .45; }

/* Teams */
.teams { display: grid; gap: 10px; }
@media (min-width: 640px) { .teams { grid-template-columns: repeat(3, 1fr); } }
.team { border-radius: 12px; padding: 10px 12px; border: 2px solid; }
.team h3 { display: flex; justify-content: space-between; margin: 0 0 6px; }
.team ol { margin: 0; padding-left: 22px; }
.team.vang { border-color: var(--vang); background: var(--vang-soft); }
.team.do { border-color: var(--do); background: var(--do-soft); }
.team.tran { border-color: var(--tran); background: var(--tran-soft); }

/* Leaderboard */
.leader {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.rank {
  width: 40px; height: 40px; border-radius: 50%; background: #eef3ef; display: grid; place-items: center;
  font-weight: 900; font-size: 18px;
}
.rank.r1 { background: #fff1c8; }
.leader .name { font-weight: 800; font-size: 17px; }
.score { font-weight: 900; color: var(--g); font-size: 18px; white-space: nowrap; }

/* Media */
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(3, 1fr); } }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eef2ef; display: block; }
.photo .meta { font-size: 13px; color: var(--mut); margin-top: 3px; }
.video { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.video img, .video .thumb {
  width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #1b2b22;
  display: grid; place-items: center; color: #fff; font-size: 26px;
}

/* Rules */
.rules h2 { font-size: 21px; margin: 0 0 10px; }
.rules h3 { font-size: 17px; margin: 18px 0 6px; }
.rules p, .rules li { font-size: 15px; }
.rules ul { padding-left: 22px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(120px);
  background: #18251e; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700;
  transition: transform .2s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
  pointer-events: none; /* never swallow taps on buttons underneath */
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }

footer { text-align: center; padding: 0 16px 28px; color: var(--mut); font-size: 13px; }
