/* ============================================================
   Tiltless — progress game (level chip, today card, missions,
   level-up, progress modal, confetti) + small "alive" touches
   ============================================================ */

/* ---------- sidebar level chip ---------- */
.lvl-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 14px 0 6px; padding: 9px 10px;
  border-radius: 12px; border: 1px solid var(--glass-border, var(--border)); background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  color: var(--text); text-align: left; cursor: pointer; transition: border-color .2s, transform .15s var(--ease-out), background-color .2s;
}
.lvl-chip:hover { border-color: rgba(var(--ac2-rgb), .45); transform: translateY(-1px); }
.lvl-badge {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #04131a;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-2) 45%, #34d399); box-shadow: 0 0 0 1px rgba(255, 255, 255, .15) inset, 0 6px 18px -8px rgba(var(--ac2-rgb), .8);
}
.lvl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lvl-info b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl-info small { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.lvl-bar, .tc-bar { position: relative; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.lvl-fill, .tc-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), #34d399); transition: width .8s var(--ease-out); }
.lvl-fill::after, .tc-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: xpShine 2.8s ease-in-out infinite; }
.lvl-flame { flex: none; display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lvl-flame .fl { display: inline-block; animation: flick 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.lvl-flame.tier0 { opacity: .45; filter: grayscale(1); }
.lvl-flame.tier0 .fl { animation: none; }
.lvl-flame.tier4 .fl { filter: hue-rotate(185deg) saturate(1.4); }
.app-shell.collapsed .lvl-chip { justify-content: center; padding: 8px 0; }
.app-shell.collapsed .lvl-chip .nav-label { display: none; }

/* animatable ring progress (own name: --p is already used by other widgets) */
@property --xp { syntax: "<number>"; inherits: false; initial-value: 0; }

/* ---------- dashboard: today card ---------- */
.today-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: stretch; margin-bottom: 16px; padding: 16px 18px; }
.today-card[hidden] { display: none; }
.today-card > * { min-width: 0; }

.tc-streak { display: flex; align-items: center; gap: 14px; padding-right: 18px; border-right: 1px solid var(--border); }
.tc-flame { position: relative; flex: none; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: radial-gradient(circle at 50% 70%, rgba(251, 146, 60, .28), transparent 70%); }
.tc-flame span { font-size: 34px; line-height: 1; display: inline-block; transform-origin: 50% 90%; animation: flick 1.6s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(251, 146, 60, .55)); }
.tier0 .tc-flame { background: var(--surface-2); }
.tier0 .tc-flame span { animation: none; filter: grayscale(1); opacity: .45; font-size: 28px; }
.tier1 .tc-flame span { font-size: 28px; }
.tier3 .tc-flame span { font-size: 38px; filter: drop-shadow(0 4px 14px rgba(251, 146, 60, .8)); }
.tier4 .tc-flame { background: radial-gradient(circle at 50% 70%, rgba(56, 189, 248, .35), transparent 70%); }
.tier4 .tc-flame span { font-size: 40px; filter: hue-rotate(185deg) saturate(1.4) drop-shadow(0 4px 16px rgba(56, 189, 248, .9)); }
.tc-sinfo { flex: 1; min-width: 0; }
.tc-sinfo > div { display: flex; align-items: baseline; gap: 6px; }
.tc-num { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tc-sinfo span { font-size: 12.5px; color: var(--text-dim); }
.tc-sinfo small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.tc-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.35; }

.tc-missions { display: flex; flex-direction: column; gap: 8px; }
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-head h3 { font-size: 14px; margin: 0; }
.tc-count { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tc-count.all { background: rgba(52, 211, 153, .16); color: var(--green); animation: pop .5s var(--ease-out) both; }
.tc-missions ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tc-missions li { animation: rise .4s var(--ease-out) both; animation-delay: calc(var(--i) * 60ms); }
.tc-m { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; background: none; border: 0; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; transition: background-color .15s; }
.tc-m:hover:not(:disabled) { background: var(--surface-2); }
.tc-m:disabled { cursor: default; }
.tc-box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #04131a; transition: background-color .2s, border-color .2s; }
.tc-mtxt { flex: 1; min-width: 0; }
li.done .tc-box { background: var(--green); border-color: var(--green); animation: pop .45s var(--ease-out) both; }
li.done .tc-mtxt { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(52, 211, 153, .6); }
.tc-bonus { font-size: 11px; color: var(--text-muted); padding-left: 8px; }

.tc-level { display: flex; align-items: center; gap: 14px; padding: 6px 0 6px 18px; border: 0; border-left: 1px solid var(--border); background: none; color: var(--text); text-align: left; cursor: pointer; border-radius: 0; }
.tc-level:hover .tc-linfo small { color: var(--purple); }
.tc-ring {
  --xp: 0; flex: none; position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent-2) calc(var(--xp) * 1turn), var(--surface-2) 0); transition: --xp .9s var(--ease-out);
}
.tc-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.tc-ring b { position: relative; font-size: 21px; font-weight: 800; }
.tc-ring.big { width: 86px; height: 86px; }
.tc-ring.big b { font-size: 30px; }
.tc-linfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tc-linfo b { font-size: 15px; }
.tc-linfo span { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tc-linfo small { font-size: 11.5px; color: var(--text-muted); transition: color .15s; }
.bump { animation: bump .6s var(--ease-out); }

/* ---------- floating +XP ---------- */
.xp-float { position: fixed; z-index: 9998; transform: translate(-50%, 0); pointer-events: none; font-weight: 900; font-size: 15px; color: #34d399; text-shadow: 0 2px 12px rgba(52, 211, 153, .7); animation: xpFloat 1.4s var(--ease-out) forwards; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; }

/* ---------- level-up ---------- */
.lvlup { position: relative; overflow: hidden; max-width: 380px; text-align: center; padding: 34px 28px 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lvlup-rays { position: absolute; left: 50%; top: 92px; width: 520px; height: 520px; margin: -260px 0 0 -260px; background: repeating-conic-gradient(rgba(var(--ac2-rgb), .14) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 14s linear infinite; mask: radial-gradient(circle, #000 20%, transparent 62%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 62%); pointer-events: none; }
.lvlup-badge { position: relative; width: 112px; height: 112px; border-radius: 30px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-light), var(--accent-2) 45%, #34d399); box-shadow: 0 18px 50px -12px rgba(var(--ac2-rgb), .9); animation: lvlPop .8s cubic-bezier(.2, 1.6, .4, 1) both; }
.lvlup-badge span { font-size: 52px; font-weight: 900; color: #04131a; }
.lvlup h2 { position: relative; font-size: 24px; margin-top: 8px; animation: rise .5s var(--ease-out) .25s both; }
.lvlup p { position: relative; color: var(--text-dim); animation: rise .5s var(--ease-out) .35s both; }
.lvlup .primary-btn { position: relative; margin-top: 8px; animation: rise .5s var(--ease-out) .45s both; }

/* ---------- progress modal ---------- */
.gp-modal { max-width: 680px; }
.gp-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.gp-top h2 { font-size: 22px; margin-bottom: 4px; }
.gp-top p { margin: 0 0 2px; }
.gp-ladder { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; }
.gp-step { flex: none; min-width: 84px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; opacity: .5; }
.gp-step b { font-size: 11px; color: var(--text-muted); }
.gp-step span { font-size: 12.5px; font-weight: 700; }
.gp-step.got { opacity: 1; }
.gp-step.cur { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset, 0 6px 20px -10px rgba(var(--ac2-rgb), .9); }
.gp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.gp-cols h4 { font-size: 13px; margin-bottom: 8px; }
.gp-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.gp-row b { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gp-row.total b { color: var(--green); }
.gp-note { margin-top: 16px; }

/* ---------- a little more alive everywhere ---------- */
.primary-btn, .ghost-btn, .danger-btn, .icon-btn, .seg button, .fchip, .nr-tabbtn { transition: transform .12s var(--ease-out), background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.primary-btn:active, .ghost-btn:active, .danger-btn:active, .icon-btn:active, .seg button:active, .fchip:active, .nr-tabbtn:active, .tc-m:active:not(:disabled), .lvl-chip:active { transform: scale(.96); }
@media (hover: hover) {
  .stat-card { transition: transform .22s var(--ease-out), border-color .2s, box-shadow .2s; }
  .stat-card:hover { transform: translateY(-3px); }
  .nav-item .nav-icon { transition: transform .2s var(--ease-out); }
  .nav-item:hover .nav-icon { transform: translateX(2px) scale(1.12); }
}

/* ---------- keyframes ---------- */
@keyframes flick { 0%, 100% { transform: rotate(-3deg) scale(1); } 25% { transform: rotate(2deg) scale(1.06, .96); } 50% { transform: rotate(-1deg) scale(.97, 1.05); } 75% { transform: rotate(3deg) scale(1.04); } }
@keyframes xpShine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes xpFloat { 0% { opacity: 0; transform: translate(-50%, 4px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -54px) scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes lvlPop { 0% { opacity: 0; transform: scale(.3) rotate(-25deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }

/* ---------- light theme ---------- */
[data-theme="light"] .tc-ring::before { background: #fff; }
[data-theme="light"] .lvl-chip { background: rgba(255, 255, 255, .7); }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .today-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tc-streak { border-right: 0; padding-right: 0; }
  .tc-level { grid-column: 1 / -1; border-left: 0; padding: 12px 0 0; border-top: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .today-card { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
  .tc-missions { padding-top: 12px; border-top: 1px solid var(--border); }
  .gp-cols { grid-template-columns: 1fr; }
  .gp-top { gap: 14px; }
}

/* under the balance curve (left column): streak + missions side by side, the level on its own row */
.left-col .today-card { margin-bottom: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.left-col .tc-level { grid-column: 1 / -1; border-left: 0; padding: 14px 0 0; border-top: 1px solid var(--border); }
@media (max-width: 860px) { .left-col .today-card { grid-template-columns: minmax(0, 1fr); } }
