:root {
  --bg: #070b18; --bg-deep: #040711; --surface: #0d1426; --surface-raised: #111a30;
  --surface-soft: rgba(17, 26, 48, .72); --text: #f4f0e9; --text-dim: #9ea8bf; --text-faint: #68738d;
  --paper: #f5eddf; --pink: #f05bc4; --violet: #9b7cff; --blue: #63d7ff;
  --line: rgba(197, 210, 245, .2); --line-strong: rgba(197, 210, 245, .38);
  --r-sm: 12px; --r-md: 18px; --r-lg: 26px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1); --fast: 160ms; --normal: 220ms; --slow: 420ms;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { background: var(--bg-deep); }
body { margin: 0; min-width: 320px; background: var(--bg-deep); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#app { min-height: 100vh; max-width: 560px; margin: auto; background: radial-gradient(ellipse at 70% -12%, rgba(94, 78, 190, .28), transparent 42%), radial-gradient(ellipse at -10% 36%, rgba(240, 91, 196, .05), transparent 35%), var(--bg); }
.loading { min-height: 100vh; display: grid; place-content: center; gap: 14px; color: var(--text-dim); text-align: center; }
.loading p { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.spark { width: 22px; height: 22px; margin: auto; border: 1px solid var(--blue); border-radius: 50%; border-top-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#screen { min-height: 100vh; padding: env(safe-area-inset-top) 16px calc(86px + env(safe-area-inset-bottom)); animation: rise var(--normal) var(--ease) both; }
.topbar { height: 46px; display: flex; align-items: center; justify-content: space-between; }
.wordmark { color: var(--paper); font-size: 10px; font-weight: 800; letter-spacing: .34em; }
.close { width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--r-pill); background: transparent; color: var(--text-dim); font-size: 26px; line-height: 1; cursor: pointer; transition: color var(--fast), background var(--fast), border-color var(--fast); }
.close:hover, .close:active { color: var(--text); background: var(--surface-soft); border-color: var(--line); }
.portrait { position: relative; height: 398px; margin: 0 -16px; overflow: hidden; background: var(--surface); }
.portrait::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-bottom: 1px solid var(--line); }
.portrait > img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: saturate(.86) contrast(1.08); transition: transform 700ms var(--ease); }
.portrait:hover > img { transform: scale(1.015); }
.portrait-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 7, 17, .04) 30%, rgba(4, 7, 17, .16) 50%, rgba(4, 7, 17, .96) 100%); }
.portrait-copy { position: absolute; z-index: 1; left: 20px; right: 20px; bottom: 20px; }
.portrait-copy span, .xp-panel > span, .mission > span, .badges > span, .section-head > span, .visibility > span, .store-item span, .event > span { color: var(--text-dim); font-size: 10px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.portrait-copy h1 { margin: 6px 0 3px; color: var(--paper); font-size: clamp(29px, 8vw, 40px); line-height: .95; letter-spacing: -.07em; }
.portrait-copy p { margin: 0; color: var(--text); font-weight: 650; }
.xp-panel, .mission, .badges, .public-note, .visibility, .event, .store-item { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(17, 26, 48, .96), rgba(8, 13, 28, .98)); box-shadow: 0 16px 40px rgba(0, 0, 0, .16); }
.xp-panel { position: relative; z-index: 2; margin-top: -18px; padding: 18px 20px; border-radius: 22px; }
.xp-link { display: block; width: 100%; color: inherit; text-align: left; cursor: pointer; transition: border-color var(--fast), transform var(--fast) var(--ease); }
.xp-link:hover { border-color: var(--line-strong); }
.xp-link:active { transform: scale(.992); }
.edit-mark { position: absolute; top: 15px; right: 16px; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--blue); font-size: 15px; font-weight: 400; }
.xp-panel strong { display: block; margin-top: 8px; color: var(--paper); font-size: clamp(33px, 10vw, 46px); line-height: .95; letter-spacing: -.07em; text-shadow: 0 0 24px rgba(240, 91, 196, .24); }
.xp-panel strong i { color: var(--text-faint); font-style: normal; font-weight: 400; }
.xp-bar { height: 6px; margin-top: 17px; overflow: hidden; border-radius: var(--r-pill); background: rgba(255, 255, 255, .09); }
.xp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--violet) 58%, var(--blue)); transition: width var(--slow) var(--ease); }
.mission, .badges, .public-note, .visibility { margin-top: 10px; padding: 15px 16px; border-radius: 16px; }
.mission h2, .public-note h2, .visibility h2 { margin: 5px 0 0; color: var(--paper); font-size: 17px; line-height: 1.15; letter-spacing: -.025em; }
.mission p, .public-note p, .visibility p { margin: 6px 0 0; color: var(--text-dim); }
.mission.compact { margin: 0; }
.mission.done { border-color: rgba(99, 215, 255, .52); }
.badges p { margin: 7px 0 0; color: var(--paper); font-weight: 650; }
.text-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 12px; padding: 17px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--paper); font-weight: 750; text-align: left; cursor: pointer; transition: color var(--fast), border-color var(--fast); }
.text-button:hover { color: var(--blue); border-color: var(--blue); }
.text-button b { color: var(--blue); font-size: 21px; font-weight: 400; transition: transform var(--fast) var(--ease); }
.text-button:hover b { transform: translateX(4px); }
.claim-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.claim-actions button, .filter, .store-button { min-height: 40px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 9px 14px; background: rgba(255, 255, 255, .04); color: var(--paper); cursor: pointer; transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast), color var(--fast); }
.claim-actions button:hover, .filter:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .1); }
.claim-actions button:active, .filter:active, .store-button:active { transform: scale(.97); }
.tabs { position: fixed; z-index: 5; bottom: 0; left: 50%; display: grid; width: min(560px, 100%); grid-template-columns: repeat(3, 1fr); transform: translateX(-50%); padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(7, 11, 24, .86); backdrop-filter: blur(20px); }
.tabs.admin-nav { grid-template-columns: repeat(4, 1fr); }
.tab { position: relative; min-height: 48px; border: 0; background: transparent; color: var(--text-faint); font-size: 11px; cursor: pointer; transition: color var(--fast); }
.tab span { display: block; width: 4px; height: 4px; margin: 0 auto 6px; border-radius: 50%; background: currentColor; opacity: .55; transition: transform var(--fast), opacity var(--fast); }
.tab.active { color: var(--paper); }
.tab.active span { opacity: 1; transform: scale(1.8); background: var(--blue); box-shadow: 0 0 12px rgba(99, 215, 255, .7); }
.section-head { padding: 20px 0 15px; }
.section-head h1 { margin: 7px 0 6px; color: var(--paper); font-size: clamp(32px, 9vw, 42px); line-height: .92; letter-spacing: -.07em; }
.section-head p { max-width: 440px; margin: 0; color: var(--text-dim); }
.mission-list, .feed, .store { display: grid; gap: 10px; }
.mission-journey { position: relative; display: grid; gap: 13px; padding: 4px 0 20px; }
.mission-journey::before { position: absolute; top: 0; bottom: 0; left: 11px; width: 1px; background: linear-gradient(var(--text-faint), var(--blue), transparent); content: ""; opacity: .58; }
.mission-past, .mission-future { display: grid; gap: 8px; padding-left: 24px; }
.mission-past .mission { opacity: .52; filter: saturate(.35); }
.mission-past .mission::before, .mission-future .mission::before { position: absolute; left: -29px; top: 23px; width: 9px; height: 9px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--bg); content: ""; }
.mission-past .mission { position: relative; }
.mission-past .mission::before { border-color: var(--text-faint); background: var(--text-faint); }
.mission-future .mission { position: relative; }
.mission-current { position: relative; margin: 8px 0 8px 24px; padding: 24px 20px; border-color: rgba(99, 215, 255, .52); border-radius: var(--r-lg); background: linear-gradient(145deg, rgba(22, 30, 57, .98), rgba(9, 15, 31, .98)); }
.mission-current::before { position: absolute; top: 28px; left: -31px; width: 13px; height: 13px; border: 3px solid var(--blue); border-radius: 50%; background: var(--bg); box-shadow: 0 0 14px rgba(99, 215, 255, .72); content: ""; }
.mission-current h2 { font-size: 25px; letter-spacing: -.04em; }
.mission-current p { font-size: 14px; }
.journey-caption { margin: 4px 0; padding: 10px 0; color: var(--text-faint); font-size: 13px; }
.filter-row { display: flex; gap: 8px; margin: 0 0 15px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter { min-height: 36px; padding: 7px 13px; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.filter.active { border-color: var(--paper); background: var(--paper); color: var(--bg); }
.event { padding: 17px; border-radius: var(--r-md); }
.event-link { cursor: pointer; transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease); }
.event-link:hover { border-color: var(--line-strong); background: linear-gradient(145deg, rgba(23, 35, 63, .98), rgba(8, 13, 28, .98)); }
.event-link:active { transform: scale(.99); }
.event > span { color: var(--blue); }
.event h2 { margin: 0 0 4px; color: var(--paper); font-size: 17px; letter-spacing: -.02em; }
.event p { margin: 0; color: var(--text-dim); }
.event time { display: block; margin-top: 9px; color: var(--text-faint); font-size: 11px; }
.notice { margin: 0; padding: 16px; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--text-dim); }
.store-item { position: relative; display: grid; min-height: 116px; grid-template-columns: 82px 1fr; gap: 13px; padding: 12px; overflow: hidden; border-radius: var(--r-md); }
.store-item.selected { border-color: var(--blue); }
.store-item img, .swatch { width: 82px; height: 92px; object-fit: cover; border-radius: var(--r-sm); background: linear-gradient(145deg, var(--accent, var(--violet)), var(--surface)); }
.store-item h2 { margin: 4px 0; color: var(--paper); font-size: 17px; }
.store-item p { margin: 0; color: var(--text-dim); font-size: 13px; }
.store-button { position: absolute; right: 12px; bottom: 12px; min-height: 34px; padding: 7px 12px; background: var(--paper); color: var(--bg); font-size: 12px; font-weight: 750; }
.store-button.owned { background: rgba(255, 255, 255, .1); color: var(--paper); }
.store-button:disabled { cursor: default; opacity: .45; }
.error { padding: 28px; color: var(--text-dim); text-align: center; }
@media (min-width: 561px) { #app { min-height: 100vh; border-right: 1px solid rgba(197, 210, 245, .06); border-left: 1px solid rgba(197, 210, 245, .06); } }
@media (max-width: 560px) and (max-height: 900px) {
  .portrait { height: 398px; }
  .portrait-copy { bottom: 17px; }
  .badges p { font-size: 14px; }
}
body[data-screen="profile"] #screen { position: relative; min-height: 100svh; padding: 0 0 calc(78px + env(safe-area-inset-bottom)); }
body[data-screen="profile"] .topbar { position: absolute; z-index: 4; top: env(safe-area-inset-top); left: 16px; right: 16px; }
body[data-screen="profile"] .portrait { height: calc(100svh - 76px); margin: 0; }
body[data-screen="profile"] .portrait > img { width: 100%; height: 100%; object-fit: cover; object-position: center center; }
body[data-screen="profile"] .portrait::after { border-bottom: 0; }
body[data-screen="profile"] .portrait-copy { left: 20px; right: 20px; bottom: 285px; }
body[data-screen="profile"] .profile-panels { position: absolute; z-index: 3; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 16px; }
body[data-screen="profile"] .profile-panels .xp-panel { margin-top: 0; }
body[data-screen="profile"] .profile-panels .mission { margin-top: 8px; }
body[data-screen="profile"] .profile-panels .xp-panel, body[data-screen="profile"] .profile-panels .mission { background: rgba(10, 16, 34, .66); backdrop-filter: blur(14px); }
body[data-screen="profile"] .profile-panels .xp-panel { padding: 14px 17px; border-radius: 18px; }
body[data-screen="profile"] .profile-panels .mission { display: none; }
body[data-screen="profile"] .profile-panels .xp-panel strong { margin-top: 6px; font-size: clamp(30px, 9vw, 40px); }
body[data-screen="profile"] .profile-panels .xp-bar { height: 5px; margin-top: 13px; }
body[data-screen="profile"] .profile-panels .mission { padding: 12px 14px; border-radius: 15px; }
body[data-screen="profile"] .profile-panels .mission h2 { font-size: 16px; }
body[data-screen="profile"] .profile-panels .mission p { margin-top: 4px; font-size: 13px; }
body[data-screen="profile"] .tabs { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
body[data-screen="profile"] .tabs { border-top: 0; }
body[data-screen="profile"] .tab { min-height: 42px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
