/* Fogyika – „mérőszalag” irány.
   Papírfehér alap, tinta-kék, Barlow / Barlow Condensed. Kártyák helyett vonalak. */
:root {
  --bg: #F7F8F6;          /* papír */
  --bg2: #EEF0EC;         /* halvány sáv, bemeneti mező */
  --ink: #1B2A41;         /* tinta-kék: szöveg és kiemelés */
  --ink-soft: #4B5A6B;    /* másodlagos szöveg */
  --steel: #8A96A3;       /* címkék, halk szöveg */
  --rule: #D9DEE3;        /* elválasztó vonal */
  --rule-strong: #B8C0C8;
  --tape: #DCE3EA;        /* mérőszalag hátralévő szakasz */
  --good: #2F7D5C;
  --warn: #C77D1B;
  --danger: #B3402E;
  --on-ink: #F7F8F6;      /* szöveg tinta-kék alapon */
  --shadow: none;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: Barlow, "Arial Narrow", Arial, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131B27; --bg2: #1C2634; --ink: #E6EAEE; --ink-soft: #B8C0C8; --steel: #8A96A3;
    --rule: #2A3646; --rule-strong: #3B4A61; --tape: #2C3B50; --good: #5DB58F; --warn: #E0A028; --danger: #E06A57; --on-ink: #131B27;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131B27; --bg2: #1C2634; --ink: #E6EAEE; --ink-soft: #B8C0C8; --steel: #8A96A3;
  --rule: #2A3646; --rule-strong: #3B4A61; --tape: #2C3B50; --good: #5DB58F; --warn: #E0A028; --danger: #E06A57; --on-ink: #131B27;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.num { font-variant-numeric: tabular-nums; }
.cond { font-family: var(--cond); }

/* Fejléc és menü */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: baseline; justify-content: space-between; padding: 14px 20px 10px; background: var(--bg); border-bottom: 1px solid var(--rule); }
.brand { font-family: var(--cond); font-weight: 700; font-size: 22px; letter-spacing: 0.2px; }
.chip { font-size: 13px; color: var(--steel); }

.view { padding: 8px 20px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.loading { text-align: center; color: var(--steel); padding: 40px 0; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg); border-top: 1px solid var(--rule); padding-bottom: var(--safe-b); z-index: 5; }
.tabs button { flex: 1; background: none; border: 0; color: var(--steel); padding: 10px 0 8px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--ink); font-weight: 600; }

/* Szekciók: vonalakkal tagolt lista, nem kártya */
.card { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.card:last-child { border-bottom: 0; }
.card h2 { margin: 0 0 12px; font-family: var(--cond); font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card h2 .muted { font-family: var(--font); font-size: 13px; font-weight: 400; }
.card h3 { margin: 0 0 6px; font-family: var(--cond); font-size: 22px; font-weight: 600; line-height: 1.1; }
.muted { color: var(--steel); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { text-align: right; }
.stack { display: grid; gap: 8px; }

/* Nagy szám és mérőszalag */
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero .big { font-family: var(--cond); font-size: 96px; font-weight: 700; line-height: 0.9; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.hero .big small { font-family: var(--cond); font-size: 26px; font-weight: 600; color: var(--steel); letter-spacing: 0; margin-left: 6px; }
.hero .sub { color: var(--steel); font-size: 14px; }
.hero .sub b { color: var(--ink); font-weight: 600; }
.tape { width: 100%; height: auto; display: block; overflow: visible; margin-top: 6px; }
.tape text { font-family: var(--font); fill: var(--steel); font-size: 10px; }
.tape .lbl { fill: var(--ink); font-size: 11px; }
.tape .base { fill: var(--bg2); }
.tape .left { fill: var(--tape); }
.tape .done { fill: var(--ink); }
.tape .tick { stroke: var(--steel); stroke-width: 1; }
.tape .goal { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.tape .now { fill: var(--ink); }
.tape .start { fill: var(--steel); }

/* Számsor kártyák helyett */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; padding-top: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-family: var(--cond); font-size: 26px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 16px; font-weight: 600; color: var(--steel); }
.stat .l { font-size: 12px; color: var(--steel); }

/* Űrlapok */
input[type=number], input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--rule); border-radius: 2px; padding: 10px 12px; color: var(--ink); outline: none; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--steel); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; font-size: 12px; color: var(--steel); margin-bottom: 4px; }
.field { margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.btn { background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); border-radius: 2px; padding: 12px 16px; font-weight: 600; min-height: 48px; cursor: pointer; width: 100%; font-size: 16px; }
.btn:active { opacity: 0.85; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 8px 12px; min-height: 40px; width: auto; font-size: 14px; }
.btn:disabled { opacity: .5; }

/* Üzenetek */
.notice { border: 1px solid var(--rule-strong); padding: 10px 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 2px; }
.notice b { font-family: var(--cond); font-size: 17px; font-weight: 600; }
.notice.success b { color: var(--good); }
.notice.warn b { color: var(--warn); }
.notice.warn { border-color: var(--warn); }
.notice.hint { border-style: dashed; }

/* Szokások: négyzet pipák */
.habits { display: grid; gap: 10px; }
.habit { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 32px; font-size: 15px; }
.habit .box { width: 22px; height: 22px; border: 1.5px solid var(--steel); display: grid; place-items: center; flex: none; color: var(--on-ink); font-size: 14px; font-weight: 700; line-height: 1; }
.habit.on .box { background: var(--ink); border-color: var(--ink); }

/* Vékony haladásjelző */
.bar { height: 3px; background: var(--bg2); overflow: hidden; }
.bar > div { height: 100%; background: var(--ink); transition: width .3s; }
.bar.warn > div { background: var(--warn); }
.bar.over > div { background: var(--danger); }
.goal-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.goal-row b { font-variant-numeric: tabular-nums; }

/* Gyakorlatok */
.ex { border-top: 1px solid var(--rule); padding: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.ex:first-child { border-top: 0; }
.ex .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ex .head h3 { margin: 0; }
.ex .target { color: var(--ink); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex .cue { color: var(--ink-soft); font-size: 13px; }
.ex .note { font-size: 13px; color: var(--good); }
.ex .prev { font-size: 13px; color: var(--steel); }
.plate { width: 50px; height: 50px; border-radius: 50%; border: 6px solid var(--ink); display: grid; place-items: center; flex: none; font-family: var(--cond); font-weight: 700; font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
.sets { display: grid; gap: 6px; }
.set { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 10px; align-items: end; }
.set .n { color: var(--steel); font-size: 13px; padding-bottom: 8px; font-variant-numeric: tabular-nums; }
.set.hdr { min-height: 0; }
.set.hdr span { font-size: 12px; color: var(--steel); }
.set input { min-height: 40px; padding: 6px 0; text-align: left; background: transparent; border: 0; border-bottom: 1.5px solid var(--rule-strong); border-radius: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.set input:focus { border-bottom-color: var(--ink); }
.set input::placeholder { color: var(--rule-strong); font-weight: 400; font-size: 15px; }
.swap { min-height: 32px; padding: 4px 10px; font-size: 13px; }

/* Grafikon */
.chart { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.chart .avg { fill: none; stroke: var(--good); stroke-width: 2; }
.chart .dot { fill: var(--ink); }
.chart text { fill: var(--steel); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .goalline { stroke: var(--warn); stroke-dasharray: 2 4; }

/* Fázis-útiterv: valódi sorrend, ezért számozott */
.road { display: grid; gap: 0; }
.step { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--rule); }
.step .num { width: 30px; height: 30px; border: 1.5px solid var(--rule-strong); display: grid; place-items: center; font-family: var(--cond); font-weight: 700; flex: none; color: var(--steel); }
.step.current .num { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.step.done .num { border-color: var(--ink); color: var(--ink); }
.step.done { color: var(--steel); }

.seg { display: flex; border: 1px solid var(--rule-strong); }
.seg button { flex: 1; border: 0; background: transparent; color: var(--steel); padding: 10px; font-weight: 600; cursor: pointer; min-height: 44px; }
.seg button.active { background: var(--ink); color: var(--on-ink); }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--rule); }
th { color: var(--steel); font-weight: 500; }
td.r, th.r { text-align: right; }

ul.rules { margin: 6px 0 0; padding-left: 18px; }
ul.rules li { margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; z-index: 10; font-size: 14px; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

.hist { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); gap: 8px; }
.hist:first-child { border-top: 0; }
.pill { display: inline-block; font-size: 12px; padding: 1px 6px; border: 1px solid var(--rule-strong); color: var(--steel); font-variant-numeric: tabular-nums; }
.pill.good { color: var(--good); border-color: var(--good); }
.pill.bad { color: var(--warn); border-color: var(--warn); }

/* Pihenőidőzítő sáv az edzés fülön */
.restbar { position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-b)); z-index: 4; display: flex; gap: 12px; align-items: center; padding: 0 20px; height: 56px; background: var(--ink); color: var(--on-ink); max-width: 640px; margin: 0 auto; }
.restbar .lbl { font-size: 13px; opacity: 0.7; }
.restbar button { background: transparent; color: var(--on-ink); border: 1.5px solid var(--on-ink); padding: 6px 10px; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 36px; }
.restbar #restTime { flex: 1; text-align: center; font-family: var(--cond); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
body:has(.restbar) .view { padding-bottom: calc(150px + var(--safe-b)); }

/* Bejelentkezés */
body.noauth .tabs, body.noauth .top { display: none; }
body.noauth .view { padding-bottom: 20px; max-width: 460px; }
.auth .brand-big { font-family: var(--cond); font-size: 40px; font-weight: 700; line-height: 1; }
