/* Option C: Garnet, from Mockups/Druben-Gym-Option-C-Garnet.png */

@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("/fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }

:root {
  --accent: #7b1e2e;
  --accent-ink: #ffffff;
  --cream: #f6dfae;
  --ground: #f7f3f2;
  --surface: #ffffff;
  --tint: #f0e4e4;
  --text: #1e1416;
  --muted: #6f5f61;
  --line: #e7dcdc;
  --danger: #a3132c;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabs-height: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { background: var(--ground); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font: 500 16px/1.35 var(--body);
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(var(--tabs-height) + env(safe-area-inset-bottom) + 28px);
}
main.bare { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--accent); font-weight: 600; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: 1; letter-spacing: .005em; overflow-wrap: anywhere; }
.page-title { font-size: 40px; }
.eyebrow { font-weight: 600; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.section-label { margin: 26px 4px 10px; font-weight: 700; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.spaced > * + * { margin-top: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Cards and rows */
.card { background: var(--surface); border-radius: 18px; padding: 16px 18px; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.person {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: var(--surface); border-radius: 16px; padding: 12px 14px;
}
.person-body { flex: 1; min-width: 0; }
.person-name { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { display: flex; gap: 10px; font-size: 14px; color: var(--muted); }
.streak { color: var(--accent); font-weight: 600; }
.you { font-size: 12px; font-weight: 700; color: var(--accent); margin-left: 6px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--tint); font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.avatar.large { width: 84px; height: 84px; background: var(--accent); color: var(--accent-ink); font: 800 34px var(--display); }

/* Check-in control */
.check {
  flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  border: 2px solid var(--muted); background: transparent;
}
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check svg { width: 24px; height: 24px; }
.status { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); }
.status.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.status svg { width: 16px; height: 16px; }

/* Hero */
.hero { margin-top: 16px; background: var(--accent); color: var(--accent-ink); border-radius: 22px; padding: 20px; }
.hero-name { font-size: 26px; }
.pill { flex: none; padding: 3px 11px; border-radius: 99px; background: rgba(255, 255, 255, .17); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-day { margin-top: 16px; font: 800 52px/1 var(--display); color: var(--cream); }
.hero-day small { font: 600 17px var(--body); color: var(--accent-ink); margin-left: 6px; }
.meter { height: 8px; border-radius: 9px; background: rgba(255, 255, 255, .22); overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; background: var(--cream); border-radius: 9px; }
.hero-foot { display: flex; justify-content: space-between; margin-top: 11px; font-weight: 600; font-size: 14px; }
.meter.plain { background: var(--tint); height: 6px; }
.meter.plain > i { background: var(--accent); }

/* Standings */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; align-items: end; margin-top: 22px; }
.podium-spot { display: flex; flex-direction: column; align-items: center; min-width: 0; width: 100%; }
.podium-avatar { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); border: 3px solid #d8c5c5; font-weight: 700; }
.first .podium-avatar { border-color: var(--accent); }
.third .podium-avatar { border-color: #d4a98c; }
.podium-name { margin: 6px 0 7px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-block { width: 100%; border-radius: 16px 16px 12px 12px; background: var(--tint); padding: 12px 4px; text-align: center; }
.podium-rank { font: 800 36px/1 var(--display); }
.podium-points { font-size: 14px; font-weight: 600; }
.first .podium-block { background: var(--accent); color: var(--accent-ink); height: 140px; }
.second .podium-block { height: 106px; }
.third .podium-block { height: 84px; }
.rank { flex: none; width: 24px; font: 800 26px var(--display); color: var(--muted); }
.points { flex: none; text-align: right; font: 800 26px var(--display); }
.points small { font: 500 13px var(--body); color: var(--muted); margin-left: 3px; }
.rules-card { margin-top: 12px; border: 1.5px dashed #d3c2c2; border-radius: 16px; padding: 14px 18px; }
.winner { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.winner-crown { font-size: 32px; }
.competition-switch { position: relative; color: var(--accent); font-weight: 600; font-size: 15px; }
.competition-switch select { position: absolute; inset: 0; opacity: 0; width: 100%; }

/* Member detail */
.back { display: inline-flex; gap: 3px; align-items: center; color: var(--accent); font-weight: 600; font-size: 17px; margin-bottom: 20px; }
.profile { display: flex; align-items: center; gap: 16px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.tile { background: var(--surface); border-radius: 16px; padding: 12px 16px; }
.tile-value { font: 800 38px/1.1 var(--display); }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin-top: 12px; justify-items: center; }
.calendar-head { font-size: 12px; font-weight: 700; color: var(--muted); }
.day {
  width: 100%; max-width: 40px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; border: 1.5px solid var(--line); color: var(--text);
}
.day.out { visibility: hidden; }
.day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day.missed { background: var(--tint); border-color: var(--tint); }
.day.today { outline: 2px solid var(--text); outline-offset: 1px; }
.day:disabled { opacity: 1; }
.day.fixable { border-color: var(--accent); }
.day.on.fixable { border-color: var(--accent); }

/* Forms and buttons */
.button {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px;
  padding: 12px 18px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px;
}
.button.secondary { background: var(--tint); color: var(--accent); }
.button.danger { background: transparent; color: var(--danger); }
.text-button { color: var(--accent); font-weight: 600; min-height: 36px; }
.text-button.danger { color: var(--danger); }
.icon-button { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
label { display: block; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field { margin-top: 16px; }
input[type="text"], input[type="date"], select.input {
  display: block; width: 100%; margin-top: 7px; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 13px; background: var(--surface); font-size: 17px; font-weight: 600; color: var(--text);
  text-transform: none; letter-spacing: 0; appearance: none; -webkit-appearance: none;
}
input.code { text-transform: uppercase; letter-spacing: .08em; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.stepper + .stepper { border-top: 1px solid var(--line); }
.stepper-buttons { flex: none; display: flex; background: var(--tint); border-radius: 11px; }
.stepper-buttons button { width: 46px; height: 40px; font-size: 22px; font-weight: 600; }

/* Landing */
.landing { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: center; }
.brand { font-size: 68px; color: var(--accent); }
.landing .lead { margin: 14px 0 28px; font-size: 19px; color: var(--muted); }

/* Invite sheet */
.invite-code { font: 800 38px var(--display); letter-spacing: .08em; text-align: center; padding: 14px 0; color: var(--accent); }
.revoke { text-align: center; margin-top: 14px; }

/* Tabs */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: var(--ground); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; max-width: 173px; height: var(--tabs-height); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }

/* Dialogs */
dialog { border: 0; border-radius: 22px; width: min(480px, calc(100vw - 24px)); max-height: 88dvh; padding: 22px 20px; background: var(--ground); color: var(--text); }
dialog::backdrop { background: rgba(30, 20, 22, .55); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.sheet-title { font-size: 19px; font-weight: 700; text-align: center; }
.dialog-actions { display: grid; gap: 9px; margin-top: 20px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-height) + env(safe-area-inset-bottom) + 14px);
  max-width: calc(100vw - 32px); width: max-content; background: var(--text); color: #fff; padding: 11px 16px; border-radius: 13px;
  font-size: 15px; font-weight: 600; z-index: 10;
}

.empty { background: var(--surface); border-radius: 18px; padding: 26px 20px; text-align: center; margin-top: 16px; }
.empty h2 { font-size: 24px; margin-bottom: 6px; }
.empty .button { margin-top: 16px; }
.install { margin-top: 14px; display: flex; gap: 12px; align-items: flex-start; }

@media (prefers-reduced-motion: no-preference) {
  .check, .day, .status { transition: background-color .15s, border-color .15s; }
}
