/* ─────────────────────────────────────────────────────────
   DO SOMETHING — styles
   Apple-minimalist × premium game interface.
   Monochrome ground, near-black ink, one signal accent
   reserved for XP, streak fire, and live indicators.
   ───────────────────────────────────────────────────────── */

:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #111113;
  --ink-soft: #6B6B70;
  --ink-faint: #B3B3B8;
  --line: rgba(17, 17, 19, 0.08);
  --accent: #FF5A36;
  --accent-soft: rgba(255, 90, 54, 0.12);
  --danger: #E23E3E;
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --shadow-soft: 0 20px 50px rgba(17, 17, 19, 0.08), 0 2px 6px rgba(17, 17, 19, 0.04);
  --shadow-card: 0 12px 28px rgba(17, 17, 19, 0.09), 0 2px 6px rgba(17, 17, 19, 0.05);
  --shadow-button: 0 24px 44px rgba(17, 17, 19, 0.28), 0 8px 16px rgba(17, 17, 19, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-button-glow: 0 28px 54px rgba(255, 90, 54, 0.22), 0 10px 20px rgba(17, 17, 19, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Screens ─────────────────────────────────────────────── */

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 18px clamp(16px, 5vw, 24px) 100px;
  animation: fadeIn 0.4s var(--ease);
}
.screen-active { display: flex; }

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

/* ── Home top: brand + logo spot ────────────────────────── */

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 0;
}

.brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Doubles as the shop entry button, top right. */
.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 16px rgba(17, 17, 19, 0.18);
  transition: transform 0.15s var(--ease-bounce);
}
.logo-mark:active { transform: scale(0.92); }
.logo-mark-text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.shards-badge {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(255, 90, 54, 0.3);
}

.dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-faint);
  border: 2px solid var(--bg);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.dot-active {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px var(--accent-soft); }
}

/* ── Home center ─────────────────────────────────────────── */

.home-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  min-height: 0;
}

.guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 10px 10px 10px 14px;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}
.guest-banner button {
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 8px 14px;
  border-radius: 999px;
  flex-shrink: 0;
}

.theme-wrap { margin-bottom: 2px; }
.theme-caption {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}
.theme-label {
  font-size: clamp(12px, 3.4vw, 13px);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-top: 1px;
}

.level-name {
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

.home-xp {
  font-size: clamp(14px, 4vw, 16px);
  color: var(--ink-soft);
  font-weight: 500;
}

/* ── The big button ──────────────────────────────────────── */

.do-button-wrap {
  display: flex;
  justify-content: center;
  padding: clamp(18px, 5vh, 28px) 0 8px;
}

.do-button {
  position: relative;
  width: clamp(168px, 52vw, 220px);
  height: clamp(168px, 52vw, 220px);
  border-radius: 50%;
  background: var(--button-skin, radial-gradient(circle at 32% 26%, #2b2b2e, var(--ink) 65%));
  background-size: var(--button-skin-size, 100% 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: var(--shadow-button);
  overflow: visible;
  transform: scale(1);
  transition: transform 0.22s var(--ease-bounce), box-shadow 0.3s var(--ease);
  animation: doBreathe 3.6s ease-in-out infinite;
  will-change: transform, box-shadow;
}

@keyframes doBreathe {
  0%, 100% { box-shadow: var(--shadow-button); }
  50% { box-shadow: var(--shadow-button-glow); }
}

.do-label {
  font-size: clamp(18px, 5.6vw, 26px);
  font-weight: 800;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

.btn-pressed {
  transform: scale(0.86) !important;
  box-shadow: 0 10px 22px rgba(17, 17, 19, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease) !important;
}

/* Expanding ripple / "bubble" on tap (done/skip buttons) */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  opacity: 1;
  pointer-events: none;
  animation: rippleOut 0.6s var(--ease) forwards;
}
.btn-skip .ripple { background: rgba(17, 17, 19, 0.08); }
@keyframes rippleOut {
  to { transform: scale(2.6); opacity: 0; }
}

/* ── Stat chips ──────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 2vw, 10px);
  padding: 4px 0;
}
.stats-row-4 { grid-template-columns: repeat(4, 1fr); margin-top: 22px; }

.stat-chip {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 13px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s var(--ease);
  cursor: pointer;
}
.stat-chip:active { transform: scale(0.95); }

.stat-chip-accent {
  background: var(--ink);
  box-shadow: 0 14px 30px var(--accent-soft), 0 4px 10px rgba(17, 17, 19, 0.12);
}
.stat-chip-accent .stat-value,
.stat-chip-accent .stat-label { color: #fff; }

.stat-icon {
  line-height: 1;
  margin-bottom: 2px;
  display: flex;
}
.stat-icon-level,
.stat-icon-done,
.stat-icon-trust { color: var(--ink); }
.stat-icon-streak { color: var(--accent); }

.stat-value {
  font-size: clamp(16px, 4.6vw, 19px);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: clamp(8px, 2.2vw, 9px);
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

/* ── Tooltip "islands" ───────────────────────────────────── */

#tipLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
}

.tip-bubble {
  position: fixed;
  max-width: 240px;
  width: max-content;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transition: opacity 0.22s var(--ease-bounce), transform 0.22s var(--ease-bounce);
  pointer-events: none;
  --arrow-offset: 0px;
}
/* Arrow points down (bubble sits above its anchor) */
.tip-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: calc(50% + var(--arrow-offset));
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--ink);
}
/* Flipped: bubble sits below its anchor, arrow points up */
.tip-bubble-below::after {
  bottom: auto;
  top: -5px;
}
.tip-bubble-visible { opacity: 1; }

/* ── Thinking overlay ────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 248, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  z-index: 50;
  padding: 16px;
}
.overlay-visible { opacity: 1; pointer-events: all; }

.thinking-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* ── Nav lock (mission in progress) ──────────────────────── */

.nav-locked .navitem:not(.navitem-active) {
  opacity: 0.35;
}

/* ── Mission screen ──────────────────────────────────────── */

.mission-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 10px;
}

#missionCategory {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

#missionXP {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.mission-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: clamp(20px, 6vw, 28px) clamp(18px, 5vw, 24px);
  margin-top: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  transition: transform 0.28s var(--ease-bounce), opacity 0.28s var(--ease);
}
.mission-card.swiping { transition: none; }
.mission-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--swipe-tint, transparent);
  pointer-events: none;
  transition: background 0.1s linear;
}

.card-enter { animation: cardIn 0.45s var(--ease-bounce); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.swipe-hint {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 12px;
  padding: 0 4px;
}
.swipe-hint-skip { color: var(--danger); }
.swipe-hint-skip span { opacity: 0.85; }
.swipe-hint-done { color: #2E8B4F; }

/* ── Gesture-only mission card: Tinder-style stamps + edge chevrons ── */

.swipe-stamp {
  position: absolute;
  top: 22px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 14px;
  border: 3px solid;
  border-radius: 10px;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  background: var(--surface);
}
.swipe-stamp-skip {
  left: 18px;
  border-color: var(--danger);
  color: var(--danger);
  transform: rotate(-8deg);
}
.swipe-stamp-done {
  right: 18px;
  border-color: #2E8B4F;
  color: #2E8B4F;
  transform: rotate(8deg);
}
.stamp-penalty {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.swipe-edge-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-faint);
  opacity: 0.3;
  pointer-events: none;
  animation: edgeHintPulse 2.4s ease-in-out infinite;
}
.swipe-edge-hint-left { left: 2px; }
.swipe-edge-hint-right { right: 2px; animation-delay: 0.3s; }
@keyframes edgeHintPulse {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.45; }
}

/* DONE/SKIP buttons stay functional (for the existing disabled-state
   gating) but are never shown — gestures are the only visible way in. */
.mission-actions-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.mission-difficulty {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.mission-title {
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.mission-description {
  font-size: clamp(14px, 4vw, 16px);
  line-height: 1.5;
  color: var(--ink-soft);
  flex: 1;
}

.mission-timer { margin-top: 16px; }
.mission-timer-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.mission-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), var(--accent));
  border-radius: 3px;
  width: 0%;
  transition: width 0.25s linear;
}
.mission-timer-text {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-align: center;
}

.mission-capture { margin-top: 16px; }
.capture-btn {
  width: 100%;
  padding: 14px 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px dashed var(--ink-faint);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  transition: transform 0.12s var(--ease), border-color 0.2s var(--ease);
}
.capture-btn:active { transform: scale(0.97); }
.capture-status {
  width: 100%;
  padding: 14px 0;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
}
.capture-note {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-faint);
  margin-top: 8px;
  text-align: center;
}

.mission-text-input { margin-top: 16px; }
.mission-text-input textarea {
  width: 100%;
  resize: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px; /* stays >=16px to stop iOS auto-zoom on focus */
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.mission-text-input textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--line);
}

.mission-proof {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.mission-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-skip, .btn-done {
  flex: 1;
  padding: 16px 4px;
  border-radius: var(--radius-md);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.12s var(--ease), opacity 0.12s var(--ease), box-shadow 0.12s var(--ease);
  position: relative;
  overflow: hidden;
}
.btn-skip:active, .btn-done:active { transform: scale(0.97); }

.btn-skip {
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  flex: 0.8;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.btn-skip span { display: block; }
#skipLabelXP {
  font-size: clamp(10px, 2.8vw, 11px);
  font-weight: 700;
  color: var(--danger);
}
#skipLabelText {
  font-size: clamp(11px, 3vw, 13px);
}

.btn-done {
  background: var(--ink);
  color: #fff;
  flex: 1.2;
  box-shadow: 0 14px 28px rgba(17, 17, 19, 0.22);
}
.btn-done:disabled {
  opacity: 0.35;
  box-shadow: none;
  pointer-events: none;
}

/* ── Profile ─────────────────────────────────────────────── */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px 20px;
  margin: -18px -24px 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--profile-banner, transparent);
  transition: background 0.3s var(--ease);
}
.profile-header .npc-orb { margin-bottom: 0; }

.avatar-ring {
  padding: var(--ring-padding, 0px);
  border-radius: 50%;
  background: var(--ring-css, transparent);
  margin-bottom: 16px;
  transition: padding 0.2s var(--ease);
}

.npc-orb {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--avatar-from, #3a3a3d), var(--avatar-to, #111113) 70%);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s var(--ease-bounce);
}
.npc-orb:active { transform: scale(0.94); }
.npc-orb-emoji {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.npc-orb-edit {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
}

#profileNpc {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

#profileLevelName {
  font-size: clamp(22px, 6.5vw, 28px);
  font-weight: 800;
  margin-top: 4px;
}

#profileXP {
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}
.account-row button {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  margin-top: 18px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), var(--accent));
  border-radius: 3px;
  transition: width 0.6s var(--ease-bounce);
}
.progress-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.section-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 26px 0 12px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin-bottom: 10px;
  opacity: 0.45;
  transform: scale(0.98);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease-bounce), box-shadow 0.3s var(--ease);
}
.achievement-unlocked {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 14px 30px var(--accent-soft), 0 4px 10px rgba(17, 17, 19, 0.06);
}

.achievement-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
}
.achievement-unlocked .achievement-dot { background: var(--accent); }

.achievement-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.achievement-desc {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
}

/* ── Friends ─────────────────────────────────────────────── */

.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
}
.friends-header h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
}
.btn-add {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 10px 20px rgba(17, 17, 19, 0.2);
  transition: transform 0.15s var(--ease-bounce);
}
.btn-add:active { transform: scale(0.9) rotate(90deg); }

.friends-empty {
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  padding: 40px 20px;
  line-height: 1.5;
}

.friend-card-wrap {
  position: relative;
  border-radius: var(--radius-md);
  margin-top: 12px;
  overflow: hidden;
}
.friend-delete-bg {
  position: absolute;
  inset: 0;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 22px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.friend-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  touch-action: pan-y;
}
.friend-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #3a3a3d, var(--ink) 70%);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.friend-info { flex: 1; min-width: 0; }
.friend-id {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.friend-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.friend-xp {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ── Modals ──────────────────────────────────────────────── */

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: calc(100% - 40px);
  max-width: 360px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
  animation: cardIn 0.35s var(--ease-bounce);
}
.modal-card h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 14px;
}
.modal-card input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 16px; /* >=16px: prevents iOS auto-zoom on focus */
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}
.modal-card input:focus { border-color: var(--ink); }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions button {
  flex: 1;
  padding: 14px 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 14px;
  transition: transform 0.12s var(--ease);
}
.modal-actions button:active { transform: scale(0.96); }
.modal-cancel {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.modal-confirm {
  background: var(--ink);
  color: #fff;
}

.account-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.account-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.account-tab-active { background: var(--ink); color: #fff; }

.modal-card input + input { margin-top: 10px; }

.account-error {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  margin-top: 10px;
  text-align: center;
}

.account-divider {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 18px 0 12px;
  position: relative;
}
.account-divider::before, .account-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--line);
}
.account-divider::before { left: 0; }
.account-divider::after { right: 0; }

.account-oauth {
  width: 100%;
  padding: 13px 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s var(--ease);
}
.account-oauth:active { transform: scale(0.97); }
.soon-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: var(--line);
  padding: 2px 7px;
  border-radius: 999px;
}

.account-note {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
  margin-top: 14px;
  text-align: center;
}

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 32% 28%, var(--avatar-from, #3a3a3d), var(--avatar-to, #111113) 70%);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-card);
}
.avatar-upload-btn {
  flex: 1;
  padding: 13px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px dashed var(--ink-faint);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 0.12s var(--ease), border-color 0.2s var(--ease);
}
.avatar-upload-btn:active { transform: scale(0.97); }

.avatar-palette {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.avatar-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  transition: transform 0.15s var(--ease-bounce), border-color 0.15s var(--ease);
}
.avatar-swatch:active { transform: scale(0.9); }
.avatar-swatch-selected {
  border-color: var(--ink);
  transform: scale(1.08);
}

/* ── Bottom nav ──────────────────────────────────────────── */

.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  padding: 14px clamp(12px, 4vw, 24px) calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 20;
}

.navitem {
  font-size: clamp(10px, 3vw, 12px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 6px 8px;
  transition: color 0.2s var(--ease), transform 0.15s var(--ease-bounce), opacity 0.2s var(--ease);
}
.navitem-active { color: var(--ink); transform: translateY(-2px); }

/* ── Toasts ──────────────────────────────────────────────── */

#toastLayer {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  width: calc(100% - 40px);
  max-width: 420px;
}

.toast {
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(-10px) scale(0.85);
  transition: opacity 0.35s var(--ease-bounce), transform 0.35s var(--ease-bounce);
  text-align: center;
  max-width: 100%;
}
.toast-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast-level {
  background: linear-gradient(120deg, var(--ink), var(--accent));
}

/* ── Bubble bursts (level-up + button press) ────────────── */

#burstLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}

.burst-bubble {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
  animation: burstFly 0.7s var(--ease) forwards;
}
@keyframes burstFly {
  0% { transform: translate(0, 0) scale(0); opacity: 0.95; }
  65% { opacity: 0.7; }
  100% { transform: var(--burst-transform); opacity: 0; }
}

/* ── Shared cosmetic animations (shop items) ────────────── */

.cosmetic-pulse { animation: cosmeticPulse 1.6s ease-in-out infinite; }
@keyframes cosmeticPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

.cosmetic-shimmer { background-size: 220% 220% !important; animation: cosmeticShimmer 3.2s ease-in-out infinite; }
@keyframes cosmeticShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Shop screen ─────────────────────────────────────────── */

.shop-balance {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

/* Discord-style try-on stage */
.shop-stage { margin-top: 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.pv-banner { height: 92px; background: var(--profile-banner, transparent); background-color: var(--line); }
.pv-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 16px 16px; margin-top: -42px; }
.pv-ring { padding: var(--ring-padding, 0px); border-radius: 50%; background: var(--ring-css, transparent); box-shadow: 0 0 0 4px var(--surface); position: relative; }
.pv-avatar { width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, var(--avatar-from, #3a3a3d), var(--avatar-to, #111113) 70%); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 38px; }
.pv-name { margin-top: 10px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.pv-sub { margin-top: 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--ink-faint); }
.pv-do { margin-top: 14px; width: 64px; height: 64px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; background: var(--button-skin, #111113); background-size: var(--button-skin-size, 100% 100%); box-shadow: 0 10px 20px rgba(17,17,19,.22); transition: transform .15s var(--ease-bounce); }
.pv-do:active { transform: scale(.9); }
.pv-hint { margin-top: 8px; font-size: 11px; color: var(--ink-faint); }

.shop-tabs { display: flex; gap: 6px; margin-top: 16px; background: var(--bg); border-radius: 999px; padding: 4px; }
.shop-tab { flex: 1; padding: 10px 0; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .03em; color: var(--ink-soft); transition: background .15s var(--ease), color .15s var(--ease); }
.shop-tab-active { background: var(--ink); color: #fff; }

.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; padding-bottom: 96px; }
.shop-tile { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px solid transparent; transition: transform .15s var(--ease-bounce), border-color .15s var(--ease); min-width: 0; }
.shop-tile:active { transform: scale(.96); }
.shop-tile-selected { border-color: var(--ink); }
.shop-tile-visual { height: 52px; width: 100%; display: flex; align-items: center; justify-content: center; }
.tile-ring { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); }
.tile-ring-in { width: 100%; height: 100%; border-radius: 50%; background: var(--surface); }
.tile-banner { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); }
.tile-btn { width: 48px; height: 48px; border-radius: 50%; box-shadow: 0 6px 12px rgba(17,17,19,.2); }
.tile-burst { display: flex; align-items: center; justify-content: center; }
.tile-burst i { width: 18px; height: 18px; border-radius: 50%; margin-left: -6px; border: 2px solid var(--surface); }
.tile-burst i:first-child { margin-left: 0; }
.shop-tile-name { font-size: 10px; font-weight: 800; letter-spacing: .02em; text-align: center; line-height: 1.2; max-width: 100%; overflow-wrap: anywhere; }
.shop-tile-tag { font-size: 10px; font-weight: 700; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.shop-tile-tag.price-money { color: var(--accent); }
.shop-tile-tag.price-locked { color: var(--ink-faint); }
.shop-tile-tag.tag-on { color: #fff; background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.shop-tile-tag.tag-own { color: var(--ink); }

.shop-buybar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 -8px 24px rgba(17,17,19,.08); border-radius: 24px 24px 0 0; }
#screen-shop:not(.screen-active) ~ .shop-buybar, .shop-buybar:empty { display: none; }
.buybar-info { flex: 1; min-width: 0; }
.buybar-name { font-size: 13px; font-weight: 800; }
.buybar-sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.buybar-btn { padding: 14px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; transition: transform .12s var(--ease); }
.buybar-btn:active { transform: scale(.96); }
.buybar-btn.buy-disabled { background: var(--bg); color: var(--ink-faint); border: 1px solid var(--line); }

.logo-mark-icon { width: 21px; height: 21px; }

/* ── Terms gate ──────────────────────────────────────────── */

.terms-gate { z-index: 200; background: rgba(250, 250, 248, 0.97); }
.terms-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
}
.terms-card h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 12px;
  text-align: center;
}
.terms-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.terms-scroll h3 {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  margin: 14px 0 4px;
}
.terms-scroll h3:first-child { margin-top: 0; }
.terms-scroll p { margin: 0 0 8px; }
.terms-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.terms-doc-list li {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
.terms-doc-list a {
  display: block;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.terms-doc-list a:active { opacity: 0.6; }
.terms-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  cursor: pointer;
}
.terms-checkbox input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; }
.terms-accept {
  border-radius: 999px;
  margin-top: 14px;
  width: 100%;
  padding: 16px 0;
}
.terms-accept:disabled { opacity: 0.35; pointer-events: none; }

/* ── Flash (red/skip, green/done) ───────────────────────── */

#flashLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 85;
  opacity: 0;
}
#flashLayer.flash-done {
  background: radial-gradient(circle at 50% 35%, rgba(126, 209, 126, 0.4), transparent 70%);
  animation: flashPulse 0.55s ease-out;
}
#flashLayer.flash-skip {
  background: radial-gradient(circle at 50% 35%, rgba(226, 62, 62, 0.4), transparent 70%);
  animation: flashPulse 0.55s ease-out;
}
@keyframes flashPulse {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Completion overlay (after DONE) ─────────────────────── */

.completion-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  width: calc(100% - 48px);
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: cardIn 0.4s var(--ease-bounce);
}
.completion-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 14px 28px rgba(17, 17, 19, 0.22);
}
.completion-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.completion-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.completion-card .modal-actions { margin-top: 22px; }

/* ── History screen ──────────────────────────────────────── */

.history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}
.history-header h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}
.btn-back {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s var(--ease-bounce);
}
.btn-back:active { transform: scale(0.9); }

.history-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin-top: 10px;
}
.history-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.history-status-done { color: var(--accent); }
.history-status-skip { color: var(--danger); }
.history-item-title {
  font-size: 15px;
  font-weight: 800;
  margin-top: 5px;
}
.history-item-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}
.history-item-answer {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-style: italic;
  line-height: 1.4;
}
.history-item-location {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* ── Profile: weekly summary + history link ─────────────── */

.week-summary {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
  padding: 0 6px;
}

.history-link {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-top: 24px;
  transition: transform 0.15s var(--ease-bounce);
}
.history-link:active { transform: scale(0.98); }

/* ── Modal drag-to-dismiss grabber ───────────────────────── */

.modal-grabber {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto 16px;
  touch-action: none;
}

/* ── Motion preference ───────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .do-button { animation: none; }
}

/* ── Very small screens ──────────────────────────────────── */

@media (max-width: 340px) {
  .stats-row-4 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stats-row-4 .stat-chip:nth-child(3),
  .stats-row-4 .stat-chip:nth-child(4) { margin-top: 0; }
}

@media (max-height: 640px) {
  .do-button-wrap { padding-top: 10px; }
  .theme-caption { display: none; } /* keep the theme value itself, just drop the tiny caption line */
}

/* ── Desktop ─────────────────────────────────────────────── */

@media (min-width: 700px) {
  body { background: #F0F0EE; }
  #app {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
    border-radius: 40px;
    box-shadow: 0 30px 80px rgba(17, 17, 19, 0.12);
    overflow: hidden;
    background: var(--bg);
  }
  .nav { border-radius: 0 0 40px 40px; }
}

/* ── Friend activity + share toggle ──────────────────────── */
.friend-activity { font-size: 11px; color: var(--ink-faint); margin-top: 4px; line-height: 1.35; }
.friend-activity b { color: var(--ink-soft); font-weight: 800; }
.share-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; margin-top: 14px; padding: 12px 14px;
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
  font-size: 12px; font-weight: 700; color: var(--ink-soft); text-align: left;
}
.share-toggle {
  flex-shrink: 0; min-width: 56px; padding: 7px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  background: var(--bg); color: var(--ink-faint); border: 1px solid var(--line);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.share-toggle-on { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Friend requests ─────────────────────────────────────── */
.request-card { display:flex; align-items:center; gap:8px; background:var(--surface); border-radius:var(--radius-md); padding:12px 12px 12px 16px; margin-top:8px; box-shadow:var(--shadow-card); }
.request-name { flex:1; min-width:0; font-size:13px; font-weight:800; }
.request-name small { display:block; font-size:10px; font-weight:600; color:var(--ink-faint); margin-top:2px; }
.request-yes { background:var(--ink); color:#fff; font-size:11px; font-weight:800; letter-spacing:.03em; padding:9px 14px; border-radius:999px; }
.request-no { width:34px; height:34px; border-radius:50%; background:var(--bg); color:var(--ink-soft); border:1px solid var(--line); font-size:13px; }

/* ── Friends map ─────────────────────────────────────────── */
.friends-header-actions { display:flex; align-items:center; gap:10px; }
.btn-map { padding:9px 14px; border-radius:999px; background:var(--surface); box-shadow:var(--shadow-card); font-size:11px; font-weight:800; letter-spacing:.05em; color:var(--ink); transition:transform .15s var(--ease-bounce); }
.btn-map:active { transform:scale(.94); }
.share-row small { display:block; font-size:10px; font-weight:600; color:var(--ink-faint); margin-top:3px; line-height:1.35; }
.loc-btn { margin-left:6px; flex-shrink:0; width:34px; height:34px; border-radius:50%; font-size:14px; background:var(--bg); border:1px solid var(--line); opacity:.55; transition:background .2s var(--ease), opacity .2s var(--ease); }
.loc-btn-on { background:var(--accent-soft); border-color:transparent; opacity:1; }

/* ── Full-screen map ── */
#screen-map { padding:0; position:fixed; top:0; bottom:0; left:50%; transform:translateX(-50%); width:100%; max-width:480px; z-index:60; overflow:hidden; background:#8CC8EC; animation:none; }
#screen-map.screen-active { display:block; }
.map-svg { position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none; user-select:none; -webkit-user-select:none; background:linear-gradient(180deg,#B4E0F7,#86C4EB); cursor:grab; }
.map-svg:active { cursor:grabbing; }
.map-grid line { stroke:rgba(255,255,255,.35); stroke-width:1; vector-effect:non-scaling-stroke; }
.map-land path { stroke:#fff; stroke-width:.9; vector-effect:non-scaling-stroke; stroke-linejoin:round; fill-rule:evenodd; }
.map-land .L0 { fill:#F7D98B; } .map-land .L1 { fill:#A9DC9A; } .map-land .L2 { fill:#F5B7A0; }
.map-land .L3 { fill:#C6B5EE; } .map-land .L4 { fill:#8FD6CF; }
.map-marker { cursor:pointer; }
.map-marker circle { stroke:#fff; }
.map-marker .m-dot { fill:var(--ink); }
.map-marker.m-self .m-dot { fill:var(--accent); }
.map-marker .m-halo { fill:var(--accent-soft); }
.map-marker text { font-weight:800; fill:#fff; text-anchor:middle; pointer-events:none; }
.map-fab { width:46px; height:46px; border-radius:50%; background:#fff; color:var(--ink); font-size:22px; font-weight:700; box-shadow:0 4px 14px rgba(0,0,0,.22); display:flex; align-items:center; justify-content:center; transition:transform .15s var(--ease-bounce); }
.map-fab:active { transform:scale(.92); }
.map-back { position:absolute; top:max(14px, env(safe-area-inset-top)); left:14px; z-index:3; }
.map-controls { position:absolute; right:14px; bottom:calc(var(--sheet-h, 150px) + 16px); display:flex; flex-direction:column; gap:10px; z-index:3; transition:bottom .25s var(--ease); }
.map-sheet { position:absolute; left:0; right:0; bottom:0; z-index:4; background:#fff; border-radius:24px 24px 0 0; box-shadow:0 -6px 24px rgba(0,0,0,.18); padding:8px 20px calc(18px + env(safe-area-inset-bottom)); transition:transform .25s var(--ease); }
.map-sheet.map-sheet-collapsed { transform:translateY(calc(100% - 44px)); }
.map-sheet-handle { display:block; width:44px; height:5px; border-radius:3px; background:rgba(17,17,19,.18); margin:4px auto 10px; padding:10px 0; background-clip:content-box; }
.map-sheet-title { font-size:11px; font-weight:800; letter-spacing:.08em; color:var(--ink-faint); margin-bottom:6px; }
.map-note { font-size:12px; line-height:1.5; color:var(--ink-soft, var(--ink)); }
.loc-btn { margin-left:6px; flex-shrink:0; width:34px; height:34px; border-radius:50%; font-size:14px; background:var(--bg); border:1px solid var(--line); opacity:.55; transition:background .2s var(--ease), opacity .2s var(--ease); }
.loc-btn-on { background:var(--accent-soft); border-color:transparent; opacity:1; }

/* avatars are always perfect circles */
.avatar-swatch, .avatar-preview, .npc-orb, .pv-avatar, .avatar-ring, .pv-ring { aspect-ratio: 1 / 1; border-radius: 50% !important; flex: 0 0 auto; -webkit-tap-highlight-color: transparent; }
.avatar-swatch, .avatar-preview, .pv-avatar { -webkit-appearance: none; appearance: none; outline: none; user-select: none; -webkit-user-select: none; clip-path: circle(50% at 50% 50%); }
.avatar-swatch { box-sizing: border-box; }
.npc-orb-edit { bottom: -2px; right: -2px; }

/* friend profile + list avatar */
.friend-ring { padding: var(--ring-padding, 0px); border-radius: 50%; background: var(--ring-css, transparent); flex: 0 0 auto; }
.friend-orb { font-size: 20px; }
.fp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.fp-stat { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 12px 4px; text-align: center; min-width: 0; }
.fp-stat-v { font-size: 17px; font-weight: 800; }
.fp-stat-l { margin-top: 3px; font-size: 9px; font-weight: 800; letter-spacing: .06em; color: var(--ink-faint); }
.fp-activity { margin-top: 14px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

.friend-delete-bg { opacity: 0; transition: opacity .15s var(--ease); }
.friend-swiping .friend-delete-bg { opacity: 1; }
.modal-card { position: relative; }
.modal-close { position: sticky; top: 0; float: right; margin: -8px -8px 0 0; width: 34px; height: 34px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 800; z-index: 2; display: flex; align-items: center; justify-content: center; }
.modal-close:active { transform: scale(.9); }

/* ═══ Animated cosmetics ═══════════════════════════════════ */
.avatar-ring, .pv-ring, .friend-ring, .tile-ring { position: relative; }
.ring-deco { position: absolute; inset: -18%; pointer-events: none; z-index: 3; }
.ring-deco svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar-ring.has-deco { margin: 14px 0 28px; }
.pv-ring.has-deco { margin-top: 10px; margin-bottom: 14px; }
.friend-ring.has-deco { margin: 6px 8px 6px 6px; }
.tile-ring.has-deco { margin: 2px; }
.tile-ring.has-deco .ring-deco { inset: -22%; }

.ring-deco svg * { transform-box: fill-box; }
.d-mouth { transform-origin: 50% 50%; animation: dMouth 2.6s ease-in-out infinite; }
@keyframes dMouth { 0%,50%,100% { transform: scaleY(.22); } 62%,86% { transform: scaleY(1); } }
.d-tongue { transform-origin: 50% 0; animation: dTongue 2.6s ease-in-out infinite; }
@keyframes dTongue { 0%,60% { transform: scaleY(0); } 70%,80% { transform: scaleY(1); } 92%,100% { transform: scaleY(0); } }
.d-blink circle:nth-child(n+5) { transform-origin: 50% 50%; animation: dBlink 3.8s infinite; }
@keyframes dBlink { 0%,93%,100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.d-look { animation: dLook 3s ease-in-out infinite; }
@keyframes dLook { 0%,100% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }
.d-ear-l { transform-origin: 80% 90%; animation: dEarL 4.2s ease-in-out infinite; }
.d-ear-r { transform-origin: 20% 90%; animation: dEarR 4.2s ease-in-out infinite 1.1s; }
@keyframes dEarL { 0%,86%,100% { transform: rotate(0); } 90% { transform: rotate(-12deg); } 94% { transform: rotate(3deg); } }
@keyframes dEarR { 0%,86%,100% { transform: rotate(0); } 90% { transform: rotate(12deg); } 94% { transform: rotate(-3deg); } }
.d-whisk { animation: dWhisk 3s ease-in-out infinite; }
@keyframes dWhisk { 0%,100% { transform: translateY(0); } 50% { transform: translateY(1.5px); } }
.d-bob { animation: dBob 2.2s ease-in-out infinite; }
@keyframes dBob { 0%,100% { transform: translateY(0); filter: drop-shadow(0 0 3px rgba(255,213,74,.9)); } 50% { transform: translateY(-4px); filter: drop-shadow(0 0 7px rgba(255,213,74,1)); } }
.d-horn-l { transform-origin: 90% 90%; animation: dHornL 2.4s ease-in-out infinite; }
.d-horn-r { transform-origin: 10% 90%; animation: dHornR 2.4s ease-in-out infinite; }
@keyframes dHornL { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-7deg); } }
@keyframes dHornR { 0%,100% { transform: rotate(0); } 50% { transform: rotate(7deg); } }
.d-orbit { transform-box: view-box !important; transform-origin: 50px 50px; animation: dSpin 4.5s linear infinite; }
.d-orbit2 { animation-duration: 7s; animation-direction: reverse; }
.d-spin { transform-box: view-box !important; transform-origin: 50px 50px; animation: dSpin 9s linear infinite; }
@keyframes dSpin { to { transform: rotate(360deg); } }
.d-fl { transform-origin: 50% 100%; animation: dFlame .55s ease-in-out infinite alternate; }
.d-fl2 { animation-delay: -.2s; } .d-fl3 { animation-delay: -.35s; animation-duration: .45s; } .d-fl4 { animation-delay: -.1s; } .d-fl5 { animation-delay: -.3s; }
@keyframes dFlame { from { transform: scale(1, .82) skewX(-4deg); } to { transform: scale(.92, 1.15) skewX(4deg); } }
.d-tw { transform-origin: 50% 50%; animation: dTwinkle 1.8s ease-in-out infinite; }
.d-tw2 { animation-delay: .4s; } .d-tw3 { animation-delay: .9s; } .d-tw4 { animation-delay: 1.3s; } .d-tw5 { animation-delay: .7s; }
@keyframes dTwinkle { 0%,100% { transform: scale(.2) rotate(0); opacity: .2; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
.d-heart { animation: dHeart 2.6s ease-in infinite; }
.d-h2 { animation-delay: .9s; } .d-h3 { animation-delay: 1.7s; }
@keyframes dHeart { 0% { opacity: 0; transform: translateY(14px) scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px) scale(1.1); } }

/* animated overlay layers for banners and buttons */
.has-fx { position: relative; }
.has-fx::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0; }
.profile-header.has-fx > *, .do-button.has-fx > * { position: relative; z-index: 1; }
.fx-stars::after { background-image: radial-gradient(1.6px 1.6px at 12% 30%, #fff, transparent), radial-gradient(1.2px 1.2px at 34% 70%, #fff, transparent), radial-gradient(2px 2px at 58% 22%, #fff, transparent), radial-gradient(1.4px 1.4px at 78% 62%, #fff, transparent), radial-gradient(1.8px 1.8px at 90% 28%, #fff, transparent), radial-gradient(1.2px 1.2px at 46% 48%, #fff, transparent); animation: fxTwinkle 2.4s ease-in-out infinite alternate; }
@keyframes fxTwinkle { from { opacity: .3; transform: scale(1); } to { opacity: 1; transform: scale(1.03); } }
.fx-rain::after { background-image: repeating-linear-gradient(105deg, transparent 0 9px, rgba(255,255,255,.55) 9px 10px, transparent 10px 22px); background-size: 40px 40px; animation: fxRain .45s linear infinite; }
@keyframes fxRain { to { background-position: -12px 40px; } }
.fx-snow::after { background-image: radial-gradient(3px 3px at 20% 20%, #fff, transparent), radial-gradient(2.4px 2.4px at 60% 50%, #fff, transparent), radial-gradient(3.4px 3.4px at 85% 15%, #fff, transparent), radial-gradient(2px 2px at 40% 80%, #fff, transparent); background-size: 90px 90px; animation: fxSnow 4s linear infinite; }
@keyframes fxSnow { to { background-position: 18px 90px; } }
.fx-waves::after { background: radial-gradient(60px 14px at 30% 100%, rgba(255,255,255,.45) 98%, transparent) 0 100% / 120px 22px repeat-x, radial-gradient(60px 12px at 70% 100%, rgba(255,255,255,.28) 98%, transparent) 0 100% / 90px 30px repeat-x; animation: fxWaves 3.5s linear infinite; }
@keyframes fxWaves { to { background-position: 120px 100%, -90px 100%; } }
.fx-aurora::after { background: linear-gradient(110deg, transparent 10%, rgba(120,255,200,.45) 35%, rgba(160,120,255,.4) 60%, transparent 85%); background-size: 200% 100%; mix-blend-mode: screen; animation: fxAurora 6s ease-in-out infinite alternate; }
@keyframes fxAurora { from { background-position: 0% 0; filter: hue-rotate(0deg); } to { background-position: 100% 0; filter: hue-rotate(70deg); } }
.fx-scan::after { background: repeating-linear-gradient(180deg, rgba(255,255,255,.08) 0 2px, transparent 2px 5px), linear-gradient(180deg, transparent 40%, rgba(0,229,255,.35) 50%, transparent 60%); background-size: 100% 100%, 100% 200%; animation: fxScan 2.8s linear infinite; }
@keyframes fxScan { from { background-position: 0 0, 0 -100%; } to { background-position: 0 0, 0 100%; } }
.fx-bubbles::after { background-image: radial-gradient(circle, rgba(255,255,255,.75) 0 3px, transparent 4px), radial-gradient(circle, rgba(255,255,255,.55) 0 2px, transparent 3px), radial-gradient(circle, rgba(255,255,255,.65) 0 4px, transparent 5px); background-size: 46px 60px, 38px 52px, 60px 70px; background-position: 0 0, 14px 20px, 28px 10px; animation: fxBubbles 3.2s linear infinite; }
@keyframes fxBubbles { to { background-position: 0 -60px, 14px -32px, 28px -60px; } }
.do-button.fx-stars::after, .do-button.fx-bubbles::after, .pv-do.fx-stars::after, .pv-do.fx-bubbles::after { border-radius: 50%; }
.pv-do, .tile-btn, .tile-banner, .pv-banner { position: relative; }

.tile-emoji { font-size: 22px; letter-spacing: -2px; line-height: 1; }
.burst-emoji { background: transparent !important; border-radius: 0 !important; display: flex; align-items: center; justify-content: center; line-height: 1; opacity: 1 !important; margin: -12px 0 0 -12px; }

@media (prefers-reduced-motion: reduce) {
  .ring-deco svg *, .has-fx::after { animation: none !important; }
}

.account-verify { margin-top: 8px; padding: 10px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.account-forgot { display: block; margin: -4px 0 12px auto; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--ink-faint); }
.account-forgot[hidden] { display: none; }

/* duo missions */
.duo-pill { align-self: center; margin: 4px 0 10px; padding: 9px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .05em; box-shadow: 0 8px 18px rgba(17,17,19,.18); animation: fadeIn .4s var(--ease); }
.duo-pill[hidden] { display: none; }
.duo-card { margin-top: 10px; padding: 16px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); border: 2px solid var(--accent-soft); }
.duo-from { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.duo-head { display: flex; justify-content: space-between; align-items: center; font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.duo-cat { color: var(--ink-faint); } .duo-xp { color: var(--accent); }
.duo-title { margin-top: 6px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.duo-desc { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.duo-pills { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.duo-pill-s { padding: 6px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; font-weight: 800; color: var(--ink-faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duo-pill-s.on { background: #E4F7E4; border-color: transparent; color: #1F7A2E; }
.duo-actions { display: flex; gap: 8px; margin-top: 14px; }
.duo-yes, .duo-no { flex: 1; padding: 13px 0; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.duo-yes { background: var(--ink); color: #fff; } .duo-no { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); flex: 0 0 38%; }
.duo-armed { background: var(--accent); }
.duo-wait { font-size: 12px; color: var(--ink-faint); line-height: 1.4; }
.fp-duo { margin-top: 14px; width: 100%; padding: 16px 0; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .05em; box-shadow: 0 10px 22px rgba(17,17,19,.18); }
.fp-duo.duo-btn-muted { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); box-shadow: none; }

/* admin */
.admin-link { color: var(--accent); }
.admin-demo-note { margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: #FFF3CD; color: #7a5b00; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-align: center; }
.admin-tabs { display: flex; gap: 6px; margin-top: 14px; background: var(--bg); border-radius: 999px; padding: 4px; }
.admin-tab { flex: 1; padding: 10px 0; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--ink-soft); }
.admin-tab-active { background: var(--ink); color: #fff; }
.admin-loading, .admin-empty { padding: 28px 0; text-align: center; font-size: 13px; color: var(--ink-faint); }
.admin-error { margin-top: 16px; padding: 14px; border-radius: var(--radius-md); background: #FDE8E4; color: #8a2a17; font-size: 13px; line-height: 1.5; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.admin-stat { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 12px 4px; text-align: center; min-width: 0; }
.admin-stat b { display: block; font-size: 16px; font-weight: 800; }
.admin-stat span { display: block; margin-top: 3px; font-size: 8px; font-weight: 800; letter-spacing: .05em; color: var(--ink-faint); }
.admin-search, .admin-form input, .admin-form textarea, .admin-form select, .fp-report-box textarea { width: 100%; padding: 13px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 16px; font-weight: 600; color: var(--ink); outline: none; font-family: inherit; }
.admin-search { margin-top: 12px; }
.admin-sub { margin-top: 14px; font-size: 12px; color: var(--ink-soft); }
.admin-row { margin-top: 10px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.admin-row-banned { border: 2px solid #F3B3A6; }
.admin-row-closed { opacity: .6; }
.admin-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.admin-row-sub { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--ink-faint); overflow-wrap: anywhere; }
.admin-row-text { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); overflow-wrap: anywhere; }
.admin-badge { padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .05em; white-space: nowrap; }
.admin-badge-muted { background: var(--bg); color: var(--ink-faint); }
.admin-row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.admin-btn { padding: 10px 14px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--ink); }
.admin-btn-danger { color: #B3261E; }
.admin-btn-primary { width: 100%; padding: 14px; background: var(--ink); color: #fff; border: none; }
.admin-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.admin-form-row { display: flex; gap: 8px; } .admin-form-row > * { flex: 1; min-width: 0; }
.fp-report { margin: 12px auto 0; display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em; color: var(--ink-faint); padding: 8px 12px; }
.fp-report-box { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.fp-report-box[hidden] { display: none; }
.fp-report-send { padding: 13px; border-radius: 999px; background: #B3261E; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em; }

/* the [hidden] attribute must always win over component display rules */
[hidden] { display: none !important; }
.admin-item-box { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.admin-item-select { width: 100%; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); }

.verify-gate { z-index: 210; }
.verify-card { text-align: center; }
.verify-text { font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin: 4px 0 18px; overflow-wrap: anywhere; }
.verify-link { display: block; width: 100%; margin-top: 10px; padding: 12px 0; font-size: 11px; font-weight: 800; letter-spacing: .05em; color: var(--ink-faint); }
.verify-link:disabled { opacity: .5; }
.verify-card .account-error { margin-top: 12px; }

/* detailed vector map */
.map-gl { position:absolute; inset:0; z-index:0; display:none; }
#screen-map.gl-on .map-gl { display:block; }
#screen-map.gl-on .map-svg { display:none; }
.map-gl .maplibregl-ctrl-top-right { top:calc(8px + env(safe-area-inset-top)); }
.gl-marker { position:relative; width:30px; height:30px; cursor:pointer; }
.gl-dot { position:absolute; inset:0; border-radius:50%; background:var(--ink); color:#fff; border:2.5px solid #fff; font:800 13px/25px system-ui,sans-serif; text-align:center; box-shadow:0 2px 8px rgba(0,0,0,.35); }
.gl-halo { position:absolute; inset:-9px; border-radius:50%; background:var(--accent-soft); opacity:.7; }
.gl-self .gl-dot { background:var(--accent); }
.gl-self .gl-halo { animation:glpulse 2s ease-out infinite; }
@keyframes glpulse { 0%{transform:scale(.7);opacity:.9} 100%{transform:scale(1.6);opacity:0} }
.map-share-now { margin-top:10px; width:100%; border:2px solid var(--ink); background:#fff; color:var(--ink); border-radius:14px; padding:11px; font-weight:800; font-size:12px; letter-spacing:.04em; cursor:pointer; }
