/* Стилі модуля social: листівки, зустрічі, привіти, альбом, друзі, загадки. */
.soc-layer, .soc-album {
  --paper: #fdfaf3; --ink: #0b2236; --muted: #4a5a68; --sea: #0b6e8a; --accent: #ffb547; --chip: #ece6d9;
}

/* ---------- Шар з карткою ---------- */
.soc-layer {
  position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 60, 90, 0.55), rgba(2, 14, 24, 0.82));
}
.soc-layer.open { display: flex; animation: soc-in .35s ease-out; }
@keyframes soc-in { from { opacity: 0; } }
.soc-box {
  width: min(600px, 100%); display: grid; gap: 10px; justify-items: center; color: #fff;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 4px;
}
.soc-title {
  margin: 0; font-size: clamp(18px, 4.6vw, 24px); line-height: 1.25; text-align: center; font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); max-width: 34ch; text-wrap: balance;
}
.soc-stage { width: 100%; display: flex; justify-content: center; }
.soc-text {
  margin: 0; max-width: 520px; padding: 12px 16px; border-radius: 18px; background: var(--paper); color: var(--ink);
  font-size: 17px; line-height: 1.4; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: soc-rise .4s ease-out;
}
@keyframes soc-rise { from { opacity: 0; transform: translateY(10px); } }
.soc-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.soc-actions button {
  min-height: 56px; min-width: 56px; padding: 0 22px; border-radius: 999px; font-size: 18px;
  background: rgba(255, 255, 255, 0.18); color: #fff; border: 1px solid rgba(255, 255, 255, 0.3);
}
.soc-actions button.main { background: var(--accent); color: var(--ink); font-weight: 700; border-color: transparent; min-width: 140px; }
.soc-actions button.round { padding: 0; width: 56px; font-size: 24px; }

/* ---------- Листівка ---------- */
.pc {
  width: min(560px, 92vw, calc((100dvh - 330px) * 1.5)); min-width: 260px; aspect-ratio: 3 / 2;
  perspective: 1400px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: pc-arrive .7s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pc-arrive { from { transform: translateY(40px) rotate(-6deg) scale(.85); opacity: 0; } }
.pc-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.3, .1, .2, 1); }
.pc.flipped .pc-inner { transform: rotateY(180deg); }
.pc-face {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
/* Зворотний бік: папір, марка з рибкою, штемпель, рядки адреси. */
.pc-back {
  background:
    repeating-linear-gradient(135deg, #e85d5d 0 14px, #fdfaf3 14px 22px, #3f8fd6 22px 36px, #fdfaf3 36px 44px) border-box;
  border: 9px solid transparent;
}
.pc-back::before { content: ""; position: absolute; inset: 0; background: #fbf4e4; border-radius: 6px; }
.pc-lines { position: absolute; left: 50%; right: 8%; top: 46%; display: grid; gap: 16%; height: 40%; }
.pc-lines i { display: block; border-bottom: 2px solid #d9cdb3; }
.pc-back::after { content: ""; position: absolute; left: 47%; top: 12%; bottom: 12%; border-left: 2px solid #e2d6bd; }
.pc-stamps { position: absolute; right: 7%; top: 9%; display: flex; gap: 6px; }
.pc-stamp {
  width: clamp(56px, 16vw, 92px); aspect-ratio: 4 / 5; padding: 6px; background: #fff;
  border: 3px dotted #d5c8ad; display: flex; align-items: center; justify-content: center;
  background-image: linear-gradient(#5fd0e6, #1678a8); background-clip: content-box; transform: rotate(4deg);
}
.pc-stamp + .pc-stamp { transform: rotate(-5deg); }
.pc-stamp img { width: 88%; height: 70%; object-fit: contain; }
.pc-mark {
  position: absolute; right: 26%; top: 14%; width: clamp(60px, 15vw, 88px); aspect-ratio: 1; border-radius: 50%;
  border: 3px solid rgba(11, 110, 138, 0.45); box-shadow: inset 0 0 0 6px rgba(253, 250, 243, 0), inset 0 0 0 8px rgba(11, 110, 138, 0.3);
}
.pc-mark::after { content: "🌊"; position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(22px, 6vw, 34px); opacity: .7; }
.pc-hint {
  position: absolute; left: 14%; top: 50%; font-size: clamp(44px, 12vw, 70px); transform: translateY(-50%);
  animation: pc-tap 1.2s ease-in-out infinite;
}
@keyframes pc-tap { 50% { transform: translateY(-62%) scale(1.12); } }
.pc-front { transform: rotateY(180deg); background: #bfe7f1; }
.pc-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-stickers {
  position: absolute; left: 0; right: 0; bottom: 6%; display: flex; align-items: center; justify-content: flex-start;
  padding: 0 7%; gap: 2%;
}
.pc-stickers.two { justify-content: center; }
.pc-sticker { position: relative; width: 30%; animation: pc-bob 2.6s ease-in-out infinite; }
.pc-stickers.two .pc-sticker:last-child { animation-delay: -1.3s; }
.pc-sticker img { width: 100%; display: block; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 4px 6px rgba(0, 40, 60, 0.35)); }
.mirror { transform: scaleX(-1); }
.pc-flag, .duo-fish .pc-flag {
  position: absolute; right: -4px; top: -10px; font-size: clamp(16px, 4vw, 22px); background: #fff; border-radius: 999px;
  padding: 0 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); line-height: 1.4;
}
.pc-heart { font-size: clamp(22px, 6vw, 36px); animation: pc-beat 1.1s ease-in-out infinite; }
@keyframes pc-bob { 50% { transform: translateY(-7%) rotate(-2deg); } }
@keyframes pc-beat { 30% { transform: scale(1.25); } 60% { transform: scale(.95); } }

/* ---------- Дві рибки поруч (привіт, друзі, гості) ---------- */
.soc-duo {
  width: min(520px, 92vw); aspect-ratio: 2 / 1; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  gap: 4%; padding: 0 6%; background: radial-gradient(ellipse at 50% 30%, #6fd6ea, #1678a8 75%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 -30px 40px rgba(241, 217, 166, 0.25);
}
.duo-fish { position: relative; width: 36%; animation: pc-bob 2.6s ease-in-out infinite; }
.duo-fish:last-child { animation-delay: -1.3s; }
.duo-fish img { width: 100%; display: block; filter: drop-shadow(0 4px 6px rgba(0, 40, 60, 0.35)); }
.duo-mid { font-size: clamp(34px, 10vw, 60px); animation: pc-beat 1.2s ease-in-out infinite; }
.soc-duo.pop .duo-mid { animation: duo-pop .7s cubic-bezier(.2, 1.6, .4, 1), pc-beat 1.2s ease-in-out .7s infinite; }
@keyframes duo-pop { from { transform: scale(0) rotate(-30deg); } }

/* ---------- Привіти ---------- */
.soc-greets:empty { display: none; }
.soc-greets { display: grid; gap: 6px; justify-items: center; width: 100%; }
.soc-ask { font-weight: 600; font-size: 16px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.soc-greet-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.greet {
  width: 84px; min-height: 84px; padding: 6px 4px; border-radius: 20px; background: var(--paper); color: var(--ink);
  display: grid; justify-items: center; align-content: center; gap: 2px; white-space: normal; position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); transition: transform .15s;
}
.greet:active { transform: scale(.94); }
.greet .gi { font-size: 32px; line-height: 1.1; }
.greet .gl { font-size: 12px; line-height: 1.15; font-weight: 600; text-align: center; }
.greet.sent { background: #d9f3e4; }
.greet.sent::after {
  content: "✓"; position: absolute; right: -4px; top: -6px; width: 26px; height: 26px; border-radius: 50%;
  background: #2fa66a; color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 15px;
}
.greet.flying .gi { animation: greet-fly .7s ease-in; }
@keyframes greet-fly { 60% { transform: translateY(-60px) scale(1.4); opacity: 0; } 61% { transform: none; opacity: 0; } }

/* ---------- Загадка ---------- */
.quiz { width: min(600px, 100%); display: grid; gap: 12px; }
.quiz-ask { display: flex; align-items: center; gap: 10px; background: var(--paper); color: var(--ink); border-radius: 20px; padding: 10px 14px; }
.quiz-fish { width: 70px; flex: none; animation: pc-bob 2.6s ease-in-out infinite; }
.quiz-q { font-size: clamp(18px, 4.6vw, 22px); font-weight: 700; line-height: 1.25; }
.quiz-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quiz-opt {
  padding: 0 0 8px; border-radius: 18px; background: var(--paper); color: var(--ink); overflow: hidden;
  display: grid; gap: 6px; white-space: normal; font-weight: 600; font-size: 14px; line-height: 1.2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); transition: transform .2s, opacity .3s, box-shadow .3s; min-height: 56px;
}
.quiz-opt img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.quiz-opt span { padding: 0 6px; }
.quiz-opt:active { transform: scale(.96); }
.quiz-grid.done .quiz-opt { opacity: .55; }
.quiz-grid.done .quiz-opt.right { opacity: 1; box-shadow: 0 0 0 5px #3fd18a, 0 8px 22px rgba(0, 0, 0, 0.3); transform: scale(1.05); }
.quiz-grid.done .quiz-opt.miss { opacity: .8; box-shadow: 0 0 0 4px var(--accent); }

/* ---------- Альбом ---------- */
.soc-album {
  position: fixed; inset: 0; z-index: 15; display: none; flex-direction: column; background: #f6efe0; color: var(--ink);
  padding-top: env(safe-area-inset-top);
}
.soc-album.open { display: flex; animation: alb-in .3s ease-out; }
@keyframes alb-in { from { transform: translateY(24px); opacity: 0; } }
.alb-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; gap: 12px; }
.alb-head h2 { margin: 0; font-size: 24px; }
.alb-count { color: var(--muted); font-weight: 600; }
.alb-close { width: 56px; height: 56px; padding: 0; font-size: 22px; background: var(--chip); color: var(--ink); flex: none; }
.alb-tabs { display: flex; gap: 8px; padding: 6px 16px 10px; }
.alb-tabs button { min-height: 56px; flex: 1; max-width: 220px; font-size: 17px; font-weight: 600; background: var(--chip); color: var(--ink); }
.alb-tabs button.on { background: var(--sea); color: #fff; }
.alb-body { flex: 1; overflow-y: auto; padding: 0 16px max(24px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.alb-kind { margin: 14px 0 8px; font-size: 18px; }
.alb-note { color: var(--muted); font-size: 16px; max-width: 520px; }
.alb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 480px) { .alb-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } .tile-name { font-size: 11px; padding: 12px 3px 4px; } .tile-q { font-size: 26px; } }
.tile {
  position: relative; padding: 0; border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 2; background: #d8cfbd;
  box-shadow: 0 3px 10px rgba(60, 40, 10, 0.18); white-space: normal;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.got { border: 4px solid #fff; transform: rotate(-1deg); }
.tile.got:nth-child(even) { transform: rotate(1.2deg); }
.tile-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 13px; font-weight: 700; color: #fff; text-align: center;
  background: linear-gradient(transparent, rgba(5, 30, 50, 0.75));
}
.tile-new { position: absolute; right: 6px; top: 4px; font-style: normal; font-size: 22px; animation: pc-beat 1.3s infinite; }
.tile-stack { position: absolute; left: 5px; top: 5px; display: flex; align-items: center; padding: 2px 5px; border-radius: 12px; background: rgba(255,255,255,.88); }
.tile .tile-stack img { width: 26px; height: 18px; object-fit: contain; margin-left: -6px; }
.tile .tile-stack img:first-child { margin-left: 0; }
.tile-stack b { font-size: 12px; margin-left: 2px; color: #0b4f78; }
.tile.lock img { filter: blur(7px) grayscale(.85) brightness(.75); transform: scale(1.15); }
.tile.lock { background: #b9b0a0; }
.tile-q {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.alb-empty { text-align: center; padding: 30px 0; display: grid; justify-items: center; }
.alb-empty-art { font-size: 54px; }

.friend, .meet {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 8px; border-radius: 18px;
  background: #fff; color: var(--ink); text-align: left; white-space: normal; box-shadow: 0 2px 8px rgba(60, 40, 10, 0.1);
}
.friend > img { width: 76px; height: 52px; object-fit: contain; flex: none; background: linear-gradient(#5fd0e6, #1678a8); border-radius: 12px; padding: 4px; }
.friend-tx { flex: 1; display: grid; min-width: 0; }
.friend-tx b { font-size: 17px; }
.friend-tx span { color: var(--muted); font-size: 14px; }
.friend button.main { min-height: 56px; background: var(--sea); color: #fff; font-weight: 600; padding: 0 14px; white-space: normal; max-width: 160px; }
.meet { min-height: 72px; }
.meet-place { width: 84px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.meet-fish { width: 60px; height: 44px; object-fit: contain; flex: none; }

/* Крапочка «є нове» на кнопці 📮 */
#postBtn { position: relative; }
.soc-dot {
  position: absolute; right: -2px; top: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: #ff5a5a; color: #fff; font: 700 12px/22px system-ui, sans-serif; font-style: normal; text-align: center;
  box-shadow: 0 0 0 2px rgba(6, 32, 51, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .pc, .pc-sticker, .duo-fish, .pc-heart, .duo-mid, .pc-hint, .quiz-fish, .tile-new { animation: none !important; }
  .pc-inner { transition: none; }
}

/* Заглушка, поки для місця немає намальованої листівки */
.pc-ph { display: grid; place-items: center; font-size: clamp(30px, 9vw, 64px); width: 100%; height: 100%; aspect-ratio: 3 / 2; }
.pc-ph-ocean { background: radial-gradient(circle at 30% 30%, #7fe0f0, #1678a8 70%, #0b4f78); }
.pc-ph-sea { background: linear-gradient(#bfe9f6 0 38%, #3fc1d6 38%, #0b6e8a); }
.pc-ph-river { background: linear-gradient(160deg, #a8d98a 0 30%, #5fc4e0 30% 62%, #9bd47e 62%); }
.pc-ph-lake { background: radial-gradient(ellipse at 50% 60%, #6fd6ea 0 45%, #7cc56a 46%, #4f9a4c); }
.meet-place.pc-ph { width: 84px; height: 56px; font-size: 26px; border-radius: 10px; flex: none; }
.tile.lock .pc-ph { filter: grayscale(.85) brightness(.75); }

/* Місцева тварина на листівці (знайомство) */
.pc-sticker.emoji { display: grid; place-items: center; }
.pc-animal { font-size: clamp(44px, 13vw, 84px); line-height: 1; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 4px 6px rgba(0, 40, 60, 0.35)); }
.meet-animal { font-size: 36px; width: 60px; text-align: center; flex: none; }

/* Порожня вкладка «Друзі»: три кроки, як знайти друга. */
.alb-steps { list-style: none; margin: 12px auto 0; padding: 0; display: grid; gap: 10px; max-width: 420px; text-align: left; }
.alb-steps li { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 10px 14px; }
.alb-step-ico { font-size: 28px; flex: none; }
.meet-greet { flex: none; background: #0b6e8a; color: #fff; border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: 14px; }
/* Поки відкрита листівка, значки «мандрує», назва і мушлі позаду не заважають читати. */
body:has(.soc-layer.open) .travellers, body:has(.soc-layer.open) .title,
body:has(.soc-layer.open) .shells, body:has(.soc-layer.open) .parent-btn,
body:has(.soc-layer.open) .moon { opacity: 0 !important; pointer-events: none !important; }

/* Ще не відвідане місце: пастельна плитка з м'яким силуетом виду води і маленьким замочком. */
.pc-sil { width: 100%; height: 100%; display: grid; place-items: center; }
.pc-sil svg { width: 62%; height: 70%; fill: none; stroke: rgba(255, 255, 255, 0.92); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.pc-sil-ocean { background: linear-gradient(160deg, #cdeefa, #9fd8f0); }
.pc-sil-sea { background: linear-gradient(160deg, #d6f3ef, #a6e0dc); }
.pc-sil-river { background: linear-gradient(160deg, #e3f4d6, #b9e2c4); }
.pc-sil-lake { background: linear-gradient(160deg, #e6e6fa, #c1d9f2); }
.tile.lock { background: #e8f4f6; box-shadow: 0 2px 8px rgba(60, 90, 110, 0.14); }
.tile-lock {
  position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-size: 13px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
/* Порожній альбом: як отримати листівку - трьома картинками. */
.alb-empty-cards { padding: 18px 0 8px; }
.alb-howto { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 46px; }
.alb-howto .alb-arrow { font-size: 26px; color: var(--muted); }

/* Рядок друга: довгі німецькі/польські кнопки не стискають ім'я до слова в рядку - кнопка переноситься під текст. */
.friend { flex-wrap: wrap; }
.friend-tx { flex: 1 1 150px; }
.friend button.main { flex: 0 1 auto; margin-left: auto; max-width: 100%; }
.quiz-opt .quiz-sil { aspect-ratio: 3 / 2; height: auto; }

/* «Мешканки океану» (resident): маленький підпис і рядок для батьків. */
.soc-res {
  margin: 0; max-width: 460px; padding: 6px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.86); color: #24506a;
  font-size: 13px; line-height: 1.35; text-align: center;
}
.soc-res.hidden { display: none; }
.soc-res b { color: #0b6e8a; white-space: nowrap; }
.res-tag { justify-self: start; margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: #dff3fa; color: #0b6e8a; font-size: 12px; font-style: normal; font-weight: 600; }
.alb-res-why { margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: #eaf7fb; color: #24506a; font-size: 13px; line-height: 1.35; }

/* ---------- «Поки тебе не було»: одне вікно замість пачки карток ---------- */
.soc-box { position: relative; }
.soc-stop {
  justify-self: end; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; min-width: 56px; padding: 0 16px 0 12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.28); font-size: 16px;
}
.soc-stop span { font-size: 18px; line-height: 1; }
.soc-stop b { font-weight: 600; }
.soc-stop.hidden { display: none; }
.inbox {
  width: min(460px, 100%); display: grid; gap: 10px; padding: 14px; border-radius: 22px;
  background: var(--paper); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); animation: soc-rise .4s ease-out;
}
.inbox-row {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 16px; background: var(--chip);
}
.inbox-ico { font-size: 34px; line-height: 1; text-align: center; }
.inbox-label { font-size: 18px; line-height: 1.25; font-weight: 600; }
.inbox-n {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px; display: grid; place-items: center;
  background: var(--sea); color: #fff; font-size: 22px; font-weight: 800;
}
.inbox-row.done .inbox-n { background: #3aa76d; }
.inbox-fish { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inbox-fish img { width: 48px; height: 36px; object-fit: contain; }
.inbox-fish b { font-size: 16px; color: var(--muted); }
.inbox-rest { justify-items: center; grid-auto-flow: column; align-items: center; width: auto; padding: 18px 26px; }
.inbox-big { font-size: 64px; line-height: 1; }
#postBtn.soc-nudge { animation: soc-nudge 1s ease-in-out 6; }
@keyframes soc-nudge { 50% { transform: translateY(-10px) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { #postBtn.soc-nudge { animation: none; outline: 3px solid var(--accent, #ffb547); } }
