:root {
  --bg: #0e1013;
  --card: #171a1f;
  --card2: #1f232a;
  --line: #2a2f37;
  --text: #eef1f4;
  --muted: #8b939e;
  --accent: #b6f23a;
  --accent-ink: #14180a;
  --ok: #34d399;
  --bad: #f25c7a;
  --warn: #f2a33a;
  --r: 16px;
  --nav-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }

/* ---------- fejléc és alsó menü ---------- */
#top {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 8px 8px;
  background: rgba(14, 16, 19, .92); backdrop-filter: blur(10px);
}
#title { font-size: 18px; text-align: center; font-weight: 700; }
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #121519; border-top: 1px solid var(--line);
}
#tabs button {
  border: 0; background: none; color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
#tabs .ti { font-size: 20px; filter: grayscale(1) opacity(.6); }
#tabs button.on { color: var(--accent); }
#tabs button.on .ti { filter: none; }

main { max-width: 760px; margin: 0 auto; padding: 4px 16px 90px; }

/* ---------- alapelemek ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card.hl { background: linear-gradient(135deg, #1f2a12, #171a1f 70%); border: 1px solid #34431a; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt0 { margin-top: 0; }
.sec { margin: 22px 4px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--card2); font-size: 13px; }
.pill.ok { background: rgba(52, 211, 153, .15); color: var(--ok); }
.pill.bad { background: rgba(242, 92, 122, .15); color: var(--bad); }
.pill.acc { background: rgba(182, 242, 58, .15); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0;
  background: var(--card2); font-weight: 600; cursor: pointer;
}
.btn.pri { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; border: 1px solid var(--line); }
.btn.danger { background: rgba(242, 92, 122, .15); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:active { transform: scale(.98); }
.btns { display: grid; gap: 10px; margin-top: 14px; }
.btns.two { grid-template-columns: 1fr 1fr; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; font-size: 20px; cursor: pointer; }
.icon-btn:active { background: var(--card2); }

input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
label.f { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.list { display: grid; gap: 2px; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; }

/* ---------- Ma ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { text-align: center; padding: 8px 0; border-radius: 12px; background: var(--card); font-size: 12px; color: var(--muted); cursor: pointer; }
.wd b { display: block; font-size: 16px; color: var(--text); margin: 2px 0; }
.wd.today { outline: 2px solid var(--accent); }
.wd .st { height: 16px; font-size: 12px; line-height: 16px; }
.exl { display: grid; gap: 6px; margin-top: 10px; }
.exl div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }

/* ---------- edzés naplózása ---------- */
.wk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wk-time { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; color: var(--accent); }
.ex-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sets { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sets th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: center; padding: 4px; }
.sets td { padding: 4px; text-align: center; }
.sets td:first-child { width: 28px; color: var(--muted); }
.sets input { min-height: 40px; padding: 6px; text-align: center; border-radius: 10px; }
.sets tr.done input { background: rgba(182, 242, 58, .08); border-color: #3b4a1c; }
.chk { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); font-weight: 800; cursor: pointer; }
.chk.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.prevc { font-size: 12px; color: var(--muted); white-space: nowrap; }

#rest {
  position: fixed; left: 12px; right: 12px; z-index: 11;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  max-width: 736px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: #222a14; border: 1px solid #4a5d1f; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
#rest .rt { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 70px; }
#rest .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 0 0 16px 16px; }

/* ---------- naptár ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .hd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cd {
  aspect-ratio: 1 / 1.1; border-radius: 10px; background: var(--card); padding: 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; font-size: 14px; position: relative;
}
.cd.out { opacity: .3; }
.cd.today { outline: 2px solid var(--accent); }
.cd .bar { width: 70%; height: 4px; border-radius: 3px; }
.cd .ic { font-size: 13px; height: 16px; line-height: 16px; }
.cd.done { background: #1b2a17; }
.cd.miss { background: #2a1820; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ---------- tervek ---------- */
.wkrow { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; padding: 6px 0; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colors button.on { border-color: var(--text); }
.ti-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ti-row:last-child { border-bottom: 0; }
.ti-in { display: flex; gap: 4px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ti-in input { width: 50px; min-height: 38px; padding: 6px; text-align: center; }
.ti-in span { font-size: 12px; color: var(--muted); }
.ti-act { display: flex; flex-direction: column; }
.ti-act .icon-btn { width: 36px; height: 32px; font-size: 15px; }
.preset { cursor: pointer; border: 1px solid transparent; }
.preset:active { border-color: var(--accent); }

/* ---------- grafikonok, statisztika ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tile { background: var(--card); border-radius: var(--r); padding: 14px; }
.tile .v { font-size: 26px; font-weight: 800; }
.tile .l { font-size: 13px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: none; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--card2); }
.heat i.d { background: var(--accent); }
.heat i.s { background: #3a3f2a; }
.heat i.p { outline: 1px solid #4a5d1f; outline-offset: -1px; }
.prog { height: 8px; background: var(--card2); border-radius: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }

/* ---------- alsó lap (sheet) és toast ---------- */
#sheetWrap { position: fixed; inset: 0; z-index: 20; }
#sheetBg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
#sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 760px; margin: 0 auto;
  max-height: 88vh; overflow: auto; background: #15181d; border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .2s ease-out;
}
#sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 80px);
  background: #2b313a; padding: 12px 18px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.5);
  max-width: calc(100% - 32px); text-align: center;
}
.feel { display: flex; justify-content: space-between; gap: 6px; }
.feel button { flex: 1; font-size: 28px; padding: 8px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; }
.feel button.on { border-color: var(--accent); background: #222a14; }
.search { position: sticky; top: -10px; background: #15181d; padding: 6px 0; z-index: 1; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .cd { aspect-ratio: 1.3 / 1; }
}
