/* SniffIt: biel i leśna zieleń, ciepły brąz konturów jak na ilustracjach Plamki, akcent pomarańczowy dla próbek. */
:root {
  --green: #2f6e45;
  --green-2: #3f8a57;
  --green-dark: #1f4d31;
  --mint: #eaf5ee;
  --mint-2: #d5ebdc;
  --brown: #3d2817;
  --text: #3e4a43;
  --muted: #6b7a72;
  --bg: #ffffff;
  --surface: #f7fbf8;
  --line: #d9e8de;
  --accent: #e8772e;
  --accent-soft: #fdeadb;
  --ok: #2e7d32;
  --ok-bg: #e5f4e6;
  --bad: #c62828;
  --bad-bg: #fdeaea;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(31, 77, 49, 0.08);
  --max: 1100px;
  --tabbar: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#main { flex: 1 0 auto; width: 100%; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
h1, h2, h3 { color: var(--green-dark); line-height: 1.2; margin: 1.2em 0 0.5em; font-weight: 900; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.3rem); margin-top: 0.4em; }
h2 { font-size: clamp(1.2rem, 3.2vw, 1.55rem); }
h3 { font-size: 1.1rem; color: var(--brown); margin-top: 0; }
p { margin: 0 0 0.8em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Nagłówek ── */
#header { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 3px solid var(--green); }
.bar { max-width: var(--max); margin: 0 auto; padding: 6px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.3rem; color: var(--green-dark); text-decoration: none; letter-spacing: 0.01em; }
.brand-mark { width: auto; height: 52px; flex: none; }
.brand span b { color: var(--accent); }
.bar-actions { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; border: 2px solid var(--green); border-radius: 999px; overflow: hidden; }
.lang-btn { border: 0; background: #fff; color: var(--green-dark); font: inherit; font-weight: 800; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.lang-btn.active { background: var(--green); color: #fff; }
.nav { max-width: var(--max); margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 10px 12px; color: var(--brown); text-decoration: none; text-transform: uppercase; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.04em; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a.active { color: var(--green); border-bottom-color: var(--green); }

#main { max-width: var(--max); margin: 0 auto; padding: 16px 16px calc(48px + var(--tabbar)); }
footer { background: var(--green-dark); color: #dcefe2; text-align: center; padding: 14px 16px calc(14px + var(--tabbar)); font-size: 0.85rem; }

/* Dolny pasek kart na telefonie */
#tabbar { display: none; }
@media (max-width: 720px) {
  :root { --tabbar: 68px; }
  .nav { display: none; }
  #tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(31, 77, 49, 0.08);
  }
  #tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 800; }
  #tabbar a.active { color: var(--green); }
  #tabbar svg { width: 24px; height: 24px; }
  .brand-mark { height: 44px; }
  .brand { font-size: 1.15rem; }
}

/* ── Elementy wspólne ── */
.muted { color: var(--muted); font-size: 0.93rem; }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.center { align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.white { background: #fff; }
.card.dark { background: var(--green-dark); color: #e8f4ec; border-color: var(--green-dark); }
.card.dark h2, .card.dark h3 { color: #fff; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.back { display: inline-block; margin-bottom: 8px; font-weight: 700; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 2px solid var(--green); background: #fff; color: var(--green-dark); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--mint); color: var(--green-dark); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2a1608; }
.btn.accent:hover { background: #d4651f; border-color: #d4651f; }
.btn.ghost { border-color: var(--line); }
.btn.danger { color: var(--bad); border-color: #f0c4c4; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.btn.big { min-height: 56px; font-size: 1.05rem; padding: 12px 28px; }
.btn.huge { min-height: 110px; font-size: 2rem; letter-spacing: 0.06em; padding: 16px 48px; width: min(100%, 440px); border-radius: 28px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.yes { background: #3bb37f; border-color: #3bb37f; color: #0c1a13; }
.btn.no { background: var(--bad); border-color: var(--bad); color: #fff; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--mint); border: 1px solid var(--mint-2); color: var(--green-dark); font-size: 0.8rem; font-weight: 800; white-space: nowrap; }
.badge.accent { background: var(--accent-soft); border-color: #f4c3a0; color: #7a3a0e; }
.badge.dark { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 800; color: var(--brown); }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); outline: none; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--brown); font: inherit; font-weight: 800; cursor: pointer; }
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.chip.small { min-height: 36px; padding: 4px 12px; font-size: 0.88rem; }
.seg { display: inline-flex; background: var(--mint); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 800; color: var(--green-dark); padding: 8px 14px; border-radius: 10px; min-height: 40px; cursor: pointer; }
.seg button.active { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.progress { height: 10px; background: var(--mint-2); border-radius: 999px; overflow: hidden; margin: 8px 0 12px; }
.progress > div { height: 100%; background: var(--green); transition: width 0.25s; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0 18px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--mint); color: var(--green-dark); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok { color: var(--ok); font-weight: 800; }
.bad { color: var(--bad); font-weight: 800; }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--mint); border: 1px solid var(--mint-2); }
.notice.warn { background: var(--accent-soft); border-color: #f4c3a0; }
.notice.bad { background: var(--bad-bg); border-color: #f0c4c4; color: #7a1f22; font-weight: 400; }
.notice.ok { background: var(--ok-bg); border-color: #b9e0bb; color: #154a19; font-weight: 400; }

/* ── Start ── */
.hero { display: grid; grid-template-columns: 1fr minmax(260px, 46%); align-items: center; gap: 16px; padding: 8px 0; }
.hero h1 { margin-top: 0; }
.hero h1 b { color: var(--accent); }
.hero-img { width: 100%; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero-img { order: -1; max-width: 420px; margin: 0 auto; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 18px 0; }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
/* Pastelowe kafelki – każdy moduł ma swój kolor (kierunek z makiety). */
.tile { --tile-bg: var(--surface); --tile-line: var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px 18px; text-align: center; text-decoration: none;
  background: var(--tile-bg); border: 2px solid var(--tile-line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(31, 77, 49, 0.14); }
.tile-today    { --tile-bg: #eef8f1; --tile-line: #cfe8d7; }
.tile-training { --tile-bg: #fcf1dc; --tile-line: #efd9ae; }
.tile-helper   { --tile-bg: #f6e1cf; --tile-line: #e6c3a4; }
.tile-ring     { --tile-bg: #c9ecd1; --tile-line: #9fd5ad; }
.tile-explore  { --tile-bg: #ddefc0; --tile-line: #bcdc8f; }
.tile-learn    { --tile-bg: #fbe2c4; --tile-line: #efc393; }
.tile-journal  { --tile-bg: #eef8f1; --tile-line: #cfe8d7; }
.tile-events   { --tile-bg: #e3effa; --tile-line: #bcd6ee; }
.tile-groups   { --tile-bg: #f1e6f8; --tile-line: #d8c2e9; }
.tile-img { width: 100%; max-width: 180px; aspect-ratio: 300 / 240; }
.tile-title { font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; color: #2b2118; margin-top: 4px; }
.tile-desc { font-size: 0.86rem; color: #4a5a50; line-height: 1.4; }

.page-head { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.page-head-text { flex: 1 1 auto; min-width: 0; }
.page-head-img { width: 220px; flex: none; }
@media (max-width: 720px) { .page-head { flex-direction: column-reverse; align-items: stretch; } .page-head-img { width: 170px; margin: 0 auto; } }

/* ── Dziś ── */
.challenge { display: grid; gap: 10px; }
.challenge ol { margin: 0; padding-left: 20px; }
.streak { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 0.75rem; color: var(--muted); }
.streak i { display: block; height: 28px; border-radius: 14px; background: var(--mint-2); margin-bottom: 2px; }
.streak i.done { background: var(--green-2); }
.streak i.today { background: #fff; border: 2px dashed var(--accent); }

/* ── Ścieżka ── */
.path { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.path li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.path li .dot { width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; font-weight: 900; background: var(--mint-2); color: var(--green-dark); }
.path li.done .dot { background: var(--green); color: #fff; }
.path li.current { border: 2px solid var(--green); background: var(--mint); }
.path li.current .dot { background: var(--accent); color: #2a1608; }

/* ── Ring ── */
.ring-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ring-svg { width: 100%; height: auto; display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.run { background: var(--green-dark); color: #fff; border-radius: 22px; padding: 18px; display: grid; gap: 14px; }
.run .clock { font-size: clamp(3.5rem, 16vw, 5.5rem); font-weight: 900; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.run .clock.over { color: #ff9b8f; }
.run .stats .stat { background: #18382a; border-color: #285a40; }
.run .stats .stat b { color: #fff; }
.run .stats .stat span { color: #b5d3c0; }
.run .btn.ghost { color: #fff; border-color: #3d6b52; background: transparent; }
.faults { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Siatka 3x3 ── */
.grid3 { position: relative; width: 100%; max-width: 480px; aspect-ratio: 1; border-radius: 16px; overflow: hidden; margin: 0 auto; background: var(--mint); }
.grid3 img { width: 100%; height: 100%; object-fit: cover; }
.grid3-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.grid3-cells button { border: 1px solid rgba(255,255,255,.85); background: transparent; padding: 6px; display: flex; align-items: flex-start; justify-content: flex-start; cursor: pointer; font: inherit; }
.grid3-cells button span { width: 26px; height: 26px; border-radius: 13px; background: rgba(31,77,49,.75); color: #fff; font-weight: 900; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.grid3-cells button.hit { background: rgba(59,179,127,.45); }
.grid3-cells button.miss { background: rgba(198,40,40,.35); }
.grid3-cells button.answer { box-shadow: inset 0 0 0 4px var(--accent); }
.marker-stage { position: relative; max-width: 520px; margin: 0 auto; cursor: crosshair; touch-action: manipulation; }
.marker-stage img { width: 100%; border-radius: 12px; }
.marker-dot { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 4px solid #fff; background: var(--accent); box-shadow: 0 0 0 3px rgba(232,119,46,.35); pointer-events: none; }

/* ── Mapa ── */
.map { height: min(62vh, 560px); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--mint); }
.leaflet-container { font: inherit; }
.pin-list { display: grid; gap: 8px; }
.pin-item { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pin-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }

/* ── Okno instalacji (z rally-o) ── */
.install-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--green); background: #fff; color: var(--green-dark); font: inherit; font-weight: 800; cursor: pointer; }
@media (max-width: 480px) { .install-btn-label { display: none; } }
.install-dialog { border: 0; border-radius: 22px; padding: 0; max-width: min(92vw, 420px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.install-dialog::backdrop { background: rgba(20, 40, 28, 0.45); }
.install-body { padding: 22px; text-align: center; }
.install-body h2 { margin-top: 6px; }
.install-logo { margin: 0 auto; width: 110px; }
.install-perks { text-align: left; padding-left: 20px; }
.install-how { text-align: left; background: var(--mint); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.install-note { font-size: 0.9rem; color: var(--muted); }
.install-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.install-hint { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--tabbar)); z-index: 50; display: flex; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--green); border-radius: 16px; padding: 10px 12px; box-shadow: 0 8px 26px rgba(0,0,0,.2); }
.install-hint img { width: 44px; height: 44px; border-radius: 10px; }
.install-hint-text { flex: 1; font-size: 0.9rem; }
.install-hint-text strong { display: block; }
.install-hint-close { border: 0; background: transparent; font-size: 1.2rem; min-width: 44px; min-height: 44px; cursor: pointer; }
.install-share-icon { display: inline-flex; vertical-align: -3px; margin: 0 2px; }

@media print {
  #header, #tabbar, footer, .no-print { display: none !important; }
  #main { padding: 0; }
  .ring-wrap { border: 0; }
}

/* ── Konto w nagłówku ── */
.account-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); color: var(--green-dark); font-weight: 800; font-size: 0.9rem; text-decoration: none; max-width: 180px; }
.account-btn svg { width: 20px; height: 20px; flex: none; }
.account-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn:hover, .account-btn.active { border-color: var(--green); background: var(--mint); }
@media (max-width: 520px) { .account-btn span { display: none; } .account-btn { padding: 6px 9px; } }

/* ── Formularze: wyszukiwarka i pola wyboru ── */
.search { font: inherit; min-height: 40px; padding: 6px 14px; border: 2px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); min-width: 200px; flex: 1 1 200px; }
.search:focus { border-color: var(--green); outline: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brown); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
details > summary { cursor: pointer; font-weight: 800; color: var(--green-dark); }

/* ── Wydarzenia ── */
.month { margin: 18px 0 0; text-transform: capitalize; }
.event { display: flex; gap: 14px; align-items: flex-start; }
.event.past { opacity: 0.65; }
.event-date { flex: none; width: 74px; text-align: center; background: var(--mint); border: 1px solid var(--mint-2); border-radius: 14px; padding: 8px 4px; color: var(--green-dark); }
.event-date b { display: block; font-size: 1.7rem; line-height: 1; font-weight: 900; }
.event-date span { display: block; font-size: 0.72rem; font-weight: 700; margin-top: 4px; line-height: 1.25; }
@media (max-width: 520px) { .event { flex-direction: column; } .event-date { width: auto; display: flex; gap: 10px; align-items: baseline; padding: 6px 12px; } .event-date span { margin: 0; } }

/* ── Grupy ── */
.group-item { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.group-item strong { color: var(--green-dark); font-size: 1.05rem; }
.group-item:hover { border-color: var(--green-2); }
.join-code { font-size: 2rem; font-weight: 900; letter-spacing: 0.18em; color: #fff; font-variant-numeric: tabular-nums; }
.sub { border-top: 1px solid var(--line); padding-top: 8px; }
.sub input { font: inherit; flex: 1; min-height: 40px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; }
.task-done { background: var(--surface); }
