:root {
  --bg: #0b0b0d;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --border: #26262c;
  --red: #e11d2e;
  --red-hi: #ff4d5e;
  --red-dark: #7f1d1d;
  --red-glow: rgba(225, 29, 46, 0.35);
  --text: #f5f5f5;
  --muted: #a1a1aa;
  --lv0: #1f1f24;
  --lv1: #4a1016;
  --lv2: #7f1d1d;
  --lv3: #b3182a;
  --lv4: #e11d2e;
  --radius: 16px;
  --nav-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(225, 29, 46, 0.16), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 700; }
a { color: var(--red-hi); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- Elrendezés ---------- */

.app { min-height: 100vh; }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
}

.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.nav .brand { display: none; }

.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 600;
}

.nav a svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a.is-active { color: var(--red-hi); }

@media (min-width: 860px) {
  .app { display: grid; grid-template-columns: 232px 1fr; }
  main { padding: 40px 32px 64px; width: 100%; }
  .nav {
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    padding: 24px 14px;
    gap: 4px;
    border-top: 0;
    border-right: 1px solid var(--border);
  }
  .nav .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 24px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
  }
  .nav a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 15px;
  }
  .nav a:hover { background: var(--surface); color: var(--text); }
  .nav a.is-active { background: rgba(225, 29, 46, 0.12); color: var(--red-hi); }
}

/* ---------- Közös elemek ---------- */

.view-head { margin-bottom: 20px; display: flex; flex-direction: column; gap: 12px; }
.row-between { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; }

.eyebrow {
  display: block;
  color: var(--red-hi);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.section-title { margin: 28px 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 20px -8px var(--red-glow); }
.btn-primary:hover { background: var(--red-hi); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #3a3a42; }
.btn-danger { background: transparent; border-color: var(--red-dark); color: var(--red-hi); }
.btn-danger:hover { background: rgba(225, 29, 46, 0.1); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover:not(:disabled) { border-color: var(--red-dark); color: var(--red-hi); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.link-btn { background: none; border: 0; padding: 0; color: var(--red-hi); font-size: 13px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip:hover { border-color: #3a3a42; }
.chip.is-on { background: var(--red); border-color: var(--red); color: #fff; }

.pill {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-hot { border-color: var(--red-dark); color: var(--red-hi); }

.habit-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 22px;
}

/* ---------- Ma ---------- */

.day-nav { display: flex; align-items: center; gap: 12px; }
.day-label { flex: 1; text-align: center; min-width: 0; }
.day-label h1 { font-size: 22px; }

.checkin-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  box-shadow: 0 12px 32px -14px var(--red-glow);
  animation: rise 0.4s ease-out;
}
.checkin-banner p { margin: 2px 0 0; opacity: 0.9; font-size: 14px; }
.checkin-banner strong { font-size: 17px; }
.checkin-moon { font-size: 30px; }

.progress-card { display: flex; align-items: center; gap: 16px; }
.ring { width: 72px; height: 72px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring-bg { stroke: var(--lv0); }
.ring-fg { stroke: var(--red); stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.progress-text { flex: 1; min-width: 0; }
.progress-num { font-size: 20px; color: var(--muted); }
.progress-num strong { font-size: 30px; color: var(--text); font-weight: 800; }
.progress-streak { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.15; }
.progress-streak .flame { font-size: 22px; }
.progress-streak strong { font-size: 22px; font-weight: 800; }

.habit-list { display: grid; gap: 10px; margin-bottom: 16px; }

.habit {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s, background 0.2s, transform 0.1s;
}
.habit:hover { border-color: #3a3a42; }
.habit:active { transform: scale(0.99); }
.habit-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.habit-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.habit-meta { color: var(--muted); font-size: 13px; }

.check {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 2px solid #3a3a42;
  transition: background 0.2s, border-color 0.2s;
}
.check svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.5); transition: opacity 0.2s, transform 0.2s; }

.habit.is-done { border-color: var(--red-dark); background: linear-gradient(90deg, rgba(225, 29, 46, 0.14), var(--surface) 70%); }
.habit.is-done .habit-icon { background: rgba(225, 29, 46, 0.18); }
.habit.is-done .check { background: var(--red); border-color: var(--red); box-shadow: 0 0 16px var(--red-glow); }
.habit.is-done .check svg { opacity: 1; transform: scale(1); }

.hero p { margin: 0; color: var(--muted); }

/* ---------- Hős ---------- */

.hero-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 10px; overflow: visible; }
.hero-figure { width: 104px; flex: none; }
.hero-figure.big { width: 150px; }
.hero-svg { display: block; width: 100%; height: auto; overflow: visible; }
.hero-svg .hero-body { animation: bob 2.6s ease-in-out infinite; transform-origin: 60px 130px; }
.hero-svg .hero-aura { animation: aura 3s ease-in-out infinite; transform-origin: 60px 74px; }
.hero-svg .hero-sparkle { animation: twinkle 1.4s ease-in-out infinite; }
.hero-svg.mood-sad { filter: saturate(0.45) brightness(0.85); }
.hero-svg.mood-sad .hero-body { animation: none; transform: translateY(2px); }
.hero-svg.mini .hero-body, .hero-svg.mini .hero-aura { animation: none; }

.hero-info { flex: 1; min-width: 0; }
.hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-name { font-size: 17px; overflow-wrap: anywhere; }
.hero-rank {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(225, 29, 46, 0.15);
  border: 1px solid var(--red-dark);
  color: var(--red-hi);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-level { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 5px; font-weight: 800; }

.xp-bar { height: 10px; border-radius: 999px; background: var(--lv0); overflow: hidden; }
.xp-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-dark), var(--red) 60%, var(--red-hi));
  box-shadow: 0 0 12px var(--red-glow);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-bubble {
  position: relative;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.4;
}
.hero-bubble::before {
  content: "";
  position: absolute;
  left: 16px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.hero-intro { margin-bottom: 16px; }

.xp-float {
  position: absolute;
  left: 52px;
  top: 10px;
  font-weight: 900;
  font-size: 18px;
  pointer-events: none;
  animation: xpfloat 1.3s ease-out forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.xp-float.up { color: #ffd166; }
.xp-float.down { color: var(--muted); }
.hero-card.level-up .hero-figure { animation: levelup 0.9s ease-out; }
.hero-card.level-up .xp-bar span { animation: barflash 0.9s ease-out; }

.hero-panel-main { display: flex; align-items: center; gap: 16px; }
.hero-panel-name { font-size: 22px; margin-bottom: 6px; }
.hero-panel .xp-bar { margin-top: 10px; }
.hero-panel .hero-info p { margin: 6px 0 0; }
.hero-next { font-size: 14px; }
.hero-next strong { color: var(--red-hi); }

.hero-road { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.road-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 6px 2px; border-radius: 12px; border: 1px solid transparent; }
.road-step .hero-svg { width: 100%; max-width: 64px; }
.road-step.is-locked .hero-svg { filter: brightness(0) opacity(0.5); }
.road-step.is-current { border-color: var(--red-dark); background: rgba(225, 29, 46, 0.08); }
.road-name { font-size: 11.5px; font-weight: 700; }
.road-lvl { font-size: 10.5px; color: var(--muted); }
.road-step.is-current .road-lvl { color: var(--red-hi); font-weight: 700; }
.hero-rules { margin: 14px 0 0; }

.hero-custom { display: flex; align-items: center; gap: 12px; }
.hero-custom .hero-figure { width: 92px; }
.hero-custom-fields { flex: 1; min-width: 0; }
.hero-custom-fields input[type="text"] { width: 150px; max-width: 100%; }
.skin-row { flex-wrap: wrap; border-bottom: 0; }
.gender-toggle { display: flex; gap: 8px; }
.gender-btn {
  width: 44px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.gender-btn:hover { border-color: #3a3a42; color: var(--text); }
.gender-btn[aria-checked="true"] { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 6px 18px -8px var(--red-glow); }
.skin-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.skin-swatch {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--skin);
  transition: transform 0.1s, border-color 0.15s;
}
.skin-swatch:hover { transform: scale(1.08); }
.skin-swatch[aria-checked="true"] { border-color: var(--red); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--red); }

@media (max-width: 420px) {
  .hero-custom { flex-direction: column; align-items: stretch; }
  .hero-custom .hero-figure { align-self: center; }
}

/* ---------- Badge-ek és kihívások ---------- */

.medal {
  --ring: #cd7f32;
  --ring-dark: #7a4a1c;
  --size: 44px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--ring), var(--ring-dark), var(--ring), var(--ring-dark), var(--ring));
  box-shadow: 0 4px 14px -6px var(--ring);
}
.medal::before {
  content: "";
  position: absolute;
  inset: calc(var(--size) * 0.1);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2a30, #121215 75%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.medal-icon { position: relative; font-size: calc(var(--size) * 0.46); line-height: 1; }
.medal.tier-ezust { --ring: #e5e9ef; --ring-dark: #7c818b; }
.medal.tier-arany { --ring: #ffd166; --ring-dark: #b7791f; }
.medal.tier-legenda { --ring: #ff4d5e; --ring-dark: #7f1d1d; box-shadow: 0 0 18px -2px var(--red-glow); }
.medal.size-sm { --size: 26px; }
.medal.size-md { --size: 44px; }
.medal.size-lg { --size: 58px; }
.medal.size-xl { --size: 120px; }
.medal.is-locked { filter: grayscale(1) brightness(0.55); box-shadow: none; }
.medal.is-locked .medal-icon { opacity: 0.6; }

.medal-slot {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  color: #55555c;
  font-weight: 800;
}

.featured-row { display: inline-flex; gap: 4px; margin-left: auto; text-decoration: none; }
.featured-panel { display: flex; gap: 8px; margin-top: 10px; }
.hero-card .hero-figure { display: block; }

.section-sub { margin: -6px 0 12px; }
.profile-custom-link { margin: -4px 0 0; text-align: center; }
.section-title.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title.row-between h2 { margin: 0; }

.challenge { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.challenges > .challenge:last-of-type { border-bottom: 0; }
.challenge-body { flex: 1; min-width: 0; }
.challenge-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.challenge-desc { color: var(--muted); font-size: 13px; margin: 1px 0 6px; }
.challenge-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.challenge-step { flex: none; align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted); }
.challenge.is-idle { opacity: 0.75; }
.xp-bar.thin { height: 7px; }
.idle-challenges { border-top: 1px solid var(--border); }
.idle-challenges summary { cursor: pointer; padding: 12px 0; color: var(--muted); font-weight: 600; }
.done-tracks { margin: 0; padding: 12px 0; border-top: 1px solid var(--border); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; margin-bottom: 16px; }
.badge-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  color: inherit;
  font: inherit;
}
.badge-item.is-earned { cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.badge-item.is-earned:hover { border-color: #3a3a42; }
.badge-item.is-earned:active { transform: scale(0.98); }
.badge-item.is-featured { border-color: var(--red); background: linear-gradient(180deg, rgba(225, 29, 46, 0.14), var(--surface) 70%); }
.badge-name { font-weight: 800; font-size: 13.5px; line-height: 1.2; }
.badge-sub { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.badge-item:not(.is-earned) .badge-name { color: var(--muted); }
.xp-reward { margin-left: auto; color: #ffd166; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.badge-tier .xp-reward { margin-left: 0; }
.badge-xp { font-size: 12px; font-weight: 800; color: #ffd166; }
.badge-item:not(.is-earned) .badge-xp { color: #8a7a4a; }
.badge-pin { position: absolute; top: 6px; right: 8px; color: var(--red-hi); font-size: 15px; }
.badge-new {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.badge-figure { margin: 12px auto 10px; animation: levelup 1.1s ease-out; }
.badge-tier { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.center-row { justify-content: center; }

.nav a { position: relative; }
.nav a.has-dot::after {
  content: "";
  position: absolute;
  top: 10px;
  left: calc(50% + 9px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-hi);
  box-shadow: 0 0 0 2px var(--bg);
}
@media (min-width: 860px) { .nav a.has-dot::after { top: 50%; left: auto; right: 14px; transform: translateY(-50%); } }
@media (max-width: 400px) { .nav a { font-size: 10.5px; } }

.evolve { text-align: center; width: min(380px, calc(100vw - 32px)); }
.evolve-figure { width: 180px; margin: 6px auto 10px; animation: levelup 1.1s ease-out; }
.evolve h2 { margin-bottom: 6px; }
.evolve p { margin: 0 0 18px; }

@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes aura { 50% { transform: scale(1.08); opacity: 0.75; } }
@keyframes twinkle { 50% { opacity: 0.3; } }
@keyframes xpfloat {
  0% { opacity: 0; transform: translateY(8px) scale(0.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-34px) scale(1); }
}
@keyframes levelup {
  0% { transform: scale(1); filter: brightness(1); }
  30% { transform: translateY(-14px) scale(1.12); filter: brightness(1.6) drop-shadow(0 0 14px var(--red)); }
  100% { transform: none; filter: none; }
}
@keyframes barflash { 30% { filter: brightness(1.8); } }

@media (max-width: 420px) {
  .hero-figure { width: 84px; }
  .hero-figure.big { width: 110px; }
  .hero-road { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Szokások ---------- */

.goal-card h2 { margin-bottom: 2px; }
.goal-card .chips { margin: 12px 0 0; }

.list-card { padding: 6px 18px; }
.list-card .card-head { margin: 12px 0 4px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: 13px; }
.row.is-archived { opacity: 0.7; }

.archived { margin-bottom: 16px; }
.archived summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 4px 0 12px; }

.suggest-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 8px; }
.suggest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
}
.suggest-body { flex: 1; min-width: 0; }
.suggest-name { font-weight: 700; }
.suggest-reason { color: var(--muted); font-size: 12.5px; }

.catalog-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.catalog-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
}
.catalog-item .habit-icon { width: 38px; height: 38px; font-size: 19px; }
.catalog-item:hover:not(:disabled) { border-color: var(--red-dark); }
.catalog-name { flex: 1; font-weight: 600; font-size: 14px; }
.catalog-add {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--red-hi);
  font-weight: 800;
}
.catalog-item.is-added { opacity: 0.55; cursor: default; }
.catalog-item.is-added .catalog-add { background: var(--red); color: #fff; }

/* ---------- Statisztika ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.tile-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.tile-hot { background: linear-gradient(140deg, rgba(225, 29, 46, 0.22), var(--surface) 75%); border-color: var(--red-dark); }

.legend { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend span:first-child { margin-right: 4px; }
.legend span:last-child { margin-left: 4px; }

.lv0, .hm-cell.lv0 { background: var(--lv0); }
.lv1, .hm-cell.lv1 { background: var(--lv1); }
.lv2, .hm-cell.lv2 { background: var(--lv2); }
.lv3, .hm-cell.lv3 { background: var(--lv3); }
.lv4, .hm-cell.lv4 { background: var(--lv4); }

.heatmap-scroll { overflow-x: auto; padding-bottom: 6px; }
.heatmap { display: flex; gap: 6px; width: max-content; }
.hm-days { display: grid; grid-template-rows: repeat(7, 12px); gap: 3px; margin-top: 21px; color: var(--muted); font-size: 10px; line-height: 12px; }
.hm-months { display: grid; grid-template-columns: repeat(53, 12px); column-gap: 3px; height: 18px; margin-bottom: 3px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.hm-grid { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; }
.hm-cell { width: 12px; height: 12px; border-radius: 3px; border: 0; padding: 0; background: var(--lv0); }
.hm-cell.lv-none { background: #141417; }
.hm-cell.is-future { background: transparent; }
.hm-cell.is-today { outline: 1.5px solid var(--text); outline-offset: 1px; }
button.hm-cell:hover { outline: 1.5px solid var(--red-hi); outline-offset: 1px; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head strong { font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; padding-bottom: 2px; }
.cal-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-height: 52px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 700;
  font-size: 14px;
  padding: 0;
}
button.cal-day:hover { border-color: var(--red-hi); }
.cal-day.is-done { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 14px -4px var(--red-glow); }
.cal-day.is-missed { border-color: var(--red-dark); border-style: dashed; color: var(--muted); }
.cal-day.is-rest, .cal-day.is-future { background: transparent; color: #55555c; }
.cal-day.is-today { outline: 2px solid var(--text); outline-offset: 1px; }
.cal-foot { margin: 12px 0 0; }

/* ---------- Beállítások ---------- */

.settings h2 { margin-bottom: 10px; }
.settings p { margin: 8px 0 0; }
.settings .btn-row { margin-top: 12px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-of-type { border-bottom: 0; }
.setting-row > span { display: flex; flex-direction: column; }

input[type="time"], select, input[type="text"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 42px;
}
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }

.switch {
  appearance: none;
  flex: none;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #3a3a42;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch:checked { background: var(--red); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.4; }

.sync-card { border-color: var(--red-dark); }
.sync-user { margin: 0 0 6px; overflow-wrap: anywhere; }
.sync-status { display: flex; align-items: center; gap: 8px; margin: 0 0 4px !important; font-weight: 600; font-size: 14px; color: var(--muted); }
.sync-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #55555c; flex: none; }
.sync-status.ok .dot { background: #22c55e; }
.sync-status.busy .dot { background: var(--red-hi); animation: pulse 1s ease-in-out infinite; }
.sync-status.warn .dot { background: #f59e0b; }
.sync-status.err { color: var(--red-hi); }
.sync-status.err .dot { background: var(--red); }
.sync-form { display: grid; gap: 10px; margin-top: 12px; }
.sync-form input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-height: 44px; }
.sync-form .form-error { margin: 0; min-height: 0; }
.sync-form .btn-row { margin-top: 2px !important; }
.sync-info { margin: 0 !important; color: #86efac; font-size: 14px; }
.sync-info:empty, .sync-form .form-error:empty { display: none; }
.sync-form .btn-row { align-items: center; gap: 14px; }
.sync-form > p.muted { margin: 0; }
.auth-switch { margin: 4px 0 0 !important; }
.auth-switch .link-btn { font-size: inherit; }
.sync-form input:disabled { opacity: 0.6; }

@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Párbeszédablak ---------- */

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(3px); }
dialog h2 { font-size: 20px; margin-bottom: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input[type="text"], .field select { width: 100%; }

.icon-picker { display: flex; gap: 10px; align-items: flex-start; }
.icon-picker input { width: 56px !important; flex: none; text-align: center; font-size: 22px; padding: 4px; }
.icon-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-opt { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); font-size: 18px; padding: 0; }
.icon-opt:hover { border-color: var(--red-dark); }

.day-toggles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-toggle {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 700;
  font-size: 13px;
  padding: 0;
}
.day-toggle[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.day-presets { display: flex; gap: 16px; margin-top: 4px; }

.form-error { color: var(--red-hi); font-size: 13.5px; min-height: 1em; margin: 0 0 8px; }

.dlg-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.dlg-danger, .dlg-main { display: flex; gap: 8px; }
.dlg-main { margin-left: auto; }

/* ---------- Visszajelzések ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #202026;
  border: 1px solid var(--red-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 860px) { .toast { bottom: 28px; left: calc(50% + 116px); } }

.confetti { position: fixed; left: 50%; bottom: 30%; z-index: 60; pointer-events: none; }
.confetti span {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: burst var(--d) cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes burst {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 420px) {
  h1 { font-size: 23px; }
  .day-label h1 { font-size: 19px; }
  .progress-card { gap: 12px; padding: 14px; }
  .ring { width: 60px; height: 60px; }
  .row-between .btn { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Ranglétra ---------- */

.leaderboard-card .card-head { margin-bottom: 4px; }

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  max-width: 460px;
  margin: 8px auto 0;
}
.podium-spot { display: flex; flex-direction: column; align-items: center; min-width: 0; }

/* A hős neve fölötte, ugyanolyan lekerekített keretben, mint a ranglétra sorai. */
.podium-bubble {
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 14px;
  background: #111114;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.podium-bubble > span { display: block; max-width: 9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-spot.place-1 .podium-bubble { border-color: #ffd166; }
.podium-spot.is-me .podium-bubble { background: rgba(225, 29, 46, 0.12); border-color: var(--red); }

.podium-hero { width: 76%; max-width: 104px; margin-top: 10px; margin-bottom: -6px; position: relative; z-index: 1; }
.podium-spot.place-1 .podium-hero { width: 92%; max-width: 128px; }

.podium-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 12px;
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-top: 3px solid #cd7f32;
}
.place-1 .podium-block { min-height: 118px; border-top-color: #ffd166; background: linear-gradient(180deg, #2a2412, var(--surface)); }
.place-2 .podium-block { min-height: 92px; border-top-color: #e5e9ef; }
.place-3 .podium-block { min-height: 74px; }
.podium-spot.is-empty .podium-block { opacity: 0.35; }
.podium-rank { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.place-1 .podium-rank { color: #ffd166; font-size: 2rem; }
.place-2 .podium-rank { color: #e5e9ef; }
.place-3 .podium-rank { color: #cd7f32; }
.podium-meta { font-size: 0.72rem; color: var(--muted); text-align: center; }
.podium-xp { font-size: 0.78rem; font-weight: 700; color: var(--red-hi); }

.ladder { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.ladder-row {
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #111114;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.ladder-row.is-me { background: rgba(225, 29, 46, 0.12); border-color: var(--red); }
.ladder-rank { font-size: 1.05rem; font-weight: 800; color: var(--red-hi); text-align: right; }
.ladder-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder-stage { margin-left: 8px; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.ladder-lv { font-size: 0.8rem; color: var(--muted); }
.ladder-xp { font-size: 0.85rem; font-weight: 700; color: var(--red-hi); white-space: nowrap; }
.you-tag { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.68rem; font-weight: 700; vertical-align: 1px; }
.ladder-note { margin-top: 10px; }

.rank-card { padding-block: 12px; }
.rank-card p { margin: 0; }
.rank-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.rank-place { font-size: 1.05rem; }
.rank-place strong { color: var(--red-hi); font-size: 1.3rem; }
.rank-link { margin-left: auto; font-size: 0.85rem; }

@media (max-width: 420px) {
  .ladder-row { grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; }
  .ladder-lv { display: none; }
  .ladder-stage { display: block; margin-left: 0; }
  .podium-bubble { padding: 6px 10px; font-size: 0.76rem; }
}

/* ---------- Kezdő kérdőív ---------- */

dialog.quiz { width: min(560px, calc(100vw - 24px)); padding: 20px 20px 18px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.quiz-progress { margin: 10px 0 18px; }
.quiz-progress span { transition: width 0.3s ease; }
dialog.quiz h2 { margin-bottom: 6px; line-height: 1.25; }
.quiz-hint { margin: 0 0 4px; }
.quiz-hint.is-warn { color: var(--red-hi); font-weight: 600; animation: quiz-shake 0.35s; }
@keyframes quiz-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.quiz-options { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 520px) { .quiz-options.is-grid { grid-template-columns: 1fr 1fr; } }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.quiz-opt:hover { border-color: #3a3a42; }
.quiz-opt:active { transform: scale(0.98); }
.quiz-opt[aria-pressed="true"] { border-color: var(--red); background: rgba(225, 29, 46, 0.14); }
.quiz-icon { font-size: 24px; line-height: 1; flex: none; }
.quiz-label small { display: block; margin-top: 2px; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

.quiz-result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-result-head .hero-figure { width: 76px; flex: none; }
.quiz-result-head .hero-bubble { margin: 0; }
.quiz-picks { display: grid; gap: 8px; }
.quiz-sub { margin: 16px 0 8px; }
.quiz-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
  background: #111114;
  border: 1.5px solid var(--border);
  border-radius: 14px;
}
.quiz-pick-body { flex: 1; min-width: 0; }
.quiz-pick-body strong { display: block; font-size: 15px; }
.quiz-pick-body small { display: block; color: var(--muted); font-size: 12.5px; }
.quiz-pick .check { width: 28px; height: 28px; }
.quiz-pick .check svg { width: 16px; height: 16px; }
.quiz-pick[aria-pressed="true"] { border-color: var(--red); background: rgba(225, 29, 46, 0.12); }
.quiz-pick[aria-pressed="true"] .check { background: var(--red); border-color: var(--red); }
.quiz-pick[aria-pressed="true"] .check svg { opacity: 1; transform: scale(1); }

.quiz-cta { display: flex; align-items: center; gap: 14px; border-color: var(--red-dark); background: linear-gradient(135deg, rgba(225, 29, 46, 0.12), var(--surface) 60%); }
.quiz-cta-icon { font-size: 30px; flex: none; }
.quiz-cta p { margin: 2px 0 0; }
.quiz-cta .btn { margin-left: auto; flex: none; }
@media (max-width: 480px) { .quiz-cta { flex-wrap: wrap; } .quiz-cta .btn { width: 100%; } }
/* ---------- Belépőoldal (bejelentkezés nélkül nem használható az app) ---------- */

.auth-gate {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}
.gate-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.gate-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.gate-hero { width: 128px; margin: 18px auto 6px; animation: bob 3s ease-in-out infinite; }
.auth-gate h1 { margin: 6px 0 8px; font-size: 26px; }
.gate-sub { margin: 0 0 18px; line-height: 1.5; }
.gate-card { width: 100%; text-align: left; }
.gate-card .sync-form { margin-top: 0; }
.gate-card .sync-form .btn-primary { flex: 1; }
.gate-note { margin-top: 14px; }
/* Jelszómező szem gombbal (lenyomva tartva látszik a jelszó) */
.pw-field { position: relative; }
.pw-field input { width: 100%; padding-right: 48px !important; }
.pw-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pw-eye:hover { color: var(--text); }
.pw-eye.is-on { color: var(--red-hi); }
.pw-eye:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }