:root {
  color-scheme: light;
  --bg: #e9f0e8;
  --surface: rgba(250, 252, 248, 0.92);
  --surface-solid: #f8fbf7;
  --surface-soft: rgba(244, 248, 243, 0.82);
  --ink: #24352f;
  --muted: #66766f;
  --line: rgba(48, 75, 65, 0.15);
  --accent: #347b63;
  --accent-strong: #225f4c;
  --accent-soft: #d9ece2;
  --blue: #4d83d1;
  --danger: #a24444;
  --shadow: 0 18px 56px rgba(27, 51, 42, 0.2);
  --nav-height: 74px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09120f;
  --surface: rgba(17, 29, 25, 0.92);
  --surface-solid: #12201b;
  --surface-soft: rgba(21, 37, 31, 0.86);
  --ink: #e4eee8;
  --muted: #9bada5;
  --line: rgba(184, 213, 200, 0.14);
  --accent: #74c8a7;
  --accent-strong: #9ce2c6;
  --accent-soft: #193d31;
  --blue: #81aef1;
  --danger: #ef8c8c;
  --shadow: 0 20px 64px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 72%, white); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; transform: translateY(-150%); padding: 10px 14px; border-radius: 10px; background: var(--surface-solid); box-shadow: var(--shadow); text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

.app-shell { position: relative; width: 100%; height: 100%; overflow: hidden; }
.topbar { position: fixed; z-index: 20; top: 0; left: 0; right: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 11px 6px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgba(26, 48, 40, 0.1); backdrop-filter: blur(18px) saturate(1.2); cursor: pointer; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); font-size: 16px; }
.brand strong { font-weight: 750; }
.brand small { display: block; margin-top: -1px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar-status { justify-self: center; display: flex; align-items: center; gap: 7px; min-width: 0; }
.weather-pill, .privacy-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); box-shadow: 0 8px 24px rgba(26, 48, 40, 0.08); backdrop-filter: blur(18px) saturate(1.2); font-size: 12px; white-space: nowrap; }
.weather-pill span { color: var(--accent); }
.privacy-pill { color: var(--muted); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
.icon-button, .map-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 24px rgba(26, 48, 40, 0.1); backdrop-filter: blur(18px); cursor: pointer; }

.app-main, .view, .explore-view { height: 100%; }
.view[hidden] { display: none !important; }
.explore-view { position: relative; overflow: hidden; }
#world-map { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#world-map:active { cursor: grabbing; }
.map-wash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 35%, transparent 40%, rgba(24, 52, 42, 0.07) 100%); }
.map-controls { position: absolute; z-index: 9; right: 14px; top: calc(env(safe-area-inset-top, 0px) + 74px); display: flex; flex-direction: column; gap: 7px; }
.map-button { width: 40px; height: 40px; border-radius: 13px; font-size: 19px; }
.map-button.recenter { margin-top: 5px; color: var(--blue); }
.map-attribution { position: absolute; z-index: 5; right: 8px; bottom: calc(var(--nav-height) + var(--safe-bottom) + 170px); padding: 3px 6px; border-radius: 6px; color: var(--muted); background: color-mix(in srgb, var(--surface-solid) 74%, transparent); font-size: 8.5px; }
.world-loading { position: absolute; z-index: 12; top: 50%; left: 50%; display: flex; align-items: center; gap: 9px; transform: translate(-50%, -50%); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); box-shadow: var(--shadow); font-size: 12px; transition: opacity 0.25s, visibility 0.25s; }
.world-loading.done { opacity: 0; visibility: hidden; }
.loading-orbit { width: 17px; height: 17px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.nearby-panel { position: absolute; z-index: 10; left: 10px; right: 10px; bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px); padding: 13px 14px 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(1.25); }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 9.5px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.panel-heading h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.quiet-button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.panel-actions { display: flex; gap: 6px; }
.capture-button { min-height: 36px; padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line)); border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); cursor: pointer; font-size: 11px; font-weight: 750; }
.nearby-list { display: flex; gap: 9px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding-bottom: 1px; }
.nearby-list::-webkit-scrollbar { display: none; }
.nearby-card { flex: 0 0 auto; display: grid; grid-template-columns: 40px minmax(92px, 1fr); align-items: center; gap: 9px; min-width: 154px; min-height: 62px; padding: 8px 10px 8px 8px; border: 1px solid var(--line); border-radius: 15px; text-align: left; background: var(--surface-soft); cursor: pointer; scroll-snap-align: start; }
.nearby-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-1px); }
.nearby-card canvas, .nearby-symbol { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.nearby-symbol { display: grid; place-items: center; color: var(--accent-strong); font-size: 18px; }
.nearby-card strong { display: block; max-width: 116px; overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.nearby-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.empty-copy { margin: 6px 2px; color: var(--muted); font-size: 12px; }

.app-nav { position: fixed; z-index: 30; left: 50%; bottom: max(8px, var(--safe-bottom)); display: grid; grid-template-columns: repeat(5, minmax(58px, 1fr)); gap: 4px; width: min(520px, calc(100vw - 20px)); min-height: var(--nav-height); padding: 7px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 23px; background: var(--surface); box-shadow: 0 16px 48px rgba(23, 43, 36, 0.26); backdrop-filter: blur(24px) saturate(1.25); }
.nav-button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; border: 0; border-radius: 17px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 650; }
.nav-button > span:first-child { font-size: 20px; font-weight: 400; line-height: 1; }
.nav-button.active { color: var(--accent-strong); background: var(--accent-soft); }
.nav-button em { position: absolute; top: 5px; right: 19px; min-width: 17px; padding: 2px 4px; border-radius: 999px; color: white; background: var(--accent); font-size: 8px; font-style: normal; }

.library-view { min-height: 100%; overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 90px) 16px calc(var(--nav-height) + var(--safe-bottom) + 34px); background: radial-gradient(circle at 15% 4%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 32%), var(--bg); }
.page-heading { width: min(900px, 100%); margin: 0 auto 22px; }
.page-heading h1 { margin: 0; font-size: clamp(30px, 6vw, 48px); letter-spacing: -0.055em; line-height: 1; }
.page-heading > p:last-child { max-width: 580px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.collection-grid, .bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; width: min(900px, 100%); margin: 0 auto; }
.collection-card { position: relative; overflow: hidden; padding: 10px 10px 12px; border: 1px solid var(--line); border-radius: 21px; background: var(--surface-solid); box-shadow: 0 8px 30px rgba(24, 47, 39, 0.08); }
.collection-card canvas { display: block; width: 100%; aspect-ratio: 1.15; border-radius: 15px; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.collection-card .rarity-label { margin-top: 8px; }
.collection-card h2 { margin: 3px 0 2px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.collection-card p { margin: 0; color: var(--muted); font-size: 10.5px; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 10px; }
.card-actions button { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 11px; background: transparent; cursor: pointer; font-size: 10px; }
.empty-journal { grid-column: 1 / -1; padding: 36px 20px; border: 1px dashed var(--line); border-radius: 22px; color: var(--muted); text-align: center; }
.empty-journal strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }

.bag-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.bag-item { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid); }
.bag-glyph { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: var(--accent-strong); background: var(--accent-soft); font-size: 22px; }
.bag-item h2 { margin: 0 0 3px; font-size: 14px; }
.bag-item p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.bag-item strong { color: var(--accent-strong); font-size: 18px; }
.privacy-card { display: flex; gap: 14px; width: min(900px, 100%); margin: 18px auto 0; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--accent-soft); }
.privacy-icon { font-size: 26px; }
.privacy-card h2 { margin: 0 0 4px; font-size: 14px; }
.privacy-card p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }

.companion-heading { margin-bottom: 16px; }
.companion-hero { display: grid; grid-template-columns: minmax(280px, 1.05fr) minmax(260px, .95fr); gap: clamp(18px, 4vw, 42px); align-items: center; width: min(900px, 100%); margin: 0 auto; padding: clamp(16px, 3vw, 28px); border: 1px solid var(--line); border-radius: 30px; background: radial-gradient(circle at 25% 35%, color-mix(in srgb, var(--accent-soft) 82%, transparent), transparent 56%), var(--surface-solid); box-shadow: var(--shadow); }
.companion-stage { min-width: 0; border-radius: 24px; background: radial-gradient(circle, color-mix(in srgb, var(--accent-soft) 78%, transparent), transparent 70%); }
.companion-stage canvas { display: block; width: 100%; aspect-ratio: 1; cursor: grab; }
.companion-copy h2 { margin: 5px 0 7px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.055em; }
.companion-copy > p:not(.rarity-label) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.source-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.source-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent-strong); background: var(--accent-soft); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.companion-facts { display: grid; gap: 7px; margin: 15px 0; }
.companion-facts div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.companion-facts dt { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.companion-facts dd { margin: 0; max-width: 58%; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.companion-actions { display: grid; gap: 8px; }
.companion-section { width: min(900px, 100%); margin: 22px auto 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.donor-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: thin; }
.donor-card { flex: 0 0 190px; padding: 9px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid); }
.donor-card canvas { display: block; width: 100%; aspect-ratio: 1.2; border-radius: 13px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.donor-card h3 { margin: 7px 2px 2px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.donor-card p { margin: 0 2px 8px; color: var(--muted); font-size: 9.5px; }
.donor-card button { min-height: 36px; padding: 7px 9px; font-size: 10px; }
.evolution-timeline { display: grid; gap: 8px; }
.evolution-frame { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); }
.frame-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); }
.evolution-frame h3 { margin: 0 0 2px; font-size: 11.5px; }
.evolution-frame p { margin: 0; color: var(--muted); font-size: 9.5px; }
.evolution-frame button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; }

.lineage-summary { display: flex; flex-wrap: wrap; gap: 8px; width: min(900px, 100%); margin: 0 auto 14px; }
.lineage-stat { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-solid); font-size: 10px; }
.drill-card { display: grid; grid-template-columns: minmax(210px, .75fr) minmax(320px, 1.25fr); gap: 18px; width: min(900px, 100%); margin: 0 auto; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-solid); box-shadow: var(--shadow); }
.drill-card h2 { margin: 3px 0 7px; font-size: 24px; letter-spacing: -.04em; }
.drill-card > div > p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dimension-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; border: 0; }
.dimension-picker legend { grid-column: 1 / -1; margin-bottom: 1px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.dimension-picker label { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.dimension-picker input { margin-top: 2px; }
.dimension-picker strong, .dimension-picker small { display: block; }
.dimension-picker strong { font-size: 10.5px; }
.dimension-picker small { margin-top: 2px; color: var(--muted); font-size: 8.5px; line-height: 1.3; }
.drill-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(150px, .45fr) minmax(220px, 1fr); gap: 9px; }
.drill-actions label { display: grid; gap: 5px; }
.drill-actions label span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.drill-actions select { min-height: 48px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface-soft); }
.lineage-board { width: min(900px, 100%); margin: 22px auto 0; }
.lineage-scroll { overflow-x: auto; padding-bottom: 8px; }
.lineage-graph { display: flex; align-items: flex-start; gap: 14px; min-width: max-content; }
.lineage-generation { width: 218px; }
.lineage-generation > h3 { margin: 0 0 8px; color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.lineage-column { display: grid; gap: 8px; }
.rappid-card { display: grid; grid-template-columns: 70px 1fr; gap: 9px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); text-align: left; background: var(--surface-solid); cursor: pointer; }
.rappid-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rappid-card canvas { display: block; width: 70px; height: 70px; border-radius: 12px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.rappid-card strong { display: block; margin: 5px 0 2px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rappid-card span { display: block; color: var(--muted); font-size: 8.5px; line-height: 1.35; }
.rappid-card .awake { color: var(--accent-strong); }

.modal { max-width: none; max-height: none; margin: auto; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
.modal::backdrop { background: rgba(10, 21, 17, 0.42); backdrop-filter: blur(7px); }
.modal-card { position: relative; width: min(440px, calc(100vw - 20px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface-solid); box-shadow: var(--shadow); }
.close-button { position: absolute; z-index: 3; top: 13px; right: 13px; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: var(--surface-soft); cursor: pointer; font-size: 22px; }
.primary-button, .secondary-button, .danger-button, .link-button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 15px; cursor: pointer; font-weight: 720; text-decoration: none; }
.primary-button { border: 1px solid var(--accent-strong); color: #fff; background: var(--accent-strong); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 24%, transparent); }
:root[data-theme="dark"] .primary-button { color: #10231b; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--surface-soft); }
.danger-button { margin-top: 10px; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); background: transparent; }

.onboarding-modal { width: 100vw; height: 100dvh; }
.onboarding-card { display: flex; flex-direction: column; justify-content: flex-start; width: 100%; min-height: 100%; max-height: 100dvh; overflow-y: auto; padding: max(26px, env(safe-area-inset-top)) clamp(22px, 6vw, 70px) max(26px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: radial-gradient(circle at 78% 16%, rgba(130, 204, 174, 0.3), transparent 28%), radial-gradient(circle at 18% 74%, rgba(97, 143, 212, 0.22), transparent 34%), var(--surface-solid); }
.onboarding-wrap { flex: 0 0 auto; width: min(950px, 100%); margin: auto; padding-block: 12px; text-align: center; }
.onboarding-orbit { position: relative; display: grid; place-items: center; width: 138px; height: 138px; margin: 0 auto 24px; border: 1px solid var(--line); border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.onboarding-orbit::before, .onboarding-orbit::after { content: ""; position: absolute; inset: -11px; border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 50%; animation: slow-turn 11s linear infinite; }
.onboarding-orbit::after { inset: 14px -24px; border-style: dashed; animation-direction: reverse; animation-duration: 16s; }
.onboarding-orbit span { position: relative; z-index: 1; font-size: 54px; color: var(--accent-strong); }
@keyframes slow-turn { to { transform: rotate(360deg); } }
.onboarding-wrap h1 { max-width: 760px; margin: 0 auto; font-size: clamp(38px, 8vw, 76px); letter-spacing: -0.065em; line-height: 0.96; }
.onboarding-lead { max-width: 600px; margin: 18px auto 26px; color: var(--muted); font-size: clamp(14px, 2.4vw, 18px); line-height: 1.6; }
.rappid-primer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; width: min(760px, 100%); margin: 20px auto 24px; text-align: left; }
.primer-card { padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.primer-card span { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 9px; border-radius: 11px; color: var(--accent-strong); background: var(--accent-soft); font-size: 17px; }
.primer-card strong { display: block; margin-bottom: 4px; font-size: 12px; }
.primer-card p { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.onboarding-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(540px, 100%); margin: 0 auto; }
.onboarding-actions > * { flex: 1 1 220px; }
.onboarding-fineprint { margin: 16px 0 0; color: var(--muted); font-size: 10px; }
.starter-heading { margin-bottom: 24px; }
.starter-heading h1 { font-size: clamp(34px, 6vw, 58px); }
.starter-heading p { margin: 10px 0 0; color: var(--muted); }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; text-align: left; }
.starter-card { padding: 10px 10px 13px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-soft); }
.starter-card canvas { display: block; width: 100%; aspect-ratio: 1; border-radius: 16px; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.starter-card canvas, #encounter-creature { cursor: grab; }
.starter-card canvas:active, #encounter-creature:active { cursor: grabbing; }
.starter-card h2 { margin: 9px 4px 3px; font-size: 15px; }
.starter-card p { margin: 0 4px 10px; color: var(--muted); font-size: 10.5px; }
.starter-card button { min-height: 42px; }

.sheet-modal { width: 100vw; height: 100dvh; margin: 0; }
.sheet-modal[open] { display: flex; align-items: flex-end; justify-content: center; }
.sheet-modal .modal-card { width: min(500px, 100vw); max-height: calc(100dvh - 20px); border-radius: 28px 28px 0 0; padding-bottom: calc(22px + var(--safe-bottom)); }
.encounter-card { text-align: center; }
.encounter-stage { position: relative; width: min(320px, 82vw); aspect-ratio: 1; margin: -8px auto -18px; }
.encounter-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.catch-ring { position: absolute; z-index: 1; top: 50%; left: 50%; width: 47%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(1); border: 2px solid color-mix(in srgb, var(--accent) 70%, white); border-radius: 50%; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 28%, transparent); animation: catch-ring 1.5s ease-in-out infinite; }
.catch-ring.paused { animation-play-state: paused; }
@keyframes catch-ring { 50% { transform: translate(-50%, -50%) scale(0.34); } }
.throw-grade { position: absolute; z-index: 2; top: 29%; left: 0; right: 0; color: var(--accent-strong); font-size: 15px; font-weight: 800; text-shadow: 0 2px 12px var(--surface-solid); text-transform: uppercase; }
.encounter-copy { position: relative; z-index: 2; }
.rarity-label { margin: 0; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.encounter-copy h2, .place-card h2, .share-card h2, .import-card h2, .about-card h2 { margin: 5px 0 6px; font-size: 25px; letter-spacing: -0.04em; }
.encounter-copy p:last-child, .place-distance, .share-card > p, .import-card > p, .about-card > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.orb-picker { margin: 17px 0 10px; padding: 0; border: 0; text-align: left; }
.orb-picker legend { margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.orb-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.orb-option { position: relative; min-height: 54px; padding: 7px; border: 1px solid var(--line); border-radius: 13px; text-align: center; background: var(--surface-soft); cursor: pointer; }
.orb-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.orb-option strong { display: block; font-size: 11px; }
.orb-option small { color: var(--muted); font-size: 9px; }
.offering-toggle { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; margin: 8px 0 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); text-align: left; font-size: 11px; cursor: pointer; }
.offering-toggle strong { color: var(--ink); }
.encounter-result { min-height: 22px; margin-bottom: 8px; color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.encounter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.encounter-actions > :last-child { grid-column: 1 / -1; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-actions > :last-child { grid-column: 1 / -1; }

.place-card, .share-card, .import-card, .about-card { text-align: center; }
.place-symbol, .share-glyph, .about-mark { display: grid; place-items: center; width: 76px; height: 76px; margin: 4px auto 13px; border-radius: 25px; color: var(--accent-strong); background: var(--accent-soft); font-size: 34px; }
.drop-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-height: 38px; margin: 16px 0 8px; }
.drop-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); font-size: 11px; }
.place-note { min-height: 36px; margin: 8px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.place-card .secondary-button { margin-top: 8px; }
.source-note { margin: 12px 0 0; color: var(--muted); font-size: 8.5px; }
.share-glyph { font-size: 28px; }
.share-label { display: block; margin: 18px 0 6px; color: var(--muted); text-align: left; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.share-url { width: 100%; height: 44px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); font-size: 11px; }
.import-card canvas { display: block; width: 220px; height: 220px; margin: -12px auto -18px; }
.verified-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--accent-strong) !important; background: var(--accent-soft); font-size: 9px !important; font-weight: 750; text-transform: uppercase; }
.import-card .primary-button { margin-top: 16px; }
.feature-list { display: grid; gap: 8px; margin: 18px 0; padding: 0; list-style: none; text-align: left; }
.feature-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 11px; }
.feature-list span { margin-right: 8px; color: var(--accent); }

.capture-card, .splice-card { text-align: left; }
.capture-card > h2, .splice-card > h2 { margin: 5px 44px 6px 0; font-size: 27px; letter-spacing: -.045em; }
.capture-lead, .splice-card > p { margin: 0 0 15px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.moment-form { display: grid; gap: 11px; }
.moment-form label:not(.file-field):not(.weather-check) { display: grid; gap: 5px; }
.moment-form label > span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.moment-form input:not([type="checkbox"]):not([type="file"]), .moment-form textarea, .moment-form select { width: 100%; min-height: 43px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); resize: vertical; }
.moment-file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.file-field { position: relative; display: grid; grid-template-columns: 35px 1fr; grid-template-rows: auto auto; align-items: center; gap: 0 8px; min-height: 68px; padding: 10px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 14px; background: var(--accent-soft); cursor: pointer; overflow: hidden; }
.file-field > span { grid-row: 1 / 3; font-size: 24px; }
.file-field strong { align-self: end; font-size: 11px; }
.file-field small { align-self: start; color: var(--muted); font-size: 9px; }
.file-field input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-field:has(input:valid) { border-style: solid; }
.moment-inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.weather-check { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 10.5px; }
.capture-status { min-height: 16px; margin: 0; color: var(--accent-strong); font-size: 10px; }
.splice-preview { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 8px 0 14px; }
.splice-preview > div { min-width: 0; text-align: center; }
.splice-preview canvas { display: block; width: 100%; aspect-ratio: 1; border-radius: 16px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.splice-preview small { color: var(--muted); font-size: 9px; }
.trait-picker { display: grid; gap: 7px; margin: 0 0 12px; padding: 0; border: 0; }
.trait-picker legend { margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.trait-picker label { display: grid; grid-template-columns: auto 72px 1fr; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.trait-picker strong { font-size: 11px; }
.trait-picker span { color: var(--muted); font-size: 9.5px; }
.splice-note { padding: 10px 12px; border-radius: 12px; color: var(--muted); background: var(--accent-soft); font-size: 9.5px !important; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px); max-width: min(390px, calc(100vw - 30px)); padding: 11px 15px; transform: translate(-50%, 20px); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface-solid); box-shadow: var(--shadow); opacity: 0; visibility: hidden; font-size: 11.5px; text-align: center; transition: 0.22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (max-width: 620px) {
  .privacy-pill { display: none; }
  .topbar-status { justify-self: end; }
  .weather-pill { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .starter-grid { grid-template-columns: 1fr; max-height: 62vh; overflow-y: auto; }
  .onboarding-orbit { width: 88px; height: 88px; margin-bottom: 12px; }
  .onboarding-orbit span { font-size: 36px; }
  .onboarding-wrap h1 { font-size: 40px; }
  .onboarding-lead { margin: 11px auto 14px; font-size: 13px; line-height: 1.45; }
  .rappid-primer { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px auto 14px; }
  .primer-card { padding: 8px; text-align: center; }
  .primer-card span { width: 29px; height: 29px; margin: 0 auto 6px; }
  .primer-card strong { font-size: 9.5px; }
  .primer-card p { display: none; }
  .starter-card { display: grid; grid-template-columns: 106px 1fr; grid-template-rows: auto auto 1fr; gap: 0 10px; }
  .starter-card canvas { grid-row: 1 / 4; width: 106px; }
  .starter-card h2 { align-self: end; }
  .starter-card button { align-self: end; }
  .companion-hero { grid-template-columns: 1fr; }
  .drill-card { grid-template-columns: 1fr; }
  .drill-actions { grid-template-columns: 1fr; }
  .dimension-picker { grid-template-columns: 1fr; }
  .companion-stage { max-width: 330px; margin: -15px auto -34px; }
  .moment-inline-fields { grid-template-columns: 1fr; }
  .nav-button { min-width: 0; }
  .nav-button em { right: 8px; }
}

@media (min-width: 900px) {
  .topbar { padding-inline: 22px; }
  .nearby-panel { top: calc(env(safe-area-inset-top, 0px) + 84px); right: 20px; bottom: calc(var(--nav-height) + 22px); left: auto; width: 326px; overflow: hidden; padding: 18px; }
  .nearby-list { flex-direction: column; max-height: calc(100% - 58px); overflow-y: auto; }
  .nearby-card { width: 100%; min-height: 66px; }
  .nearby-card strong { max-width: 205px; }
  .map-controls { top: auto; right: 366px; bottom: 24px; }
  .map-attribution { right: 366px; bottom: 12px; }
  .app-nav { bottom: 16px; }
  .library-view { padding-inline: 34px; }
  .sheet-modal[open] { align-items: center; }
  .sheet-modal .modal-card { border-radius: 28px; padding-bottom: 24px; }
}

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