/* ════════════════ Тема «Баренцево море» ════════════════ */
:root {
  --abyss:   #04121f;
  --deep:    #072a44;
  --ocean:   #0c4a6e;
  --text:    #eaf6fb;
  --hint:    #8fb4cc;
  --accent:  #34e0d0;   /* аква */
  --accent2: #38bdf8;   /* небо/вода */
  --ok:      #43e3b0;
  --glow:    rgba(52,224,208,.45);
  --card:    rgba(13,42,66,.55);
  --card-solid: #0d2a42;
  --line:    rgba(120,200,230,.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 84px;
  background:
    radial-gradient(120% 80% at 50% -10%, #0e4a6e 0%, transparent 60%),
    linear-gradient(180deg, #06283f 0%, #061d30 40%, #04121f 100%);
  background-color: var(--abyss);
  min-height: 100vh;
}

/* ───────────── Фон-океан ───────────── */
.ocean-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(90% 60% at 15% 10%, rgba(56,189,248,.16), transparent 60%),
    radial-gradient(80% 60% at 90% 30%, rgba(52,224,208,.12), transparent 60%),
    radial-gradient(70% 50% at 50% 110%, rgba(14,116,144,.20), transparent 60%);
}
.ocean-svg { width: 100%; height: 100%; }
.wline {
  fill: none; stroke: rgba(141,210,233,.18); stroke-width: 1.4;
  stroke-linecap: round; animation: drift 16s ease-in-out infinite alternate;
}
.wline.w2 { stroke: rgba(52,224,208,.14); animation-duration: 20s; }
.wline.w3 { stroke: rgba(56,189,248,.12); animation-duration: 24s; }
.wline.w4 { stroke: rgba(141,210,233,.10); animation-duration: 18s; }
@keyframes drift {
  from { transform: translateX(-12px); }
  to   { transform: translateX(12px); }
}
.bg-whale { fill: rgba(141,210,233,.07); animation: swim 26s ease-in-out infinite alternate; }
.bg-whale.bw2 { fill: rgba(52,224,208,.06); animation-duration: 34s; transform-origin: center; }
@keyframes swim {
  from { transform: translate(0,0) rotate(-2deg); }
  to   { transform: translate(26px,-14px) rotate(2deg); }
}

/* ───────────── Шапка / бонусная карта ───────────── */
.card-header {
  position: sticky; top: 0; z-index: 500;
  padding: 16px 18px 30px;
  background: linear-gradient(150deg, rgba(12,74,110,.92), rgba(7,42,68,.92));
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.header-whale {
  position: absolute; right: -30px; top: -6px; width: 200px; height: 100px;
  fill: rgba(255,255,255,.05); transform: rotate(-8deg); pointer-events: none;
}
.card-stamp {
  font-size: 10px; letter-spacing: .22em; color: var(--accent);
  text-transform: uppercase; font-weight: 700; opacity: .85; margin-bottom: 12px;
}
.card-stamp .wx {
  letter-spacing: .04em; color: var(--text); opacity: .9; white-space: nowrap;
}
.tier-row { display: flex; align-items: center; gap: 12px; position: relative; }
.tier-emoji {
  font-size: 30px;
  filter: drop-shadow(0 0 10px var(--glow));
}
.tier-text { flex: 1; min-width: 0; }
.tier-name { font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.tier-sub { font-size: 11.5px; color: var(--hint); margin-top: 2px; }
.points {
  font-size: 20px; font-weight: 800; color: #06283f;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  padding: 5px 13px; border-radius: 20px;
  box-shadow: 0 0 16px var(--glow);
}
.points::after { content: " ⭐"; font-size: 12px; }
.progress {
  height: 9px; background: rgba(255,255,255,.12);
  border-radius: 8px; overflow: hidden; margin-top: 14px;
  position: relative;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 8px; transition: width .6s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 0 12px var(--glow);
}
.progress-label { font-size: 11.5px; color: var(--hint); margin-top: 7px; }
.wave-divider {
  position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 26px;
}
.wave-divider path { fill: var(--abyss); opacity: .9; }

/* ───────────── Контент ───────────── */
main { padding: 14px; position: relative; z-index: 1; }
.section-title {
  font-size: 12px; color: var(--accent); text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; margin: 18px 4px 10px;
}

/* ───────────── Карта на реальной геометрии Териберки (OSM) ───────────── */
#map.neonmap {
  position: relative; width: 100%; border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(70,230,214,.18);
  box-shadow: 0 12px 34px rgba(0,0,0,.45), inset 0 0 60px rgba(8,40,60,.5);
  background: #03101c;
}
.geo-svg { display: block; width: 100%; height: auto; touch-action: none; }

.g-land { fill: #04141f; }
.g-sea { fill: #082942; }
.g-water { fill: #0c3a59; stroke: #45b4d6; stroke-width: 2; opacity: .85; }
.g-coast { fill: none; stroke: #5be7ff; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.g-river { fill: none; stroke: #46e6d6; stroke-width: 3; opacity: .85; stroke-linecap: round; }
.g-road-major { fill: none; stroke: #dbe8f3; stroke-width: 4.5; opacity: .85; stroke-linecap: round; stroke-linejoin: round; }
.g-road-minor { fill: none; stroke: #88a6bd; stroke-width: 3; opacity: .6; stroke-linecap: round; }
.g-road-path { fill: none; stroke: #5f7a8e; stroke-width: 2; opacity: .45; stroke-dasharray: 4 7; stroke-linecap: round; }

.geo-svg .poi { cursor: pointer; }
.geo-svg .poi-ring { fill: #06222f; stroke: var(--c); stroke-width: 4; filter: drop-shadow(0 0 7px var(--c)); }
.geo-svg .poi-emoji { font-size: 38px; text-anchor: middle; }
.geo-svg .poi-badge { fill: var(--c); filter: drop-shadow(0 0 5px var(--c)); }
.geo-svg .poi-check { font-size: 17px; text-anchor: middle; fill: #06222f; font-weight: 900; }

.gps-core { fill: #3aa0ff; stroke: #eaf6fb; stroke-width: 3; }
.gps-pulse {
  fill: #3aa0ff; opacity: .25; transform-box: fill-box; transform-origin: center;
  animation: gpsPulse 1.8s ease-out infinite;
}
@keyframes gpsPulse { 0% { transform: scale(.35); opacity: .45; } 100% { transform: scale(1.5); opacity: 0; } }
#gpsDot.hidden { display: none; }

.gps-btn {
  position: absolute; right: 12px; bottom: 54px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid rgba(58,160,255,.5);
  background: rgba(7,30,46,.85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 20px; cursor: pointer; box-shadow: 0 0 16px rgba(58,160,255,.3);
  display: grid; place-items: center;
}
.gps-btn:active { transform: scale(.92); }

.map-legend {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px;
  padding: 7px 12px; border-radius: 12px; background: rgba(4,18,28,.72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(70,230,214,.16); font-size: 11px; color: var(--hint);
}
.map-legend span { display: flex; align-items: center; gap: 5px; }
.map-legend span::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 6px var(--c);
}

.map-popup {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
  background: rgba(7,30,46,.92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(70,230,214,.3); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 22px rgba(70,230,214,.15);
  transition: opacity .2s, transform .2s;
}
.map-popup.hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
.map-popup-x {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  color: var(--hint); font-size: 16px; cursor: pointer; line-height: 1;
}
.map-popup-h { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; padding-right: 20px; }
.map-popup-em { font-size: 24px; filter: drop-shadow(0 0 6px rgba(70,230,214,.5)); }
.map-popup-d { font-size: 13px; color: var(--hint); margin-top: 7px; line-height: 1.45; }
.map-hint { font-size: 12px; color: var(--accent); margin-top: 10px; }

/* Стеклянные карточки */
.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-radius: 18px; padding: 16px;
  margin-bottom: 13px; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-emoji {
  font-size: 28px; line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.card-body { flex: 1; min-width: 0; }
.card-name { font-weight: 700; font-size: 16.5px; }
.card-desc { font-size: 13px; color: var(--hint); margin-top: 5px; line-height: 1.45; }
.card-tip {
  font-size: 12px; margin-top: 10px; padding: 8px 11px;
  background: rgba(52,224,208,.10); border-left: 2px solid var(--accent);
  border-radius: 8px; color: #bdeee7;
}

/* Кнопка-печать */
.stamp-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 9px 15px;
  border: 1px solid rgba(52,224,208,.5); border-radius: 12px;
  background: rgba(52,224,208,.08); color: var(--accent);
  font-weight: 700; font-size: 13px; cursor: pointer; transition: all .2s;
}
.stamp-btn:active { transform: scale(.96); }
.stamp-btn.done {
  background: linear-gradient(135deg, var(--ok), var(--accent));
  border-color: transparent; color: #06283f;
  box-shadow: 0 0 14px rgba(67,227,176,.4);
}

/* Блюда */
.dish {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.dish:first-of-type { border-top: none; }
.dish-emoji { font-size: 23px; }
.dish-body { flex: 1; min-width: 0; }
.dish-name { font-weight: 600; font-size: 14.5px; }
.dish-note { font-size: 12px; color: var(--hint); margin-top: 3px; line-height: 1.4; }
.dish-check {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  border: 2px solid rgba(141,180,204,.5); background: transparent; color: transparent;
  font-size: 15px; cursor: pointer; display: grid; place-items: center; transition: all .2s;
}
.dish-check:active { transform: scale(.9); }
.dish-check.done {
  background: linear-gradient(135deg, var(--ok), var(--accent));
  border-color: transparent; color: #06283f;
  box-shadow: 0 0 12px rgba(67,227,176,.45);
}

/* Паспорт — сетка печатей */
.stamp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.stamp-cell {
  background: var(--card); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 8px; text-align: center; cursor: pointer; position: relative;
  opacity: .5; transition: all .25s;
}
.stamp-cell:active { transform: scale(.95); }
.stamp-cell.done {
  opacity: 1; border-color: rgba(52,224,208,.55);
  background: radial-gradient(120% 120% at 50% 0%, rgba(52,224,208,.20), rgba(13,42,66,.55));
  box-shadow: 0 0 18px rgba(52,224,208,.2);
}
.stamp-cell .em { font-size: 30px; filter: grayscale(1) opacity(.6); transition: filter .25s; }
.stamp-cell.done .em { filter: none drop-shadow(0 0 8px var(--glow)); }
.stamp-cell .nm { font-size: 11px; margin-top: 7px; line-height: 1.2; }
.stamp-cell .pts { font-size: 10px; color: var(--hint); margin-top: 4px; }
.stamp-cell.done::after {
  content: "✓"; position: absolute; top: 7px; right: 9px;
  color: var(--ok); font-weight: 800; font-size: 14px;
  text-shadow: 0 0 8px rgba(67,227,176,.6);
}

.guide-tag {
  display: inline-block; font-size: 11px; color: var(--accent);
  background: rgba(52,224,208,.12); padding: 4px 9px; border-radius: 8px; margin-top: 8px;
}

.goals-banner {
  font-size: 13px; background: rgba(56,189,248,.10);
  border: 1px solid rgba(56,189,248,.2);
  border-radius: 14px; padding: 11px 13px; margin-bottom: 13px; color: #cfe9ff;
}

/* ───────────── Таббар ───────────── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 600;
  display: flex;
  background: rgba(6,29,48,.85);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; color: var(--hint);
  font-size: 21px; padding: 10px 0 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  position: relative; transition: color .2s;
}
.tab span { font-size: 10px; font-weight: 600; }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--glow);
}

/* ───────────── Тост ───────────── */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #0c4a6e, #072a44);
  border: 1px solid rgba(52,224,208,.4);
  color: #fff; padding: 13px 19px; border-radius: 14px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: all .35s cubic-bezier(.22,1,.36,1); z-index: 999;
  box-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 18px rgba(52,224,208,.25);
  max-width: 82%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
