/* =========================================================================
   自然探秘 PicRec — Living Field Journal
   活页图鉴 · 温暖的自然探索设计系统
   ========================================================================= */

/* -------------------------------------------------------------------------
   Design Tokens
   ------------------------------------------------------------------------- */
:root {
  /* ── Page & Surfaces ── */
  --page:          #fdfaf3;      /* Warm parchment background */
  --page-alt:      #f5efe2;      /* Slightly darker parchment */
  --surface:       #fffef9;      /* Card surface — cool off-white contrast */
  --surface-hover: #f8f4eb;      /* Card hover warmth */

  /* ── Botanical Greens ── */
  --green-deep:    #2d5a3f;      /* Deep forest — primary brand */
  --green-mid:     #3d7353;      /* Mid green — interactive states */
  --green-leaf:    #5c9b6a;      /* Leaf green — accents */
  --green-pale:    #c4ddc8;      /* Pale botanical — backgrounds */
  --green-wash:    #edf5ec;      /* Very light wash — subtle sections */

  /* ── Earth & Warmth ── */
  --earth:         #7b6344;      /* Warm brown — secondary accents */
  --earth-light:   #bfa680;      /* Light earth — borders */
  --amber:         #c4873a;      /* Warm amber — highlights */
  --amber-light:   #f5e6d0;      /* Amber wash — tips */
  --rose:          #c97b6d;      /* Muted rose — contrast accent */

  /* ── Ink (Text) ── */
  --ink:           #2c2416;      /* Rich brown-black — primary text */
  --ink-secondary: #6b5e4a;      /* Secondary text */
  --ink-light:     #9c8f7a;      /* Light text / captions */

  /* ── Semantic ── */
  --success:       #4a7c59;
  --warning:       #c4873a;
  --error:         #b5453c;

  /* ── Typography ── */
  --font-display:  "Noto Serif SC", "Songti SC", "STSong", "Georgia", "Times New Roman", serif;
  --font-body:     -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-latin:    "Crimson Text", "Georgia", "Times New Roman", serif;

  /* ── Spacing Scale (4px base) ── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ── Radii ── */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* ── Shadows (warm-tinted, no pure black) ── */
  --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.06);
  --shadow-md: 0 4px 16px rgba(44, 36, 22, 0.08);
  --shadow-lg: 0 8px 32px rgba(44, 36, 22, 0.10);
  --shadow-xl: 0 12px 48px rgba(44, 36, 22, 0.14);

  /* ── Transitions ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-normal: 300ms;
  --dur-slow: 500ms;

  /* ── Safe Areas ── */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* -------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--page);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--page);
  box-shadow: -1px 0 0 var(--earth-light), 1px 0 0 var(--earth-light);
}

/* -------------------------------------------------------------------------
   Screen Manager
   ------------------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: calc(68px + var(--safe-bottom));
  scroll-behavior: smooth;
}

.screen.active {
  display: flex;
  animation: screenIn 0.4s var(--ease-out);
}

/* Hide scrollbars everywhere — scrolling & swipe still work (touch / wheel / drag) */
.screen,
.result-scroll,
.collection-scroll {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* legacy Edge / IE */
}
.screen::-webkit-scrollbar,
.result-scroll::-webkit-scrollbar,
.collection-scroll::-webkit-scrollbar {
  display: none;               /* Chrome / Safari / WebKit */
  width: 0;
  height: 0;
}

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

/* ── Screen Header (shared) ── */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) var(--space-4) var(--space-3);
  background: var(--page);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--earth-light);
}

.screen-header::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to bottom, rgba(44,36,22,0.03), transparent);
  pointer-events: none;
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.03em;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--earth-light);
  background: var(--surface);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  transition: all var(--dur-fast) var(--ease-out);
}

.header-btn:active {
  background: var(--green-wash);
  border-color: var(--green-mid);
  transform: scale(0.93);
}

/* -------------------------------------------------------------------------
   HOME SCREEN
   ------------------------------------------------------------------------- */

/* ── Hero ── */
.home-hero {
  position: relative;
  flex-shrink: 0;
  padding: calc(40px + var(--safe-top)) var(--space-6) var(--space-6);
  text-align: center;
  overflow: hidden;
}

/* Decorative background blobs — soft and subtle */
.home-hero::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 240px;
  height: 240px;
  background:
    radial-gradient(ellipse at 30% 70%, var(--green-pale) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, var(--amber-light) 0%, transparent 50%);
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
}

.home-hero::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 160px;
  height: 160px;
  background: radial-gradient(ellipse at center, var(--green-wash) 0%, transparent 70%);
  border-radius: 50%;
  opacity: 0.4;
  pointer-events: none;
}

.hero-mark {
  position: relative;
  display: inline-block;
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--earth-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.hero-mark::before,
.hero-mark::after {
  content: "·";
  margin: 0 var(--space-3);
  color: var(--green-pale);
}

.hero-logo {
  position: relative;
  font-size: 72px;
  margin-bottom: var(--space-2);
  filter: drop-shadow(0 4px 12px rgba(45,90,63,0.15));
  animation: logoDrift 4s ease-in-out infinite;
}

@keyframes logoDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30% { transform: translateY(-6px) rotate(1deg); }
  60% { transform: translateY(-3px) rotate(-0.5deg); }
}

.hero-title {
  position: relative;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--green-deep);
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.hero-subtitle {
  position: relative;
  font-size: 0.9375rem;
  color: var(--ink-secondary);
  font-weight: 400;
  line-height: 1.6;
}

/* ── Action Buttons ── */
.home-actions {
  padding: 0 var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn-capture {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--green-deep);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.0625rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  box-shadow:
    0 4px 0 color-mix(in srgb, var(--green-deep) 80%, #000),
    0 6px 20px rgba(45,90,63,0.2);
}

.btn-capture::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255,255,255,0.08) 40%,
    transparent 60%
  );
  pointer-events: none;
}

.btn-capture:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--green-deep) 80%, #000),
    0 3px 12px rgba(45,90,63,0.15);
}

.btn-capture .capture-icon {
  font-size: 1.5rem;
  transition: transform var(--dur-fast) var(--ease-out);
}

.btn-capture:active .capture-icon {
  transform: scale(0.9);
}

.btn-album {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: transparent;
  color: var(--ink-secondary);
  border: 1.5px dashed var(--earth-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-album:active {
  border-color: var(--green-mid);
  color: var(--green-mid);
  background: var(--green-wash);
  transform: scale(0.97);
}

/* ── My Discoveries (Statistics) ── */
.home-discoveries {
  padding: 0 var(--space-5);
  margin-bottom: var(--space-5);
}

.discoveries-label {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
  padding-left: 2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.discoveries-total {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-light);
}

.discoveries-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.discovery-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 10px 6px;
  background: transparent;
  border: 1px solid var(--earth-light);
  border-radius: 100px;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.discovery-pill:active {
  border-color: var(--green-leaf);
  background: var(--green-wash);
}

.discovery-pill-line {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.discovery-pill-count {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--green-deep);
}

.discovery-pill-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.discoveries-empty {
  font-size: 0.8125rem;
  color: var(--ink-light);
  padding: var(--space-2) 2px;
  line-height: 1.6;
}

/* ── Home 图鉴 Preview ── */
.home-collection {
  padding: 0 var(--space-5) var(--space-5);
}

.collection-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--earth-light);
}

.collection-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.03em;
}

.collection-link {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  color: var(--earth);
  cursor: pointer;
  transition: color var(--dur-fast);
}

.collection-link:active { color: var(--green-mid); }

.collection-scroll {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
  scroll-snap-type: x mandatory;
}

.collection-thumb {
  flex-shrink: 0;
  width: 130px;
  background: var(--surface);
  border-radius: 4px 16px 4px 16px;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform var(--dur-fast) var(--ease-out);
  border: 1px solid var(--earth-light);
}

.collection-thumb:active { transform: scale(0.95); }

.collection-thumb img {
  width: 100%;
  height: 95px;
  object-fit: cover;
  border-bottom: 2px solid var(--green-pale);
}

.collection-thumb-meta {
  padding: var(--space-2) var(--space-3);
}

.collection-thumb-emoji {
  font-size: 0.875rem;
}

.collection-thumb-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-family: var(--font-display);
}

.collection-thumb-tag {
  font-size: 0.6875rem;
  color: var(--ink-light);
  margin-top: 2px;
}

/* ── Footer Motif ── */
.home-footer-motif {
  text-align: center;
  padding: var(--space-6) var(--space-5);
  color: var(--ink-light);
  font-size: 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  opacity: 0.5;
}

/* ── Demo Section ── */
.demo-section {
  margin: 0 var(--space-5);
  padding: var(--space-5);
  background: var(--green-wash);
  border-radius: 16px 4px 16px 4px;
  border: 1px dashed var(--green-pale);
}

.demo-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-deep);
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--green-leaf);
  background: var(--surface);
  color: var(--green-deep);
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.demo-btn:active {
  background: var(--green-leaf);
  color: white;
  transform: scale(0.96);
}

.demo-btn-danger {
  border-color: var(--earth-light);
  color: var(--earth);
}

.demo-btn-danger:active {
  background: var(--rose);
  color: white;
  border-color: var(--rose);
}

/* -------------------------------------------------------------------------
   CAMERA SCREEN
   ------------------------------------------------------------------------- */
#screen-camera {
  padding-bottom: 0;
  background: #000;
}

.camera-container {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #1a1a14;
  overflow: hidden;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

/* Viewfinder */
.camera-viewfinder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.viewfinder-frame {
  width: 250px;
  height: 250px;
  position: relative;
}

.viewfinder-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 32px;
  box-shadow:
    0 0 0 9999px rgba(20,18,14,0.45),
    inset 0 0 60px rgba(255,255,255,0.03);
}

/* Corner accents */
.viewfinder-frame .vf-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--green-leaf);
  border-style: solid;
  z-index: 1;
}

.vf-corner-tl { top: -1px; left: -1px; border-width: 3px 0 0 3px; border-radius: 10px 0 0 0; }
.vf-corner-tr { top: -1px; right: -1px; border-width: 3px 3px 0 0; border-radius: 0 10px 0 0; }
.vf-corner-bl { bottom: -1px; left: -1px; border-width: 0 0 3px 3px; border-radius: 0 0 0 10px; }
.vf-corner-br { bottom: -1px; right: -1px; border-width: 0 3px 3px 0; border-radius: 0 0 10px 0; }

.camera-hint {
  position: absolute;
  top: calc(50% + 145px);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.8125rem;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  background: rgba(0,0,0,0.35);
  padding: 6px 16px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

/* Top bar */
.camera-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(12px + var(--safe-top)) var(--space-4);
  display: flex;
  justify-content: space-between;
  z-index: 10;
}

.cam-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.85);
  font-size: 17px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.cam-btn:active {
  background: rgba(0,0,0,0.7);
  transform: scale(0.9);
}

/* Shutter */
.camera-controls {
  position: absolute;
  bottom: calc(40px + var(--safe-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.shutter {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.9);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.shutter:active {
  transform: scale(0.88);
  border-color: var(--green-leaf);
}

.shutter-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  transition: all var(--dur-fast) var(--ease-out);
}

.shutter:active .shutter-inner {
  background: var(--green-leaf);
  transform: scale(0.85);
}

/* -------------------------------------------------------------------------
   LOADING SCREEN
   ------------------------------------------------------------------------- */
#screen-loading {
  background: var(--page);
  padding-bottom: 0;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse at 20% 80%, var(--green-wash) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, var(--amber-light) 0%, transparent 40%);
}

.loading-container {
  text-align: center;
  padding: var(--space-8);
}

.loading-illustration {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto var(--space-8);
}

.loading-illustration .botanical {
  position: absolute;
  font-size: 36px;
  animation: botanicalUnfurl 2.4s ease-in-out infinite;
}

.botanical-1 { top: 10px; left: 30px; animation-delay: 0s; }
.botanical-2 { top: 50px; right: 25px; animation-delay: 0.5s; }
.botanical-3 { bottom: 15px; left: 50%; animation-delay: 1s; }
.botanical-4 { top: 40%; left: 20px; animation-delay: 1.5s; }

@keyframes botanicalUnfurl {
  0%, 100% { transform: scale(0.6) rotate(-10deg); opacity: 0.4; }
  50% { transform: scale(1) rotate(5deg); opacity: 1; }
}

.loading-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.loading-desc {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  margin-bottom: var(--space-8);
}

/* Progress indicator — organic style */
.loading-progress {
  width: 180px;
  height: 3px;
  background: var(--earth-light);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
  opacity: 0.6;
}

.loading-progress-fill {
  height: 100%;
  background: var(--green-leaf);
  border-radius: 2px;
  animation: progressWander 2s ease-in-out infinite;
}

@keyframes progressWander {
  0% { width: 0%; margin-left: 0%; }
  40% { width: 45%; margin-left: 0%; }
  60% { width: 45%; margin-left: 55%; }
  100% { width: 0%; margin-left: 100%; }
}

/* -------------------------------------------------------------------------
   RESULT SCREEN
   ------------------------------------------------------------------------- */
#screen-result {
  padding-bottom: calc(68px + var(--safe-bottom));
}

.result-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Photo area with decorative border */
.result-photo-frame {
  position: relative;
  margin: var(--space-2) var(--space-4);
  border-radius: 6px 24px 6px 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.result-photo-frame img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.result-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(44,36,22,0.08);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

/* ▸ Rarity Star Badge — overlaid bottom-right on the photo */
.result-star-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: none;
  gap: 1px;
  padding: 4px 9px;
  background: rgba(20, 16, 10, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 100px;
  font-size: 0.8rem;
  line-height: 1;
  z-index: 5;
}

.result-star-badge .star-on { color: #ffd24a; }
.result-star-badge .star-off { color: rgba(255, 255, 255, 0.4); }

/* ▸ Photo Album (carousel) — top of the identification report */
.result-album {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--space-2) var(--space-4);
}

.result-album .result-photo-frame {
  flex: 1;
  margin: 0;
  cursor: zoom-in;
}

.album-nav {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(44, 36, 22, 0.55);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.album-nav:active { transform: scale(0.92); }
.album-nav:hover { background: rgba(44, 36, 22, 0.75); }

.album-counter {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 2px 9px;
  background: rgba(20, 16, 10, 0.55);
  border-radius: 100px;
  color: #fff;
  font-size: 0.72rem;
  z-index: 5;
  pointer-events: none;
}

.album-empty-tip {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--earth);
  font-size: 0.9rem;
  background: var(--page);
  z-index: 2;
}

/* ▸ Lightbox overlay (zoom / browse / delete a single photo) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.lb-img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
.lb-delete {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 100px;
  border: none;
  background: rgba(220, 70, 60, 0.92);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
.lb-counter {
  position: absolute;
  bottom: 24px;
  right: 20px;
  color: #fff;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 100px;
}

/* ▸ Share long-image (长图) — button + preview overlay */
.btn-share-card {
  display: block;
  width: calc(100% - var(--space-4) * 2);
  margin: 0 var(--space-4) var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: #e8f1fa;
  color: #2563a8;
  border: 1px dashed #7eb0dd;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.btn-share-card:active {
  background: #cfe3f5;
  transform: scale(0.98);
}

.share-card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  z-index: 1100;
  padding: 16px;
}
.share-card-overlay.active { display: flex; }
.share-card-img {
  max-width: 100%;
  margin-top: 8px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.share-card-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 1101;
}
.share-card-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 750px;
  margin-top: 16px;
  padding: 14px 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.95) 55%);
  justify-content: center;
}
.btn-share-card-action {
  flex: 1;
  max-width: 200px;
  padding: 12px;
  border-radius: 100px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-share-card-action.primary { background: var(--green-deep); color: #fff; }
.btn-share-card-action.secondary { background: rgba(255, 255, 255, 0.92); color: #2c2416; }
.btn-share-card-action:active { transform: translateY(2px); }

/* ▸ Optional tag row inside specimen card (right-aligned) */
.specimen-tagrow {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-3);
}

.result-optional-tag {
  display: inline-block;
  padding: 4px 14px;
  background: var(--surface);
  border: 1px solid var(--earth-light);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-secondary);
  box-shadow: var(--shadow-sm);
}

/* ▸ Specimen Card — main identity card */
.specimen-card {
  margin: calc(-1 * var(--space-6)) var(--space-4) var(--space-3);
  padding: var(--space-5) var(--space-5);
  background: var(--surface);
  border-radius: 4px 20px 4px 20px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--earth-light);
}

.specimen-header {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.specimen-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 2px solid var(--green-pale);
}

.specimen-meta {
  flex: 1;
  min-width: 0;
}

.specimen-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--green-deep);
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.specimen-latin {
  font-family: var(--font-latin);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--ink-light);
  margin-top: 2px;
}

.specimen-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tag-category {
  background: var(--green-wash);
  color: var(--green-deep);
}

.tag-confidence-high {
  background: #e6f0e4;
  color: #3d6b4a;
}

.tag-confidence-medium {
  background: var(--amber-light);
  color: var(--amber);
}

.tag-confidence-low {
  background: #f7e8e6;
  color: var(--error);
}

.tag-protection {
  background: #fdf0e0;
  color: var(--amber);
}

/* ▸ Info Block — journal entry style */
.info-block {
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--earth-light);
  box-shadow: var(--shadow-sm);
}

.info-block-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--earth-light);
}

.info-block-title .ib-icon {
  font-size: 1.125rem;
}

.info-block-text {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--ink-secondary);
  white-space: pre-line;
}

/* Key-value rows */
.info-kv {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(191,166,128,0.2);
}

.info-kv:last-child { border-bottom: none; }

.info-kv .kv-label {
  flex-shrink: 0;
  width: 64px;
  color: var(--ink-light);
  font-weight: 600;
  font-size: 0.8125rem;
}

.info-kv .kv-value {
  color: var(--ink);
  flex: 1;
  font-weight: 500;
  white-space: pre-line;
}

/* ▸ Fun Facts */
.fun-fact {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--green-wash);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink);
  border-left: 3px solid var(--green-leaf);
}

.fun-fact:last-child { margin-bottom: 0; }

.fun-fact-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-mid);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* ▸ Tip Banner */
.tip-banner {
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--amber-light), #faf3e6);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink);
  border: 1px solid rgba(196,135,58,0.2);
}

.tip-banner .tip-icon { font-size: 1.25rem; flex-shrink: 0; }

.info-banner-protect {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--green-wash);
  border: 1px solid var(--green-leaf);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--green-deep);
}

/* ▸ Result Actions */
.result-actions {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-6);
}

.btn-result-secondary {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  color: var(--ink-secondary);
  border: 1px solid var(--earth-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-result-secondary:active {
  border-color: var(--green-leaf);
  color: var(--green-deep);
  background: var(--green-wash);
  transform: scale(0.97);
}

.btn-result-primary {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--green-deep);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--green-deep) 80%, #000);
}

.btn-result-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--green-deep) 80%, #000);
}

/* ▸ Error — playful line shown when recognition fails */
.err-fun {
  margin-top: var(--space-4);
  text-align: center;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink-light);
}

/* ▸ Release (放生) — gentle, full-width action at the bottom of the report */
.btn-release {
  display: block;
  width: calc(100% - var(--space-4) * 2);
  margin: 0 var(--space-4) var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--green-wash);
  color: var(--green-deep);
  border: 1px dashed var(--green-leaf);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-release:active {
  background: var(--green-pale);
  transform: scale(0.98);
}

/* ▸ Error State */
.result-error-card {
  margin: var(--space-4);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--earth-light);
}

.result-error-card .err-emoji {
  font-size: 48px;
  margin-bottom: var(--space-3);
  opacity: 0.6;
}

.result-error-card .err-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.result-error-card .err-desc {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* -------------------------------------------------------------------------
   图鉴 (COLLECTION) SCREEN
   ------------------------------------------------------------------------- */
.collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) var(--space-4) var(--space-3);
  background: var(--page);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--earth-light);
}

/* Center the title when only a back button + title remain (no right action) */
.collection-header .header-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.collection-header::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to bottom, rgba(44,36,22,0.03), transparent);
  pointer-events: none;
}

.collection-grid {
  padding: var(--space-4);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.collection-card {
  background: var(--surface);
  border-radius: 4px 16px 4px 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--earth-light);
}

.collection-card:active { transform: scale(0.95); }

.collection-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 2px solid var(--green-pale);
}

.collection-card-body {
  padding: var(--space-3);
}

.collection-card-emoji {
  font-size: 1.125rem;
}

.collection-card-name {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card-cat {
  font-size: 0.75rem;
  color: var(--ink-light);
  margin-top: 2px;
}

/* Empty state */
.empty-collection {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-16) var(--space-5);
}

.empty-collection .empty-visual {
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-6);
  border-radius: 50%;
  background: var(--green-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  border: 2px dashed var(--earth-light);
}

.empty-collection h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: var(--space-2);
}

.empty-collection p {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* Collection counter */
.collection-count {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  color: var(--ink-light);
  letter-spacing: 0.03em;
}

/* -------------------------------------------------------------------------
   SETTINGS SCREEN
   ------------------------------------------------------------------------- */
.settings-body {
  padding: var(--space-4);
}

.settings-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
  border: 1px solid var(--earth-light);
  box-shadow: var(--shadow-sm);
}

.settings-card h3 {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--earth-light);
}

.about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(191,166,128,0.2);
}

.about-row:last-child { border-bottom: none; }

.about-label { color: var(--ink-light); }

.about-value {
  color: var(--ink);
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.8125rem;
}

/* 重复拍摄合并 — 可拖动时间滑块 */
.setting-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-secondary);
  margin: 0 0 var(--space-3);
}
.cache-window-control {
  padding: var(--space-2) 2px 0;
}
.cache-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 100px;
  background: var(--earth-light);
  outline: none;
  margin: 0;
}
.cache-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-deep);
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.cache-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-deep);
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.cache-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--ink-light);
  font-family: var(--font-display);
}
.cache-window-value {
  margin-top: var(--space-3);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--green-deep);
}

/* EXP / Level card (redesigned: soft gradient, no heavy border) */
.level-card {
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(45,90,63,0.06), rgba(120,160,110,0.09));
  border: 1px solid rgba(45, 90, 63, 0.16);
}
.level-card-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.level-badge {
  flex: 0 0 auto;
  min-width: 54px;
  height: 54px;
  padding: 0 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--green-leaf, #7fae6b), var(--green-deep));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.level-card-meta { min-width: 0; }
.level-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--green-deep);
  line-height: 1.3;
}
.level-persona {
  margin-top: 3px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-secondary);
}
.level-progress {
  margin-top: var(--space-4);
}
.level-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 100px;
  background: var(--earth-light);
  overflow: hidden;
}
.level-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--green-leaf), var(--green-deep));
  transition: width 0.5s var(--ease-out, ease);
}
.level-exp-text {
  margin-top: 6px;
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--ink-light);
  font-family: var(--font-display);
}

.settings-footer-note {
  text-align: center;
  padding: var(--space-4);
  font-size: 0.75rem;
  color: var(--ink-light);
  opacity: 0.5;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

/* -------------------------------------------------------------------------
   BOTTOM NAVIGATION
   ------------------------------------------------------------------------- */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--earth-light);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: all var(--dur-fast) var(--ease-out);
  opacity: 0.4;
}

.nav-item.active { opacity: 1; }

.nav-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--green-deep);
}

.nav-icon { font-size: 1.25rem; }

.nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

/* Hide on fullscreen + auth screens */
#screen-camera.active ~ #bottom-nav,
#screen-loading.active ~ #bottom-nav,
#screen-auth.active ~ #bottom-nav {
  display: none;
}

/* -------------------------------------------------------------------------
   TOAST
   ------------------------------------------------------------------------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(44,36,22,0.88);
  color: #fff;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  animation: toastIn 0.35s var(--ease-spring);
  max-width: 280px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* =========================================================================
   AUTH SCREEN (Login / Register)
   ========================================================================= */
#screen-auth {
  background: var(--page);
  padding-bottom: calc(24px + var(--safe-bottom));
  background-image:
    radial-gradient(ellipse at 30% 70%, var(--green-wash) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 30%, var(--amber-light) 0%, transparent 40%);
  /* Center vertically without breaking overflow scroll */
  justify-content: flex-start;
  min-height: -webkit-fill-available;
  overscroll-behavior: contain;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  /* Auto margin centers when content is shorter than viewport,
     and degrades gracefully to scroll when content overflows */
  margin: auto;
  padding: var(--space-6);
}

.auth-hero {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo {
  font-size: 64px;
  filter: drop-shadow(0 4px 12px rgba(45,90,63,0.15));
  animation: logoDrift 4s ease-in-out infinite;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--green-deep);
  letter-spacing: 0.06em;
  margin-top: var(--space-2);
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  margin-top: var(--space-2);
  line-height: 1.5;
}

.auth-form {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--earth-light);
  box-shadow: var(--shadow-md);
}

.auth-input-group {
  margin-bottom: var(--space-4);
}

.auth-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-secondary);
  letter-spacing: 0.03em;
  margin-bottom: var(--space-2);
  display: block;
}

.auth-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--earth-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--page);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: var(--font-body);
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: var(--green-leaf);
  box-shadow: 0 0 0 3px var(--green-wash);
}

.auth-input::placeholder {
  color: var(--ink-light);
}

.btn-auth-primary {
  width: 100%;
  padding: var(--space-4);
  background: var(--green-deep);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--green-deep) 80%, #000);
  margin-top: var(--space-2);
}

.btn-auth-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--green-deep) 80%, #000);
}

.btn-auth-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-switch {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

.auth-switch a {
  color: var(--green-mid);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.auth-switch a:hover {
  color: var(--green-deep);
}

.btn-auth-skip {
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  color: var(--ink-light);
  border: 1px dashed var(--earth-light);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  cursor: pointer;
  margin-top: var(--space-4);
  transition: all var(--dur-fast);
}

.btn-auth-skip:active {
  border-color: var(--green-leaf);
  color: var(--ink-secondary);
  background: var(--green-wash);
}

/* ── Auth Indicator (floating login status) ── */
.auth-indicator {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  border: 1.5px solid var(--earth-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.auth-indicator:hover {
  border-color: var(--green-leaf);
  background: var(--green-wash);
}

.auth-indicator.authed {
  border-color: var(--green-leaf);
  background: var(--green-wash);
}

.auth-indicator-icon {
  font-size: 1rem;
}

.auth-indicator-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* When logged in, hide the emoji icon and show avatar */
.auth-indicator.authed .auth-indicator-icon {
  display: none;
}
.auth-indicator.authed .auth-indicator-avatar {
  display: block;
}

/* ── Settings User Profile ── */
/* ── My Account card (redesigned: clean & minimal) ── */
.account-card { padding: var(--space-5); }

.account-top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.account-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--green-wash, #eef3ea);
  border: 1px solid var(--earth-light);
}
.account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.account-avatar-edit {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-deep);
  color: #fff;
  font-size: 0.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.account-info {
  flex: 1;
  min-width: 0;
}
.account-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.account-name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-email {
  margin-top: 3px;
  font-size: 0.8125rem;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-joined {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--ink-light);
}

/* Small pencil button to edit the nickname */
.btn-edit-nickname {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--green-deep);
  background: rgba(45, 90, 63, 0.10);
  border: 1px solid rgba(45, 90, 63, 0.25);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn-edit-nickname:hover { background: rgba(45, 90, 63, 0.18); }
.btn-edit-nickname:active { transform: scale(0.9); }
.btn-edit-nickname:disabled { opacity: 0.5; cursor: default; }

/* Inline nickname editing input */
.nickname-edit-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-deep);
  padding: 4px 8px;
  border: 1.5px solid var(--green-deep);
  border-radius: 8px;
  background: #fff;
  outline: none;
}

.btn-auth-logout {
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(181,69,60,0.3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: var(--space-3);
  transition: all var(--dur-fast);
}

.btn-auth-logout:active {
  background: rgba(181,69,60,0.08);
  border-color: var(--error);
}

/* ── Login Prompt ── */
.login-prompt-content {
  text-align: center;
  padding: var(--space-4) 0;
}

.login-prompt-icon {
  font-size: 40px;
  margin-bottom: var(--space-3);
  opacity: 0.6;
}

.login-prompt-text {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   MAP / 自然足迹 (AMap)
   ------------------------------------------------------------------------- */
/* Floating globe button (bottom-right of the collection screen).
   Placed as a direct child of #app (NOT inside a .screen) and positioned
   absolute relative to #app, so it is never affected by a screen's scroll
   container or the screenIn transform animation, and always stays within the
   app column (centered 480px on desktop, full width on mobile). */
.map-fab {
  position: absolute;
  right: 16px;
  bottom: calc(76px + var(--safe-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--green-leaf, #7fae6b), var(--green-deep));
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  display: none; /* hidden by default; shown via .visible on the collection screen */
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(45, 90, 63, 0.35);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.map-fab.visible { display: flex; }
.map-fab:hover { box-shadow: 0 8px 22px rgba(45, 90, 63, 0.45); }
.map-fab:active { transform: scale(0.9); }

/* Map overlay sheet */
.map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.5);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.map-sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-lg, 18px) var(--radius-lg, 18px) 0 0;
  padding: var(--space-4);
  padding-bottom: calc(var(--space-5) + var(--safe-bottom));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.map-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.map-sheet-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--green-deep);
}
.map-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(45, 90, 63, 0.1);
  color: var(--green-deep);
  font-size: 1rem;
  cursor: pointer;
}
.map-close:active { transform: scale(0.9); }
.map-container {
  position: relative;
  width: 100%;
  height: 60vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #eef1ec;
}
.map-msg {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-secondary);
}
.map-empty {
  flex: 1;
  min-height: 200px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.map-empty .empty-visual { font-size: 48px; opacity: 0.6; margin-bottom: var(--space-3); }
.map-empty p { font-size: 0.875rem; color: var(--ink-secondary); line-height: 1.6; }

/* Map footprint: photo-thumbnail markers (replaces plain dots) */
.map-thumb-marker {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  background: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.map-thumb-marker:hover { transform: scale(1.08); }
.map-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-thumb-marker--fallback {
  font-size: 1.4rem;
  line-height: 1;
}
/* Own footprints: green ring. Other users: inline-colored ring (set in JS). */
.map-thumb-marker--me {
  border-color: var(--green-deep, #2d5a3f);
  border-width: 3px;
}
.map-thumb-marker--other {
  border-width: 3px;
}

/* Green "you are here" dot at the user's live location */
.map-me-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2dc75f;
  border: 2px solid #fff;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.45);
}
.map-me-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(45, 199, 95, 0.3);
  transform: translate(-50%, -50%);
  z-index: -1;
  animation: me-pulse 2s ease-out infinite;
}
@keyframes me-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.8); opacity: 0; }
}

/* Legend: color → username for the other explorers currently in view */
.map-legend {
  position: absolute;
  left: 12px;
  top: 12px;
  max-width: 168px;
  max-height: 42%;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  font-size: 12px;
  color: #333;
  z-index: 6;
  display: none;
}
.map-legend-title {
  font-weight: 700;
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.7;
  white-space: nowrap;
}
.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.map-legend-more {
  margin-top: 2px;
  padding-top: 3px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  font-size: 11px;
  color: #8a8a8a;
  line-height: 1.6;
}

/* InfoWindow popup shown when a thumbnail marker is tapped */
.map-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}
.map-info-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #eee;
}
.map-info-thumb--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(45, 90, 63, 0.1);
}
.map-info-body { display: flex; flex-direction: column; gap: 2px; }
.map-info-name { font-weight: 700; font-size: 0.875rem; color: #1f2d26; }
.map-info-user { font-size: 0.75rem; font-weight: 600; }
.map-info-time { font-size: 0.75rem; color: #777; }

/* In-result location chip */
.loc-banner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* The specimen-card below uses a -space-6 top margin (overlap effect), which
     would otherwise slide up over this chip. Reserve extra space so the card's
     upward pull lands below the chip (leaving a small gap after margin collapse). */
  margin-bottom: calc(var(--space-3) + var(--space-6));
  margin-left: var(--space-4);
  padding: 6px 12px;
  background: rgba(45, 90, 63, 0.08);
  border: 1px solid rgba(45, 90, 63, 0.18);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--green-deep);
}

/* Lottie 撒花动画层（升级时播放一次，限定在 #app 版面内）
   #app 已设置 position:relative + overflow:hidden，本层用 absolute 铺满 #app，
   撒花即被裁剪在移动端 app 区域内，而不会飘满整个浏览器页面。 */
#confetti-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;        /* 不阻挡任何交互 */
  z-index: 9999;               /* 置于 app 内所有 UI 之上 */
  display: none;
  overflow: hidden;
}
#confetti-layer.playing {
  display: block;
}
#confetti-layer svg {
  width: 100% !important;
  height: 100% !important;
}

/* -------------------------------------------------------------------------
   隐藏开发者功能（演示模式 / 从相册选择 / 关于-AI服务·模型）
   默认隐藏；长按"设置-关于"板块 3 秒后，body.dev-mode 才显示。
   ------------------------------------------------------------------------- */
.dev-only {
  display: none !important;
}
body.dev-mode .demo-section.dev-only {
  display: block !important;
}
body.dev-mode .about-row.dev-only {
  display: flex !important;
}
body.dev-mode .btn-album.dev-only {
  display: flex !important;
}
body.dev-mode .settings-footer-note.dev-only {
  display: block !important;
}
/* 长按"关于"板块时的视觉反馈 */
#about-card.dev-press {
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

