/* Pointify - Unrailed vibe: louka, voxel bloky, tvrdy offset stin, chunky tlacitka */
:root {
  --grass: #7BC950;
  --grass-deep: #59A83B;
  --meadow: #EAF6D8;
  --cream: #FFF8E7;
  --ink: #3A2E39;
  --ink-soft: #6F6276;
  --coin: #FFD23F;
  --coin-deep: #E0A800;
  --orange: #FF9F1C;
  --pink: #F26CA7;
  --blue: #4CC9F0;
  --red: #EF5B5B;
  --shadow: 0 4px 0 var(--ink);
  --shadow-big: 0 6px 0 var(--ink);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: var(--meadow);
  min-height: 100dvh;
}
/* pozadi jako fixed vrstva - background-attachment:fixed na iOS nefunguje */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.55) 0 22px, transparent 23px),
    radial-gradient(circle at 82% 30%, rgba(255,255,255,.4) 0 16px, transparent 17px),
    linear-gradient(180deg, #C9EFF9 0%, var(--meadow) 44%, var(--meadow) 100%);
}
h1, h2, .brand-name, .coin-num, .level-name, .btn, .habit-pts, .reward-price, .tab {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
}
.hidden { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 20px;
  box-shadow: var(--shadow-big); padding: 28px 24px; width: min(360px, 100%); text-align: center;
}
.login-train { font-size: 56px; animation: chug 1.2s ease-in-out infinite; }
.login-card h1 { font-size: 40px; font-weight: 800; letter-spacing: .5px; }
.login-card p { color: var(--ink-soft); margin-bottom: 18px; }
.login-card input {
  width: 100%; padding: 12px 14px; font: inherit; border: 3px solid var(--ink);
  border-radius: var(--radius); margin-bottom: 12px; background: #fff;
}
.login-err { color: var(--red); min-height: 22px; margin-top: 8px; font-weight: 800; }

/* ---------- layout ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-train { font-size: 34px; }
.brand-name { font-size: 26px; font-weight: 800; line-height: 1; }
.brand-why { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; }

.coin {
  display: flex; align-items: center; gap: 8px; background: var(--cream);
  border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow);
  padding: 6px 14px 6px 8px; cursor: default;
}
.coin-disc {
  width: 30px; height: 30px; border-radius: 50%; background: var(--coin);
  border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 var(--coin-deep);
  display: grid; place-items: center; font-family: 'Baloo 2'; font-weight: 800; font-size: 15px;
}
.coin-num { font-size: 22px; font-weight: 800; }
.coin.bump .coin-disc { animation: bump .35s ease; }

/* ---------- level + trat ---------- */
.level-card {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow); padding: 12px 14px 16px; margin-bottom: 14px;
}
.level-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.level-name { font-size: 19px; font-weight: 800; }
.level-info { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.rail {
  position: relative; height: 26px; border-radius: 999px; background: #D9CBB6;
  border: 3px solid var(--ink); overflow: visible;
  background-image: repeating-linear-gradient(90deg, transparent 0 10px, rgba(58,46,57,.25) 10px 13px);
}
.rail-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
  background: linear-gradient(180deg, var(--grass), var(--grass-deep));
  transition: width .5s cubic-bezier(.34,1.4,.64,1);
}
.rail-train {
  position: absolute; top: 50%; left: 0%; transform: translate(-30%, -58%); font-size: 26px;
  transition: left .5s cubic-bezier(.34,1.4,.64,1); filter: drop-shadow(0 2px 0 rgba(58,46,57,.4));
}
.rail-station { position: absolute; right: -4px; top: 50%; transform: translate(0, -62%); font-size: 22px; }
.rail-label { margin-top: 8px; font-size: 12.5px; color: var(--ink-soft); font-weight: 700; text-align: center; }

/* ---------- panely ---------- */
.panel h2 { font-size: 20px; font-weight: 800; margin: 18px 0 10px; }
.panel h2:first-child { margin-top: 2px; }
.h-red { color: var(--red); }
.hint { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.today-sum { font-size: 14px; color: var(--grass-deep); }

/* ---------- navyky ---------- */
.habit-list { display: flex; flex-direction: column; gap: 9px; }
.habit {
  display: flex; align-items: center; gap: 10px; background: var(--cream);
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 9px 10px; cursor: pointer; user-select: none;
  transition: transform .06s ease, box-shadow .06s ease;
}
.habit:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.habit.done { background: #E4F5D2; }
.habit.maxed { opacity: .62; }
.habit-emoji { font-size: 24px; width: 32px; text-align: center; }
.habit-name { flex: 1; font-weight: 700; font-size: 15px; line-height: 1.15; }
.habit-count { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; }
.habit-pts {
  min-width: 52px; text-align: center; font-weight: 800; font-size: 15px;
  background: var(--coin); border: 3px solid var(--ink); border-radius: 10px;
  box-shadow: inset 0 -3px 0 var(--coin-deep); padding: 4px 6px;
}
.habit.penalty .habit-pts { background: #FFC9C9; box-shadow: inset 0 -3px 0 #E08B8B; }
.habit-undo {
  border: none; background: none; font-size: 16px; cursor: pointer; padding: 4px;
  color: var(--ink-soft);
}

/* ---------- obchod ---------- */
.shop-note { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 10px; }
.reward-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.reward {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: var(--shadow); padding: 12px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.reward-emoji { font-size: 34px; }
.reward-name { font-weight: 800; font-size: 14.5px; line-height: 1.15; }
.reward-price { font-size: 15px; font-weight: 800; color: var(--ink); }
.reward-price::after { content: ' B'; color: var(--coin-deep); }

/* ---------- tlacitka ---------- */
.btn {
  font-weight: 800; font-size: 15px; color: var(--ink); background: var(--cream);
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 9px 16px; cursor: pointer; transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn-green { background: var(--grass); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn-blue { background: var(--blue); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn-big { width: 100%; padding: 13px 16px; font-size: 17px; }
.btn-small { padding: 7px 12px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:active { transform: none; box-shadow: var(--shadow); }

/* ---------- log ---------- */
.log { display: flex; flex-direction: column; gap: 5px; }
.log-item {
  display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px;
  background: rgba(255,255,255,.65); border: 2px solid rgba(58,46,57,.25);
  border-radius: 10px; padding: 6px 10px;
}
.log-pts { font-weight: 800; }
.log-pts.plus { color: var(--grass-deep); }
.log-pts.minus { color: var(--red); }
.log-empty { color: var(--ink-soft); font-size: 13.5px; padding: 6px 2px; }
.log-cal { border: none; background: none; cursor: pointer; font-size: 15px; }

/* ---------- dilna ---------- */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.ios-hint { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.cfg-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.cfg-row { display: flex; gap: 6px; align-items: center; }
.cfg-row input {
  font: inherit; font-weight: 700; border: 2.5px solid var(--ink); border-radius: 10px;
  padding: 7px 9px; background: #fff; min-width: 0;
}
.cfg-emoji { width: 52px; text-align: center; }
.cfg-name { flex: 1; }
.cfg-num { width: 64px; text-align: center; }
.cfg-del { border: none; background: none; font-size: 17px; cursor: pointer; }
.save-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); margin-top: 16px; }

/* ---------- taby ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(234,246,216,.92) 30%);
}
.tab {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 13px; font-weight: 800; color: var(--ink);
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: var(--shadow); padding: 8px 6px; cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease, background .15s ease;
}
.tab span { font-size: 20px; }
.tab.active { background: var(--coin); }
.tab:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- toast + konfety ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; font-weight: 800; font-family: 'Baloo 2';
  border-radius: 999px; padding: 10px 20px; font-size: 15.5px;
  box-shadow: 0 4px 0 rgba(0,0,0,.3); animation: pop .25s ease;
  max-width: 90vw; text-align: center;
}
.toast.gold { background: var(--coin-deep); }
.toast.red { background: var(--red); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

/* ---------- animace ---------- */
@keyframes chug { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes pop { from { transform: translateX(-50%) scale(.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (min-width: 600px) {
  .reward-grid { grid-template-columns: repeat(3, 1fr); }
}
