/* ==========================================================
   Счётчик свободы — warm, calm, travel-journal aesthetic
   ========================================================== */
:root {
  --milk: #fbf7f0;
  --cream: #f6efe4;
  --cream-2: #efe5d5;
  --sand: #e6d6bd;
  --beige: #d6c1a1;
  --clay: #b9a88c;
  --terra: #c27c5e;
  --terra-soft: #d69a78;
  --peach: #e9c3a3;
  --olive: #8a8f5c;
  --olive-soft: #b4b88a;
  --powder: #e8c6be;
  --sage: #c9cfb0;
  --ink: #3d342b;
  --ink-2: #6e6253;
  --ink-3: #9a8d7c;
  --line: rgba(110, 90, 66, 0.12);
  --card: rgba(255, 252, 246, 0.72);
  --card-solid: #fffcf6;
  --shadow: 0 1px 1px rgba(90, 66, 40, 0.04), 0 10px 30px -12px rgba(90, 66, 40, 0.18), 0 30px 60px -30px rgba(90, 66, 40, 0.16);
  --shadow-soft: 0 8px 24px -14px rgba(90, 66, 40, 0.28);
  --radius: 28px;
  --radius-sm: 16px;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }
::selection { background: var(--peach); color: var(--ink); }

/* ---------- atmosphere ---------- */
.atmo { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
/* Performance: the blobs are already soft radial gradients, so no blur filter (a full-screen
   blur recomputed every frame was the main GPU cost); only transform moves → compositor only. */
.blob {
  position: absolute; border-radius: 50%; opacity: 0.55; will-change: transform;
  animation: drift 28s var(--ease) infinite alternate;
}
.b1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: radial-gradient(circle, #f1d3bd 0%, transparent 65%); }
.b2 { width: 44vmax; height: 44vmax; right: -12vmax; top: 10vh; background: radial-gradient(circle, #dfe0c4 0%, transparent 65%); animation-duration: 34s; animation-delay: -8s; }
.b3 { width: 40vmax; height: 40vmax; left: 20vw; bottom: -20vmax; background: radial-gradient(circle, #efd2cb 0%, transparent 65%); animation-duration: 40s; animation-delay: -16s; }
.b4 { width: 30vmax; height: 30vmax; right: 18vw; bottom: 8vh; background: radial-gradient(circle, #f3e3c4 0%, transparent 65%); animation-duration: 31s; animation-delay: -4s; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4vw, 3vh, 0) scale(1.08); }
  100% { transform: translate3d(-3vw, 5vh, 0) scale(0.95); }
}
/* static paper grain: a jittering 2×-viewport blended layer cost a full repaint 5 times a second */
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.32; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 18px var(--gutter);
  background: linear-gradient(to bottom, rgba(246, 239, 228, 0.92), rgba(246, 239, 228, 0.6) 70%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; justify-self: start; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-sun { animation: sunrise 2.4s var(--ease) both; transform-origin: 20px 26px; }
@keyframes sunrise { from { transform: translateY(12px); } to { transform: translateY(0); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 23px; font-weight: 600; letter-spacing: 0.01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; }

.tabs {
  position: relative; display: flex; padding: 5px; border-radius: 999px;
  background: rgba(255, 252, 246, 0.66); border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(90, 66, 40, 0.06), var(--shadow-soft);
}
.tabs-ink {
  position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 999px;
  background: linear-gradient(135deg, #fffdf9, #f7ecdd);
  box-shadow: 0 6px 16px -8px rgba(160, 100, 60, 0.45), inset 0 0 0 1px rgba(194, 124, 94, 0.18);
  transition: transform 0.6s var(--ease), width 0.6s var(--ease);
}
.tab-btn {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: 0; background: none; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap;
  transition: color 0.4s var(--ease);
}
.tab-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab-btn[aria-selected='true'] { color: var(--ink); }
.tab-btn[aria-selected='true'] svg { color: var(--terra); }
.tab-btn:focus-visible { outline: 2px solid var(--terra-soft); outline-offset: 2px; }

.admin-bar { justify-self: end; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.admin-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--olive); box-shadow: 0 0 0 4px rgba(138, 143, 92, 0.18); }
/* pulse ring: transform + opacity (composited) instead of an animated box-shadow (repaint every frame) */
.admin-dot::after, .live i::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; opacity: 0.35;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(3); opacity: 0; } 100% { transform: scale(1); opacity: 0; } }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-solid); font-size: 13px; font-weight: 600;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s;
}
.chip-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chip-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.chip-btn.ghost { background: transparent; }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter) 40px; }
.tab-panel { animation: panelIn 0.9s var(--ease) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.hero { position: relative; text-align: center; padding: clamp(28px, 6vw, 64px) 0 clamp(18px, 3vw, 30px); isolation: isolate; }
.hero.compact { padding-bottom: clamp(14px, 2.4vw, 24px); }
.hero-sun {
  position: absolute; left: 50%; top: 50%; width: clamp(220px, 34vw, 400px); aspect-ratio: 1; z-index: -1;
  transform: translate(-50%, -38%); overflow: hidden; border-radius: 50% 50% 0 0 / 100% 100% 0 0; height: calc(clamp(220px, 34vw, 400px) / 2);
  -webkit-mask: linear-gradient(to bottom, #000 60%, transparent);
  mask: linear-gradient(to bottom, #000 60%, transparent);
}
.hero-sun span {
  position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(241, 196, 160, 0.85), rgba(233, 179, 140, 0.45) 45%, rgba(233, 179, 140, 0) 70%);
  transform: translateY(calc((1 - var(--sun, 0)) * 60%));
  transition: transform 2.6s var(--ease);
}
.eyebrow { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--terra); }
.eyebrow.small { font-size: 11px; color: var(--ink-3); }
.hero-number {
  margin: 0; font-family: var(--serif); font-weight: 500; line-height: 0.9; letter-spacing: -0.02em;
  font-size: clamp(96px, 18vw, 210px); font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(180deg, #4a3d31 20%, #8a6a52 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-number.small { font-size: clamp(70px, 12vw, 140px); }
.hero-number .unit { font-size: 0.42em; font-style: italic; color: var(--terra); -webkit-text-fill-color: var(--terra); margin-left: 0.04em; }
.hero-line { margin: 14px auto 0; max-width: 34em; font-size: clamp(15px, 1.7vw, 18px); color: var(--ink-2); }
.hero-line b { color: var(--ink); font-weight: 700; white-space: nowrap; }

/* ---------- the big freedom bar ---------- */
.freedom { --p: 0; position: relative; margin: clamp(48px, 7vw, 76px) 0 clamp(36px, 5vw, 56px); }
.freedom-track {
  position: relative; height: clamp(76px, 11vw, 124px); padding: 9px; border-radius: 999px;
  background: linear-gradient(180deg, #ebe0cf, #f5ede1);
  box-shadow: inset 0 3px 10px rgba(110, 80, 50, 0.16), inset 0 -2px 0 rgba(255, 255, 255, 0.8), 0 1px 0 rgba(255, 255, 255, 0.9), var(--shadow);
}
.freedom-fill {
  position: relative; height: 100%; width: max(calc(var(--p) * 1%), 0%); min-width: 0; border-radius: 999px; overflow: hidden;
  background: #e2ab87;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -6px 14px rgba(150, 80, 50, 0.18), 0 8px 22px -8px rgba(194, 124, 94, 0.6);
  transition: width 2.4s var(--ease);
}
/* the slow colour drift slides a wider gradient layer (transform) instead of animating
   background-position, which repainted the bar on every frame */
.freedom-fill::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 160%; will-change: transform;
  background: linear-gradient(90deg, #efd7bd 0%, #e8b996 40%, #d99872 75%, #c98463 100%);
  animation: hue 9s ease-in-out infinite alternate;
}
.freedom.has-value .freedom-fill { min-width: calc(clamp(76px, 11vw, 124px) - 18px); }
@keyframes hue { to { transform: translateX(-37.5%); } }
.freedom-fill::after {
  content: ''; position: absolute; right: 0; top: 10%; bottom: 10%; width: 40px; border-radius: 50%;
  background: radial-gradient(ellipse at 70% 50%, rgba(255, 246, 232, 0.9), transparent 70%); filter: blur(4px);
}
.wave { position: absolute; left: 0; width: 200%; height: 46%; bottom: 0; }
.wave path { fill: rgba(255, 245, 232, 0.22); }
.wave.w1 { animation: wave 7s linear infinite; }
.wave.w2 { animation: wave 11s linear infinite reverse; height: 60%; }
.wave.w2 path { fill: rgba(160, 90, 60, 0.1); }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.sheen {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, transparent 62%);
  transform: translateX(-120%); animation: sheen 5.5s var(--ease) 1.8s infinite;
}
@keyframes sheen { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }
.motes i {
  position: absolute; bottom: -8px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 248, 238, 0.85);
  animation: mote 6s ease-in infinite; opacity: 0;
}
.motes i:nth-child(1) { left: 8%; animation-delay: 0s; }
.motes i:nth-child(2) { left: 22%; animation-delay: 1.4s; width: 4px; height: 4px; }
.motes i:nth-child(3) { left: 37%; animation-delay: 2.6s; }
.motes i:nth-child(4) { left: 51%; animation-delay: 0.8s; width: 3px; height: 3px; }
.motes i:nth-child(5) { left: 66%; animation-delay: 3.4s; width: 5px; height: 5px; }
.motes i:nth-child(6) { left: 80%; animation-delay: 2s; width: 4px; height: 4px; }
.motes i:nth-child(7) { left: 92%; animation-delay: 4.2s; }
@keyframes mote {
  0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 0.9; }
  100% { transform: translate(14px, -130px); opacity: 0; }
}
.milestones span {
  position: absolute; top: 22%; bottom: 22%; left: calc(9px + (100% - 18px) * var(--m) / 100); width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(110, 80, 50, 0.22), transparent);
}
.freedom-scale { position: relative; height: 22px; margin-top: 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-3); }
.freedom-scale span { position: absolute; transform: translateX(-50%); }
.freedom-scale span:first-child { left: 18px; }
.freedom-scale span[style] { left: calc(9px + (100% - 18px) * var(--m) / 100); }
.freedom-scale span:last-child { right: 0; transform: none; font-family: var(--serif); font-style: italic; font-size: 16px; letter-spacing: 0.02em; color: var(--terra); top: -3px; }

.freedom-marker {
  position: absolute; bottom: calc(100% - 4px); left: calc(9px + (100% - 18px) * min(var(--p), 100) / 100);
  transform: translateX(-50%); transition: left 2.4s var(--ease); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 6px;
}
.freedom.has-value .freedom-marker { left: max(calc(9px + (100% - 18px) * min(var(--p), 100) / 100 - 22px), 48px); }
.marker-bubble {
  padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--milk); white-space: nowrap;
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em; box-shadow: 0 10px 20px -10px rgba(61, 52, 43, 0.7);
  position: relative;
}
.marker-bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.marker-bird { width: 26px; height: 16px; fill: none; stroke: var(--olive); stroke-width: 2.2; stroke-linecap: round; position: absolute; top: -22px; left: 70%; animation: fly 3.6s ease-in-out infinite; }
@keyframes fly {
  0%, 100% { transform: translate(0, 0) scaleY(1); } 25% { transform: translate(4px, -5px) scaleY(0.6); }
  50% { transform: translate(8px, -2px) scaleY(1); } 75% { transform: translate(3px, -7px) scaleY(0.7); }
}
.freedom.complete .freedom-fill::before { background: linear-gradient(90deg, #dfe0bf, #c9cfa0 40%, #a8ae76 100%); }
.freedom.complete .marker-bubble { background: var(--olive); }
.freedom.complete .marker-bubble::after { background: var(--olive); }

/* ---------- cards ---------- */
.cards { display: grid; gap: clamp(14px, 2vw, 22px); margin-bottom: clamp(14px, 2vw, 22px); }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, 1fr); margin-top: clamp(14px, 2vw, 22px); }
.card {
  position: relative; padding: clamp(20px, 2.6vw, 30px); border-radius: var(--radius);
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.7);
  /* no backdrop blur: behind the cards there is only the soft atmosphere, blurring it changed
     nothing visible but was recomputed every frame while the blobs drift */
  box-shadow: var(--shadow);
  animation: rise 0.9s var(--ease) both;
}
.cards > .card:nth-child(2) { animation-delay: 0.08s; }
.cards > .card:nth-child(3) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.stat-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.stat-value { margin: 10px 0 2px; font-family: var(--serif); font-size: clamp(34px, 4vw, 46px); font-weight: 500; line-height: 1; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.stat-hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.stat.accent { background: linear-gradient(150deg, rgba(246, 222, 202, 0.85), rgba(255, 249, 240, 0.75)); }
.stat.accent .stat-value { color: #9c5c40; }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-family: var(--serif); font-size: clamp(26px, 3vw, 32px); font-weight: 500; }
.count-pill { min-width: 34px; padding: 4px 12px; border-radius: 999px; background: var(--cream-2); font-size: 13px; font-weight: 700; text-align: center; color: var(--ink-2); }

.source-list { list-style: none; margin: 0; padding: 0; }
.source {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  padding: 16px 0; border-top: 1px solid var(--line);
  animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms);
}
.source:first-child { border-top: 0; }
.source-num {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink-2); background: var(--c, var(--cream-2));
}
.source-body { min-width: 0; }
.source-name { margin: 0; font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-share { position: relative; height: 5px; margin-top: 9px; border-radius: 9px; background: var(--cream-2); overflow: hidden; }
.source-share span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--c, var(--terra-soft)); filter: saturate(1.8) brightness(0.88); transition: width 1.6s var(--ease); }
.source-amount { font-family: var(--serif); font-size: 24px; font-weight: 600; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.source-amount small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.source.inactive { opacity: 0.5; }
.empty { margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--ink-3); text-align: center; padding: 18px 0; }

/* admin editing inside the source list */
.source-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.source-edit .amount-input { width: 120px; text-align: right; }
.source-name-input { width: 100%; font-weight: 600; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-solid); color: var(--ink-2); transition: all 0.3s var(--ease);
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--terra); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.icon-btn.danger:hover { color: #a64c3c; background: #f7e3dc; }
.switch { position: relative; width: 40px; height: 24px; border-radius: 99px; border: 0; background: var(--sand); transition: background 0.3s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform 0.4s var(--ease-spring); }
.switch[aria-checked='true'] { background: var(--olive-soft); }
.switch[aria-checked='true']::after { transform: translateX(16px); }

/* ---------- inputs & buttons ---------- */
input[type='text'], input[type='search'], input[type='password'] {
  height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 253, 249, 0.9);
  outline: none; transition: border-color 0.3s, box-shadow 0.3s; min-width: 0;
}
input:focus { border-color: rgba(194, 124, 94, 0.5); box-shadow: 0 0 0 4px rgba(214, 154, 120, 0.18); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 20px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, #cf8c6b, #b9714f); color: #fffaf3; font-weight: 700; font-size: 14.5px; white-space: nowrap;
  box-shadow: 0 10px 20px -10px rgba(185, 113, 79, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 16px 26px -12px rgba(185, 113, 79, 0.85); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.small { height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--card-solid); }
.btn.olive { background: linear-gradient(135deg, #a3a872, #858a55); box-shadow: 0 10px 20px -10px rgba(110, 115, 70, 0.8); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.6; pointer-events: none; }

.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }
.inline-edit { gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); align-items: center; flex-wrap: wrap; }
.inline-edit input { flex: 1; height: 38px; border-radius: 12px; }
.inline-edit label { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 13px; color: var(--ink-2); }
.inline-edit label input { max-width: 90px; }
.add-source { gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.add-source input[name='name'] { flex: 2; }
.add-source input[name='amount'] { flex: 1; min-width: 110px; }

/* ---------- map ---------- */
/* the map is part of the page: edge to edge, no frame, edges dissolve into the background */
.map-full {
  --edge: max(var(--gutter), calc((100vw - 1180px) / 2 + var(--gutter)));
  position: relative; width: 100vw; margin-left: calc(50% - 50vw);
  animation: fadeIn 1.2s var(--ease) both;
}
.map-full #map {
  -webkit-mask: linear-gradient(to bottom, transparent 0, #000 7%, #000 90%, transparent 100%), linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask: linear-gradient(to bottom, transparent 0, #000 7%, #000 90%, transparent 100%), linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%);
  mask-composite: intersect;
}
.map-full .map-toolbar { left: var(--edge); right: var(--edge); top: 6px; }
.map-full .country-panel {
  position: absolute; z-index: 4; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(760px, calc(100% - 2 * var(--gutter))); margin: 0; box-shadow: var(--shadow);
  background: rgba(255, 252, 246, 0.92);
}
.map-toolbar {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 3; display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 10px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.9); backdrop-filter: blur(8px); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-soft);
  animation: popIn 0.5s var(--ease-spring) both;
}
.crumb svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crumb:hover { color: var(--terra); }
@keyframes popIn { from { opacity: 0; transform: scale(0.85) translateX(-8px); } to { opacity: 1; transform: none; } }
.map-title { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); font-weight: 500; padding: 0 8px; text-shadow: 0 1px 0 #fff; pointer-events: none; transition: opacity 0.4s; }
.map-search { margin-left: auto; }
.map-search input { height: 40px; width: 200px; border-radius: 999px; background: rgba(255, 252, 246, 0.92); box-shadow: var(--shadow-soft); }
.zoom-ctrl { display: flex; flex-direction: column; gap: 6px; margin-left: auto; position: absolute; right: 0; top: 54px; }
body.is-admin .zoom-ctrl { margin-left: 0; }
.zoom-ctrl button {
  width: 40px; height: 40px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 252, 246, 0.92);
  display: grid; place-items: center; box-shadow: var(--shadow-soft); transition: transform 0.3s var(--ease);
}
.zoom-ctrl button:hover { transform: scale(1.06); color: var(--terra); }
.zoom-ctrl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.map-stage { position: relative; height: clamp(420px, min(86vh, calc(100vw / 1.5 + 40px)), 980px); }
#map { width: 100%; height: 100%; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#map:active { cursor: grabbing; }
.graticule { fill: none; stroke: rgba(150, 120, 90, 0.11); stroke-width: 0.6; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.land {
  fill: #e4d6bf; stroke: #fbf6ed; stroke-width: 0.6; vector-effect: non-scaling-stroke;
  transition: fill 0.9s var(--ease), opacity 0.8s var(--ease), filter 0.4s;
  cursor: pointer;
}
.land:hover, .land.hover { fill: #d9c6a6; filter: url(#lift); }
.land.visited { fill: var(--fill); }
.land.visited:hover, .land.visited.hover { fill: var(--fill); filter: url(#lift) brightness(1.03) saturate(1.15); }
.countries.dimmed .land { opacity: 0.32; }
.countries.dimmed .land.current { opacity: 0; pointer-events: none; }
.w-region { stroke: #fbf6ed; stroke-width: 0.4; vector-effect: non-scaling-stroke; pointer-events: none; transition: opacity 0.8s var(--ease); }
.world-regions.dimmed .w-region { opacity: 0.32; }
.w-region.hidden { opacity: 0 !important; }
.land.appear { animation: landIn 1.2s var(--ease) both; }
@keyframes landIn { from { opacity: 0; } }
.region {
  fill: #ede2d0; stroke: #fffaf2; stroke-width: 0.8; vector-effect: non-scaling-stroke; cursor: pointer;
  transition: fill 0.8s var(--ease), filter 0.3s;
  animation: regionIn 0.9s var(--ease) both; animation-delay: calc(var(--i, 0) * 6ms);
}
.region:hover, .region.hover { fill: #e2d2b8; filter: url(#lift); }
.region.visited { fill: var(--fill); }
.region.visited:hover, .region.visited.hover { filter: url(#lift) saturate(1.2); }
.regions.readonly .region { cursor: default; }
.region.in-full { fill: var(--fill); fill-opacity: 0.42; }
@keyframes regionIn { from { opacity: 0; } }
.ripple { fill: none; stroke: var(--terra-soft); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.spark { pointer-events: none; }

.map-loading {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px;
  font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--ink-3); transition: opacity 0.6s; pointer-events: none;
}
.map-loading span { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--sand); border-top-color: var(--terra-soft); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-loading.done { opacity: 0; }
.map-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px;
  background: rgba(61, 52, 43, 0.82); color: var(--milk); font-size: 13px; white-space: nowrap; animation: popIn 0.4s var(--ease) both; pointer-events: none;
}
.tooltip {
  position: absolute; z-index: 5; left: 0; top: 0; pointer-events: none; padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 252, 246, 0.96); box-shadow: 0 14px 30px -14px rgba(90, 66, 40, 0.45); border: 1px solid var(--line);
  transform: translate(-50%, calc(-100% - 14px)); white-space: nowrap; max-width: 260px;
}
.tooltip b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.tooltip small { font-size: 12px; color: var(--ink-3); }
.tooltip .tt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c); vertical-align: 1px; }

.country-panel {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 16px 20px; margin: 0 14px 14px;
  border-radius: 20px; background: rgba(255, 252, 246, 0.86); border: 1px solid var(--line); backdrop-filter: blur(10px);
  animation: rise 0.6s var(--ease) both;
}
.cp-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 200px; }
.cp-swatch { width: 38px; height: 38px; border-radius: 12px; background: var(--c, var(--sand)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04), 0 6px 14px -8px var(--c, var(--sand)); transition: background 0.8s var(--ease); flex: none; }
.cp-name { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.1; }
.cp-meta { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.cp-actions { gap: 8px; flex-wrap: wrap; }
.cp-tip { width: 100%; margin: 0; font-size: 12.5px; color: var(--ink-3); }

.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meter-value { margin: 0; font-family: var(--serif); font-size: 22px; color: var(--ink-2); }
.meter-value b { font-size: 46px; font-weight: 500; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.meter-track { position: relative; height: 22px; margin-top: 16px; padding: 4px; border-radius: 99px; background: linear-gradient(180deg, #ebe0cf, #f5ede1); box-shadow: inset 0 2px 5px rgba(110, 80, 50, 0.14); }
.meter-fill { position: relative; height: 100%; width: 0; border-radius: inherit; transition: width 2s var(--ease); overflow: hidden; }
.meter-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 65%); transform: translateX(-120%); animation: sheen 6s var(--ease) 2s infinite; }
.meter-fill.olive { background: linear-gradient(90deg, #dcdcb8, #b4b88a 60%, #969b65); }
.meter-fill.terra { background: linear-gradient(90deg, #f0d2c5, #e2ad99 60%, #cf8c74); }
.meter-fill.free { width: 100% !important; opacity: 0.35; }
.city-edit { gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--card-solid); overflow: hidden; }
.stepper button { width: 42px; height: 42px; border: 0; background: none; font-size: 20px; color: var(--ink-2); transition: background 0.2s; }
.stepper button:hover { background: var(--cream-2); color: var(--terra); }
.stepper input { width: 70px; height: 42px; border: 0; border-radius: 0; text-align: center; font-weight: 700; background: transparent; box-shadow: none !important; }
.goal-input { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.goal-input input { width: 120px; height: 42px; }

.visited-wrap { margin-top: clamp(26px, 4vw, 40px); text-align: center; }
.visited-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.v-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.8); font-size: 13.5px; font-weight: 600; transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.v-chip i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.v-chip small { color: var(--ink-3); font-weight: 500; }
.v-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

/* ---------- footer, toast, login ---------- */
.foot { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 28px var(--gutter) 40px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.foot .dot { opacity: 0.5; }
.live { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; }
.live i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--olive-soft); }
.live.off i { background: var(--clay); }
.live.off i::after { animation: none; opacity: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50; padding: 12px 20px; border-radius: 999px;
  background: rgba(61, 52, 43, 0.92); color: var(--milk); font-size: 14px; font-weight: 600; box-shadow: 0 16px 40px -16px rgba(61, 52, 43, 0.8);
  transform: translate(-50%, 140%); opacity: 0; transition: transform 0.6s var(--ease-spring), opacity 0.4s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: rgba(140, 66, 50, 0.94); }

.login { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(246, 239, 228, 0.6); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: fadeIn 0.6s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } }
.login-card { width: min(380px, 100%); padding: 36px 30px 28px; border-radius: var(--radius); background: var(--card-solid); box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; gap: 12px; animation: rise 0.8s var(--ease) both; }
.login-mark { width: 56px; height: 56px; margin: 0 auto 4px; }
.login-card h2 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 500; }
.login-card p { margin: 0 0 8px; color: var(--ink-3); font-size: 14px; }
.login-card .login-error { color: #a64c3c; margin: 0; font-weight: 600; }
.login-card.shake { animation: shake 0.5s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.login-back { font-size: 13px; color: var(--ink-3); text-decoration: none; margin-top: 4px; }
.login-back:hover { color: var(--terra); }

/* ---------- posters (owner only) ---------- */
body.is-admin .poster-btn.admin-only { display: inline-flex !important; margin: 16px auto 0; }
.poster-btn span { display: inline !important; }
.poster-modal {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px;
  background: rgba(61, 52, 43, 0.28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fadeIn 0.4s var(--ease) both;
}
.poster-dialog {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: var(--radius); background: var(--card-solid); box-shadow: var(--shadow); animation: rise 0.6s var(--ease) both;
}
.poster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.poster-head h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; }
.poster-formats { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--cream-2); }
.poster-formats button { flex: 1; padding: 8px 6px; border: 0; border-radius: 999px; background: none; font-size: 13px; font-weight: 600; color: var(--ink-3); transition: all 0.3s var(--ease); }
.poster-formats button[aria-checked='true'] { background: var(--card-solid); color: var(--ink); box-shadow: var(--shadow-soft); }
.poster-amounts { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.poster-amounts input { accent-color: var(--terra); width: 16px; height: 16px; }
.poster-preview { display: grid; place-items: center; min-height: 200px; border-radius: 18px; background: var(--cream-2); padding: 12px; transition: opacity 0.3s; }
.poster-preview.busy { opacity: 0.5; }
.poster-preview canvas { max-width: 100%; max-height: 52vh; width: auto; height: auto; border-radius: 10px; box-shadow: var(--shadow-soft); }

/* confetti petals when a goal is reached / a place is marked */
.petal { position: fixed; z-index: 60; width: 10px; height: 14px; border-radius: 60% 0 60% 0; pointer-events: none; will-change: transform, opacity; }

/* ---------- responsive ---------- */
.brand-name, .brand-sub { white-space: nowrap; }
@media (max-width: 1240px) {
  .admin-label, #copyLink span { display: none; }
  .is-admin .brand-sub { display: none; }
}
@media (max-width: 980px) {
  .top { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .brand-sub { display: none; }
  .admin-label { display: none; }
}
@media (max-width: 760px) {
  .cards.three, .cards.two { grid-template-columns: 1fr; }
  .cards.three .stat:first-child { order: 2; }
  .cards.three .stat.accent { order: 1; }
  .cards.three .stat:last-child { order: 3; }
  .map-search input { width: 150px; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .top { padding-top: 12px; padding-bottom: 10px; gap: 10px; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 34px; height: 34px; }
  .tabs { width: 100%; }
  .tab-btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 13px; gap: 6px; }
  .tab-btn svg { width: 16px; height: 16px; }
  .chip-btn span { display: none; }
  .hero-line b { white-space: normal; }
  .source { grid-template-columns: 38px 1fr; gap: 6px 12px; }
  .source-num { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
  .source-amount { grid-column: 2; font-size: 21px; }
  .source-edit { grid-column: 1 / -1; justify-content: flex-start; }
  .source-edit .amount-input { flex: 1; width: auto; }
  .add-source { flex-direction: column; align-items: stretch !important; }
  .map-stage { height: 62vh; min-height: 340px; }
  .map-full.world-view .map-stage { height: calc(100vw / 1.5 + 56px); min-height: 0; }
  body.is-admin .map-full.world-view .map-stage { height: calc(100vw / 1.5 + 104px); }
  .map-full .map-toolbar { top: 4px; flex-wrap: wrap; }
  .map-full .country-panel { position: relative; left: auto; bottom: auto; transform: none; width: auto; margin: 0 var(--gutter); }
  .map-title { font-size: 20px; }
  .map-search { order: 5; width: 100%; margin-left: 0; }
  .map-search input { width: 100%; }
  .zoom-ctrl { top: auto; bottom: -1px; position: relative; display: none; }
  .country-panel { padding: 14px; }
  .freedom-scale span[style] { font-size: 11px; }
  .freedom-scale span:first-child { left: 10px; }
  .marker-bubble { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
