/* 星牧手记 · mobile-first read-only snapshot UI */
:root {
  --bg: #f6f1e7;
  --bg-2: #efe7d8;
  --surface: rgba(255, 252, 246, .78);
  --surface-solid: #fffcf6;
  --surface-2: rgba(244, 237, 224, .9);
  --line: rgba(64, 48, 26, .10);
  --line-2: rgba(64, 48, 26, .18);
  --text: #2b2418;
  --text-2: #6b5f4c;
  --text-3: #9a8d77;
  --accent: #6c5ce7;
  --accent-2: #e8789a;
  --accent-soft: rgba(108, 92, 231, .12);
  --gold: #c98a12;
  --gold-soft: rgba(201, 138, 18, .14);
  --good: #2f9e6b;
  --good-soft: rgba(47, 158, 107, .14);
  --warn: #c77a12;
  --warn-soft: rgba(199, 122, 18, .14);
  --bad: #d0514e;
  --bad-soft: rgba(208, 81, 78, .13);
  --muted-soft: rgba(107, 95, 76, .10);
  --shadow: 0 1px 2px rgba(60, 40, 10, .05), 0 8px 28px -12px rgba(60, 40, 10, .22);
  --shadow-lift: 0 2px 4px rgba(60, 40, 10, .06), 0 18px 40px -16px rgba(60, 40, 10, .32);
  --star: rgba(108, 92, 231, .22);
  --nebula-a: rgba(232, 120, 154, .16);
  --nebula-b: rgba(108, 92, 231, .14);
  --radius: 20px;
  --radius-sm: 12px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1029; --bg-2: #151a3d;
    --surface: rgba(28, 33, 72, .62); --surface-solid: #1b2048; --surface-2: rgba(38, 44, 92, .72);
    --line: rgba(190, 196, 255, .10); --line-2: rgba(190, 196, 255, .18);
    --text: #eef0ff; --text-2: #aeb3dc; --text-3: #7b80ad;
    --accent: #9d8fff; --accent-2: #ff9fb8; --accent-soft: rgba(157, 143, 255, .16);
    --gold: #ffc857; --gold-soft: rgba(255, 200, 87, .14);
    --good: #5fd6a0; --good-soft: rgba(95, 214, 160, .14);
    --warn: #ffb35c; --warn-soft: rgba(255, 179, 92, .14);
    --bad: #ff7d7a; --bad-soft: rgba(255, 125, 122, .14);
    --muted-soft: rgba(174, 179, 220, .10);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px -14px rgba(0, 0, 0, .6);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 20px 44px -18px rgba(0, 0, 0, .75);
    --star: rgba(255, 255, 255, .85); --nebula-a: rgba(255, 159, 184, .14); --nebula-b: rgba(120, 104, 255, .22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1029; --bg-2: #151a3d;
  --surface: rgba(28, 33, 72, .62); --surface-solid: #1b2048; --surface-2: rgba(38, 44, 92, .72);
  --line: rgba(190, 196, 255, .10); --line-2: rgba(190, 196, 255, .18);
  --text: #eef0ff; --text-2: #aeb3dc; --text-3: #7b80ad;
  --accent: #9d8fff; --accent-2: #ff9fb8; --accent-soft: rgba(157, 143, 255, .16);
  --gold: #ffc857; --gold-soft: rgba(255, 200, 87, .14);
  --good: #5fd6a0; --good-soft: rgba(95, 214, 160, .14);
  --warn: #ffb35c; --warn-soft: rgba(255, 179, 92, .14);
  --bad: #ff7d7a; --bad-soft: rgba(255, 125, 122, .14);
  --muted-soft: rgba(174, 179, 220, .10);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 20px 44px -18px rgba(0, 0, 0, .75);
  --star: rgba(255, 255, 255, .85); --nebula-a: rgba(255, 159, 184, .14); --nebula-b: rgba(120, 104, 255, .22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  transition: background-color .5s var(--ease-out), color .5s var(--ease-out);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- sky ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: linear-gradient(180deg, var(--bg), var(--bg-2)); transition: background .5s; }
.stars { position: absolute; inset: -50%; background-repeat: repeat; }
.s1 { background-image: radial-gradient(1px 1px at 20px 30px, var(--star), transparent), radial-gradient(1px 1px at 120px 80px, var(--star), transparent), radial-gradient(1.2px 1.2px at 200px 160px, var(--star), transparent); background-size: 240px 220px; animation: drift 180s linear infinite; opacity: .7; }
.s2 { background-image: radial-gradient(1.5px 1.5px at 60px 110px, var(--star), transparent), radial-gradient(1px 1px at 170px 40px, var(--star), transparent); background-size: 300px 260px; animation: drift 260s linear infinite reverse, twinkle 6s ease-in-out infinite; opacity: .5; }
.s3 { background-image: radial-gradient(2px 2px at 90px 70px, var(--star), transparent); background-size: 420px 380px; animation: drift 340s linear infinite, twinkle 9s ease-in-out infinite 2s; opacity: .55; }
.nebula { position: absolute; inset: 0; background: radial-gradient(60% 40% at 85% 0%, var(--nebula-a), transparent 70%), radial-gradient(70% 50% at 0% 30%, var(--nebula-b), transparent 70%), radial-gradient(50% 40% at 70% 100%, var(--nebula-b), transparent 70%); animation: breathe 18s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(240px, 220px, 0); } }
@keyframes twinkle { 50% { opacity: .15; } }
@keyframes breathe { to { transform: scale(1.08) translateY(-2%); opacity: .8; } }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 0 16px calc(96px + var(--safe-b)); max-width: 1080px; margin: 0 auto; }
.rail { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); }
.rail .brand, .rail-note { display: none; }
.tabs {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: var(--shadow-lift);
}
.tabs a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--text-3); border-radius: 18px; transition: color .3s; }
.tabs a svg { font-size: 22px; transition: transform .4s var(--ease-spring); }
.tabs a[aria-selected="true"] { color: var(--accent); }
.tabs a[aria-selected="true"] svg { transform: translateY(-1px) scale(1.08); }
.tabs a:active svg { transform: scale(.88); }
.tab-indicator { position: absolute; z-index: 0; top: 6px; left: 0; height: calc(100% - 12px); width: 0; border-radius: 18px; background: var(--accent-soft); transition: transform .5s var(--ease-spring), width .5s var(--ease-spring), height .5s var(--ease-spring); }

@media (min-width: 960px) {
  .main { padding: 0 32px 48px; }
  .rail { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; width: 232px; flex: none; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; border-right: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
  .rail .brand { display: flex; }
  .rail-note { display: block; margin-top: auto; font-size: 12px; color: var(--text-3); line-height: 1.7; }
  .tabs { grid-template-columns: 1fr; padding: 0; gap: 4px; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tabs a { flex-direction: row; gap: 12px; padding: 11px 14px; font-size: 14px; }
  .tabs a svg { font-size: 19px; }
  .tab-indicator { top: 0; left: 0; }
  .topbar .brand.compact { display: none; }
}

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 0 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: linear-gradient(var(--bg) 55%, transparent); }
@media (min-width: 960px) { .topbar { margin: 0 -32px; padding-left: 32px; padding-right: 32px; } }
.brand { align-items: center; gap: 10px; display: flex; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -6px var(--accent); }
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand-text small { font-size: 9.5px; letter-spacing: .18em; color: var(--text-3); font-weight: 600; }
.brand.compact .brand-text { font-size: 15px; }
.fresh-pill { display: inline-flex; align-items: center; gap: 7px; min-width: 0; margin-left: auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .2s; }
.fresh-pill:active { transform: scale(.96); }
.fresh-pill span { overflow: hidden; text-overflow: ellipsis; }
.fresh-pill i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.fresh-pill[data-state="fresh"] i { background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: ping 2.4s var(--ease-out) infinite; }
.fresh-pill[data-state="stale"] i { background: var(--warn); }
.fresh-pill[data-state="error"] i { background: var(--bad); }
.sync-status { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: -4px 0 18px; font-size: 12px; line-height: 1.7; color: var(--text-3); }
.sync-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--text-2); }
.sync-label::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--warn); }
.sync-status[data-state="normal"] .sync-label::before { background: var(--good); }
.sync-status[data-state="error"] .sync-label::before { background: var(--bad); }
.sync-detail { width: 100%; overflow-wrap: anywhere; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
.top-actions { display: flex; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; color: var(--text-2); transition: transform .25s var(--ease-spring), background .2s, color .2s; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.spinning svg { animation: spin .9s var(--ease-out) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- character switcher ---------- */
.switcher { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; margin: 4px 0 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.switcher button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 6px; border: 0; background: none; border-radius: 14px; color: var(--text-2); transition: color .35s; }
.switcher b { font-size: 15px; }
.switcher small { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.switcher button[aria-checked="true"] { color: var(--text); }
.switch-thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 14px; background: var(--surface-solid); box-shadow: var(--shadow); transition: transform .55s var(--ease-spring); }
.switcher[data-active="odoudouIron"] .switch-thumb { transform: translateX(100%); }
.switch-thumb::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 18px; height: 3px; margin-left: -9px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- view transitions ---------- */
.view { outline: none; }
.view.silent-update .rise, .view.silent-update .pop { animation: none; }
.view.silent-update .bar > i, .view.silent-update .ring .value { transition: none; }
.view.leave { animation: viewOut .18s ease-in forwards; }
.view.enter { animation: viewIn .5s var(--ease-out); }
.view.enter-left { animation: slideL .5s var(--ease-out); }
.view.enter-right { animation: slideR .5s var(--ease-out); }
@keyframes viewOut { to { opacity: 0; transform: translateY(6px) scale(.995); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-28px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(28px); } }
.rise { animation: rise .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.pop { animation: pop .45s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes pop { from { opacity: 0; transform: scale(.86); } }

/* ---------- generic cards ---------- */
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } .span-2 { grid-column: span 2; } }
.card { position: relative; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out); }
@media (hover: hover) { .card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .glyph { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .16em; color: var(--text-3); text-transform: uppercase; }
.page-title { margin: 6px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.page-sub { margin: 0 0 18px; color: var(--text-2); font-size: 13.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.section-gap { margin-top: 14px; }

/* meta row: completeness + freshness + time */
.meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--muted-soft); color: var(--text-2); border: 0; }
button.chip { cursor: pointer; transition: transform .2s var(--ease-spring); }
button.chip:active { transform: scale(.94); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.foot-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--text-3); }
.foot-note b { color: var(--text-2); font-weight: 600; }

/* ---------- hero ---------- */
.hero { overflow: hidden; padding: 20px; }
.hero::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; animation: breathe 9s ease-in-out infinite alternate; }
.hero-top { position: relative; display: flex; gap: 16px; align-items: center; }
.avatar { position: relative; flex: none; width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(145deg, var(--accent-soft), var(--gold-soft)); border: 1px solid var(--line-2); overflow: hidden; }
.avatar svg { width: 60%; height: 60%; stroke: var(--text-3); stroke-width: 1.5; }
.avatar .orbit { position: absolute; inset: -6px; border-radius: 28px; border: 1.5px dashed var(--line-2); animation: spin 30s linear infinite; }
.hero h1 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; word-break: break-all; }
.hero .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.total-level { margin-left: auto; text-align: right; }
.total-level b { display: block; font-size: 30px; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.total-level span { font-size: 11px; color: var(--text-3); }
.wallet { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
@media (min-width: 560px) { .wallet { grid-template-columns: repeat(4, 1fr); } }
.coin { padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.coin span { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.coin span i { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; color: #fff; }
.coin b { display: block; margin-top: 3px; font-size: 18px; font-weight: 750; }
.coin.unknown b { color: var(--text-3); font-weight: 500; font-size: 14px; }
.ci-gold { background: linear-gradient(135deg, #ffd36b, #e09a12); }
.ci-bell { background: linear-gradient(135deg, #b8a8ff, #6c5ce7); }
.ci-token { background: linear-gradient(135deg, #7fe3b4, #2f9e6b); }
.ci-food { background: linear-gradient(135deg, #ffb3a1, #e8789a); }

/* ---------- activity ---------- */
.action { display: flex; gap: 14px; align-items: center; }
.pulse { position: relative; flex: none; width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.pulse.running::before, .pulse.running::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--accent); opacity: 0; animation: ring 2.6s var(--ease-out) infinite; }
.pulse.running::after { animation-delay: 1.3s; }
@keyframes ring { 0% { opacity: .55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.45); } }
.action-name { font-size: 18px; font-weight: 750; }
.action-sub { color: var(--text-2); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.stat b { display: block; font-size: 16px; font-weight: 750; }
.stat span { font-size: 11px; color: var(--text-3); }
.stat.unknown b { color: var(--text-3); font-weight: 500; font-size: 13px; }
.queue { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line-2); font-size: 13.5px; }
.queue .pos { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--muted-soft); font-size: 11px; font-weight: 700; color: var(--text-2); }
.queue .q-right { margin-left: auto; color: var(--text-2); font-size: 12.5px; }

/* ---------- route timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent-2)); opacity: .35; transform-origin: top; animation: grow 1s var(--ease-out) both .2s; }
@keyframes grow { from { transform: scaleY(0); } }
.timeline li { position: relative; padding: 0 0 16px 40px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { position: absolute; left: 4px; top: 1px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 0 4px var(--bg); }
.timeline b { display: block; font-size: 14px; }
.timeline p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); }
.prereq { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.prereq li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.prereq li .chip { flex: none; }

/* ---------- ring + bars ---------- */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; flex: none; width: 84px; height: 84px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--muted-soft); }
.ring .value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease-out); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 17px; line-height: 1.1; }
.ring .label small { display: block; font-size: 10px; color: var(--text-3); font-weight: 600; }
.bar { position: relative; height: 8px; border-radius: 8px; background: var(--muted-soft); overflow: hidden; }
.bar > i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; transform: scaleX(0); transition: transform 1.1s var(--ease-out); }
.bar.gold > i { background: linear-gradient(90deg, #ffd36b, var(--gold)); }
.bar.good > i { background: linear-gradient(90deg, #7fe3b4, var(--good)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

/* ---------- tasks ---------- */
.task { padding: 12px; border-radius: 14px; background: var(--surface-2); margin-top: 10px; }
.task-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.task-top b { font-size: 14px; }
.task-foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; color: var(--text-2); }
.empty { padding: 22px 12px; text-align: center; color: var(--text-3); font-size: 13px; border-radius: 14px; border: 1px dashed var(--line-2); }
.empty .em { display: block; font-size: 26px; margin-bottom: 4px; opacity: .7; }

/* ---------- skills ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg button { padding: 6px 12px; border: 0; border-radius: 9px; background: none; font-size: 12.5px; color: var(--text-2); transition: background .25s, color .25s; }
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .skills { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .skills { grid-template-columns: repeat(4, 1fr); } }
.skill { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform .3s var(--ease-out); }
.skill:active { transform: scale(.97); }
.skill-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.skill-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-size: 17px; background: var(--accent-soft); }
.skill-name { font-weight: 700; font-size: 14px; }
.skill-key { font-size: 10.5px; color: var(--text-3); font-family: var(--mono); }
.skill-lv { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.skill-lv b { font-size: 26px; font-weight: 800; line-height: 1; }
.skill-lv .bonus { font-size: 12px; font-weight: 700; color: var(--good); }
.skill .bar { height: 5px; }

/* ---------- equipment ---------- */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 640px) { .slots { grid-template-columns: repeat(6, 1fr); } }
.slot { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: center; transition: transform .3s var(--ease-spring), border-color .2s; }
button.slot { cursor: pointer; }
button.slot:hover { border-color: var(--accent); }
button.slot:active { transform: scale(.93); }
.slot.empty { background: transparent; border-style: dashed; color: var(--text-3); }
.slot.unknown { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--muted-soft) 6px 12px); border-style: dashed; color: var(--text-3); }
.slot .slot-name { font-size: 10.5px; color: var(--text-3); line-height: 1.2; }
.slot .slot-item { font-size: 11px; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.enh { position: absolute; top: 4px; right: 4px; padding: 1px 5px; border-radius: 6px; font-size: 10px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface-2); }
.legend i.e { border-style: dashed; background: transparent; }
.legend i.u { border-style: dashed; background: repeating-linear-gradient(135deg, transparent 0 3px, var(--muted-soft) 3px 6px); }

/* item icon placeholder */
.ico { --h: 260; position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-weight: 800; font-size: 15px; color: hsl(var(--h) 55% 45%); background: hsl(var(--h) 70% 60% / .16); border: 1px solid hsl(var(--h) 60% 55% / .22); }
:root[data-theme="dark"] .ico { color: hsl(var(--h) 85% 78%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ico { color: hsl(var(--h) 85% 78%); } }
.ico.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.ico.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 26px; }
.ico svg { width: 72%; height: 72%; stroke: none; }

.abilities { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ability { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.ability.on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.ability b { display: block; font-size: 13px; font-family: var(--mono); font-weight: 600; word-break: break-all; }
.ability span { font-size: 11.5px; color: var(--text-3); }

/* ---------- inventory ---------- */
.search { position: relative; flex: 1 1 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 17px; }
.search input { width: 100%; height: 42px; padding: 0 38px 0 38px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 9px; background: none; color: var(--text-3); display: grid; place-items: center; }
.search .clear[hidden] { display: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; scroll-snap-align: start; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--text-2); transition: background .25s, color .25s, transform .25s var(--ease-spring); }
.chips button:active { transform: scale(.94); }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.inv-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.inv-summary b { color: var(--text); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .3s var(--ease-spring), border-color .2s, box-shadow .3s; }
.item:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.item:active { transform: scale(.96); }
.item-body { min-width: 0; }
.item-name { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-qty { font-size: 12px; color: var(--text-2); }
.item-qty .enhl { color: var(--accent); font-weight: 700; margin-left: 4px; }
.load-more { display: flex; justify-content: center; padding: 18px 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; transition: transform .25s var(--ease-spring); }
.btn:active { transform: scale(.95); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }

/* ---------- attributes ---------- */
.attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.attr { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.attr span { display: block; font-size: 11.5px; color: var(--text-3); }
.attr b { font-size: 15px; font-weight: 700; }
.attr small { font-size: 11px; color: var(--text-3); margin-left: 2px; }

.sec-list { display: grid; gap: 6px; }
.sec-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.sec-row .name { font-weight: 600; min-width: 64px; }
.sec-row .meta { margin-left: auto; }

/* ---------- skeleton ---------- */
.sk { position: relative; overflow: hidden; border-radius: 12px; background: var(--muted-soft); }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-solid) 70%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk.h { height: 168px; border-radius: var(--radius); }
.sk.m { height: 120px; border-radius: var(--radius); }
.sk.s { height: 64px; }

/* ---------- error state ---------- */
.state-card { text-align: center; padding: 36px 20px; }
.state-card .em { font-size: 38px; display: block; margin-bottom: 8px; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px); } }

/* ---------- sheet ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-layer[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 30, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .35s var(--ease-out); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 86vh; display: flex; flex-direction: column; border-radius: 26px 26px 0 0; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .4); padding-bottom: var(--safe-b); transform: translateY(100%); transition: transform .5s var(--ease-out); touch-action: none; }
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: translateY(var(--drag, 0px)); }
.sheet-layer.dragging .sheet { transition: none; }
@media (min-width: 720px) { .sheet-layer { align-items: center; } .sheet { border-radius: 26px; transform: translateY(40px) scale(.96); opacity: 0; transition: transform .45s var(--ease-spring), opacity .3s; } .sheet-layer.open .sheet { transform: none; opacity: 1; } .sheet-grip { display: none; } }
.sheet-grip { width: 40px; height: 5px; margin: 10px auto 0; border-radius: 5px; background: var(--line-2); flex: none; cursor: grab; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px 6px; }
.sheet-head h2 { margin: 0; font-size: 17px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 6px 18px 22px; touch-action: pan-y; }
.sheet-hero { display: flex; gap: 14px; align-items: center; margin: 6px 0 16px; }
.sheet-hero b { font-size: 20px; display: block; }
.code-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.code-list li { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--muted-soft); color: var(--text-2); word-break: break-all; }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow-lift); font-size: 13px; animation: toastIn .5s var(--ease-spring); pointer-events: auto; }
.toast.out { animation: toastOut .3s ease-in forwards; }
.toast i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.toast.bad i { background: var(--bad); }
.toast.warn i { background: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.97); } }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 28px; font-size: 11.5px; color: var(--text-3); }
.noscript { padding: 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- small-screen refinements ---------- */
.brand-text, .card-title { white-space: nowrap; }
.card-head { flex-wrap: wrap; }
.card-head .meta { margin-left: auto; }
.badges .meta { justify-content: flex-start; }
@media (max-width: 420px) {
  .topbar .brand.compact .brand-text { display: none; }
  .hero-top { flex-wrap: wrap; }
  .hero-top > div:nth-child(2) { flex: 1 1 0; }
  .total-level { order: -1; position: absolute; top: 0; right: 0; }
  .hero-top > div:nth-child(2) { padding-right: 72px; }
}
@media (min-width: 960px) { .slots { grid-template-columns: repeat(8, 1fr); } }
