/* 75 Hard — mobile-first dark theme.
   Adventure / discipline / camaraderie: topographic backdrop, trail-green +
   ember-orange accents, bold typographic hierarchy. */

:root {
  --bg:        #0d1210;
  --bg-2:      #121a17;
  --panel:     #16211c;
  --panel-2:   #1c2a23;
  --line:      #26362e;
  --text:      #e7efe9;
  --muted:     #8ea79a;
  --brand:     #4ade80;   /* trail green */
  --brand-dim: #2f9e5b;
  --ember:     #f97316;   /* ember orange */
  --gold:      #fbbf24;
  --danger:    #f87171;

  --tier-1: #4ade80;
  --tier-2: #a3e635;
  --tier-3: #fbbf24;
  --tier-4: #fb923c;
  --tier-5: #f87171;

  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  /* Faint topographic-contour motif built from layered radial gradients. */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(74,222,128,0.06), transparent 60%),
    repeating-radial-gradient(circle at 20% 10%, transparent 0 38px, rgba(255,255,255,0.012) 38px 39px),
    repeating-radial-gradient(circle at 85% 90%, transparent 0 46px, rgba(255,255,255,0.012) 46px 47px);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* --- Top bar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(13,18,16,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: 0.06em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--brand); font-size: 1.1rem; }
.brand-text { font-size: 1rem; }

.nav {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.9rem; font-weight: 600;
}
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; }
.inline-form { display: inline; margin: 0; }
.linklike {
  background: none; border: none; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.linklike:hover { color: var(--text); }

/* --- Layout ---------------------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.hero { padding: 28px 4px 8px; }
.eyebrow {
  margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.18em;
  font-weight: 700; color: var(--ember);
}
.hero h1 {
  margin: 0; font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.01em; line-height: 1.05;
}
.hero-sub { margin: 8px 0 0; color: var(--muted); }

.section-title {
  font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 28px 0 12px;
}

/* --- Cards ----------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card.center { text-align: center; }
.card.center h1 { font-size: 3rem; margin: 0 0 4px; }
.auth-card { max-width: 420px; margin: 24px auto; }
.auth-card h1 { margin-top: 0; font-size: 1.6rem; }

/* --- Standings board ------------------------------------------------------- */
.tier {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.tier-1 { border-left-color: var(--tier-1); }
.tier-2 { border-left-color: var(--tier-2); }
.tier-3 { border-left-color: var(--tier-3); }
.tier-4 { border-left-color: var(--tier-4); }
.tier-5 { border-left-color: var(--tier-5); }

.tier-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.tier-num { font-weight: 800; color: var(--muted); font-size: 0.8rem; }
.tier-name { font-weight: 700; flex: 1; }
.tier-count {
  font-size: 0.78rem; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 9px;
}
.tier-list { list-style: none; margin: 0; padding: 4px 0; }
.tier-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.tier-list li + li { border-top: 1px solid var(--line); }
.who { font-weight: 600; }
.stats { display: flex; gap: 12px; color: var(--muted); font-size: 0.9rem; }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; color: var(--muted);
}

[x-cloak] { display: none !important; }

/* --- Weekly movers spotlight ----------------------------------------------- */
.movers {
  background: linear-gradient(135deg, rgba(74,222,128,0.1), rgba(249,115,22,0.08));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}
.movers-label { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.movers-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.mover {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 14px; flex: 1; min-width: 90px;
}
.mover:hover { text-decoration: none; border-color: var(--brand-dim); }
.mover-name { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.mover-pts { font-weight: 800; color: var(--brand); }

/* --- Tabs ------------------------------------------------------------------ */
.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 5px;
}
.tab {
  flex: 1; font: inherit; font-weight: 700; cursor: pointer;
  padding: 10px 6px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 0.9rem;
}
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }

/* --- Ranked list (points) -------------------------------------------------- */
.rank { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.rank li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px;
}
.rank-num {
  font-weight: 800; color: var(--muted); width: 1.6rem; text-align: center;
}
.rank li:first-child .rank-num { color: var(--gold); }
.rank .who { flex: 1; font-weight: 600; }
.rank-val { font-weight: 800; font-size: 1.05rem; }
.rank-val small { color: var(--muted); font-weight: 600; font-size: 0.72rem; }

/* --- Trophies -------------------------------------------------------------- */
.trophy-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px;
}
@media (min-width: 480px) { .trophy-grid { grid-template-columns: 1fr 1fr; } }
.trophy {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.trophy-emoji { font-size: 1.8rem; }
.trophy-label {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.trophy-winner { font-weight: 700; font-size: 1.05rem; }
.trophy-val { font-size: 0.82rem; }

/* --- Forms ----------------------------------------------------------------- */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-dim);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.15);
}
small.muted { font-weight: 500; }

.btn {
  display: inline-block; text-align: center;
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.btn:hover { text-decoration: none; border-color: var(--brand-dim); }
.btn.primary { background: var(--brand); color: #06231a; border-color: var(--brand); }
.btn.primary:hover { background: #3ecf70; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
/* Constrain chart height so Chart.js (responsive + maintainAspectRatio:false)
   can't enter a grow-on-resize feedback loop. */
.chart-box { position: relative; height: 220px; width: 100%; }
.chart-box canvas { position: absolute; inset: 0; }
.chart-box + .chart-box { margin-top: 14px; }

.proj-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
@media (min-width: 480px) { .proj-grid { grid-template-columns: repeat(3, 1fr); } }
.proj { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.proj-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.proj-val { font-weight: 800; font-size: 1.05rem; margin-top: 2px; }
.proj-val small { font-weight: 600; font-size: 0.72rem; color: var(--muted); }
.warn { color: var(--gold); background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.3); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 0.85rem; margin: 10px 0 0; }
.badge { display: inline-block; margin: 10px 0 0; padding: 7px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; border: 1px solid var(--line); }
.badge-ok { color: var(--brand); background: rgba(74,222,128,0.1); border-color: var(--brand-dim); }
.badge-warn { color: var(--gold); background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.35); }
.mini-list { margin: 6px 0 0; padding-left: 18px; }
.mini-list li { margin: 2px 0; }
.error {
  color: var(--danger);
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
}

/* --- My Day ---------------------------------------------------------------- */
.day-head { padding: 16px 0 6px; }
.day-nav { display: flex; align-items: center; gap: 12px; }
.day-title { flex: 1; text-align: center; }
.day-title h1 { margin: 0; font-size: 1.7rem; }
.day-title p { margin: 2px 0 0; font-size: 0.85rem; }
.nav-arrow {
  font-size: 1.8rem; line-height: 1; color: var(--text);
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel);
}
.nav-arrow:hover { text-decoration: none; border-color: var(--brand-dim); }
.nav-arrow.disabled { color: var(--line); pointer-events: none; }
.lock { color: var(--gold); }

.day-summary {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 14px;
}
.pill {
  font-size: 0.78rem; font-weight: 700;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; color: var(--muted);
}
.tier-pill { color: var(--text); }
.tier-pill.tier-1 { border-color: var(--tier-1); }
.tier-pill.tier-2 { border-color: var(--tier-2); }
.tier-pill.tier-3 { border-color: var(--tier-3); }
.tier-pill.tier-4 { border-color: var(--tier-4); }
.tier-pill.tier-5 { border-color: var(--tier-5); }
.all-done {
  text-align: center; color: var(--brand); font-weight: 700; margin: 14px 0 0;
}

.task-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-top: 14px;
}
.task-card.done { border-color: var(--brand-dim); box-shadow: inset 3px 0 0 var(--brand); }
.task-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.task-top h2 { margin: 0; font-size: 1.1rem; }
.target { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.hint { font-size: 0.8rem; margin: 6px 0 0; }

.bar {
  height: 10px; background: var(--bg-2); border-radius: 999px;
  overflow: hidden; margin: 12px 0; border: 1px solid var(--line);
}
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-dim), var(--brand)); }

.chips { display: flex; gap: 8px; margin-bottom: 10px; }
.chip {
  flex: 1; font: inherit; font-weight: 700; cursor: pointer;
  padding: 12px 0; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.chip:hover { border-color: var(--brand-dim); }

.row { display: flex; gap: 8px; align-items: center; }
.row input[type="number"], .row input[type="text"] { flex: 1; }

.entry-list { list-style: none; margin: 12px 0; padding: 0; }
.entry-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 0.92rem;
}
.entry-list li + li { border-top: 1px solid var(--line); }
.danger { color: var(--danger); }

.edit-item { width: 100%; }
.edit-item > summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none; gap: 10px; font-weight: 600;
}
.edit-item > summary::-webkit-details-marker { display: none; }
.edit-item .edit-hint { color: var(--brand); font-size: 0.78rem; font-weight: 700; }
.edit-item[open] > summary .edit-hint::after { content: " ▾"; }

.check { display: flex; align-items: center; gap: 10px; flex-direction: row; font-weight: 600; color: var(--text); }
.check input { width: auto; }
.check.big { font-size: 1.05rem; }
.check.big input { width: 22px; height: 22px; }
textarea { resize: vertical; }

/* --- Admin ----------------------------------------------------------------- */
.admin-h1 { font-size: 1.7rem; margin: 12px 0; }
.card + .card { margin-top: 16px; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
.flash {
  background: rgba(74,222,128,0.1); border: 1px solid var(--brand-dim);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 0.9rem;
}
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 120px; }
.mt { margin-top: 14px; }
.ok { color: var(--brand); }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 10px; }
.tbl th { text-align: left; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl code { font-size: 0.9rem; }
.tbl .row { gap: 6px; }
.tbl input, .tbl select { padding: 7px 8px; }
.sel-row { background: var(--panel-2); }

.task-edit { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.task-edit-head { margin-bottom: 8px; }

details summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.sep { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.pic-thumb { width: 100%; max-width: 340px; border-radius: var(--radius-sm); margin-top: 10px; border: 1px solid var(--line); display: block; }
.pic-caption { margin: 8px 0 0; font-size: 0.9rem; color: var(--text); font-style: italic; }
input[type="file"] { padding: 8px; font-size: 0.85rem; }

.pic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pic-cell { margin: 0; }
.pic-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.pic-cell figcaption { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 3px; }

.note-list { list-style: none; margin: 8px 0 0; padding: 0; }
.note-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.note-list li:first-child { border-top: none; }
.note-day { font-size: 0.72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.note-list p { margin: 4px 0 0; }
.who a { color: var(--text); }
.who a:hover { color: var(--brand); }

/* --- Loading overlay ------------------------------------------------------- */
.loader-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9, 13, 11, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.loader-overlay.show { opacity: 1; visibility: visible; }
.loader-box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 28px 34px;
}
.loader-emoji {
  font-size: 3.4rem; line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4));
  will-change: transform;
}
.loader-track {
  width: 190px; height: 6px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); overflow: hidden;
}
.loader-bar {
  width: 40%; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: ld-slide 1.05s linear infinite;
}
.loader-msg {
  color: var(--text); font-weight: 700; letter-spacing: 0.02em;
  font-size: 0.95rem;
}

@keyframes ld-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }
/* Weightlifting / streak: a determined bob. */
.ld-lift { animation: ld-lift-k 0.7s ease-in-out infinite; }
@keyframes ld-lift-k { 0%,100% { transform: translateY(4px) scale(1,0.96); } 45% { transform: translateY(-14px) scale(1,1.04); } }
/* Running / hiking: stride side to side. */
.ld-run { animation: ld-run-k 0.9s ease-in-out infinite; }
@keyframes ld-run-k { 0% { transform: translateX(-26px) scaleX(1); } 49% { transform: translateX(26px) scaleX(1); } 50% { transform: translateX(26px) scaleX(-1); } 99% { transform: translateX(-26px) scaleX(-1); } 100% { transform: translateX(-26px) scaleX(1); } }
/* Swimming: glide + roll. */
.ld-swim { animation: ld-swim-k 1.2s ease-in-out infinite; }
@keyframes ld-swim-k { 0%,100% { transform: translateX(-22px) rotate(-8deg); } 50% { transform: translateX(22px) rotate(8deg); } }
/* Reading: gentle page sway. */
.ld-read { animation: ld-read-k 1.1s ease-in-out infinite; }
@keyframes ld-read-k { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
/* Water: tip and pour. */
.ld-pour { animation: ld-pour-k 0.9s ease-in-out infinite; }
@keyframes ld-pour-k { 0%,100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(16deg) translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .loader-emoji { animation: none !important; }
  .loader-bar { animation-duration: 1.6s; }
}

/* --- Footer ---------------------------------------------------------------- */
.foot {
  text-align: center; color: var(--muted); font-size: 0.78rem;
  letter-spacing: 0.12em; padding: 24px 16px 40px;
}
