* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: var(--tg-theme-bg-color, #12141c);
  --card: var(--tg-theme-secondary-bg-color, #1c2030);
  --text: var(--tg-theme-text-color, #eef0f6);
  --hint: var(--tg-theme-hint-color, #8b91a5);
  --accent: #e8b04b;
  --ok: #6fce7f;
  --busy: #7aa5e8;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;   /* лист не должен «оттягиваться» при рисовании */
}
/* пока палец ведёт штрих - список под холстом не скроллится вообще */
body.drawing #view { overflow: hidden; }

#top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
}
#who { color: var(--hint); font-size: 13px; }
#grain { font-size: 16px; display: flex; align-items: center; gap: 5px; }
#grain b { color: var(--accent); }
#grain img { width: 19px; height: 19px; }

.ico img { width: 40px; height: 40px; display: block; }
img.g { width: 13px; height: 13px; vertical-align: -2px; margin-left: 1px; }
img.hicon { width: 21px; height: 21px; vertical-align: -4px; margin-right: 4px; }

#view { flex: 1; overflow-y: auto; padding: 4px 12px 84px; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
     color: var(--hint); margin: 14px 4px 8px; font-weight: 600; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card .ico { font-size: 30px; width: 40px; text-align: center; flex: none; }
.card .mid { flex: 1; min-width: 0; }
.card .name { font-weight: 600; }
.card .sub { color: var(--hint); font-size: 13px; }
.card .st { font-size: 13px; margin-top: 2px; }
.st.free { color: var(--ok); }
.st.flying { color: var(--busy); }
.st.resting { color: var(--accent); }

button.act {
  border: 0; border-radius: 10px;
  background: var(--accent); color: #22180a;
  font: 600 13px/1 inherit;
  padding: 9px 12px;
  flex: none;
}
button.act:disabled { opacity: .4; }
button.act.ghost { background: #2a3046; color: var(--text); }

#tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  background: color-mix(in srgb, var(--bg) 88%, black);
  border-top: 1px solid #ffffff14;
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; border: 0; background: none; color: var(--hint);
  font: 11px/1.2 inherit; padding: 8px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
#tabs img { width: 24px; height: 24px; opacity: .5; }
#tabs button.on { color: var(--accent); }
#tabs button.on img { opacity: 1; }

#overlay {
  position: fixed; inset: 0;
  background: #000a;
  display: flex; align-items: flex-end;
  z-index: 10;
}
/* авторский display перебивает атрибут hidden - гасим явно */
#overlay[hidden] { display: none; }
#overlay .sheet {
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
}
.sheet h3 { font-size: 16px; margin-bottom: 10px; }
.sheetback {
  border: 0; background: none; color: var(--hint);
  font: 500 13px/1 inherit; padding: 2px 0 12px; display: block;
}
.biothumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.sheet .card { background: #262c40; }
.sheet input {
  width: 100%; border: 1px solid #ffffff22; border-radius: 10px;
  background: var(--bg); color: var(--text);
  padding: 10px 12px; font: inherit; margin-bottom: 10px;
}
.empty { color: var(--hint); text-align: center; padding: 32px 0; }

/* чипы выбора пути */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin: 0 -2px; }
.chip {
  flex: none; display: flex; align-items: center; gap: 5px;
  border: 1px solid #ffffff1c; border-radius: 999px;
  background: #262c40; color: var(--hint);
  font: 500 12px/1 inherit; padding: 8px 11px;
}
.chip img { width: 15px; height: 15px; opacity: .65; }
.chip.bird img { width: 22px; height: 22px; opacity: 1; }
button.act.ren { padding: 9px 10px; font-size: 15px; }
.chip.on { background: var(--accent); color: #22180a; border-color: transparent; }
.chip.on img { opacity: 1; }
.rhint { margin: 2px 2px 12px; font-size: 12.5px; }

/* профиль */
.prof { display: flex; align-items: center; gap: 14px; padding: 10px 4px 16px; }
.pav {
  width: 60px; height: 60px; border-radius: 50%; flex: none;
  background: var(--card); display: grid; place-items: center; font-size: 28px;
}
.pav img { width: 42px; height: 42px; }
.pname { font-size: 19px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--card); border-radius: 12px; padding: 12px 8px; text-align: center;
}
.stat b { display: block; font-size: 19px; color: var(--accent); }
.stat span { font-size: 11px; color: var(--hint); }
.badge {
  flex: none; font-size: 11px; color: #22180a; background: var(--accent);
  border-radius: 999px; padding: 4px 9px; font-weight: 600;
}
.rar { font-size: 11px; font-weight: 500; margin-left: 6px; }

/* карточки птиц: крупная картинка, статы, действие - раскладка как у карточных коллекций */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bcard {
  position: relative;
  background: var(--card); border-radius: 16px; padding: 12px 12px 12px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.bcard .pic {
  width: 100%; height: 96px; display: grid; place-items: center; margin-bottom: 6px;
}
.bcard .pic img { max-width: 88px; max-height: 92px; }
.bname { font-weight: 700; font-size: 15px; }
/* без uppercase: названия видов теперь пишутся с большой буквы сами */
.btype { font-size: 12px; color: var(--hint); }
.bspeed {
  font-size: 13px; color: var(--text); margin: 7px 0 8px;
  border-top: 1px solid #ffffff12; padding-top: 8px; width: 100%;
}
.prow { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin-bottom: 9px; }
.pill {
  font-size: 10.5px; border-radius: 999px; padding: 3px 8px;
  background: #ffffff12; color: var(--hint);
}
.pill.home { background: #2c4a33; color: var(--ok); }
.pill.fly  { background: #27395c; color: var(--busy); }
.pill.rest { background: #4a3d23; color: var(--accent); }
.bcard .ren {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  border: 0; background: none; color: var(--hint); font-size: 13px; padding: 4px 6px;
}
button.act.wide { width: 100%; padding: 10px; }
button.act.wide.ghost { background: #2a3046; color: var(--hint); opacity: 1; }
.card.drop { background: linear-gradient(100deg, #34302a, #2a2f42); }

/* Холст письма. Пропорции задаёт сам canvas (у фото из галереи они любые),
   поэтому aspect-ratio тут нет - иначе фото растянет. */
#pad {
  display: block; margin: 0 auto;
  width: auto; height: auto; max-width: 100%; max-height: 62vh;
  border-radius: 14px; background: #e8dcc0;
  box-shadow: 0 6px 18px #0006;
  touch-action: none;            /* жесты браузера по холсту выключены */
  overscroll-behavior: contain;
}
.tools { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 0; }
.tools .dot { display: inline-block; border-radius: 50%; background: currentColor; }
#cap {
  width: 100%; border: 1px solid #ffffff22; border-radius: 10px;
  background: var(--card); color: var(--text);
  padding: 10px 12px; font: inherit; margin: 12px 0 8px;
}
button.act.send { width: 100%; padding: 13px; font-size: 15px; }

/* ---------- экран полёта: лента пути ---------- */
#flight { display: none; flex-direction: column; flex: 1; overflow-y: auto; padding-bottom: 24px; }
body.flightmode #view, body.flightmode #tabs { display: none; }
body.flightmode #flight { display: flex; }

.band {
  position: relative; height: 168px; overflow: hidden;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(#1b2740 0%, #3d4a63 100%);
  transition: background 1.2s ease;
}

.biolabel {
  position: absolute; top: 10px; left: 0; right: 0; text-align: center;
  font: 600 12px/1 inherit; letter-spacing: .08em; text-transform: uppercase;
  color: #ffffffcc; text-shadow: 0 2px 6px #0008; opacity: 0;
}
.biolabel.show { animation: biofade 3.4s ease forwards; }
@keyframes biofade { 0% { opacity: 0; transform: translateY(-4px) } 18%,62% { opacity: 1; transform: none } 100% { opacity: 0 } }

/* полоска пройденных миров */
.trail { display: flex; gap: 3px; padding: 10px 16px 0; }
.seg {
  flex: 1; height: 26px; border-radius: 6px; position: relative;
  background: #ffffff0d; display: grid; place-items: center; overflow: hidden;
}
.seg span { font-size: 10px; color: var(--hint); position: relative; z-index: 1; }
.seg.done { background: var(--hz); }
.seg.done span { color: #ffffffcc; }
.seg.on { background: linear-gradient(var(--sky), var(--hz)); box-shadow: 0 0 0 2px var(--accent) inset; }
.seg.on span { color: #fff; font-weight: 600; }

.layer { position: absolute; left: 0; bottom: 0; width: 100%; background-repeat: repeat-x; }
.layer.l1 { height: 120px; background-image: url(/icons/sky.svg?v=19); background-size: 400px 120px; opacity: .6; animation: scrollx-400 74s linear infinite; }
/* пейзаж биома - подставляется из JS, меняется на границах отрезков */
.layer.l2 { height: 124px; background-size: 400px 124px; transition: opacity .5s; animation: scrollx-400 26s linear infinite; }
.layer.l3 { height: 46px;  background-image: url(/icons/grass.svg?v=19); background-size: 240px 46px; opacity: .85; animation: scrollx-240 9s linear infinite; }

.stars { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
.band.night .stars, .band.dusk .stars { opacity: .8; }
.stars i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #fff; animation: tw 3s infinite alternate;
}
@keyframes tw { from { opacity: .25 } to { opacity: 1 } }

/* Птица - главный герой экрана, держим её крупной и по центру полосы. */
#flyer {
  position: absolute; top: 24%; left: 50%; width: 104px; height: 104px;
  margin-left: -52px; transition: transform .8s ease-out;
  animation: bob 1.8s ease-in-out infinite;
}
/* НИКАКОГО filter: drop-shadow на птицах. В вебвью айфона он рисует тень от
   ПРЯМОУГОЛЬНИКА картинки, а не от силуэта - под птицей чёрный квадрат.
   Правки через object-fit не помогли, поэтому фильтр убран отовсюду совсем.
   Тень под птицей в полёте рисуем отдельным эллипсом (.flyshade). */
#flyer img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
}
.flyshade {
  position: absolute; left: 50%; margin-left: -34px; top: 24%;
  width: 68px; height: 14px; border-radius: 50%; z-index: -1;
  transform: translateY(78px);
  background: radial-gradient(closest-side, #00000066, transparent 72%);
}
@keyframes bob { 0%,100% { translate: 0 0 } 50% { translate: 0 -9px } }

/* Наземная птица (страус сезона). Она НЕ ЛЕТАЕТ: сажаем её на землю,
   покачивание делаем мелким и частым - это бег, а не парение. */
.band.onfoot #flyer { top: auto; bottom: 12%; animation: trot .38s ease-in-out infinite; }
.band.onfoot .flyshade { top: auto; bottom: 10%; transform: none; opacity: .8; }
@keyframes trot { 0%,100% { translate: 0 0 } 50% { translate: 0 -4px } }

.fhead { padding: 14px 16px 4px; }
.fhead .to { font-size: 17px; font-weight: 600; }
.fhead .meta { color: var(--hint); font-size: 13px; margin-top: 2px; }
.bigtime {
  font-size: 30px; font-weight: 700; letter-spacing: .01em;
  color: var(--accent); margin: 10px 16px 2px;
}
.bigtime small { font-size: 13px; color: var(--hint); font-weight: 400; margin-left: 6px; }

.beats { padding: 12px 16px 0; }
.beat { display: flex; gap: 12px; align-items: flex-start; }
.beat .rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 16px; }
.beat .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid #414a63; margin-top: 4px;
}
.beat.done .dot { background: var(--ok); border-color: var(--ok); }
.beat.now .dot { background: var(--accent); border-color: var(--accent);
                 box-shadow: 0 0 0 4px #e8b04b33; }
.beat .line { width: 2px; flex: 1; min-height: 22px; background: #333b50; }
.beat.done .line { background: #3f6a49; }
.beat .txt { padding-bottom: 12px; font-size: 14px; color: var(--hint); }
.beat.done .txt { color: var(--text); }
.beat.now .txt { color: var(--accent); font-weight: 600; }
.beat.bad .txt { color: #e07a5f; }
.beat.good .txt { color: var(--ok); }

.backbtn {
  margin: 16px; padding: 11px; border: 0; border-radius: 12px;
  background: #2a3046; color: var(--text); font: 600 14px/1 inherit; width: calc(100% - 32px);
}
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: #000c; color: #fff; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; z-index: 20;
  animation: fade 2.2s forwards;
}
@keyframes fade { 0%,75% { opacity: 1 } 100% { opacity: 0 } }

/* игра «зерно с руки» */
.gwrap { position: relative; border-radius: 16px; overflow: hidden; background: #171c29; }
#gc { display: block; width: 100%; touch-action: none; }
.gover {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 24px;
  background: #0e111ad9; text-align: center;
}
.gover[hidden] { display: none; }
.gtitle { font-size: 21px; font-weight: 700; color: var(--accent); }
.gsub { font-size: 13px; color: var(--hint); margin-bottom: 6px; }
.gover .act { max-width: 220px; }
.ghud {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; font: 700 18px/1 inherit;
  color: var(--accent); text-shadow: 0 2px 6px #000a; pointer-events: none;
}
.ghud[hidden] { display: none; }
#gtime { color: #fff; font-weight: 500; font-size: 15px; }

/* палитра и штампы */
.chip.ink { padding: 6px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; display: block; border: 1px solid #ffffff33; }
.chip.stamp { font-size: 17px; padding: 6px 10px; }

/* отправка не должна выглядеть как выбор птицы */
.chip.bird { background: #262c40; }
.chip.bird.on { background: #2f3a55; color: var(--text); box-shadow: 0 0 0 2px var(--accent) inset; }
button.act.send { background: #2f7de0; color: #fff; }
button.act.send:disabled { background: #2a3046; color: var(--hint); }
/* чипы «кто понесёт» не должны наезжать на кнопку отправки */
.tools { margin-bottom: 4px; }
button.act.send { margin-top: 14px; }
.gico { font-size: 26px; display: grid; place-items: center; }
.gbtns { display: flex; gap: 8px; justify-content: center; }
.gover .gtitle img.hicon { vertical-align: -3px; }
@keyframes scrollx-400 { to { background-position-x: -400px; } }
@keyframes scrollx-240 { to { background-position-x: -240px; } }

/* ---------- дизайн-пас ---------- */

/* плавающий док вкладок, как у Roost */
#tabs {
  left: 10px; right: 10px; bottom: 8px;
  border-radius: 24px; border: 1px solid #ffffff14;
  background: color-mix(in srgb, var(--bg) 72%, black);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px #000a;
  padding-bottom: 0;
}
#tabs button { padding: 9px 0 11px; }
/* Док - позиционированный элемент БЕЗ z-index, то есть нулевой. Карандаш
   переименования на карточке птицы стоит с z-index:1 и рисовался ПОВЕРХ дока.
   5 - выше карточек, ниже шторки (10) и тоста (20). */
#tabs { z-index: 5; }
#view { padding-bottom: 108px; }

/* карточка птицы: подсветка за птицей, чуть глубины */
.bcard {
  background: linear-gradient(160deg, #232a3e, #191e2c);
  border: 1px solid #ffffff0e;
  box-shadow: 0 8px 22px #0006;
}
.bcard .pic {
  background: radial-gradient(closest-side, #ffffff17, transparent 75%);
}
.bcard .pic img {
  max-width: 96px; max-height: 96px;
  
}

/* магазин: полоска редкости слева */
.card.shopc { box-shadow: inset 3px 0 0 var(--rar), 0 6px 18px #0004; border: 1px solid #ffffff0c; }
.card.shopc .ico img {  }

/* основная кнопка - синяя, как у Roost; зерно остаётся золотым акцентом */
button.act { background: #2f7de0; color: #fff; }
button.act.ghost { background: #2a3046; color: var(--text); }
button.act:disabled { background: #2a3046; color: var(--hint); opacity: 1; }

.card { border: 1px solid #ffffff0c; box-shadow: 0 6px 18px #0004; }
.card.drop { border-color: #e8b04b33; }

/* Небо перетекает между мирами, а не щёлкает: 6 биомов за полёт - это 6 склеек,
   и каждая читалась как баг перерисовки. */
/* Экран полёта - это про пейзаж под крылом, а не про подпись под ним.
   На 190px сцена занимала треть экрана, остальное было пустотой. */
.band {
  height: min(46vh, 360px); box-shadow: inset 0 -30px 40px -30px #000c;
  transition: background 1.4s ease;
}
.layer.l2 { transition: opacity .42s ease; }
.layer.l2.fade { opacity: 0; }

/* Светило и дымка у горизонта: без них небо - просто заливка. */
.sundisc {
  position: absolute; right: 16%; top: 16%;
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(closest-side, #fff8d8 0%, #ffe9a8 46%, #ffe9a800 72%);
  opacity: .9; filter: blur(.3px);
}
.band.night .sundisc, .band.dusk .sundisc {
  background: radial-gradient(closest-side, #eef3ff 0%, #cfd8ff 44%, #cfd8ff00 72%);
  width: 40px; height: 40px; opacity: .85;
}
.hazeglow {
  position: absolute; left: 0; right: 0; bottom: 34px; height: 92px;
  background: radial-gradient(60% 100% at 50% 100%, #ffd9a03d, transparent 70%);
  pointer-events: none;
}
.band.night .hazeglow { background: radial-gradient(60% 100% at 50% 100%, #7f9dff2e, transparent 70%); }
/* дальняя стайка: три чёрточки, медленно тянутся по небу */
.birds.far {
  position: absolute; top: 26%; left: -30%; width: 30%; height: 20px;
  background:
    radial-gradient(3px 1.4px at 10% 40%, #0006, transparent),
    radial-gradient(3px 1.4px at 40% 20%, #0006, transparent),
    radial-gradient(3px 1.4px at 68% 55%, #0006, transparent);
  opacity: .5; animation: farfly 34s linear infinite;
}
@keyframes farfly { from { transform: translateX(0) } to { transform: translateX(440%) } }

/* Чужая птица навстречу: справа налево, зеркально (спрайты смотрят вправо),
   строго выше земли. Ни на что не влияет, просто в мире есть кто-то ещё. */
.passer {
  position: absolute; right: -80px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  animation: passby 8.5s linear forwards;
  pointer-events: none;
}
.passer img { width: 52px; height: auto; transform: scaleX(-1); }
.pname2 {
  font-size: 10px; color: #fff; background: #0006; border-radius: 999px;
  padding: 2px 7px; white-space: nowrap; backdrop-filter: blur(3px);
}
@keyframes passby {
  0%   { transform: translateX(0) translateY(0); opacity: 0 }
  12%  { opacity: .95 }
  50%  { transform: translateX(-58vw) translateY(-14px) }
  88%  { opacity: .95 }
  100% { transform: translateX(-118vw) translateY(6px); opacity: 0 }
}

/* Прилёт: вспышка, печать «ДОСТАВЛЕНО», птица делает круг почёта. */
.arrived {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; pointer-events: none; z-index: 3;
}
.arrived span {
  border: 3px solid var(--accent); color: var(--accent);
  border-radius: 12px; padding: 8px 16px;
  font: 800 19px/1 inherit; letter-spacing: .1em;
  background: #12141cc0; transform: rotate(-8deg) scale(2.4);
  text-shadow: 0 2px 8px #000;
}
.band.land .arrived { animation: stamp 2.6s ease-out forwards; }
.band.land .arrived span { animation: stampin .5s cubic-bezier(.2,1.6,.4,1) forwards; }
.band.land::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  background: #fff; opacity: 0; animation: flashout .7s ease-out forwards;
  pointer-events: none;
}
.band.land #flyer { animation: bob 1.8s ease-in-out infinite, cheer 1.1s ease-out 1; }
@keyframes stamp { 0% { opacity: 0 } 10% { opacity: 1 } 78% { opacity: 1 } 100% { opacity: 0 } }
@keyframes stampin { to { transform: rotate(-8deg) scale(1) } }
@keyframes flashout { 0% { opacity: .55 } 100% { opacity: 0 } }
@keyframes cheer {
  0% { scale: 1 } 35% { scale: 1.28 } 60% { scale: .94 } 100% { scale: 1 }
}

/* заголовок */
#top { padding: 14px 16px 10px; }
#grain {
  background: #e8b04b1a; border: 1px solid #e8b04b40;
  border-radius: 999px; padding: 5px 12px 5px 8px; font-weight: 600;
}
/* ---------- живой док вкладок ---------- */
#tabs button { position: relative; transition: color .18s; }
/* значки вкладок - системные эмодзи вместо своих SVG */
#tabs button i {
  position: relative; z-index: 1; display: block;
  font-style: normal; font-size: 21px; line-height: 24px; height: 24px;
  filter: opacity(.45) saturate(.7);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), filter .18s;
}
#tabs button.on i { transform: translateY(-2px) scale(1.18); filter: none; }
#tabs button.on::before {
  content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 32px; border-radius: 13px;
  background: linear-gradient(160deg, #e8b04b30, #e8b04b10);
  border: 1px solid #e8b04b3a;
}

/* ---------- игры: карточки меню и HUD ---------- */
.runsrow {
  display: flex; justify-content: space-between; color: var(--hint);
  font-size: 13px; padding: 0 4px 10px;
}
.runsrow b { color: var(--accent); }
.card.gamec { cursor: pointer; }
.card.gamec .gpic {
  width: 54px; height: 54px; flex: none; border-radius: 14px;
  background: radial-gradient(closest-side, #ffffff1c, transparent 80%), #262c40;
  display: grid; place-items: center;
}
.card.gamec .gpic img { width: 42px; height: 42px;  }
.gpill {
  background: #000000559; background: #00000059; border-radius: 999px;
  padding: 5px 11px; backdrop-filter: blur(4px);
}
@keyframes shakex { 0%,100% { transform: none } 25% { transform: translateX(-7px) } 75% { transform: translateX(7px) } }
#gc.shake { animation: shakex .16s 2; }
/* ---------- магазин: карточки как в коллекционных играх ---------- */
.scard {
  position: relative;
  background: linear-gradient(165deg, #242b40, #191e2c);
  border: 1px solid var(--rar); border-radius: 16px;
  padding: 12px 10px 10px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  box-shadow: 0 8px 22px #0006, inset 0 0 26px -14px var(--rar);
}
.scard.poor { opacity: .62; }
.scard .pic {
  width: 100%; height: 92px; display: grid; place-items: center; margin-bottom: 4px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rar) 26%, transparent), transparent 75%);
}
.scard .pic img { max-width: 88px; max-height: 88px;  }
.scard .btype { margin-bottom: 6px; }
.srow {
  display: flex; gap: 10px; justify-content: center; width: 100%;
  font-size: 12px; color: var(--hint);
  border-top: 1px solid #ffffff12; padding: 7px 0 9px;
}
.owned {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  font-size: 10px; font-weight: 600; color: #22180a;
  background: var(--ok); border-radius: 999px; padding: 3px 7px;
}
.lockrow {
  color: var(--hint); font-size: 13px; text-align: center;
  border: 1px dashed #ffffff1f; border-radius: 14px; padding: 16px 12px;
}
.card.tripc .biothumb { width: 44px; height: 44px; }
.tripico { width: 46px; height: 46px; border-radius: 13px; box-shadow: 0 4px 10px #0007; }
.card.tripc .ico { width: 46px; }

/* купленный вид: приглушаем цену, но карточку оставляем яркой - это трофей */
.scard.have { box-shadow: 0 8px 22px #0006, inset 0 0 30px -10px var(--rar); }
.scard.have .act[disabled] { background: #ffffff10; color: var(--hint); border: 1px solid var(--rar); }
.scard.myth .pic { background: radial-gradient(closest-side, #e8b04b3d, transparent 75%); }

/* ---------- календарь наград ---------- */
.card.daily .ico img { width: 46px; height: 46px; object-fit: contain; }
.card.daily.hot { border-color: #e8b04b55; background: linear-gradient(100deg, #3a3324, #2a2f42); }
.dbar { height: 5px; border-radius: 999px; background: #ffffff14; margin-top: 7px; overflow: hidden; }
.dbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #e8b04b, #f3d68a); }
.dgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
  margin: 10px 0 14px;
}
.dcell {
  position: relative; border-radius: 12px; padding: 20px 4px 7px;
  background: #1b2130; border: 1px solid #ffffff10;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 86px; justify-content: center;
}
.dcell img { width: 34px; height: 34px; object-fit: contain; }
.dcell .dnum {
  position: absolute; top: 5px; left: 7px;
  font-size: 10px; color: var(--hint); font-weight: 700;
}
.dcell .dval { font-size: 10px; color: var(--hint); line-height: 1.15; text-align: center; }
/* рамка и подпись по редкости самой птицы, а не «любая птица = фиолетовая» */
.dcell.bird { background: linear-gradient(165deg, #262c3c, #1b202c); }
.dcell.bird img { width: 46px; height: 46px; }
.dcell.bird .dval { font-weight: 600; }
.dcell.bird.rare { border-color: #5aa9d6aa; }
.dcell.bird.rare .dval { color: #8ecdf0; }
.dcell.bird.epic { border-color: #b07ae0aa; }
.dcell.bird.epic .dval { color: #d6b8f0; }
.dcell.bird.myth { border-color: #e8b04b; box-shadow: inset 0 0 22px -8px #e8b04b; }
.dcell.bird.myth .dval { color: var(--accent); }
.dcell.got { opacity: .45; }
.dcell.got::after {
  content: '✓'; position: absolute; top: 4px; right: 6px;
  color: var(--ok); font-size: 12px; font-weight: 700;
}
.dcell.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 18px -6px #e8b04b88; }

/* ---------- профиль ---------- */
.profcard {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(170deg, #232a3e, #171c28);
  border: 1px solid #ffffff10; border-radius: 20px;
  padding: 18px 16px 16px; text-align: center;
  box-shadow: 0 10px 26px #0006;
}
.profcard > * { position: relative; z-index: 1; }
.pedit {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  border: 0; border-radius: 999px; padding: 6px 9px; font-size: 13px;
  background: #0006; color: #fff; backdrop-filter: blur(6px);
}
.codexbtn { margin-top: 10px; }

/* ---------- фоны карточки профиля ----------
   Каждый - три-четыре слоя: дальнее свечение, ближнее пятно, база и «пыль».
   Плоский двухцветный градиент на такой большой площади выглядит дёшево. */
.profcard::before, .bdsw::before, .dbg::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
}
.bd-night::before {
  background:
    radial-gradient(90% 70% at 22% 0%, #4b5f9e 0%, transparent 58%),
    radial-gradient(70% 55% at 88% 18%, #7d63c8 0%, transparent 55%),
    linear-gradient(170deg, #1d2447 0%, #0c0f22 100%);
}
.bd-night::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .55;
  background-image:
    radial-gradient(1.6px 1.6px at 18% 24%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 71% 16%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 44% 62%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 86% 54%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 32% 84%, #fff, transparent);
}
.bd-dawn::before {
  background:
    radial-gradient(80% 65% at 50% 108%, #ffd9a0 0%, transparent 62%),
    radial-gradient(90% 70% at 18% 6%, #6f8fd0 0%, transparent 60%),
    linear-gradient(170deg, #2b3f72 0%, #7a5b7e 62%, #d98f6a 100%);
}
/* лучи восходящего солнца */
.bd-dawn::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .3;
  background: repeating-conic-gradient(from 200deg at 50% 118%,
    #fff2d0 0deg 4deg, transparent 4deg 16deg);
  -webkit-mask-image: linear-gradient(0deg, #000, transparent 72%);
  mask-image: linear-gradient(0deg, #000, transparent 72%);
}
.bd-forest::before {
  background:
    radial-gradient(70% 55% at 78% 8%, #a8d98a 0%, transparent 55%),
    radial-gradient(110% 80% at 30% 110%, #16351f 0%, transparent 62%),
    linear-gradient(170deg, #2c5238 0%, #12291b 100%);
}
/* силуэты ёлок по низу */
.bd-forest::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 54%; z-index: 0; opacity: .5;
  background:
    conic-gradient(from 135deg at 12% 100%, #0d1f13 0deg 90deg, transparent 90deg),
    conic-gradient(from 135deg at 34% 100%, #0d1f13 0deg 90deg, transparent 90deg),
    conic-gradient(from 135deg at 58% 100%, #0d1f13 0deg 90deg, transparent 90deg),
    conic-gradient(from 135deg at 82% 100%, #0d1f13 0deg 90deg, transparent 90deg);
}
.bd-sea::before {
  background:
    radial-gradient(75% 60% at 20% 4%, #9fe6ef 0%, transparent 58%),
    radial-gradient(100% 70% at 70% 108%, #0b3b63 0%, transparent 60%),
    linear-gradient(170deg, #2f7fa8 0%, #103a5c 100%);
}
/* блики волн */
.bd-sea::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 62%; z-index: 0; opacity: .28;
  background: repeating-linear-gradient(100deg,
    #d8f4ff 0 2px, transparent 2px 16px);
  -webkit-mask-image: linear-gradient(0deg, #000, transparent 88%);
  mask-image: linear-gradient(0deg, #000, transparent 88%);
}
.bd-lilac::before {
  background:
    radial-gradient(70% 60% at 78% 6%, #f0c2ec 0%, transparent 58%),
    radial-gradient(90% 70% at 16% 96%, #4b2f7a 0%, transparent 60%),
    linear-gradient(165deg, #8c6fd0 0%, #3a2560 100%);
}
/* лепестки сирени */
.bd-lilac::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .4;
  background-image:
    radial-gradient(5px 3px at 16% 22%, #f6d9f7, transparent),
    radial-gradient(4px 3px at 62% 14%, #f6d9f7, transparent),
    radial-gradient(6px 3px at 38% 58%, #efc9f2, transparent),
    radial-gradient(4px 2px at 84% 46%, #f6d9f7, transparent),
    radial-gradient(5px 3px at 26% 82%, #efc9f2, transparent),
    radial-gradient(4px 3px at 72% 76%, #f6d9f7, transparent);
}
.bd-sunset::before {
  background:
    radial-gradient(65% 55% at 50% 104%, #ffb45e 0%, transparent 60%),
    radial-gradient(85% 65% at 82% 10%, #ff7d6b 0%, transparent 55%),
    linear-gradient(170deg, #5a2c62 0%, #b2503f 70%, #f0965a 100%);
}
/* полосы облаков поперёк заката */
.bd-sunset::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .22;
  background: repeating-linear-gradient(178deg,
    #ffe6c4 0 3px, transparent 3px 26px);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 90%, #000, transparent 75%);
  mask-image: radial-gradient(80% 60% at 50% 90%, #000, transparent 75%);
}
.bd-ice::before {
  background:
    radial-gradient(80% 60% at 26% 2%, #eafcff 0%, transparent 55%),
    radial-gradient(95% 70% at 76% 104%, #2a5f8f 0%, transparent 60%),
    linear-gradient(170deg, #7fc4e8 0%, #274a75 100%);
}
/* снежинки */
.bd-ice::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .6;
  background-image:
    radial-gradient(2px 2px at 14% 18%, #fff, transparent),
    radial-gradient(2.5px 2.5px at 48% 30%, #fff, transparent),
    radial-gradient(2px 2px at 78% 14%, #fff, transparent),
    radial-gradient(2px 2px at 30% 62%, #fff, transparent),
    radial-gradient(2.5px 2.5px at 66% 72%, #fff, transparent),
    radial-gradient(2px 2px at 88% 54%, #fff, transparent),
    radial-gradient(2px 2px at 10% 86%, #fff, transparent);
}
.bd-gold::before {
  background:
    radial-gradient(60% 50% at 50% -6%, #fff3c4 0%, transparent 58%),
    radial-gradient(95% 75% at 80% 106%, #6b3f0a 0%, transparent 60%),
    linear-gradient(168deg, #e0aa48 0%, #7a4d16 100%);
}
/* золотые лучи из-за верхнего края */
.bd-gold::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .26;
  background: repeating-conic-gradient(from 160deg at 50% -18%,
    #fff6d0 0deg 3deg, transparent 3deg 13deg);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 78%);
  mask-image: linear-gradient(180deg, #000, transparent 78%);
}
.bd-coral::before {
  background:
    radial-gradient(70% 58% at 24% 4%, #ffd9e4 0%, transparent 56%),
    radial-gradient(90% 70% at 82% 104%, #8c2f52 0%, transparent 60%),
    linear-gradient(168deg, #f0879f 0%, #6d2440 100%);
}
.bd-tiger::before {
  background:
    radial-gradient(64% 52% at 70% 4%, #ffd9c2 0%, transparent 54%),
    radial-gradient(96% 74% at 20% 106%, #4a1414 0%, transparent 60%),
    linear-gradient(168deg, #c34a3a 0%, #3d1010 100%);
}
.bd-tiger::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .3;
  background-image:
    radial-gradient(2px 2px at 22% 30%, #fff, transparent),
    radial-gradient(2px 2px at 64% 22%, #fff, transparent),
    radial-gradient(2px 2px at 40% 68%, #fff, transparent),
    radial-gradient(2px 2px at 80% 60%, #fff, transparent);
}
.bd-ember::before {
  background:
    radial-gradient(60% 50% at 50% 106%, #ffd06a 0%, transparent 55%),
    radial-gradient(80% 62% at 24% 8%, #ff5a2e 0%, transparent 58%),
    linear-gradient(170deg, #6a1414 0%, #1b0808 100%);
}
/* искры, поднимающиеся от углей */
.bd-ember::after {
  content: ''; position: absolute; inset: 0; z-index: 0; opacity: .75;
  background-image:
    radial-gradient(2px 2px at 20% 74%, #ffd06a, transparent),
    radial-gradient(2.5px 2.5px at 44% 58%, #ffb347, transparent),
    radial-gradient(2px 2px at 68% 80%, #ffd06a, transparent),
    radial-gradient(2px 2px at 82% 46%, #ff8a3d, transparent),
    radial-gradient(2.5px 2.5px at 34% 34%, #ffd06a, transparent),
    radial-gradient(2px 2px at 58% 22%, #ffb347, transparent);
}
/* коралловый: волнистые рифы */
.bd-coral::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 58%; z-index: 0; opacity: .3;
  background: repeating-radial-gradient(circle at 50% 100%,
    #ffe3ec 0 2px, transparent 2px 20px);
}

/* выбор фона */
.bdgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.bdsw {
  position: relative; overflow: hidden; isolation: isolate;
  height: 72px; border-radius: 14px; border: 1px solid #ffffff14;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 4px; color: #fff; font: 600 11px/1.15 inherit; text-align: center;
}
.bdsw > * { position: relative; z-index: 1; text-shadow: 0 1px 3px #0009; }
.bdsw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bdsw.shut { filter: grayscale(.85) brightness(.55); }
.bdhint { font-weight: 400; font-size: 9.5px; opacity: .85; }
/* мини-плашка фона в календаре */
.dbg {
  position: relative; overflow: hidden; display: block;
  width: 40px; height: 30px; border-radius: 7px; border: 1px solid #ffffff20;
}

/* ---------- кодекс ---------- */
.cxbar { height: 6px; border-radius: 999px; background: #ffffff12; overflow: hidden; margin: 4px 0 6px; }
.cxbar i { display: block; height: 100%; background: linear-gradient(90deg, #5aa9d6, #e8b04b); }
.cxh { font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
       color: var(--hint); margin: 14px 2px 7px; font-weight: 600; }
.cxgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cxc {
  border-radius: 13px; padding: 8px 5px 7px; text-align: center;
  background: #1b2130; border: 1px solid var(--rar);
}
.cxpic { height: 56px; display: grid; place-items: center; }
/* Ширина ОБЯЗАТЕЛЬНА. С одними max-* незагруженная картинка имеет размер 0x0,
   а loading="lazy" по нулевому элементу не срабатывает - получается тупик:
   нет размера, значит нет загрузки, значит нет размера. */
.cxpic img { width: 54px; height: auto; max-height: 54px; }
.cxname { font-size: 11.5px; font-weight: 600; }
.cxsub { font-size: 9.5px; color: var(--hint); line-height: 1.2; margin-top: 2px; }
.cxc.miss { border-color: #ffffff12; }
/* Невзятый вид - силуэт: видно, кого не хватает, но не видно, кто это.
   Силуэт СВЕТЛЫЙ: чёрный на тёмной карточке просто исчезает. */
.cxc.miss .cxpic img { filter: brightness(0) invert(1) opacity(.16); }
.cxc.have .cxpic img {  }

/* ---------- доска почёта ---------- */
.board { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.brow2 {
  display: flex; align-items: center; gap: 10px;
  background: #1b2130; border: 1px solid #ffffff0c; border-radius: 11px;
  padding: 9px 12px; font-size: 13px;
}
.brow2.me { border-color: var(--accent); background: #2a2718; }
.bpl { width: 24px; flex: none; text-align: center; color: var(--hint); font-weight: 700; }
.bnm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bvl { flex: none; font-weight: 700; color: var(--accent); }
.bvl i { font-style: normal; font-weight: 400; font-size: 11px; color: var(--hint); }

/* ---------- путь: полоса прогресса вместо ленты биомов ---------- */
.fprog { padding: 12px 16px 2px; }
.fprogtop {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--hint); margin-bottom: 7px;
}
#fbiome { color: var(--text); font-weight: 600; }
.fbar {
  position: relative; height: 13px; border-radius: 999px;
  background: #ffffff1f; overflow: visible;
  box-shadow: inset 0 1px 3px #0007;
}
.fbar i {
  display: block; height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, #57b05a, #8ae06f);
  box-shadow: 0 0 14px -1px #8ae06fcc;
  transition: width .6s ease;
}
.fbar b {
  position: absolute; top: -9px; left: 0; margin-left: -11px;
  font-size: 15px; transition: left .6s ease; filter: drop-shadow(0 2px 3px #0008);
}

/* ---------- шансы яиц ---------- */
.odds { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.odd { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.oname { width: 74px; flex: none; color: var(--rar); font-weight: 600; }
.obar { flex: 1; height: 7px; border-radius: 999px; background: #ffffff12; overflow: hidden; }
.obar i { display: block; height: 100%; background: var(--rar); }
.opct { width: 44px; flex: none; text-align: right; color: var(--hint); }

/* ---------- карточка птицы: цвет редкости ---------- */
.bcard {
  border: 1px solid var(--rar, #ffffff0e);
  box-shadow: 0 8px 22px #0006, inset 0 0 30px -16px var(--rar, transparent);
}
.bcard .pic {
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--rar, #fff) 22%, transparent), transparent 74%);
}
.bcard.rar-myth { box-shadow: 0 8px 22px #0006, inset 0 0 26px -10px var(--rar); }

/* ---------- яйца ---------- */
.card.eggc .eggpic { font-size: 32px; display: block; }
.card.eggc.empty2 .eggpic { filter: grayscale(1) opacity(.5); }
.card.eggc.ready { border-color: #e8b04b55; background: linear-gradient(100deg, #34302a, #2a2f42); }
.card.eggc.ready .eggpic { animation: wobble 1.4s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-9deg) } 50% { transform: rotate(9deg) } }

/* ---------- достижения ---------- */
.achs { display: flex; flex-direction: column; gap: 6px; }
.ach {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid #ffffff0c; border-radius: 13px;
  padding: 10px 12px;
}
.achi { font-size: 18px; flex: none; filter: grayscale(1) opacity(.5); }
.ach.done .achi { filter: none; }
.achm { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.achm b { font-size: 13.5px; font-weight: 600; }
.achm i { font-style: normal; font-size: 11px; color: var(--hint); }
.achbar { height: 4px; border-radius: 999px; background: #ffffff12; overflow: hidden; margin-top: 3px; }
.achbar em { display: block; height: 100%; background: var(--busy); }
.achg { flex: none; font-size: 12px; font-weight: 700; color: var(--hint); }
.ach.done .achg { color: var(--accent); }
.ach.done { border-color: #e8b04b3a; }

/* ---------- уход ---------- */
.carepic { display: grid; place-items: center; margin: 4px 0 10px; }
.carepic img { max-width: 128px; max-height: 128px; }
.carepic.happy img { animation: cheer .8s ease-out 1; }
.carelist { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.care {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: #262c40; border: 1px solid #ffffff12; border-radius: 13px;
  padding: 12px 14px; color: var(--text); font: 500 14px/1 inherit;
}
.carei { font-size: 20px; flex: none; }
.carel { flex: 1; text-align: left; }
.carec { color: var(--ok); font-weight: 700; }
.care.ok { background: #23372a; border-color: #6fce7f45; color: var(--hint); }
#cg {
  display: block; width: 100%; height: auto; margin: 8px 0 0;
  border-radius: 14px; background: #1b2130;
  touch-action: none; overscroll-behavior: contain;
}
.cgbar { height: 8px; border-radius: 999px; background: #ffffff12; overflow: hidden; margin-top: 8px; }
.cgbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #57b05a, #8ae06f); transition: width .18s; }

/* «сейчас в небе» */
.skyrow {
  text-align: center; color: var(--hint); font-size: 12.5px;
  padding: 2px 0 8px;
}
.skyrow b { color: var(--text); }

/* админка */
.acard { background: var(--card); border: 1px solid #ffffff0c; border-radius: 14px; padding: 6px 14px; }
.arow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 13.5px; color: var(--hint);
  border-bottom: 1px solid #ffffff0c;
}
.arow:last-child { border-bottom: 0; }
.arow b { color: var(--accent); font-size: 15px; }
.profcard .pav {
  width: 146px; height: 146px; margin: 0 auto 6px;
  display: grid; place-items: center; border-radius: 50%;
  /* фон карточки бывает и тёмным, и светлым - птицу вытягиваем собственным
     ореолом, иначе тёмная ворона на ночном фоне сливается в пятно */
  background: radial-gradient(closest-side, #ffffff38, #ffffff12 55%, transparent 76%);
}
/* Подписи должны читаться и на светлом закате, и на тёмной ночи. Одного
   text-shadow мало - кладём под текст затемняющую подложку. */
.profcard .ptext {
  display: inline-block; padding: 6px 14px 8px; border-radius: 16px;
  background: linear-gradient(180deg, #0000006e, #00000090);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.profcard .pname { text-shadow: 0 2px 8px #000; color: #fff; }
.profcard .phandle, .profcard .pmeta { text-shadow: 0 1px 5px #000; color: #dfe4ee; }
/* width:auto ОБЯЗАТЕЛЕН: общее правило .pav img задаёт 42px, и без сброса
   аватарка оставалась крошечной, сколько ни ставь max-width. Фильтров нет -
   см. комментарий у #flyer img. */
.profcard .pav img { width: auto; height: auto; max-width: 128px; max-height: 128px; }
.profcard .pname { font-size: 21px; font-weight: 700; }
.profcard .phandle { font-size: 14px; color: var(--hint); margin-top: 2px; }
.profcard .pmeta { font-size: 12px; color: var(--hint); margin-top: 8px; }

.statcard {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border: 1px solid #ffffff0c; border-radius: 18px;
  margin-top: 10px; padding: 14px 6px;
}
.statcard .stat { border: 0; background: none; padding: 0; text-align: center; }
.statcard .stat + .stat { border-left: 1px solid #ffffff12; }
.statcard .si { display: block; font-style: normal; font-size: 17px; margin-bottom: 3px; }
.statcard .stat b { display: block; font-size: 18px; color: var(--text); }
.statcard .stat span { font-size: 11px; color: var(--hint); }

.lvcard {
  background: var(--card); border: 1px solid #ffffff0c; border-radius: 18px;
  margin-top: 10px; padding: 14px 16px;
}
.lvtop { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.lvname { letter-spacing: .06em; color: var(--hint); }
.lvname b { color: var(--accent); font-size: 14px; letter-spacing: .04em; }
.lvxp { color: var(--hint); }
.lvbar { height: 9px; border-radius: 999px; background: #ffffff12; margin: 9px 0 8px; overflow: hidden; }
.lvbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #e8b04b, #7ad06a); }
.lvhint { font-size: 11px; color: var(--hint); }
.perks { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.perk {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--hint);
  border-top: 1px solid #ffffff0e; padding-top: 6px;
}
.perk b {
  flex: none; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-size: 11px;
  background: #ffffff10; color: var(--hint);
}
.perk.got { color: var(--text); }
.perk.got b { background: var(--accent); color: #22180a; }

/* карточка птицы: статы в строку и полоска опыта */
.bstats {
  display: flex; justify-content: center; gap: 10px; width: 100%;
  font-size: 12px; color: var(--text);
  border-top: 1px solid #ffffff12; padding-top: 8px; margin-top: 7px;
}
.blv { display: flex; align-items: center; gap: 6px; width: 100%; margin: 7px 0 8px; }
.blnum { font-size: 10.5px; color: var(--hint); flex: none; }
.blbar { flex: 1; height: 5px; border-radius: 999px; background: #ffffff12; overflow: hidden; }
.blbar i { display: block; height: 100%; background: linear-gradient(90deg, #5aa9d6, #7ad06a); }
.brow { display: flex; gap: 6px; width: 100%; }
.brow .act { flex: 1; padding: 9px 4px; font-size: 12px; }

/* Кнопка выбора фото стояла вплотную и наезжала на верх холста. */
#view .tools { margin-bottom: 10px; }
/* ---------- ответ птицей из чата ---------- */
/* Экран забирает всё окно: человек пришёл из чужого чата ответить другу, и
   вкладки с магазином на этом шаге только уводят в сторону. */
#reply { display: none; flex: 1; overflow-y: auto; }
body.replymode #view, body.replymode #tabs,
body.replymode #top, body.replymode #flight { display: none; }
body.replymode #reply { display: block; }

.rwrap { padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; }
.rhead { text-align: center; margin-bottom: 18px; }
.rhead h2 { font: 700 21px/1.2 inherit; margin-bottom: 4px; }
.rsub { color: var(--hint); font-size: 13px; }
.rpic {
  width: 108px; height: 108px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(closest-side, #ffffff30, #ffffff10 55%, transparent 76%);
}
/* drop-shadow тут НЕ ставить: в телеграмном вебвью он вместе с object-fit
   рисует тень прямоугольником картинки, а не силуэтом птицы. */
.rpic img { width: auto; height: auto; max-width: 92px; max-height: 92px; }
.rpic.fly { animation: rbob 2.4s ease-in-out infinite; }
@keyframes rbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.rcard { background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.rtext {
  width: 100%; resize: none; border: 0; outline: 0;
  background: transparent; color: var(--text);
  font: 15px/1.45 inherit; user-select: text;
}
.rtext::placeholder { color: var(--hint); }

.roffer { display: flex; gap: 12px; align-items: center; }
.roffpic { width: 72px; flex: none; display: grid; place-items: center; }
.roffpic img { width: auto; height: auto; max-width: 66px; max-height: 66px; }
.rofftxt { flex: 1; min-width: 0; }
.rofftxt b { font-size: 14px; }
.rofftxt .rhint { margin: 3px 0 8px; }
.rname {
  width: 100%; border: 1px solid #ffffff1c; border-radius: 9px;
  background: #ffffff0d; color: var(--text);
  font: 500 13px/1 inherit; padding: 8px 10px; user-select: text;
}
.rhint.mid { text-align: center; margin-bottom: 12px; }
.rfoot { text-align: center; color: var(--hint); font-size: 11.5px; margin: 8px 2px 16px; }
button.act.big { padding: 14px; font-size: 15px; margin-bottom: 8px; }

/* приложенная к ответу картинка */
.rart { margin-top: 10px; text-align: center; }
.rart img {
  display: block; max-width: 100%; max-height: 200px;
  margin: 0 auto 8px; border-radius: 10px;
}
/* встречная птица настоящего игрока подписана ярче выдуманной */
.pname2.live { color: var(--accent); }
.ico.pal { display: grid; place-items: center; font-size: 22px; }

/* пока палец ведёт штрих - экран ответа тоже не должен скроллиться */
body.drawing #reply { overflow: hidden; }

/* ---------- срок письма: сургучная печать вместо строчки текста ---------- */
.seal {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #2a2434, #1e2130);
  border: 1px solid #ffffff12; border-radius: 14px;
  padding: 12px; margin: 10px 0 4px;
}
.seal.on { background: linear-gradient(120deg, #3a2630, #241f2e); border-color: #b0475622; }
.seal .wax {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px;
  background: radial-gradient(circle at 34% 30%, #d9564f, #8e2b2b 68%, #6b1f1f);
  box-shadow: inset 0 -3px 6px #0006, 0 4px 12px #0007;
}
.seal .wax.now {
  background: radial-gradient(circle at 34% 30%, #4a5570, #2b3247 70%, #222839);
}
.sealtxt { min-width: 0; }
.sealtxt b { display: block; font-size: 14.5px; }
.sealtxt span { display: block; color: var(--hint); font-size: 12px; margin-top: 2px; }

/* ---------- сезон ---------- */
.card.seasonc { background: linear-gradient(100deg, #2f2a3c, #232a3e); }
.sstat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.sstat > div {
  background: #262c40; border-radius: 12px; padding: 12px 8px; text-align: center;
}
.sstat b { display: block; font-size: 20px; color: var(--accent); }
.sstat span { font-size: 11px; color: var(--hint); }
.slist { display: flex; flex-direction: column; gap: 8px; }
.sitem {
  display: flex; align-items: center; gap: 11px;
  background: #262c40; border-radius: 13px; padding: 10px 12px;
}
.sitem.got { opacity: .55; }
.sitem .sico {
  width: 40px; flex: none; text-align: center; font-size: 24px;
  display: grid; place-items: center;
}
.sitem .sico img { width: auto; height: auto; max-width: 38px; max-height: 38px; }
.sitem .mid { flex: 1; min-width: 0; }
.sitem .name { font-weight: 600; font-size: 14px; }
.sitem .sub { color: var(--hint); font-size: 12px; }

/* ---------- сезон: витрина ---------- */
.sitem .sico img { width: auto; height: auto; max-width: 40px; max-height: 40px; }
.swhat { color: #7d8598; font-size: 11px; margin-top: 3px; }
.scalc {
  background: #262c40; border: 1px solid #ffffff10; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; color: var(--hint);
}
.scalc b { color: var(--accent); }
img.fe { width: 14px; height: 14px; vertical-align: -2px; margin-left: 2px; }
.card.seasonc .ico img { width: 32px; height: 32px; }

/* закрытый по уровню тир магазина: ни цены, ни статов */
.scard.locked { opacity: .5; }
.scard.locked .pic img { filter: brightness(0) invert(1) opacity(.25); }

/* титул, лента и оправа аватарки из витрины сезона */
.ptitle { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 1px; }
.pribbon { font-size: 11.5px; color: #e7d9b6; margin-top: 4px; opacity: .9; }
.pav.framed {
  box-shadow: 0 0 0 3px #e8b04b, 0 0 0 6px #e8b04b33, 0 6px 18px #0007;
}

/* фон профиля из витрины сезона */
.bd-season::before {
  background:
    radial-gradient(120% 80% at 50% 8%, #ffd98a55, transparent 60%),
    linear-gradient(170deg, #3b2f5e 0%, #6d4a7a 42%, #c07a5e 74%, #2a1f38 100%);
}
.bd-season::after {
  background:
    radial-gradient(closest-side, #ffe9b0aa, transparent 70%) 50% 26% / 92px 92px no-repeat,
    repeating-linear-gradient(115deg, #ffffff10 0 2px, transparent 2px 26px),
    radial-gradient(closest-side, #ffffff55, transparent 70%) 18% 62% / 8px 8px no-repeat,
    radial-gradient(closest-side, #ffffff44, transparent 70%) 74% 48% / 6px 6px no-repeat,
    radial-gradient(closest-side, #ffffff33, transparent 70%) 88% 70% / 5px 5px no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 0 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0 72%, transparent 100%);
}

/* откуда перья: список вместо абзаца прозы */
.frows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.frow {
  display: flex; align-items: center; gap: 10px;
  background: #262c40; border-radius: 11px; padding: 9px 12px;
}
.frow b { flex: none; color: var(--accent); font-size: 14px; min-width: 34px; }
.frow span { color: var(--hint); font-size: 12.5px; }
/* перья на ячейке календаря */
/* Перо в ячейке календаря. Размер задаём ЯВНО: `.dcell img` и `.dcell.bird img`
   выше по файлу делают все картинки внутри ячейки 34-46px, и перо раздувалось
   до размера награды. */
.dcell .dfe { display: block; font-size: 10px; color: var(--accent); margin-top: 3px; }
.dcell .dfe img { width: 11px; height: 11px; vertical-align: -1px; margin-left: 1px; }

/* «Погода в пути» из витрины сезона: листья и снежинки мимо птицы */
.flyfx {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(closest-side, #ffffffcc, transparent 70%) 12% 20% / 4px 4px no-repeat,
    radial-gradient(closest-side, #ffffffaa, transparent 70%) 38% 62% / 3px 3px no-repeat,
    radial-gradient(closest-side, #d8a05fcc, transparent 70%) 61% 30% / 7px 5px no-repeat,
    radial-gradient(closest-side, #ffffff99, transparent 70%) 78% 74% / 3px 3px no-repeat,
    radial-gradient(closest-side, #c98a4acc, transparent 70%) 88% 40% / 6px 4px no-repeat,
    radial-gradient(closest-side, #ffffffbb, transparent 70%) 26% 84% / 4px 4px no-repeat;
  animation: flyfx 5.5s linear infinite;
}
@keyframes flyfx {
  from { transform: translate3d(24px, -14px, 0); opacity: 0; }
  15%  { opacity: .9; }
  85%  { opacity: .9; }
  to   { transform: translate3d(-46px, 26px, 0); opacity: 0; }
}
.ploft { font-size: 11.5px; color: #cfe0ff; margin-top: 3px; opacity: .9; }

/* ---------- обучение ---------- */
.tut { text-align: center; padding: 4px 4px 6px; }
.tico {
  width: 92px; height: 92px; margin: 4px auto 14px;
  display: grid; place-items: center; border-radius: 24px;
  background: radial-gradient(closest-side, #ffffff1c, transparent 72%);
}
.tico img { width: 82px; height: 82px; }
.tut h3 { font-size: 19px; margin-bottom: 8px; }
.ttext { color: var(--text); font-size: 14px; line-height: 1.55; margin: 0 4px 10px; }
.thint { color: var(--accent); font-size: 12.5px; margin-bottom: 16px; }
.tdots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.tdots i { width: 7px; height: 7px; border-radius: 50%; background: #ffffff26; }
.tdots i.on { background: var(--accent); width: 18px; border-radius: 999px; }

/* публичная голубятня: ссылка в шторке */
#shurl { font-size: 12px; }

/* ---------- чужая голубятня по ссылке ---------- */
#loft { display: none; flex: 1; overflow-y: auto; }
body.loftmode #view, body.loftmode #tabs,
body.loftmode #top, body.loftmode #flight, body.loftmode #reply { display: none; }
body.loftmode #loft { display: block; }
.lwrap { padding: 10px 12px calc(28px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
.lwrap .stats { margin-bottom: 4px; }
.lwrap .act.wide { margin-top: 10px; }

/* ---------- шторка «поделиться» ---------- */
.shr { text-align: center; margin-bottom: 16px; }
.shpic {
  width: 104px; height: 104px; margin: 0 auto 10px; display: grid; place-items: center;
  border-radius: 50%; font-size: 40px;
  background: radial-gradient(closest-side, #ffffff2e, #ffffff10 55%, transparent 76%);
}
.shpic img { width: auto; height: auto; max-width: 88px; max-height: 88px; }
.shr h3 { font-size: 19px; margin-bottom: 4px; }
.shsub { color: var(--hint); font-size: 13px; }
.shlink { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.shlink input { margin-bottom: 0; font-size: 11.5px; }
.shlink .act { flex: none; }

/* переписка: строка «имя - число». Кружок с эмодзи ✉️ на части клиентов
   рисовался пустым прямоугольником, а строка от шрифта не зависит. */
.palrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: 13px; padding: 12px 15px; margin-bottom: 8px;
  font-size: 14px;
}
.palrow span { min-width: 0; overflow-wrap: anywhere; }
.palrow b { flex: none; color: var(--accent); font-size: 13px; }

/* ---------- вылупление ---------- */
.hatch { text-align: center; padding: 6px 4px 4px; }
.hstage {
  position: relative; height: 210px; display: grid; place-items: center;
  margin-bottom: 6px;
}
.hglow {
  position: absolute; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(closest-side, #e8b04b22, transparent 70%);
  animation: hpulse 2.4s ease-in-out infinite;
}
@keyframes hpulse { 0%,100% { transform: scale(.9); opacity: .55 } 50% { transform: scale(1.06); opacity: 1 } }

.hegg {
  position: relative; width: 118px; height: 152px; border: 0; padding: 0;
  background: none; cursor: pointer;
}
.hshell {
  position: absolute; inset: 0; border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background:
    radial-gradient(closest-side at 36% 28%, #fffdf6, #f2e6cd 55%, #d8c49c 100%);
  box-shadow: inset -10px -16px 26px #00000026, 0 14px 30px #0008;
}
.hshell::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background:
    radial-gradient(closest-side, #00000018, transparent 70%) 30% 62% / 16px 12px no-repeat,
    radial-gradient(closest-side, #00000014, transparent 70%) 62% 44% / 13px 10px no-repeat,
    radial-gradient(closest-side, #00000012, transparent 70%) 48% 78% / 11px 9px no-repeat;
}
/* трещины: рисуем ломаной, показываем по одной за удар */
/* Ломаная, а не прямая палка: прямая линия читается как царапина.
   clip-path даёт зигзаг, светлая обводка - «изнутри бьёт свет». */
.hcrack {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 0;
  margin-left: -7px;
  background: linear-gradient(90deg, transparent 38%, #2f2109 38%, #2f2109 62%, transparent 62%);
  transform-origin: top center; opacity: 0;
  transition: height .2s ease-out, opacity .12s;
  clip-path: polygon(50% 0%, 78% 14%, 30% 30%, 82% 46%, 26% 62%, 74% 78%, 44% 100%,
                     20% 78%, 62% 62%, 14% 46%, 66% 30%, 22% 14%);
  filter: drop-shadow(0 0 4px #ffdc8a);
}
.hcrack.c1 { transform: translate(-34px, -40px) rotate(24deg); }
.hcrack.c2 { transform: translate(18px, -46px) rotate(-32deg); }
.hcrack.c3 { transform: translate(-6px, -18px) rotate(8deg); }
.t1 .hcrack.c1 { height: 42px; opacity: 1; }
.t2 .hcrack.c1 { height: 52px; opacity: 1; }
.t2 .hcrack.c2 { height: 48px; opacity: 1; }
.t3 .hcrack { height: 70px; opacity: 1; }

/* свет из щелей растёт с каждым ударом */
.hlight {
  position: absolute; inset: 8px; border-radius: inherit; opacity: 0;
  background: radial-gradient(closest-side, #fff3c4, #f0c977 60%, transparent 78%);
  transition: opacity .25s;
}
.t1 .hlight { opacity: .18; }
.t2 .hlight { opacity: .42; }
.t3 .hlight { opacity: .9; }

.hegg.shake { animation: hshake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes hshake {
  10%, 90% { transform: translateX(-3px) rotate(-2deg) }
  20%, 80% { transform: translateX(4px) rotate(3deg) }
  30%, 50%, 70% { transform: translateX(-7px) rotate(-4deg) }
  40%, 60% { transform: translateX(7px) rotate(4deg) }
}

/* кульминация: вспышка на весь экран */
.hatch.boom .hegg { animation: hburstout .38s ease-in forwards; }
@keyframes hburstout {
  to { transform: scale(1.5); opacity: 0; filter: brightness(3); }
}
.hatch.boom .hstage::after {
  content: ''; position: absolute; inset: -60px; border-radius: 50%;
  background: radial-gradient(closest-side, #fff, #ffe9b0 45%, transparent 72%);
  animation: hflash .5s ease-out forwards;
}
@keyframes hflash {
  0% { transform: scale(.2); opacity: 0 }
  35% { opacity: 1 }
  100% { transform: scale(1.6); opacity: 0 }
}

/* птица проявляется из света */
.hatch.done .hbird { animation: hbird .55s cubic-bezier(.2,1.5,.5,1) both; }
.hatch.done .hbird img { width: auto; height: auto; max-width: 140px; max-height: 150px; }
@keyframes hbird {
  0% { transform: scale(.3); opacity: 0; filter: brightness(4) }
  60% { opacity: 1 }
  100% { transform: scale(1); opacity: 1; filter: none }
}
.hburst {
  position: absolute; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--rar), transparent 68%);
  opacity: .42; animation: hpulse 2.6s ease-in-out infinite;
}
.hrays { position: absolute; width: 210px; height: 210px; }
.hrays i {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 108px;
  margin-left: -2.5px; transform-origin: top center;
  background: linear-gradient(var(--rar), transparent 78%);
  opacity: .55; filter: blur(.4px);
  animation: hspin 9s linear infinite, hrayin .6s ease-out both;
}
@keyframes hrayin { from { height: 0; opacity: 0 } to { height: 108px; opacity: .55 } }
/* искры разлетаются в момент появления птицы */
.hspark {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px;
  margin: -3px 0 0 -3px; border-radius: 50%; background: var(--rar);
  box-shadow: 0 0 8px var(--rar);
  animation: hfly .9s ease-out both;
}
@keyframes hfly {
  0% { transform: translate(0, 0) scale(.4); opacity: 0 }
  20% { opacity: 1 }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0 }
}
@keyframes hspin { to { rotate: 360deg } }
.hrar {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 700; margin-bottom: 2px;
}
.hdots { display: flex; gap: 7px; justify-content: center; margin-top: 12px; }
.hdots i { width: 8px; height: 8px; border-radius: 50%; background: #ffffff1f; transition: background .2s; }
.hdots i.on { background: var(--accent); }

/* Титул сезона в доске почёта. Отдельной строкой под именем, а не рядом:
   в строку он не влезает и выталкивает число за край. */
.brow2 .bnm { display: flex; flex-direction: column; line-height: 1.2; }
.brow2 .btitle {
  font-style: normal; font-size: 11px; color: #f0c977; opacity: .9;
}

/* Выбор строки на ленте - сразу под купленной ленточкой в витрине сезона.
   Чипсы, а не выпадашка: строк восемь, они короткие, и выбор в один тап. */
.ribpick { margin: -4px 0 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--card2, #ffffff0d); }
.ribhead { font-size: 12px; opacity: .65; margin-bottom: 8px; }
.ribrow { display: flex; flex-wrap: wrap; gap: 6px; }
.ribchip { font: inherit; font-size: 13px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid #ffffff26; background: transparent; color: inherit; cursor: pointer; }
.ribchip.on { border-color: #f0c977; background: #f0c9771f; color: #f0c977; font-weight: 600; }
