/* WildDex — Field-Journal Editorial Aesthetic */
/* Style Movement: Field-journal editorialism meets calm utility software */
/* Palette: Warm Paper #f7f5ef, Ink Navy #172a3a, Citrus Orange #f28f3b, Moss Sage #57715a */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  color: #172a3a;
  background: #f7f5ef;
  font-family: 'DM Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;

  --paper: #f7f5ef;
  --paper-deep: #edeae1;
  --ink: #172a3a;
  --muted: #718078;
  --rule: #dfe2d9;
  
  --orange: #f28f3b;
  --orange-soft: #fff0e2;
  
  --sage: #57715a;
  --sage-soft: #e6eee6;
  
  --lilac: #8e7bf1;
  --lilac-soft: #eeeaff;
  
  --sky: #477b8a;
  --sky-soft: #e5f0f2;
  
  --pink: #b97175;
  --pink-soft: #f6e6e5;
  
  --stone: #8a8272;
  --stone-soft: #ebe7df;
  
  --shadow: 0 12px 30px rgba(23, 42, 58, 0.06);
  --shadow-lg: 0 20px 40px rgba(23, 42, 58, 0.12);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

/* Master App Shell Layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--paper);
}

/* Sidebar Navigation (Desktop / Tablet) */
.sidebar {
  width: 260px;
  min-height: 100vh;
  padding: 32px 20px 24px;
  background: #f1efe8;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  flex-shrink: 0;
}

.brand-mark-dot {
  width: 7px;
  height: 7px;
  background: var(--orange);
  border-radius: 50%;
  position: absolute;
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.05em;
  font-size: 17px;
  line-height: 1;
}

.brand-name span {
  color: var(--orange);
  font-weight: 600;
}

.brand-caption, .nav-label, .eyebrow, .quest-label, .section-meta, .sidebar-foot, .streak-top, .result-state, .distance-badge, .demo-chip {
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-caption {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .16em;
  margin-top: 5px;
}

.rail-rule {
  height: 1px;
  background: var(--rule);
  margin: 32px 8px 24px;
}

.nav-label {
  padding: 0 12px;
  color: #9aa39a;
  font-size: 9px;
  margin-bottom: 10px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #748078;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  font-size: 13px;
  font-weight: 600;
}

.nav-item:hover {
  color: var(--ink);
  background: #e9e7df;
  transform: translateX(2px);
}

.nav-item.is-active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 6px 16px rgba(23,42,58,.12);
}

.nav-item span {
  flex: 1;
}

.nav-item small {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px;
  opacity: .56;
  letter-spacing: .1em;
}

.sidebar-bottom {
  margin-top: auto;
}

.streak-card {
  border: 1px solid #d9ddd2;
  border-radius: 13px;
  padding: 15px;
  background: rgba(247,245,239,.5);
}

.streak-top {
  color: var(--sage);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(242,143,59,.14);
}

.pulse-dot.sage {
  background: var(--sage);
  box-shadow: 0 0 0 4px #dcebdd;
}

.streak-card strong {
  font-family: 'Fraunces', Georgia, serif;
  display: block;
  font-size: 28px;
  line-height: 1.05;
  margin-top: 10px;
  color: var(--ink);
}

.streak-card strong em {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.streak-line, .progress-track {
  background: #dfe3d8;
  height: 6px;
  border-radius: 20px;
  overflow: hidden;
}

.streak-line {
  margin: 10px 0;
}

.streak-line span, .progress-track span {
  height: 100%;
  background: var(--orange);
  display: block;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.streak-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  margin: 0;
}

.sidebar-foot {
  margin: 18px 2px 0;
  color: #98a198;
  font-size: 8px;
  display: flex;
  justify-content: space-between;
}

/* Topbar Header */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  background: rgba(247, 245, 239, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--ink);
}

.slash {
  color: #c3c8bd;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button, .avatar-button {
  border: 1px solid var(--rule);
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 180ms ease;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.avatar-button {
  background: var(--orange);
  color: var(--ink);
  font-size: 11px;
  border: 0;
  font-weight: 700;
}

/* Content Page Wrapper */
.page-wrap {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 48px 80px;
  flex: 1;
}

.screen-view {
  display: none;
  animation: fadeIn 220ms ease-out;
}

.screen-view.active {
  display: block;
}

#view-scan,
#view-pokedex,
#view-adventures,
#view-profile {
  border-inline: 1px solid var(--rule);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Editorial Page Intro Header */
.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 38px;
}

.page-intro .eyebrow {
  color: var(--orange);
}

.page-intro h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(38px, 4.8vw, 60px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 600;
  margin: 14px 0 12px;
  color: var(--ink);
}

.page-intro h1 i, h2 i {
  color: var(--sage);
  font-style: italic;
}

.page-intro p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 480px;
  margin: 0;
}

/* Buttons */
.button {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  white-space: nowrap;
  font-family: inherit;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 4px 0 #0c1922;
}

.button-primary:hover {
  box-shadow: 0 6px 0 #0c1922;
}

.button-outline {
  color: var(--ink);
  border: 1px solid #cfd5ca;
  background: transparent;
}

.button-outline:hover {
  border-color: var(--ink);
  background: #eeece4;
}

.button.small {
  padding: 8px 13px;
  font-size: 11px;
}

.button.full {
  width: 100%;
  margin-top: 18px;
}

/* Today Overview Layout (Level Progression Panel) */
.today-overview {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 40px;
}

.level-panel {
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 26px 28px 22px;
  position: relative;
  overflow: hidden;
}

.level-panel::after {
  content: '';
  width: 240px;
  height: 240px;
  position: absolute;
  right: -70px;
  top: -100px;
  border: 1px solid rgba(247,245,239,.13);
  border-radius: 50%;
  box-shadow: 0 0 0 27px rgba(247,245,239,.03), 0 0 0 55px rgba(247,245,239,.03);
  pointer-events: none;
}

.panel-topline, .level-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.level-panel .eyebrow {
  color: #aebbb0;
}

.level-number {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--orange);
  font-size: 18px;
}

.level-copy {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 32px 0 18px;
  position: relative;
  z-index: 1;
}

.level-copy strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 32px;
  letter-spacing: -.04em;
  font-weight: 600;
}

.level-copy span {
  display: block;
  margin-top: 4px;
  color: #aebbb0;
  font-size: 12px;
}

.progress-track.large {
  height: 8px;
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.15);
}

.progress-track.large span {
  background: var(--orange);
}

.level-footer {
  color: #aebbb0;
  font-size: 11px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.level-footer span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--orange);
}

.level-footer span:last-child {
  letter-spacing: .13em;
  font-size: 9px;
}

.memory-panel {
  background: #e9eee6;
  border: 1px solid #dce5da;
  border-radius: 14px;
  padding: 26px;
  display: flex;
  gap: 14px;
  position: relative;
}

.memory-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--sage);
  background: #d8e5d5;
  border-radius: 9px;
  font-size: 18px;
}

.memory-panel strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 21px;
  margin: 12px 0 8px;
  letter-spacing: -.03em;
}

.memory-panel p {
  margin: 0;
  color: #66756c;
  font-size: 12px;
  line-height: 1.6;
}

.memory-arrow {
  position: absolute;
  right: 20px;
  top: 24px;
  color: var(--sage);
}

/* Sections & Headings */
.section-block {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.04em;
  font-size: 26px;
  margin: 8px 0 0;
}

.section-meta {
  color: #8b978c;
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

/* Quest Cards */
.quest-list {
  display: grid;
  gap: 10px;
}

.quest-card {
  display: grid;
  grid-template-columns: 32px 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px 18px 16px;
  background: rgba(255,255,255,.45);
  border: 1px solid var(--rule);
  border-radius: 12px;
  transition: border 180ms ease, background 180ms ease, transform 180ms ease;
  cursor: pointer;
}

.quest-card:hover {
  background: #fbfaf6;
  border-color: #c5cec2;
  transform: translateX(3px);
}

.quest-card.is-started {
  border-color: var(--orange);
  background: #fffaf4;
}

.quest-card.is-complete {
  opacity: .72;
  background: #f0f3eb;
}

.quest-index {
  color: #a3aea4;
  font-size: 11px;
  font-weight: 700;
  align-self: start;
  padding-top: 4px;
}

.quest-icon, .result-species-icon, .mini-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.quest-icon {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

/* Category Tone Colors */
.sage { color: var(--sage); background: var(--sage-soft); }
.orange { color: #c96b22; background: var(--orange-soft); }
.lilac { color: var(--lilac); background: var(--lilac-soft); }
.sky { color: var(--sky); background: var(--sky-soft); }
.pink { color: var(--pink); background: var(--pink-soft); }
.stone { color: var(--stone); background: var(--stone-soft); }
.mint { color: #568474; background: #e2f0e9; }

.quest-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quest-label {
  color: #95a098;
  font-size: 9px;
}

.quest-tag {
  color: var(--sage);
  background: var(--sage-soft);
  font-size: 9px;
  border-radius: 20px;
  padding: 3px 8px;
  font-weight: 700;
}

.quest-main h3 {
  margin: 6px 0 4px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -.03em;
}

.quest-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quest-foot {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: #8c978e;
  font-size: 11px;
}

.quest-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.quest-foot .xp-reward {
  color: #c96b22;
  font-weight: 700;
}

.quest-start {
  background: transparent;
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  transition: background 180ms ease, border 180ms ease;
}

.quest-start:hover {
  background: var(--orange-soft);
  border-color: var(--orange);
}

.completed-mark {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--sage);
  font-weight: 700;
  font-size: 12px;
  padding: 8px;
}

.safety-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #87928a;
  margin-top: 16px;
  font-size: 11px;
  line-height: 1.5;
}

.shield-badge {
  margin-left: auto;
  color: var(--sage);
  border: 1px solid #cfddce;
  background: var(--sage-soft);
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .11em;
  white-space: nowrap;
}

/* Small Wins Activity Strip */
.activity-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 24px;
  padding: 20px 22px;
  border: 1px solid #d8dfd4;
  border-radius: 12px;
  background: #edf2ea;
}

.activity-strip strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  letter-spacing: -.03em;
  margin-top: 6px;
}

.activity-strip p {
  color: var(--muted);
  font-size: 11px;
  margin: 4px 0 0;
}

.activity-actions {
  display: flex;
  gap: 10px;
}

.activity-action {
  min-width: 140px;
  border: 1px solid #ccdaca;
  border-radius: 9px;
  background: rgba(255,255,255,.6);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: border 180ms ease, background 180ms ease, transform 180ms ease;
}

.activity-action:hover:not(:disabled) {
  border-color: var(--sage);
  background: #f8fbf6;
  transform: translateY(-2px);
}

.activity-action span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 600;
}

.activity-action strong {
  color: var(--sage);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  margin-top: 6px;
}

.activity-action.is-done {
  opacity: .65;
  background: #e4ece1;
}

.activity-action:disabled {
  cursor: default;
}

/* Scanner Layout */
.demo-chip, .distance-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dce1d6;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 9px;
}

.scanner-layout {
  display: grid;
  grid-template-columns: minmax(350px, .95fr) minmax(340px, 1.05fr);
  gap: 26px;
  align-items: stretch;
}

.scanner-window {
  border: 1px solid #ccd5cb;
  border-radius: 14px;
  background: #e5ece3;
  padding: 16px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.scanner-toolbar {
  display: flex;
  justify-content: space-between;
  color: var(--sage);
  font-size: 9px;
  padding: 2px 2px 12px;
}

.scanner-toolbar span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}

.scan-visual {
  position: relative;
  min-height: 360px;
  border-radius: 10px;
  background: radial-gradient(circle at 51% 42%, #d9e8d2, #b3c6aa 58%, #91aa8d 100%);
  display: grid;
  place-items: center;
  align-content: center;
  overflow: hidden;
}

.scan-visual::before {
  content: '';
  position: absolute;
  inset: 9%;
  background: repeating-linear-gradient(127deg, transparent 0 40px, rgba(255,255,255,.12) 41px 43px, transparent 44px 86px);
  opacity: .7;
}

.scan-visual::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.26);
  box-shadow: 0 0 0 40px rgba(255,255,255,.08), 0 0 0 80px rgba(255,255,255,.05);
}

.scan-corner {
  z-index: 2;
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: rgba(255,255,255,.85);
}

.scan-corner.top-left { left: 22px; top: 22px; border-left: 2px solid; border-top: 2px solid; }
.scan-corner.top-right { right: 22px; top: 22px; border-right: 2px solid; border-top: 2px solid; }
.scan-corner.bottom-left { left: 22px; bottom: 22px; border-left: 2px solid; border-bottom: 2px solid; }
.scan-corner.bottom-right { right: 22px; bottom: 22px; border-right: 2px solid; border-bottom: 2px solid; }

.scan-orbit {
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.9);
  position: relative;
  margin-bottom: 16px;
}

.scan-orbit::before, .scan-orbit::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,.46);
  border-radius: 50%;
}

.scan-orbit::before { width: 72px; height: 72px; }
.scan-orbit::after { width: 112px; height: 112px; border-style: dashed; animation: rotate 16s linear infinite; }

.orbit-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  top: -21px;
  left: 37px;
  background: var(--orange);
}

@keyframes rotate { to { transform: rotate(360deg); } }

.scan-instruction, .scan-subcopy {
  z-index: 1;
  color: white;
  text-shadow: 0 1px 5px rgba(23,42,58,.25);
  text-align: center;
}

.scan-instruction {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 21px;
  letter-spacing: -.03em;
}

.scan-subcopy {
  margin-top: 6px;
  font-size: 11px;
  opacity: .85;
}

#camera-preview-video, #captured-preview-img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
  z-index: 0;
  border-radius: 10px;
}

.scanner-controls {
  padding: 16px 0 0;
  display: grid;
  gap: 10px;
}

.scan-button {
  width: 100%;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  justify-content: center;
}

.text-button:hover {
  color: var(--ink);
}

.scan-result-column {
  min-height: 520px;
  display: flex;
  align-items: center;
}

.scan-empty-state {
  padding: 24px 16px;
}

.empty-stamp {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--orange-soft);
  color: var(--orange);
  border-radius: 50%;
  margin-bottom: 24px;
  font-size: 22px;
}

.scan-empty-state h2 {
  max-width: 400px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.05em;
  margin: 14px 0;
}

.scan-empty-state p {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.confidence-legend {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 10px;
}

.confidence-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.confident { background: var(--sage); }
.legend-dot.possible { background: var(--orange); }

/* Scan Result Cards */
.result-card {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 24px;
  background: rgba(255,255,255,.45);
  box-shadow: var(--shadow);
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-state {
  color: var(--sage);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
}

.confidence-dot {
  width: 7px;
  height: 7px;
  background: var(--sage);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--sage-soft);
}

.possible-state {
  color: #bd762b;
}

.possible-state .confidence-dot {
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.result-confidence {
  color: var(--sage);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  text-align: right;
}

.result-confidence small {
  font-family: 'DM Sans', sans-serif;
  display: block;
  text-align: right;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.result-species {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 26px 0 22px;
}

.result-species-icon {
  width: 58px;
  height: 58px;
  font-size: 28px;
}

.result-species h2, .possible-heading h2 {
  margin: 0 0 4px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -.04em;
}

.result-species p, .possible-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.result-details {
  display: grid;
  grid-template-columns: .7fr 1fr;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.result-details div:last-child {
  grid-column: 1 / -1;
}

.result-details strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

.result-disclaimer {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  margin-top: 16px;
}

.possible-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0;
}

.match-list {
  border-top: 1px solid var(--rule);
}

.match-row {
  display: grid;
  grid-template-columns: 24px 1fr 34px;
  gap: 10px;
  align-items: center;
  padding: 14px 0 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 150ms ease;
}

.match-row:hover {
  background: var(--orange-soft);
  padding-left: 6px;
  padding-right: 6px;
  border-radius: 6px;
}

.match-rank {
  color: #a0aaa1;
  font-size: 10px;
  font-weight: 700;
}

.match-row > span:nth-child(3) {
  color: var(--muted);
  text-align: right;
  font-weight: 700;
}

.match-bar {
  grid-column: 2 / -1;
  height: 5px;
  border-radius: 10px;
  background: #ebece6;
  overflow: hidden;
  margin-top: 4px;
}

.match-bar i {
  display: block;
  height: 100%;
  background: var(--orange);
  border-radius: inherit;
}

/* Pokédex Screen */
.collection-stamp {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 4px;
  align-items: baseline;
  justify-content: end;
  color: var(--ink);
}

.collection-stamp span {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 52px;
  line-height: .8;
  letter-spacing: -.07em;
}

.collection-stamp small {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.collection-stamp small.milestone-earned {
  color: var(--orange);
  font-weight: 700;
  background: var(--orange-soft);
  border-radius: 999px;
  padding: 4px 7px;
}

.collection-stamp label {
  grid-column: 1 / -1;
  color: var(--orange);
  font-size: 8px;
  letter-spacing: .14em;
  font-weight: 700;
  margin-top: 8px;
}

.collection-summary {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 36px;
  padding: 24px 0;
  margin-bottom: 48px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.collection-count strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 38px;
  letter-spacing: -.05em;
  margin: 12px 0 16px;
}

.collection-count strong small {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.collection-line {
  height: 8px;
  background: #e2e5dc;
  border-radius: 10px;
  overflow: hidden;
  max-width: 280px;
}

.collection-line i {
  display: block;
  height: 100%;
  background: var(--sage);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.muted-copy {
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
  display: block;
}

.category-counts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.category-count {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 8px;
  align-items: center;
}

.mini-icon {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.category-count strong {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  line-height: 1;
}

.category-count span {
  color: var(--muted);
  font-size: 9px;
  margin-top: 2px;
}

/* Category Filters & Tabs */
.pokedex-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.category-filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.cat-chip {
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  border: 1px solid var(--rule);
  white-space: nowrap;
  cursor: pointer;
  transition: all 180ms ease;
}

.cat-chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.pokedex-toggle-tabs {
  display: flex;
  background: #e9ece4;
  border-radius: 20px;
  padding: 3px;
  border: 1px solid var(--rule);
}

.dex-tab-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 180ms ease;
}

.dex-tab-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.discovery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.discovery-card, .empty-discovery-card {
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.4);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
  transition: transform 180ms ease, border 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
}

.discovery-card:hover {
  transform: translateY(-3px);
  border-color: #c2ccc0;
  box-shadow: var(--shadow);
}

.discovery-art {
  height: 145px;
  display: grid;
  place-items: center;
  position: relative;
  font-size: 48px;
  overflow: hidden;
}

.discovery-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-art::before {
  content: '';
  position: absolute;
  width: 110px;
  height: 110px;
  border: 1px dashed currentColor;
  border-radius: 50%;
  opacity: .2;
}

.discovery-rarity {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid currentColor;
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 8px;
  opacity: .8;
  font-weight: 700;
}

.discovery-count-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
}

.discovery-content {
  padding: 16px;
}

.discovery-content h3 {
  margin: 6px 0 3px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  letter-spacing: -.03em;
}

.discovery-content p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.discovery-meta {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  margin-top: 16px;
  color: #909b91;
  font-size: 10px;
}

.discovery-card.locked {
  opacity: 0.55;
  border-style: dashed;
}

.empty-discovery-card {
  border: 1px dashed #cbd2c6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 25px;
  text-align: center;
  min-height: 250px;
  background: transparent;
}

.plus-ring {
  width: 46px;
  height: 46px;
  border: 1px dashed #a6b3a4;
  border-radius: 50%;
  color: var(--sage);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  font-size: 20px;
}

.empty-discovery-card strong {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
}

.empty-discovery-card p {
  max-width: 180px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin-top: 4px;
}

/* Adventures & Trail Log */
.adventure-hero {
  margin-bottom: 48px;
}

.trail-visual {
  min-height: 270px;
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #d7ddd2;
  background: #e7eee3;
}

.trail-skyline {
  position: relative;
  min-height: 270px;
  padding: 24px 28px;
  background: radial-gradient(circle at 74% 25%, #f7cf9e 0 2%, transparent 3%), linear-gradient(155deg, #d8e7d2 0%, #b7d0b3 60%, #88a787 100%);
  overflow: hidden;
}

.trail-skyline::after {
  content: '';
  position: absolute;
  width: 520px;
  height: 190px;
  border-radius: 50% 50% 0 0;
  left: -80px;
  bottom: -100px;
  background: #709373;
  transform: rotate(-7deg);
}

.trail-skyline > span {
  position: relative;
  z-index: 2;
  color: rgba(23,42,58,.7);
  font-size: 9px;
  letter-spacing: .15em;
  font-weight: 700;
}

.trail-points {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--orange);
  border: 3px solid rgba(247,245,239,.9);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(23,42,58,.18);
}

.point.one { left: 18%; top: 61%; }
.point.two { left: 37%; top: 38%; }
.point.three { left: 57%; top: 63%; }
.point.four { left: 78%; top: 29%; }

.trail-path {
  position: absolute;
  left: 19%;
  top: 31%;
  width: 62%;
  height: 39%;
  border-top: 1px dashed rgba(23,42,58,.38);
  border-right: 1px dashed rgba(23,42,58,.38);
  border-radius: 0 80% 0 0;
  transform: rotate(7deg);
}

.trail-caption {
  position: absolute;
  bottom: 24px;
  left: 28px;
  z-index: 4;
  display: flex;
  gap: 20px;
  color: rgba(23,42,58,.78);
  font-size: 11px;
}

.adventure-note {
  padding: 32px 28px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.adventure-note .eyebrow {
  color: var(--orange);
}

.adventure-note h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.045em;
  font-size: 26px;
  line-height: 1.1;
  margin: 16px 0 12px;
}

.adventure-note p {
  color: #aebbb0;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

.adventure-note strong {
  color: var(--orange);
}

.exploration-radar-box {
  margin-top: 24px;
  background: #0d1a14;
  border-radius: 12px;
  height: 220px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
}

#exploration-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.outing-list {
  border-top: 1px solid var(--rule);
  margin-top: 16px;
}

.outing-row {
  display: grid;
  grid-template-columns: 110px 40px 1fr 20px;
  align-items: center;
  gap: 20px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--rule);
}

.outing-date strong {
  font-family: 'Fraunces', Georgia, serif;
  display: block;
  font-size: 16px;
  letter-spacing: -.03em;
}

.outing-date span {
  color: var(--muted);
  display: block;
  font-size: 9px;
  letter-spacing: .1em;
  margin-top: 4px;
}

.outing-marker {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 18px;
}

.outing-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.outing-stats strong {
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

/* Profile & Field Kit */
.profile-grid {
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 18px;
  margin-bottom: 40px;
}

.profile-card {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 26px;
  background: rgba(255,255,255,.4);
}

.identity-card {
  background: #eae6dc;
  border-color: #e0dbce;
}

.identity-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--orange);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 24px;
}

.identity-card h2, .memory-card-large h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.04em;
  font-size: 24px;
  margin: 12px 0 4px;
}

.identity-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.identity-card p span {
  color: var(--orange);
  margin: 0 4px;
}

.identity-rule {
  height: 1px;
  background: #d6d2c6;
  margin: 24px 0 18px;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-metrics strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
}

.profile-metrics span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .08em;
  margin-top: 4px;
}

.memory-card-large {
  background: #e8eee7;
  border-color: #dbe4d9;
}

.profile-card-heading {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-card-heading h2 {
  font-size: 21px;
  margin: 6px 0 0;
}

.memory-intro {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 480px;
  margin: 20px 0 16px;
}

.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interest-list > span, .add-interest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--sage);
  background: rgba(255,255,255,.5);
  border: 1px solid #ccdcca;
  border-radius: 6px;
  font-size: 12px;
}

.interest-list button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: inherit;
  font-size: 14px;
}

.add-interest {
  border-style: dashed;
  color: var(--muted);
  cursor: pointer;
}

.memory-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  color: var(--sage);
  font-size: 11px;
}

.settings-strip {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 18px;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.settings-strip h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  letter-spacing: -.03em;
  margin: 8px 0 0;
}

.setting-line {
  padding: 8px 0;
  border-left: 1px solid var(--rule);
  padding-left: 16px;
}

.setting-line > span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.setting-line button {
  border: 0;
  background: transparent;
  color: var(--sage);
  font-size: 10px;
  font-weight: 700;
  margin-top: 8px;
  padding: 0;
  cursor: pointer;
}

.setting-dot {
  width: 6px;
  height: 6px;
  border: 1px solid #a7b1a7;
  border-radius: 50%;
}

.setting-dot.on {
  background: var(--sage);
  border-color: var(--sage);
}

/* Supabase Cloud Settings Block */
.supabase-box {
  margin-top: 28px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 22px;
}

.supabase-input {
  width: 100%;
  padding: 10px 12px;
  background: #fdfdfb;
  border: 1px solid var(--rule);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  margin-top: 4px;
  margin-bottom: 12px;
}

.supabase-input:focus {
  border-color: var(--orange);
}

/* Mobile Bottom Navigation Dock */
.mobile-nav {
  display: none;
}

/* Toast Feedback Notification */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 9px;
  box-shadow: 0 15px 35px rgba(23,42,58,.25);
  font-size: 12px;
  font-weight: 600;
  animation: toast-in 240ms ease-out;
}

.toast span {
  color: var(--paper);
}

.toast button {
  color: #9eaaa1;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  margin-left: 6px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23,42,58,.36);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 200ms ease;
}

.install-modal {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: 14px;
  padding: 30px;
  position: relative;
  box-shadow: 0 24px 60px rgba(23,42,58,.25);
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
}

.modal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 14px;
  margin-bottom: 24px;
  font-size: 24px;
}

.install-modal h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  letter-spacing: -.05em;
  margin: 12px 0 8px;
}

.install-modal p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 22px;
}

/* Details Sheet Modal */
.sheet-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border-top: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  z-index: 110;
  pointer-events: none;
  visibility: hidden;
  max-width: 600px;
  margin: 0 auto;
}

.sheet-modal.open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* Responsive Media Queries */
@media (max-width: 1050px) {
  .sidebar { width: 220px; }
  .topbar { padding: 0 32px; }
  .page-wrap { padding-left: 32px; padding-right: 32px; }
  .category-counts { gap: 10px; }
  .category-count span { font-size: 8px; }
  .scanner-layout { grid-template-columns: 1fr 1fr; }
  .settings-strip { grid-template-columns: 1.2fr repeat(3, 1fr); gap: 10px; }
}

@media (max-width: 820px) {
  .sidebar { display: none; }
  .topbar { height: 62px; padding: 0 20px; }
  .page-wrap {
    padding: 34px 18px 128px;
    scroll-padding-bottom: 128px;
  }
  
  .mobile-nav {
    position: fixed;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 64px;
    background: rgba(23,42,58,.97);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(23,42,58,.25);
    padding: 6px;
  }

  #view-scan {
    padding-bottom: 190px;
    border-inline: 1px solid var(--rule);
    padding-inline: 12px;
  }

  #view-pokedex,
  #view-adventures,
  #view-profile {
    border-inline: 1px solid var(--rule);
    padding-inline: 12px;
  }

  #view-scan .scan-result-column,
  #view-scan #scan-active-result-box {
    padding-bottom: 90px;
  }
  
  .mobile-nav button {
    border: 0;
    background: transparent;
    color: #91a39a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms ease;
  }
  
  .mobile-nav button.is-active {
    color: var(--orange);
    background: rgba(247,245,239,.08);
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 30px;
    gap: 20px;
  }
  
  .page-intro h1 { font-size: 46px; }
  .today-overview, .scanner-layout, .profile-grid { grid-template-columns: 1fr; }
  .today-overview { margin-bottom: 40px; }
  .scan-result-column { min-height: auto; }
  .scan-empty-state { padding: 24px 0; }
  .trail-visual { grid-template-columns: 1fr; }
  .adventure-note { min-height: 180px; }
  .collection-summary { grid-template-columns: 1fr; gap: 24px; margin-bottom: 36px; }
  .category-counts { justify-content: flex-start; gap: 24px; }
  .discovery-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-strip { grid-template-columns: 1fr 1fr; }
  .settings-strip > div:first-child { grid-column: 1 / -1; }
  .outing-stats { grid-template-columns: repeat(2, 1fr); row-gap: 10px; }
  .outing-row { grid-template-columns: 90px 36px 1fr 17px; gap: 12px; }
}

@media (max-width: 520px) {
  .page-wrap { padding-left: 14px; padding-right: 14px; }
  .page-intro h1 { font-size: 40px; }
  .level-panel, .memory-panel, .profile-card { padding: 20px; }
  .quest-card {
    grid-template-columns: 24px 40px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 14px 12px;
  }
  .quest-icon { width: 40px; height: 40px; font-size: 20px; }
  .quest-main h3 { font-size: 16px; }
  .quest-main p { font-size: 11px; }
  .quest-action { grid-column: 3; margin-top: 6px; }
  .scanner-window { min-height: 460px; padding: 12px; }
  .scan-visual { min-height: 310px; }
  .category-counts { gap: 12px; justify-content: space-between; }
  .discovery-grid { gap: 10px; }
  .discovery-art { height: 115px; font-size: 38px; }
  .discovery-content { padding: 12px; }
  .discovery-content h3 { font-size: 15px; }
  .outing-row { grid-template-columns: 75px 34px 1fr; }
  .toast {
    left: 14px;
    right: 14px;
    transform: none;
    bottom: 84px;
    justify-content: center;
  }
  .activity-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  .activity-actions { width: 100%; }
  .activity-action { flex: 1; min-width: 0; }
}
