/* ========== GoVibe Visual System ==========
   Warm white + saturated teal + photo-first
   Plex Sans (primary) + Plex Mono (technical only)
   ============================================ */

:root {
  /* Light theme (default) */
  --bg: #f6f5f2;
  --bg-elev: #ffffff;
  --bg-sunk: #efede8;
  --ink: #14201f;
  --ink-2: #3b4a48;
  --ink-3: #6b7976;
  --ink-4: #a4aeab;
  --line: #e3e0d8;
  --line-2: #d4d0c5;

  /* More saturated, warmer teal */
  --teal: oklch(0.58 0.14 185);
  --teal-soft: oklch(0.92 0.05 185);
  --teal-ink: oklch(0.28 0.08 185);

  /* Warm coral accent for hero moments */
  --warm: oklch(0.72 0.18 32);
  --warm-soft: oklch(0.95 0.05 32);

  --status-fresh: oklch(0.64 0.18 148);
  --status-stale: oklch(0.68 0.15 65);
  --status-rare: oklch(0.55 0.16 295);
  --status-done: oklch(0.58 0.14 185);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;

  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #0d1414;
  --bg-elev: #141d1d;
  --bg-sunk: #0a1010;
  --ink: #e8efed;
  --ink-2: #b4c0bd;
  --ink-3: #7d8a87;
  --ink-4: #4d5755;
  --line: #1f2a29;
  --line-2: #2a3635;

  --teal: oklch(0.72 0.14 185);
  --teal-soft: oklch(0.22 0.07 185);
  --teal-ink: oklch(0.85 0.10 185);

  --warm: oklch(0.78 0.16 32);
  --warm-soft: oklch(0.20 0.06 32);

  --status-fresh: oklch(0.72 0.16 148);
  --status-stale: oklch(0.78 0.14 65);
  --status-rare: oklch(0.72 0.16 295);
  --status-done: oklch(0.72 0.14 185);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root:not([data-effects="off"]) :where(button, a, input, select, .mission-card, .pill, .glyph, .placeholder-img) {
  transition:
    background-color .16s ease,
    border-color .16s ease,
    color .16s ease,
    box-shadow .16s ease,
    opacity .16s ease,
    transform .16s ease;
}

:root:not([data-effects="off"]) :where(button, a, .mission-card) {
  -webkit-tap-highlight-color: transparent;
}

:root:not([data-effects="off"]) :where(button, a, .mission-card):focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

:root:not([data-effects="off"]) :where(button:not(.twk-toggle):not(.twk-x):not(.dc-expand), a, .mission-card):hover {
  transform: translateY(-1px);
}

:root:not([data-effects="off"]) :where(button:not(.twk-toggle):not(.twk-x):not(.dc-expand), a, .mission-card):active {
  transform: translateY(1px) scale(0.99);
}

:root:not([data-effects="off"]) :where(.btn-primary, .btn-secondary):hover {
  box-shadow: 0 8px 18px rgba(20,32,31,0.14);
}

:root:not([data-effects="off"]) .mission-card:hover {
  box-shadow: 0 10px 24px rgba(20,32,31,0.10);
}

:root[data-effects="off"] :where(*, *::before, *::after) {
  transition: none !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
}

/* ===== Phone screen container ===== */
.screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
}

/* iOS-ish status bar */
.statusbar {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 28px 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.statusbar .icons {
  display: flex;
  gap: 5px;
  align-items: center;
}
.statusbar svg { display: block; }

/* Bottom tab bar */
.tabbar {
  flex-shrink: 0;
  height: 84px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 0 24px;
}
.tabbar button {
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 6px 0;
}
.tabbar button[data-active="true"] { color: var(--ink); }
.tabbar button .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--teal);
  opacity: 0;
  transition: opacity .2s;
}
.tabbar button[data-active="true"] .dot { opacity: 1; }

/* Persistent map + draggable bottom sheet */
.map-shell {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
}

.map-fab {
  position: absolute;
  right: 16px;
  z-index: 11;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(20,32,31,0.08);
  font-family: var(--font-sans);
  transition: bottom .28s cubic-bezier(0.22, 1, 0.36, 1), transform .16s ease;
}
.map-fab[data-tier="peek"] { bottom: 116px; }
.map-fab[data-tier="half"] { bottom: calc(42% + 16px); }
.map-fab[data-tier="full"] { bottom: calc(92% - 52px); }

.map-bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -12px 34px rgba(20,32,31,0.12);
  overflow: hidden;
  will-change: height;
  transition: height .32s cubic-bezier(0.22, 1, 0.36, 1);
}
.map-bottom-sheet[data-tier="peek"] { height: 94px; }
.map-bottom-sheet[data-tier="half"] { height: 42%; }
.map-bottom-sheet[data-tier="full"] { height: 92%; }

.map-sheet-grabber {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 0 8px;
  cursor: grab;
  touch-action: none;
}
.map-sheet-grabber:active { cursor: grabbing; }
.map-sheet-grabber span {
  display: block;
  width: 42px;
  height: 4px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--line-2);
}

.map-sheet-summary {
  border: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 0 20px 12px;
  text-align: left;
  font-family: var(--font-sans);
  cursor: pointer;
  touch-action: none;
}
.map-sheet-summary-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.08;
}
.map-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.map-sheet-body::-webkit-scrollbar { display: none; }
.map-bottom-sheet[data-tier="peek"] .map-sheet-body {
  overflow: hidden;
  pointer-events: none;
}

/* Mono micro-label — reserve for technical data only */
.mono {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Small readable label — replaces mono for non-technical text */
.label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-3);
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill[data-tone="teal"] {
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal-ink);
  font-weight: 600;
}
.pill[data-tone="rare"] {
  background: linear-gradient(90deg, var(--bg-elev), oklch(0.93 0.05 295));
  color: var(--status-rare);
  border-color: oklch(0.84 0.06 295);
}

/* Primary CTA */
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: 0;
  height: 48px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.btn-primary:active { transform: translateY(1px); }
.btn-secondary {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  height: 44px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

/* Mission card */
.mission-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  position: relative;
}
.mission-card:active { transform: scale(0.99); }
.mission-card[data-rare="true"] {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box,
    linear-gradient(135deg, oklch(0.82 0.08 295), oklch(0.86 0.06 195), oklch(0.88 0.05 65)) border-box;
  border: 1.5px solid transparent;
}

/* Hero featured mission card */
.hero-mission {
  position: relative;
  height: 210px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s;
}
.hero-mission:active { transform: scale(0.99); }

/* Photo utilities */
.photo-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,16,16,0.88) 0%,
    rgba(10,16,16,0.35) 55%,
    rgba(10,16,16,0.1) 100%
  );
}

/* Card reveal animation */
@keyframes card-reveal {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.card-reveal {
  animation: card-reveal 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes receipt-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mapdrop-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* Freshness bar */
.freshness {
  height: 2px;
  background: var(--bg-sunk);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.freshness::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--fresh-color, var(--status-stale));
  width: var(--fresh-pct, 50%);
}

/* Scrollable area */
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.scroll::-webkit-scrollbar { display: none; }

/* Section header */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sec-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-family: var(--font-sans);
}

/* Difficulty dots */
.diff {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.diff i {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink-4);
  display: block;
}
.diff i[data-on="true"] { background: var(--ink); }

/* Level progress ring (used in mission home + profile) */
.level-ring-track {
  fill: none;
  stroke: var(--bg-sunk);
  stroke-width: 5;
}
.level-ring-fill {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
}

/* Glow behind card reveal */
@keyframes glow-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* World screen animations */
@keyframes world-open {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes building-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
