/* Chaotic Leveling. Builds on /styles.css tokens. System windows are glass panels lit with brand purple. */
.cl-page { --sys-line: color-mix(in oklab, var(--brand-ink) 42%, transparent); --sys-glow: rgb(122 44 209 / .28); --rank-e: #a9a1b5; --rank-d: #7fb0ff; --rank-c: #6be0b0; --rank-b: #b58cf0; --rank-a: #ff8a4c; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .cl-page { --sys-glow: rgb(64 19 103 / .14); --rank-e: #635b6f; --rank-d: #2c5fb8; --rank-c: #15805a; --rank-b: #401367; --rank-a: #c2410c; } }
:root[data-theme="light"] .cl-page { --sys-glow: rgb(64 19 103 / .14); --rank-e: #635b6f; --rank-d: #2c5fb8; --rank-c: #15805a; --rank-b: #401367; --rank-a: #c2410c; }

.cl-hero[hidden] { display: none; }
.cl-hero h1 { font-size: clamp(3.25rem, 10vw, 10rem); }
.cl-hero h1 b { background: var(--heat); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cl-hero .sys-line { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 8px 14px; border: 1px solid rgb(255 255 255 / .22); border-radius: 999px; background: rgb(8 6 12 / .35); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-size: .9375rem; font-weight: 500; }
.cl-hero .sys-line::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ff6a2b; box-shadow: 0 0 12px #ff6a2b; animation: cl-pulse 1.8s var(--ease) infinite; }
@keyframes cl-pulse { 50% { opacity: .35; } }

/* App frame */
#cl-app { position: relative; margin: 8px var(--frame) 0; padding: clamp(14px, 3vw, 40px); border-radius: var(--r-xl); background: radial-gradient(120% 70% at 85% 0, rgb(122 44 209 / .35), transparent 60%), radial-gradient(80% 60% at 0 100%, rgb(211 35 95 / .16), transparent 60%), var(--bg-2); scroll-margin-top: calc(var(--header) + 4px); isolation: isolate; overflow: clip; }
#cl-app::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("/assets/img/grain.png"); mix-blend-mode: overlay; opacity: .18; pointer-events: none; }
#cl-app[hidden] { display: none; }

/* System window */
.sys { position: relative; padding: clamp(18px, 2.6vw, 32px); border: 1px solid var(--sys-line); border-radius: var(--r-l); background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 0 48px var(--sys-glow), var(--shadow); }
.sys::before, .sys::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1.5px solid var(--brand-ink); pointer-events: none; }
.sys::before { top: 9px; left: 9px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; opacity: .8; }
.sys::after { right: 9px; bottom: 9px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; opacity: .8; }
.sys-head { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--brand-ink); font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; }
.sys-mark { width: 10px; height: 10px; rotate: 45deg; border: 1.5px solid currentColor; box-shadow: 0 0 10px currentColor; }
.sys-step { margin-left: auto; color: var(--muted); font-weight: 450; font-variant-numeric: tabular-nums; }
.sys h2 { font-size: clamp(2.25rem, 5vw, 4rem); }
.sys h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.sys-kicker { margin-bottom: 6px; color: var(--muted); font-size: .9375rem; }
.sys-sub { max-width: 40rem; margin-top: 10px; color: var(--muted); }
.sys-sub b { color: var(--fg); font-weight: 600; }
.sys-note { margin-top: 18px; color: var(--muted); font-size: .9375rem; }
.sys-in { animation: sys-in .7s var(--ease) both; }
@keyframes sys-in { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); } }

.cl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 24px; }
.cl-ghost { min-height: 46px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: inherit; font: 500 1rem var(--font); cursor: pointer; transition: background-color .3s, border-color .3s; }
@media (hover: hover) { .cl-ghost:hover { background: var(--surface-2); border-color: var(--sys-line); } }
.cl-ghost.danger { color: #ff7a7a; }
.cl-chip { flex: none; min-height: 38px; padding: 0 16px; border: 1px solid var(--sys-line); border-radius: 999px; background: transparent; color: var(--fg); font: 550 .9375rem var(--font); cursor: pointer; }
.cl-chip.hot { border: 0; background: var(--heat); color: #120b1b; box-shadow: 0 0 22px rgb(255 106 43 / .45); animation: cl-glow 2.4s var(--ease) infinite; }
@keyframes cl-glow { 50% { box-shadow: 0 0 6px rgb(255 106 43 / .25); } }

/* Profile form */
.cl-profile { max-width: 760px; margin-inline: auto; }
.cl-form { display: grid; gap: 20px; margin-top: 26px; }
.cl-field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.cl-field > span, .cl-field legend { padding: 0; font-weight: 550; }
.cl-field small { color: var(--muted); font-size: .875rem; }
.cl-field input:not([type="radio"]) { width: 100%; min-height: 54px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: 450 1.0625rem var(--font); }
.cl-field input:focus { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; flex: 1 1 64px; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: grid; place-items: center; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); font-weight: 550; cursor: pointer; transition: background-color .3s, border-color .3s, color .3s; }
.seg input:checked + span { border-color: var(--brand-ink); background: var(--brand); color: #fff; box-shadow: 0 0 18px var(--sys-glow); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.cl-check { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: .9375rem; }
.cl-check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand-ink); }

/* Assessment */
.cl-assess { max-width: 860px; margin-inline: auto; }
.cl-bar, .xp, .st-xp { position: relative; height: 6px; overflow: hidden; border-radius: 99px; background: var(--line); }
.cl-bar { margin: -4px 0 22px; }
.cl-bar i, .xp i, .st-xp i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--heat); box-shadow: 0 0 12px rgb(255 106 43 / .5); transition: width .9s var(--ease); }
.lvl-list, .tree ol { display: grid; gap: 6px; margin-top: 22px; }
.lvl-pick, .tree li button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; transition: border-color .3s, background-color .3s, translate .5s var(--ease); }
@media (hover: hover) { .lvl-pick:hover, .tree li button:hover { border-color: var(--sys-line); translate: 4px 0; } }
.lvl-pick.on { border-color: var(--brand-ink); background: var(--brand); color: #fff; box-shadow: 0 0 24px var(--sys-glow); }
.lvl-pick.on small, .lvl-pick.on .lv-n { color: rgb(255 255 255 / .78); }
.lv-n { flex: none; width: 46px; color: var(--muted); font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-b { flex: 1; min-width: 0; }
.lv-b b { display: block; font-weight: 550; letter-spacing: -.015em; }
.lv-b small { display: block; margin-top: 1px; color: var(--muted); font-size: .875rem; line-height: 1.3; }
.lv-r { flex: none; width: 28px; color: var(--muted); font-weight: 700; text-align: center; }
.lvl-zero { background: transparent; border-style: dashed; }

/* Dashboard */
.cl-dash { display: grid; gap: 14px; max-width: 1180px; margin-inline: auto; }
.pl-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 28px; }
.pl-id { flex: 1 1 260px; min-width: 0; }
.pl-id h2 { overflow-wrap: anywhere; }
.pl-lvl { display: grid; text-align: right; }
.pl-lvl > span, .aw-l > span { color: var(--muted); font-size: .9375rem; }
.pl-lvl > b, .aw-l > b { font-size: clamp(3.5rem, 8vw, 6.5rem); font-weight: 650; line-height: .9; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.pl-rank { display: grid; place-items: center; width: clamp(72px, 9vw, 104px); aspect-ratio: 1; border: 2px solid currentColor; border-radius: 22px; rotate: 45deg; font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; box-shadow: 0 0 30px color-mix(in oklab, currentColor 40%, transparent), inset 0 0 20px color-mix(in oklab, currentColor 25%, transparent); }
.pl-rank > span { rotate: -45deg; }
.pl-rank { color: var(--rank-e); }
.rank-D { color: var(--rank-d); } .rank-C { color: var(--rank-c); } .rank-B { color: var(--rank-b); } .rank-A { color: var(--rank-a); }
.pl-rank.rank-S, .st-r.rank-S { color: #ff6a2b; }
.xp { height: 8px; margin-top: 22px; }
.pl-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.pl-facts dt { color: var(--muted); font-size: .875rem; }
.pl-facts dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.cl-tabs { position: sticky; top: calc(var(--frame) + 80px); z-index: 5; display: flex; gap: 4px; justify-self: center; padding: 5px; border: 1px solid var(--glass-line); border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.cl-tabs button { position: relative; min-height: 44px; padding: 0 clamp(14px, 2.4vw, 26px); border: 0; border-radius: 999px; background: transparent; color: inherit; font: 550 1rem var(--font); cursor: pointer; transition: background-color .35s, color .35s; }
.cl-tabs button[aria-current] { background: var(--btn-bg); color: var(--btn-fg); }
.dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ff6a2b; box-shadow: 0 0 10px #ff6a2b; }
.cl-tabbody { display: grid; gap: 14px; }
.cl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; }

.radar { width: 100%; max-width: 480px; margin: 0 auto; overflow: visible; }
.r-ring { fill: none; stroke: var(--line); }
.r-axis { stroke: var(--line); }
.r-shape { fill: url(#cl-heat); fill-opacity: .32; stroke: url(#cl-heat); stroke-width: 2.5; stroke-linejoin: round; filter: drop-shadow(0 0 10px rgb(255 106 43 / .45)); animation: r-in 1.2s var(--ease) both; transform-origin: 170px 170px; }
@keyframes r-in { from { transform: scale(.2); opacity: 0; } }
.radar text { fill: var(--muted); font: 500 14px var(--font); }
.radar tspan { fill: var(--fg); font-weight: 700; }

.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.st-r { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 1.5px solid currentColor; border-radius: 10px; color: var(--rank-e); font-weight: 700; }
.st-b { flex: 1; min-width: 0; }
.st-b b { display: block; font-weight: 550; }
.st-b em { margin-left: 4px; color: var(--brand-ink); font-style: normal; font-weight: 650; }
.st-b small { display: block; overflow: hidden; color: var(--muted); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.st-xp { height: 4px; margin-top: 7px; }
.st-n { flex: none; min-width: 34px; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; text-align: right; }
.stat.off { opacity: .6; }

.cl-coach { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 28px; }
.cl-coach .sys-head { grid-column: 1 / -1; }
.cl-coach p { margin-top: 8px; color: var(--muted); max-width: 38rem; }
.cl-coach .cl-row { margin-top: 18px; }

/* Quests */
.q-title { margin-top: 4px; }
.quests { display: grid; gap: 10px; margin-top: 22px; }
.quest { display: flex; align-items: flex-start; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); transition: border-color .4s, opacity .4s, background-color .4s; }
.q-check { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1.5px solid var(--sys-line); border-radius: 12px; background: transparent; color: #fff; cursor: pointer; transition: background-color .35s, scale .5s var(--spring); }
.q-check svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .5s var(--ease); }
.q-check:active { scale: .88; }
.quest.done { border-color: var(--sys-line); }
.quest.done .q-check { border-color: transparent; background: var(--brand); box-shadow: 0 0 18px var(--sys-glow); }
.quest.done .q-check svg { stroke-dashoffset: 0; }
.quest.done .q-b ul { color: var(--muted); }
.q-b { flex: 1; min-width: 0; }
.q-k { color: var(--brand-ink); font-size: .9375rem; font-weight: 600; }
.q-b ul { display: grid; gap: 4px; margin-top: 6px; }
.q-b li { position: relative; padding-left: 16px; }
.q-b li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; rotate: 45deg; background: currentColor; opacity: .5; }
.q-t { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.quest > .cl-chip { align-self: center; }

.week { display: grid; gap: 6px; margin-top: 20px; }
.week li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 54px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.week li.rest { background: transparent; color: var(--muted); }
.week li.is-today { border-color: var(--brand-ink); box-shadow: 0 0 22px var(--sys-glow); }
.week b { font-weight: 650; }
.cl-inline { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.cl-inline select { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); font: 550 1rem var(--font); }

.tree { border-top: 1px solid var(--line); }
.tree:first-of-type { margin-top: 14px; }
.tree summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary b { font-size: 1.25rem; font-weight: 550; }
.tree summary span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tree summary::after { content: "+"; width: 20px; color: var(--muted); font-size: 1.4rem; text-align: center; transition: rotate .5s var(--spring); }
.tree[open] summary::after { rotate: 45deg; }
.tree ol { margin: 0 0 18px; }
.tree li.pass button { border-color: var(--sys-line); }
.tree li.pass .lv-r { color: var(--brand-ink); }
.tree li.next button { border-color: var(--brand-ink); box-shadow: 0 0 18px var(--sys-glow); }
.tree li.lock button { opacity: .55; }
.tree > .cl-ghost { margin-bottom: 18px; }

/* Overlays */
.cl-over { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgb(8 6 12 / .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity .35s var(--ease); }
.cl-over.in { opacity: 1; }
.cl-pop { -webkit-backdrop-filter: none; backdrop-filter: none; width: min(100%, 520px); max-height: calc(100svh - 32px); overflow: auto; background: var(--surface); transform: translateY(18px) scale(.94); transition: transform .7s var(--spring); }
.cl-over.in .cl-pop { transform: none; }
.cl-pop h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.lu .cl-pop { text-align: center; }
.lu .cl-row { justify-content: center; }
.lu .sys-sub { margin-inline: auto; }
.lu-k { color: var(--muted); }
.lu-big { margin-top: 6px; background: var(--heat); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: clamp(2.75rem, 9vw, 4.5rem); font-weight: 650; line-height: 1; letter-spacing: -.05em; }
.cl-over.in .lu-big { animation: lu-in 1s var(--ease) both .1s; }
@keyframes lu-in { from { opacity: 0; transform: scale(.86); letter-spacing: .06em; } }
.lu-n { display: flex; justify-content: center; align-items: baseline; gap: 14px; margin-top: 14px; font-size: 1.25rem; }
.lu-n span { color: var(--muted); text-decoration: line-through; }
.lu-n b { font-size: 2rem; font-weight: 650; }
.lu-n b::before { content: "→ "; color: var(--muted); font-weight: 400; }
.lu-goal { margin-top: 6px; color: var(--brand-ink); font-size: 1.25rem; font-weight: 600; }
.aw { display: flex; justify-content: center; align-items: center; gap: 40px; margin: 22px 0 8px; }
.aw-l { display: grid; }

@media (max-width: 860px) {
  .cl-grid, .cl-coach { grid-template-columns: minmax(0, 1fr); }
  .pl-lvl { text-align: left; }
  .cl-tabs { top: calc(var(--frame) + 76px); width: 100%; justify-content: space-between; }
  .cl-tabs button { flex: 1; padding: 0 8px; }
}
@media (max-width: 520px) {
  #cl-app { padding: 10px; }
  .quest { gap: 12px; padding: 14px; flex-wrap: wrap; }
  .quest > .cl-chip { margin-left: 56px; }
  .lvl-pick, .tree li button { gap: 10px; padding: 10px 12px; }
  .lv-n { width: 40px; }
  .pl-facts dd { font-size: 1.0625rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sys-in, .r-shape, .cl-over.in .lu-big, .cl-chip.hot, .cl-hero .sys-line::before { animation: none; }
}
@media print { #cl-app { background: none; } .cl-tabs, .cl-coach { display: none !important; } }

/* ---------- Unlimited levels: Chaos ranks ---------- */
.rank-X { color: #ff6a2b; }
.pl-rank.rank-X, .st-r.rank-X { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--heat) border-box; border: 2px solid transparent; }
.pl-rank.rank-X span { background: var(--heat); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pl-rankwrap, .aw-r { display: grid; justify-items: center; gap: 14px; }
.pl-rankwrap small, .aw-r small { color: var(--muted); font-size: .875rem; font-weight: 550; }
.pl-rank.sm { width: 52px; border-radius: 14px; font-size: 1.375rem; border-width: 1.5px; }
.xp-row { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.xp-row .xp { flex: 1; margin: 0; }
.xp-row span { flex: none; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.sys-help { margin-left: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 500 .875rem var(--font); cursor: pointer; transition: color .3s, border-color .3s; }
@media (hover: hover) { .sys-help:hover { color: var(--fg); border-color: var(--sys-line); } }
.q-xp { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8125rem; font-weight: 550; }
.inf .lv-b b { color: var(--brand-ink); }
.tree li.inf { display: flex; padding: 10px 16px 10px 76px; opacity: .8; }
.cl-hint { margin: 0 0 20px; padding: 14px 16px; border: 1px dashed var(--sys-line); border-radius: var(--r-s); color: var(--fg); font-size: .9375rem; }

/* ---------- First-visit journey ---------- */
.cl-journey { max-width: 820px; margin-inline: auto; min-height: min(560px, 70svh); display: flex; flex-direction: column; }
.cl-journey #cl-j { flex: 1; }
.j-dots { display: flex; gap: 6px; margin-left: auto; }
.j-dots i { width: 22px; height: 4px; border-radius: 4px; background: var(--line); transition: background-color .5s, width .6s var(--ease); }
.j-dots i.past { background: var(--brand-ink); }
.j-dots i.on { width: 36px; background: var(--heat); }
.j-skip { display: flex; justify-content: flex-end; margin-top: 18px; }
.j-skip .cl-ghost { min-height: 38px; border: 0; color: var(--muted); }
.notif { display: grid; gap: 12px; margin: clamp(10px, 4vw, 40px) 0 clamp(20px, 4vw, 40px); }
.notif p { font-size: clamp(1.25rem, 2.6vw, 1.75rem); letter-spacing: -.025em; line-height: 1.25; }
.notif p:first-child { color: var(--brand-ink); }
.n-line { animation: n-in .9s var(--ease) both; animation-delay: calc(var(--d) * .45s + .15s); }
@keyframes n-in { from { opacity: 0; transform: translateY(10px); clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.j-ladder { display: grid; gap: 6px; margin-top: 22px; }
.j-ladder li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); animation: sys-in .7s var(--ease) both; animation-delay: calc(var(--d) * .12s + .15s); }
.j-ladder li.inf { border-style: dashed; background: transparent; }
.j-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.j-skills li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .875rem; font-weight: 500; }
.j-skills li.car { border-color: color-mix(in oklab, #ff6a2b 45%, transparent); }
.quest.pop .xp-pop { animation: xp-pop 1.2s var(--ease) both; }
.quest { position: relative; }
.xp-pop { position: absolute; right: 18px; top: 14px; color: #ff6a2b; font-weight: 700; opacity: 0; pointer-events: none; }
@keyframes xp-pop { 0% { opacity: 0; transform: translateY(8px) scale(.8); } 25% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-26px); } }
.j-xp { display: flex; align-items: flex-end; gap: 24px; margin: 30px 0 8px; }
.j-xp .aw-l b { min-width: 2.2ch; }
.j-xp .xp { flex: 1; height: 10px; margin-bottom: 14px; }
.j-xp .xp i { transition: width .9s var(--ease); }
.bump { animation: bump .6s var(--spring); }
@keyframes bump { 30% { transform: scale(1.18); color: #ff6a2b; } }
.j-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.j-facts div { padding: 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.j-facts dt { color: var(--muted); font-size: .875rem; }
.j-facts dd { margin: 4px 0 0; font-weight: 600; }
.sys-note b { color: var(--fg); }
.j-ranks { display: flex; flex-wrap: wrap; gap: 22px 30px; margin: 34px 12px 8px; }
.j-ranks > div { display: grid; justify-items: center; gap: 14px; animation: sys-in .7s var(--ease) both; animation-delay: calc(var(--d) * .1s + .1s); }
.j-ranks small { color: var(--muted); font-size: .8125rem; font-weight: 550; }
.j-quest { margin-top: 24px; padding: clamp(18px, 3vw, 30px); border: 1px solid var(--brand-ink); border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 30px var(--sys-glow); }
.j-quest p:first-child { font-size: clamp(1.375rem, 3vw, 2rem); letter-spacing: -.03em; }
.j-quest b { font-weight: 650; }

/* ---------- Guide, spotlight, toast ---------- */
.spot { position: relative; z-index: 6; outline: 2px solid #ff6a2b; outline-offset: 6px; border-radius: var(--r-l); box-shadow: 0 0 0 9999px rgb(8 6 12 / .5); transition: outline-offset .5s var(--ease); }
.cl-guide { position: fixed; z-index: 70; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); width: min(calc(100% - 32px), 480px); translate: -50% 0; }
.cl-guide .sys { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
.cl-guide h3 { font-size: 1.5rem; }
.cl-guide .cl-row { margin-top: 16px; }
.cl-toast { position: fixed; z-index: 90; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); translate: -50% 0; display: grid; gap: 6px; justify-items: center; width: min(calc(100% - 32px), 420px); pointer-events: none; }
.cl-toast p { max-width: 100%; padding: 9px 16px; font-size: .9375rem; text-align: center; border: 1px solid var(--sys-line); border-radius: 999px; background: var(--surface); box-shadow: 0 0 24px var(--sys-glow), var(--shadow); font-weight: 600; animation: sys-in .5s var(--ease) both; transition: opacity .45s, translate .45s var(--ease); }
.cl-toast p.out { opacity: 0; translate: 0 -10px; }

@media (max-width: 620px) {
  .j-facts { grid-template-columns: minmax(0, 1fr); }
  .j-dots i { width: 12px; } .j-dots i.on { width: 22px; }
  .xp-row span { display: none; }
}
@media (max-width: 860px) { .cl-guide { bottom: calc(var(--frame) + 76px + env(safe-area-inset-bottom)); } .cl-guide .sys { padding: 16px 18px; } .cl-guide .sys-head { margin-bottom: 10px; padding-bottom: 8px; } .cl-guide h3 { font-size: 1.25rem; } .cl-guide .sys-sub { margin-top: 6px; font-size: .9375rem; } }
@media (prefers-reduced-motion: reduce) { .n-line, .j-ladder li, .j-ranks > div, .bump { animation: none; } }
.pl-rank.rank-X span { font-size: 1.35em; line-height: 1; }

/* ===================== v3: targets, focus, weekly quests, boss, army ===================== */
.bar { position: relative; display: block; height: 5px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: var(--line); }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--brand-ink); transition: width .9s var(--ease); }
.bar.heat i { background: var(--heat); box-shadow: 0 0 10px rgb(255 106 43 / .45); }

/* Journey extras */
.j-flow { display: grid; gap: 10px; margin-top: 22px; }
.j-flow li { position: relative; display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); animation: sys-in .7s var(--ease) both; animation-delay: calc(var(--d) * .25s + .15s); }
.j-flow li + li::before { content: ""; position: absolute; left: 30px; top: -11px; width: 2px; height: 10px; background: var(--heat); }
.j-flow b { font-weight: 550; }
.j-flow small { color: var(--muted); }
.j-tag { justify-self: start; padding: 2px 10px; border-radius: 99px; background: var(--brand); color: #fff; font-size: .8125rem; font-weight: 600; }
.j-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 4px; }
.j-chips span { padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; font-size: .875rem; font-weight: 550; }
.j-chips span.on { border-color: var(--brand-ink); background: var(--brand); color: #fff; }
.j-hooks { display: grid; gap: 8px; margin-top: 20px; }
.j-hooks li { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); animation: sys-in .7s var(--ease) both; animation-delay: calc(var(--d) * .12s + .1s); }
.j-hooks span { color: var(--muted); font-size: .9375rem; }
.j-facts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }

/* Setup */
.seg.kit label { flex: 1 1 150px; }
.seg.kit span { min-height: 46px; font-size: .9375rem; text-align: center; }
.paths, .tcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; margin-top: 22px; }
.path, .tcard { display: grid; gap: 6px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; transition: border-color .3s, translate .5s var(--ease), box-shadow .4s; }
.path b, .tcard b { font-size: 1.1875rem; font-weight: 600; letter-spacing: -.02em; }
.path span { color: var(--muted); font-size: .9375rem; }
.path small, .tcard small { color: var(--muted); font-size: .8125rem; }
.path.on { border-color: var(--brand-ink); box-shadow: 0 0 24px var(--sys-glow); }
@media (hover: hover) { .path:hover, .tcard:hover { border-color: var(--sys-line); translate: 0 -3px; } }
.tc-k { color: var(--brand-ink); font-size: .875rem; font-weight: 600; }
.tcustom { margin-top: 18px; padding: 4px 18px 18px; border: 1px dashed var(--sys-line); border-radius: var(--r-m); }
.tcustom summary { min-height: 48px; display: flex; align-items: center; font-weight: 550; cursor: pointer; }
.tc-own { margin: 16px 0; }
.tc-own small { color: var(--muted); }
.habits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.habit { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font: 500 .9375rem var(--font); cursor: pointer; transition: border-color .3s, background-color .3s; }
.habit input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.habit:has(input:checked), .habit.on { border-color: var(--brand-ink); background: var(--brand); color: #fff; }
.habit:has(input:focus-visible) { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.habit em { color: inherit; opacity: .7; font-style: normal; font-size: .8125rem; }

/* Today */
.alerts { display: flex; flex-wrap: wrap; gap: 8px; }
.alert { display: inline-flex; gap: 8px; align-items: center; min-height: 42px; padding: 0 16px; border: 1px solid var(--sys-line); border-radius: 999px; background: var(--surface); color: var(--fg); font: 500 .9375rem var(--font); text-decoration: none; cursor: pointer; }
.alert b { font-weight: 650; }
.alert.hot { border: 0; background: var(--heat); color: #120b1b; box-shadow: 0 0 20px rgb(255 106 43 / .4); }
.sysmsg { display: flex; align-items: center; gap: 12px; padding: 4px 6px; color: var(--muted); font-size: 1rem; font-style: italic; }
.sysmsg .sys-mark { flex: none; color: var(--brand-ink); }
.main-q { display: grid; gap: 10px; border-color: color-mix(in oklab, #ff6a2b 50%, transparent); }
.main-q h3 { font-size: clamp(1.375rem, 2.6vw, 1.875rem); }
.main-q .bar { height: 8px; }
.setrow { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 0; }
.setrow > span { color: var(--muted); font-size: .9375rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font: 500 .9375rem var(--font); cursor: pointer; transition: border-color .3s, background-color .3s, color .3s; }
.chip em { color: var(--brand-ink); font-size: .75rem; font-style: normal; font-weight: 650; }
.chip.on, .chip:has(input:checked) { border-color: var(--brand-ink); background: var(--brand); color: #fff; }
.chip.on em { color: #ffd2b0; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip:has(input:focus-visible) { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.forecast { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.forecast b { color: var(--fg); }
.done-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 24px; border-color: #ff6a2b; box-shadow: 0 0 40px rgb(255 106 43 / .25), var(--shadow); }
.done-card .cl-row { margin-top: 0; }
.quest.main { border-color: color-mix(in oklab, #ff6a2b 45%, transparent); }
.q-main { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--heat); color: #120b1b; font-size: .75rem; font-weight: 700; }
.q-cue { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.q-t .bar { margin-top: 6px; max-width: 220px; height: 4px; }
.q-side { display: grid; gap: 8px; justify-items: end; align-self: center; }
.q-swap { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 500 .8125rem var(--font); cursor: pointer; }
@media (hover: hover) { .q-swap:hover { color: var(--fg); border-color: var(--sys-line); } }
.cl-ci .chips + .chips { margin-top: 8px; }
.act-form { margin-top: 16px; }
.cl-ci.done { border-color: var(--sys-line); }
.cl-ci .bar { max-width: 320px; }
.enc { border-color: color-mix(in oklab, #d3235f 55%, transparent); }
.enc h3 { margin-bottom: 8px; }
.enc.done { opacity: .75; }

/* Week */
.wlist { display: grid; gap: 6px; margin-top: 18px; }
.wlist li { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.wlist li.done { border-color: var(--sys-line); }
.w-b { flex: 1; min-width: 0; }
.w-b b { display: block; font-weight: 550; }
.w-b small { color: var(--muted); font-size: .8125rem; }
.w-n { display: grid; justify-items: end; font-weight: 650; font-variant-numeric: tabular-nums; }
.w-n em { color: var(--muted); font-size: .8125rem; font-style: normal; font-weight: 500; }
.boss { border-color: color-mix(in oklab, #d3235f 50%, transparent); background: radial-gradient(120% 80% at 100% 0, rgb(211 35 95 / .2), transparent 60%), var(--glass); }
.boss h3 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); }
.boss-lore { margin-top: 6px; color: var(--muted); font-style: italic; }
.hp { position: relative; height: 26px; margin: 18px 0; overflow: hidden; border: 1px solid rgb(211 35 95 / .5); border-radius: 8px; background: rgb(211 35 95 / .08); }
.hp i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #d3235f, #ff6a2b); transition: width 1.2s var(--ease); }
.hp span { position: relative; display: grid; place-items: center; height: 100%; color: #fff; font-size: .8125rem; font-weight: 700; text-shadow: 0 1px 2px rgb(0 0 0 / .5); }
.boss-moves { display: grid; gap: 6px; }
.boss-moves li { padding-left: 16px; position: relative; }
.boss-moves li:first-child { padding-left: 0; font-weight: 600; }
.boss-moves li:not(:first-child)::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; rotate: 45deg; background: #ff6a2b; }
.boss.beat .hp i { width: 0 !important; }
.week li.cleared b { color: var(--brand-ink); }

/* Status */
.attrs { display: grid; gap: 12px; margin-bottom: 20px; }
.attrs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: end; }
.attrs b { display: block; font-weight: 600; }
.attrs small { color: var(--muted); font-size: .8125rem; }
.attrs em { font-size: 1.5rem; font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
.attrs .bar { grid-column: 1 / -1; height: 6px; }
.ver { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: rgb(107 224 176 / .15); color: var(--rank-c); font-size: .75rem; font-style: normal; font-weight: 650; }
.ver.warn { background: rgb(255 138 76 / .14); color: var(--rank-a); }
.stat .bar { height: 4px; }
.xpchart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; height: 140px; margin-top: 8px; }
.xpchart span { display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; }
.xpchart i { align-self: end; display: block; border-radius: 6px 6px 2px 2px; background: var(--heat); min-height: 2px; }
.xpchart small { color: var(--muted); font-size: .75rem; text-align: center; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 8px; margin-top: 16px; }
.achs button, .achs .locked { display: grid; gap: 2px; width: 100%; height: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: inherit; text-align: left; }
.achs button { cursor: pointer; border-color: var(--sys-line); }
.achs button.on { border-color: #ff6a2b; box-shadow: 0 0 18px rgb(255 106 43 / .35); }
.achs .locked { opacity: .45; }
.achs b { font-weight: 600; font-size: .9375rem; }
.achs small { color: var(--muted); font-size: .8125rem; line-height: 1.3; }

/* Army */
.army h3 { margin-top: 2px; }
.acct-mode, .lb-mode { margin-top: 16px; max-width: 420px; }
.army .cl-form { max-width: 520px; }
.army .cl-check, .cl-form .cl-check { color: var(--muted); }
.lb { display: grid; gap: 4px; margin-top: 16px; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.lb li.me { border-color: var(--brand-ink); box-shadow: 0 0 18px var(--sys-glow); }
.lb-p { width: 26px; color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; text-align: center; }
.lb li:nth-child(-n+3) .lb-p { color: #ff6a2b; }
.lb-h { flex: 1; min-width: 0; }
.lb-h b { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lb-h small { color: var(--muted); font-size: .8125rem; }
.lb-x { font-weight: 650; font-variant-numeric: tabular-nums; }
.cl-form input[type="url"], .cl-form input[type="email"], .cl-form input[inputmode="tel"], .cl-field > input { width: 100%; min-height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: 450 1rem var(--font); }
.cl-pop .cl-form { margin-top: 18px; }
.cl-pop .seg span { min-height: 44px; }
.share-img { width: 100%; max-width: 360px; margin: 6px auto 0; border-radius: 16px; box-shadow: var(--shadow); }
.cl-toast p.gold { border-color: #ff6a2b; }

/* Player card */
.xp-next p { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-top: 8px; font-size: 1rem; }
.xp-next p b { font-weight: 650; }
.xp-next p span { margin-left: auto; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.xp-next .xp-row { margin-top: 20px; }
.pl-facts dd em { color: #ff6a2b; font-style: normal; font-size: .875rem; font-weight: 700; }
.cl-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cl-tabs::-webkit-scrollbar { display: none; }

/* Installed app: drop the website around it */
.cl-standalone .site-header, .cl-standalone .site-footer, .cl-standalone .crumbs, .cl-standalone .action-bar, .cl-standalone .cl-more:not(#cl-privacy), .cl-standalone .consent { display: none !important; }
.cl-standalone main { padding-top: max(12px, env(safe-area-inset-top)); }
.cl-standalone .cl-tabs { top: max(8px, env(safe-area-inset-top)); }
.cl-standalone #cl-privacy { display: none; }
.cl-in-app .cl-more:not(#cl-privacy) { display: none; }

@media (max-width: 860px) {
  .done-card { grid-template-columns: minmax(0, 1fr); }
  .setrow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
@media (max-width: 520px) {
  .quest { flex-wrap: nowrap; }
  .q-side { position: absolute; right: 12px; bottom: 12px; }
  .quest .q-b { padding-bottom: 36px; }
  .cl-tabs button { padding: 0 10px; font-size: .9375rem; }
  .wlist li { gap: 10px; padding: 12px; }
  .chip { min-height: 38px; padding: 0 12px; font-size: .875rem; }
}
@media (prefers-reduced-motion: reduce) { .j-flow li, .j-hooks li { animation: none; } }
.cl-page .action-bar { display: none !important; }

body:has(.cl-guide) .cl-toast { bottom: 230px; }
@media (max-width: 620px) {
  .pl-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 14px; }
  .pl-id h2 { font-size: clamp(1.875rem, 8vw, 2.5rem); }
  .pl-lvl > b { font-size: 3.25rem; }
  .pl-rankwrap { gap: 10px; padding: 0 6px 2px; }
  .pl-rankwrap .pl-rank { width: 54px; border-radius: 14px; font-size: 1.5rem; border-width: 1.5px; }
  .pl-rankwrap small { font-size: .75rem; }
}
.cl-hero .label { color: rgb(255 255 255 / .74); }

/* Home screen install step */
.cl-install, .cl-carry { max-width: 760px; margin-inline: auto; }
.inst-head { display: flex; align-items: center; gap: 18px; }
.inst-head h2 { font-size: clamp(1.875rem, 4.4vw, 3rem); }
.cl-pop .inst-head h2 { font-size: clamp(1.625rem, 4vw, 2.25rem); }
.inst-app { flex: none; display: inline-grid; justify-items: center; gap: 6px; width: 64px; }
.inst-app img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 4px 14px rgb(0 0 0 / .35); }
.inst-app small { width: 76px; overflow: hidden; color: var(--fg); font-size: .6875rem; font-weight: 500; line-height: 1.2; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.inst-app.big { width: 84px; }
.inst-app.big img { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 0 0 1px rgb(255 255 255 / .08), 0 10px 30px rgb(64 19 103 / .55); }
.inst-app.big small { width: 90px; font-size: .75rem; white-space: normal; }
.inst-why { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 18px 0 0; padding: 0; list-style: none; }
.inst-why li { position: relative; padding-left: 26px; font-size: .9375rem; }
.inst-why li::before { content: ""; position: absolute; left: 2px; top: .35em; width: 9px; height: 9px; rotate: 45deg; border: 1.5px solid #ff6a2b; box-shadow: 0 0 8px rgb(255 106 43 / .6); }
.inst-plat { margin-top: 22px; }
.inst-plat button { flex: 1 1 0; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: 550 .9375rem var(--font); cursor: pointer; }
.inst-plat button[aria-pressed="true"] { border-color: var(--brand-ink); background: var(--brand); color: #fff; box-shadow: 0 0 18px var(--sys-glow); }
.inst-how { margin-top: 14px; }
.inst-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: st; }
.inst-steps > li { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); counter-increment: st; }
.inst-steps > li > span:last-child { min-width: 0; }
.inst-steps > li > span:last-child::before { content: counter(st) ". "; color: var(--muted); font-weight: 600; }
.inst-steps .inst-app { width: 40px; }
.inst-steps .inst-app img { width: 36px; height: 36px; border-radius: 9px; }
.inst-steps .inst-app small { display: none; }
.inst-steps .cl-chip { min-height: 34px; margin: 2px 0; }
.ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: color-mix(in oklab, var(--brand) 55%, transparent); color: #fff; }
.ico svg, svg.inl { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico svg .fill, svg.inl .fill { fill: currentColor; stroke: none; }
svg.inl { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.25em; }
.inst-one { display: grid; justify-items: start; gap: 4px; }
.inst-one .sys-note { margin-top: 6px; }
.inst-ok { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #ff6a2b; border-radius: var(--r-s); background: var(--surface); }
.cl-pop.sys .inst + .cl-row { margin-top: 20px; }
.inst-pop .cl-pop, .notif-pop .cl-pop { width: min(100%, 560px); }
.notif-pop .inst-why { grid-template-columns: minmax(0, 1fr); }
.cl-carry textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--fg); font: 450 .875rem/1.4 ui-monospace, monospace; resize: vertical; }

/* Reminders: app alerts */
.alerts-box { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.alerts-box h4, .rm-h { margin: 0 0 4px; font-size: 1.125rem; font-weight: 600; }
.rm-h { margin-top: 22px; }
.alerts-box .cl-row { margin-top: 14px; }
.cl-file { position: relative; display: inline-flex; align-items: center; overflow: hidden; }
.cl-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cl-file:focus-within { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

/* Installed app polish: notch-safe edges, no rubber-band at the top, no grey tap flash */
.cl-page { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.cl-standalone, .cl-standalone body { overscroll-behavior-y: none; }
.cl-standalone button, .cl-standalone a { -webkit-tap-highlight-color: transparent; }
.cl-standalone .cl-toast { bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); }
@media (max-width: 560px) {
  .inst-head { gap: 14px; }
  .inst-app.big { width: 64px; }
  .inst-app.big img { width: 58px; height: 58px; border-radius: 14px; }
  .inst-app.big small { width: 70px; font-size: .6875rem; }
  .inst-why { grid-template-columns: minmax(0, 1fr); }
  .inst-steps > li { gap: 12px; padding: 10px 12px; font-size: .9375rem; }
}

/* ---------- v2 shell: compact header, bottom navigation, simpler screens ---------- */
.cl-top { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; padding: 10px 14px; border: 1px solid var(--sys-line); border-radius: var(--r-l); background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
.ct-id { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ct-id .pl-rank { width: 40px; height: 40px; font-size: 1.1rem; }
.ct-id b { display: block; font-size: 1.05rem; line-height: 1.2; }
.ct-id small { color: var(--muted); font-size: .8125rem; }
.ct-r { display: flex; align-items: center; gap: 8px; }
.ct-help { width: 36px; height: 36px; border: 1px solid var(--sys-line); border-radius: 999px; background: transparent; color: var(--muted); font: 700 .95rem var(--font); cursor: pointer; }
.ct-help:hover, .ct-help:focus-visible { color: var(--fg); }
.ct-xp { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.ct-xp .xp { flex: 1; height: 6px; }
.ct-xp small { flex: none; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.cl-nav { position: fixed; z-index: 40; left: 50%; translate: -50% 0; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; width: min(560px, calc(100% - 20px)); padding: 5px; border: 1px solid var(--glass-line, var(--sys-line)); border-radius: 22px; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); box-shadow: 0 8px 30px rgb(0 0 0 / .18); }
.cl-nav button { position: relative; flex: 1; display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 6px 2px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font: 600 .72rem var(--font); cursor: pointer; transition: background-color .3s, color .3s; }
.cl-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.cl-nav button[aria-current] { background: var(--btn-bg); color: var(--btn-fg); }
.cl-nav .dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--heat, #ff6a2b); }
.cl-in-app #cl-app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.cl-in-app .cl-toast { bottom: calc(86px + env(safe-area-inset-bottom)) !important; }
.cl-in-app .cl-guide { bottom: calc(86px + env(safe-area-inset-bottom)) !important; }
.cl-tabs { display: none; }
.cl-next { align-items: flex-start; }
.cl-next b { margin-right: 6px; }
.cl-intro { border-color: var(--brand); }
.cl-intro p { margin: 0; }
.cl-adjust { margin: 4px 0 12px; }
.cl-adjust summary { min-height: 40px; display: flex; align-items: center; color: var(--muted); font-size: .9rem; cursor: pointer; }
.cl-adjust[open] summary { color: var(--fg); }
.cl-adjust .setrow { margin-top: 8px; }
.qc-set legend small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.qc-opts { display: grid; gap: 6px; }
.qc-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; }
.qc-opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.qc-opt b { font-weight: 550; font-size: .92rem; }
.qc-opt input { accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.plan-steps { display: grid; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }
.plan-steps li { display: grid; gap: 2px; padding: 10px 14px; border-left: 3px solid var(--brand); background: var(--surface); border-radius: var(--r-s); }
.plan-steps span { color: var(--muted); font-size: .92rem; }
.inst-point { font-size: 1.05rem; }
.inst-point .inl, .sys-sub .inl { width: 1.2em; height: 1.2em; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.8; }
.inst-arrow { display: block; margin: 12px auto 0; width: max-content; font-size: 2rem; color: var(--brand); animation: cl-bob 1.4s ease-in-out infinite; }
@keyframes cl-bob { 50% { translate: 0 8px; } }
.cl-settings .cl-row { flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .inst-arrow { animation: none; } }
@media (min-width: 900px) { .cl-nav { bottom: 18px; } }

/* First visit: one question per screen, then the result */
.cl-quiz, .cl-result { max-width: 640px; margin-inline: auto; }
.qz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.qz-top .cl-bar { flex: 1; margin: 0; }
.qz-top .sys-step { margin-left: 0; font-size: .875rem; }
.qz-back { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--fg); cursor: pointer; }
.qz-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cl-quiz h2 { font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.15; }
.qz-opts { display: grid; gap: 10px; margin-top: 26px; }
.qz-opt { display: flex; align-items: center; min-height: 60px; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--fg); font: 500 1.0625rem var(--font); text-align: left; cursor: pointer; transition: border-color .25s, background-color .25s, scale .3s var(--spring); }
@media (hover: hover) { .qz-opt:hover { border-color: var(--sys-line); } }
.qz-opt:active { scale: .98; }
.qz-opt.on { border-color: var(--brand-ink); background: var(--surface-2); box-shadow: 0 0 22px var(--sys-glow); }
.cl-result h2 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.rs-ranks { display: flex; align-items: center; justify-content: space-around; gap: 12px; margin-top: 22px; padding: 22px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.rs-r { display: grid; justify-items: center; gap: 8px; text-align: center; }
.rs-r small { color: var(--muted); font-size: .875rem; }
.rs-r span { font-weight: 600; }
.rs-r.pot small, .rs-r.pot span { color: var(--brand-ink); }
.rs-arrow { width: 48px; height: 24px; fill: none; stroke: var(--brand-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rs-skills { display: grid; gap: 14px; margin: 22px 0 0; padding: 0; list-style: none; }
.rs-skills p { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .9375rem; }
.rs-skills small { color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-bar { position: relative; display: block; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.rs-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }
.rs-pot { background: color-mix(in oklab, var(--brand-ink) 40%, transparent); }
.rs-now { background: var(--heat); }
.rs-key { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-size: .8125rem; }
.rs-key span { display: inline-flex; align-items: center; gap: 6px; }
.rs-key i { width: 10px; height: 10px; border-radius: 3px; }
.rs-warn { margin-top: 16px; padding: 14px 16px; border: 1px solid #b7791f; border-radius: var(--r-m); background: rgb(183 121 31 / .12); font-size: .9375rem; }

/* Quest card: Done and Too hard up front, the rest under More */
.q-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.q-act .cl-ghost { min-height: 44px; padding: 0 16px; }
.q-act .q-done { min-height: 44px; padding: 0 22px; }
.q-act .q-done::before, .q-act .q-done::after { display: none; }
.q-howb { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--brand-ink); font: 500 .9375rem var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.q-more { margin-top: 10px; }
.q-more summary { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); font-size: .875rem; cursor: pointer; }
.quest.done .q-more { display: none; }

/* Log something else: check-in, own tasks and habits behind one button */
.cl-log { margin-top: 14px; }
.cl-log > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border: 1px dashed var(--sys-line); border-radius: var(--r-m); color: var(--fg); font-weight: 500; cursor: pointer; list-style: none; }
.cl-log > summary::-webkit-details-marker { display: none; }
.cl-log > summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.cl-log[open] > summary { margin-bottom: 4px; }
.cl-log > .sys-note { margin: 8px 0 14px; text-align: center; }
.cl-log > .sys + .sys, .cl-log > * + .sys { margin-top: 14px; }

/* Start screen steps */
.cl-hero .cl-steps { display: grid; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; counter-reset: s; }
.cl-hero .cl-steps li { display: flex; align-items: center; gap: 12px; font-size: 1.0625rem; counter-increment: s; }
.cl-hero .cl-steps li::before { content: counter(s); flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgb(8 6 12 / .45); border: 1px solid rgb(255 255 255 / .22); font-weight: 700; }
