/* Krokomierz. Ten sam papier i typografia co TeoPlay, ale sportowy akcent:
   świeża zieleń Triki zamiast gliny, duże cyfry, pierścień postępu. */

:root {
  --paper: #f6f8f2;
  --card: #ffffff;
  --ink: #14210f;
  --muted: #62705a;
  --line: #dfe6d5;
  --go: #2f9d4d;
  --go-deep: #227a3b;
  --track: #e4ecda;
  --radius: 16px;
}
html[data-theme="dark"] {
  --paper: #171c15;
  --card: #212a1d;
  --ink: #eef3e8;
  --muted: #98a690;
  --line: #384231;
  --go: #4fc373;
  --go-deep: #7fdb9a;
  --track: #384231;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: -.005em;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: "Source Serif 4", Georgia, serif; }
a { color: inherit; }
button { font: inherit; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand .back { width: 16px; height: 16px; color: var(--muted); }
.brand .foot { width: 22px; height: 22px; color: var(--go); fill: currentColor; }
.bar nav { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.ghost {
  color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px;
}
.ghost:hover { color: var(--ink); border-color: var(--muted); }

main { flex: 1; width: min(460px, 100%); margin: 0 auto; padding: 20px 20px 40px; display: flex; flex-direction: column; align-items: center; }

.linkStat { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.linkbtn {
  display: inline-flex; align-items: center; gap: 9px; background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 15px; font-size: 13.5px; color: var(--muted);
}
.linkbtn:hover { color: var(--ink); }
.linkbtn .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex: 0 0 auto; }
.linkbtn.live .dot { background: var(--go); animation: pulse 1.2s infinite; }
.linkbtn.err .dot { background: #d6402a; }
.linkbtn.busy { opacity: .6; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

.battery { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.battery svg { width: 22px; height: 11px; }
.battery .cell { transition: width .2s; }

.ring-wrap { position: relative; width: min(260px, 78vw); margin: 34px 0 6px; }
.ring { width: 100%; height: auto; display: block; }
.ring__track { fill: none; stroke: var(--track); stroke-width: 14; }
.ring__fill {
  fill: none; stroke: var(--go); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 603.19; stroke-dashoffset: 603.19;
  transition: stroke-dashoffset .5s cubic-bezier(.2, .8, .3, 1);
}
.ring__mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 2px;
}
.ring__mid b { font-size: 48px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.ring__mid span { margin-top: 4px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ring__mid p { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ring__mid p b { font-size: inherit; font-weight: 700; color: var(--ink); }

.hint { margin-top: 6px; font-size: 13.5px; color: var(--muted); text-align: center; min-height: 1.4em; }

.grid { width: 100%; margin-top: 30px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
}
.tile__k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tile__v { margin-top: 4px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile__u { font-size: 10.5px; color: var(--muted); }

.history { width: 100%; margin-top: 30px; }
.history__head { display: flex; align-items: baseline; justify-content: space-between; }
.history__head h2 { font-size: 16px; font-weight: 600; }
.history__head p { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars { margin-top: 16px; display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .stem { width: 100%; max-width: 30px; border-radius: 8px 8px 3px 3px; background: var(--track); min-height: 3px; transition: height .4s ease; }
.bars .stem.hit { background: var(--go); }
.bars .col.today .stem { background: var(--go-deep); }
.bars .lab { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

footer {
  border-top: 1px solid var(--line); padding: 18px 22px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}

/* arkusz ustawień */
.sheet { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(2px);
  touch-action: pan-y; overflow: auto; }
.sheet__panel {
  width: min(420px, 100%); max-height: min(88vh, 720px); overflow: auto; margin: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px;
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet__head h2 { font-size: 16px; font-weight: 600; }
.block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.fld { display: block; margin-top: 16px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; }
.fld input {
  margin-top: 7px; width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font: 600 15px/1 Inter, sans-serif;
}
.sld { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sld input { flex: 1; accent-color: var(--go); }
.sld span { color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.opt-row { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  cursor: pointer; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--muted); padding: 10px 16px; font-size: 12.5px; font-weight: 600;
}
.btn.on { background: var(--go); border-color: var(--go); color: #fff; }
.btn:hover { color: var(--ink); }

.note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.note:empty { display: none; }

#toast {
  position: fixed; left: 0; right: 0; top: 18%; text-align: center; z-index: 6;
  font-size: 22px; font-weight: 800; color: var(--go); opacity: 0; pointer-events: none;
}
#toast.show { animation: rise 1.1s cubic-bezier(.2, .8, .3, 1); }
@keyframes rise {
  0% { opacity: 0; transform: translateY(10px) scale(.9) }
  16% { opacity: 1; transform: translateY(0) scale(1.05) }
  30% { transform: scale(1) }
  76% { opacity: 1 }
  100% { opacity: 0; transform: translateY(-14px) }
}

.hidden { display: none !important; }

@media (max-width: 420px) {
  main { padding: 16px 16px 32px; }
  .grid { gap: 8px; }
  .tile { padding: 12px 6px; }
  .ring-wrap { width: min(230px, 74vw); margin-top: 26px; }
  .ring__mid b { font-size: 40px; }
}
