/* Bamboo Valley — v1.1 art direction: restrained, dark translucent panels, warm amber accent */
:root {
  --bg: #0f1411;
  --panel: rgba(17, 23, 19, 0.62);
  --panel-strong: rgba(15, 20, 17, 0.9);
  --panel-raise: rgba(255, 255, 255, 0.05);
  --line: rgba(236, 226, 205, 0.12);
  --line-strong: rgba(236, 226, 205, 0.22);
  --text: #ece6da;
  --text-2: #a8a293;
  --text-3: #7b776c;
  --amber: #e2a65b;
  --amber-2: #c8893c;
  --amber-soft: rgba(226, 166, 91, 0.16);
  --sage: #8fb37a;
  --clay: #d48a6c;
  --mist: #86aebb;
  --ok: #b7c06a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --r: 18px;
  --tg-top: 0px;
  --tg-bottom: 0px;
  --tg-left: 0px;
  --tg-right: 0px;
  --sat: max(var(--tg-top), env(safe-area-inset-top, 0px));
  --sab: max(var(--tg-bottom), env(safe-area-inset-bottom, 0px));
  --ease-out: cubic-bezier(.22, .9, .3, 1);
  --ease: cubic-bezier(.25, .8, .25, 1);
  font-family: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}
/* Telegram light theme: same art-directed dark panels, slightly lighter glass so the scene breathes */
:root[data-scheme="light"] { --panel: rgba(20, 26, 22, 0.56); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
body { -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: manipulation; font-feature-settings: 'tnum' 1; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; display: block; flex: none; }
[data-ic] { display: inline-flex; }

#app { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }
#shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8, 12, 10, 0.55), transparent 24%),
    linear-gradient(to top, rgba(8, 12, 10, 0.6), transparent 22%),
    radial-gradient(130% 90% at 50% 55%, transparent 55%, rgba(5, 8, 6, 0.45) 100%);
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ HUD */
#hud {
  position: absolute; z-index: 5;
  top: calc(var(--sat) + 8px); left: calc(10px + var(--tg-left)); right: calc(10px + var(--tg-right));
  border-radius: var(--r); padding: 10px 12px 11px;
  animation: fade-down .5s var(--ease-out) both;
}
.hud-row { display: flex; align-items: center; gap: 11px; }
.hud-row.stats { margin-top: 9px; }
.lvl { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.lvl svg { position: absolute; inset: 0; width: 40px; height: 40px; transform: rotate(-90deg); }
.lvl .trk { fill: none; stroke: var(--line-strong); stroke-width: 2.5; }
.lvl .val { fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .8s var(--ease); }
.lvl b { font-size: 16px; font-weight: 800; color: var(--text); }
.hud-title { flex: 1; min-width: 0; }
.hud-title .title { font-weight: 700; font-size: 16.5px; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title .sub { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 1px; }
.rank {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--panel-raise);
  font-weight: 800; font-size: 14.5px; color: var(--amber); transition: background .2s;
}
.rank .ic { width: 17px; height: 17px; }
.hud-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); border: 1px solid var(--line); background: var(--panel-raise); }
.hud-ic .ic { width: 18px; height: 18px; }
.hud-ic:active { background: var(--amber-soft); }
/* v19: language pill (HUD and the valley catalog) — shows the current language, a tap switches to the other one */
.lang-ic b, .home-lang b { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--text); }
.home-lang { position: absolute; top: calc(var(--sat) + 14px); right: calc(14px + var(--tg-right)); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: var(--text); z-index: 2; }
.home-lang:active { background: var(--amber-soft); }
.jade-pill {
  display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 4px; border-radius: 999px; flex: none;
  border: 1px solid rgba(110, 196, 150, .32); background: rgba(73, 176, 127, .12); font-weight: 800; font-size: 13.5px; color: #cfeedd;
}
.jade-pill .jp-ic { display: grid; place-items: center; width: 20px; height: 20px; }
.jade-pill:active { background: rgba(73, 176, 127, .24); }
.jade-pill.gain { animation: jade-gain .9s var(--ease-out); }
@keyframes jade-gain { 30% { box-shadow: 0 0 0 3px rgba(73, 176, 127, .25), 0 0 18px rgba(110, 220, 160, .5); transform: scale(1.06); } }
.rank:active { background: var(--amber-soft); }
.wb { flex: 1; min-width: 0; }
.wb-label { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; letter-spacing: .02em; }
.wb-label b { color: var(--text); font-weight: 700; }
.wb-bar { height: 4px; border-radius: 99px; background: rgba(236, 226, 205, .1); overflow: hidden; }
.wb-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--clay), var(--amber) 45%, var(--sage)); background-size: 300px 100%; transition: width 1s var(--ease); }
.pts { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; color: var(--text); padding-left: 2px; }
.pts .ic { width: 16px; height: 16px; color: var(--amber); }
.harmony { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--amber); background: var(--amber-soft); animation: glow 3s ease-in-out infinite; }
.harmony .ic { width: 16px; height: 16px; }
@keyframes glow { 50% { box-shadow: 0 0 14px rgba(226, 166, 91, .45); } }

/* ------------------------------------------------------------------ bottom bar */
#bar {
  position: absolute; z-index: 5;
  left: calc(12px + var(--tg-left)); right: calc(12px + var(--tg-right)); bottom: calc(var(--sab) + 10px);
  border-radius: 20px; padding: 6px; display: flex; gap: 6px;
  animation: fade-up .5s .08s var(--ease-out) both;
}
#bar button { position: relative; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; font-size: 14.5px; transition: transform .15s var(--ease), background .2s; min-width: 0; }
#bar button:active { transform: scale(.97); }
#bar .bar-btn { flex: 0 0 62px; flex-direction: column; gap: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .01em; color: var(--text-2); padding: 0 2px; }
#bar .bar-btn .ic { width: 20px; height: 20px; color: var(--text); }
#bar .bar-btn > span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-free { position: absolute; top: 7px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px rgba(17, 23, 19, .9), 0 0 10px rgba(226, 166, 91, .7); animation: glow 2.4s ease-in-out infinite; }
.bar-main { flex: 1; color: #1b140c; white-space: nowrap; background: linear-gradient(180deg, #ebb46c, var(--amber) 60%, var(--amber-2)); box-shadow: 0 6px 18px rgba(200, 137, 60, .28), inset 0 1px 0 rgba(255, 255, 255, .35); }
.bar-main.adopt { animation: breathe-btn 2.8s ease-in-out infinite; }
@keyframes breathe-btn { 50% { box-shadow: 0 6px 26px rgba(226, 166, 91, .55), inset 0 1px 0 rgba(255, 255, 255, .35); } }
.bar-btn { flex: 1; color: var(--text); background: var(--panel-raise); border: 1px solid var(--line) !important; }

/* ------------------------------------------------------------------ sheets */
#backdrop { position: absolute; inset: 0; z-index: 10; background: rgba(4, 7, 5, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
#backdrop.on { opacity: 1; pointer-events: auto; }
#sheets { position: absolute; inset: 0; z-index: 11; pointer-events: none; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; pointer-events: auto;
  max-height: calc(100% - var(--sat) - 40px);
  background: var(--panel-strong);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-radius: 24px 24px 0 0; border-top: 1px solid var(--line-strong);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, .45);
  padding: 8px 18px calc(var(--sab) + 16px);
  transform: translateY(105%); transition: transform .38s var(--ease-out);
  display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grab { width: 36px; height: 4px; border-radius: 9px; background: var(--line-strong); margin: 2px auto 10px; flex: none; }
.sheet-x {
  position: absolute; right: 12px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-raise); border: 1px solid var(--line); color: var(--text-2); display: grid; place-items: center; z-index: 2;
}
.sheet-x .ic { width: 15px; height: 15px; }
.sheet-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 0 -18px; padding: 0 18px; min-height: 0; }
.sheet h2 { margin: 4px 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -.015em; display: flex; align-items: center; gap: 8px; }
.sheet h2 .ic { color: var(--amber); width: 22px; height: 22px; }
.sheet .lead { margin: 0 0 14px; color: var(--text-2); font-weight: 500; font-size: 13.5px; line-height: 1.45; }

/* ------------------------------------------------------------------ panda card */
.card-head { display: flex; gap: 14px; align-items: center; position: relative; padding-top: 4px; }
.portrait {
  position: relative; width: 108px; height: 108px; flex: none; border-radius: 16px; overflow: hidden;
  background: radial-gradient(90% 80% at 50% 70%, var(--pglow, rgba(226, 166, 91, .3)) 0%, rgba(30, 40, 32, .9) 60%, #121813 100%);
  border: 1px solid var(--line);
}
.portrait::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 30px rgba(0, 0, 0, .55); border-radius: inherit; pointer-events: none; }
.portrait.mine { border-color: rgba(226, 166, 91, .6); }
/* panda figure with equipped items (anchors.js): the figure breathes, items ride along */
.pfig { position: absolute; inset: 0; transform-origin: 50% 94%; animation: breathe 4.2s ease-in-out infinite; }
.pfig .pimg { position: absolute; left: 6%; bottom: 6%; width: 88%; height: 88%; object-fit: contain; object-position: 50% 100%; }
.pfig .pimg.pop { animation: pose-in .45s var(--ease-out); }
.pfig .eq { position: absolute; pointer-events: none; height: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.portrait.gloomy .pfig { filter: saturate(.45) brightness(.9); }
@keyframes breathe { 50% { transform: scaleY(1.012); } }
@keyframes pose-in { from { opacity: .2; transform: translateY(4px); } }
.ident { flex: 1; min-width: 0; padding-right: 70px; }
.ident .name { font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; word-break: break-word; }
.badge-mine { font-size: 10.5px; font-weight: 800; padding: 3px 7px; border-radius: 6px; color: var(--amber); border: 1px solid rgba(226, 166, 91, .45); letter-spacing: .06em; text-transform: uppercase; }
.ident .owner { font-size: 12.5px; color: var(--text-2); font-weight: 500; margin: 4px 0 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 8px; background: var(--panel-raise); border: 1px solid var(--line); color: var(--text); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip.golden { border-color: rgba(226, 166, 91, .5); color: var(--amber); }

.qring { position: absolute; right: 0; top: 6px; width: 64px; height: 64px; display: grid; place-items: center; }
.qring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.qring .trk { fill: none; stroke: rgba(236, 226, 205, .1); stroke-width: 4; }
.qring .val { fill: none; stroke: var(--qc, var(--sage)); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .9s var(--ease), stroke .5s; }
.qring b { font-size: 20px; font-weight: 800; line-height: 1; margin-top: -4px; }
.qring small { position: absolute; bottom: 14px; font-size: 9px; font-weight: 700; color: var(--text-3); letter-spacing: .12em; }
.qring b.bump { animation: bump .6s var(--ease-out); }
@keyframes bump { 35% { color: var(--amber); transform: scale(1.18); } }

.bars { margin: 16px 0 4px; display: grid; gap: 11px; }
.pbar { display: grid; grid-template-columns: 22px 1fr 34px; align-items: center; gap: 10px; }
.pbar .pi { color: var(--text-2); display: grid; place-items: center; }
.pbar .pi .ic { width: 18px; height: 18px; }
.pbar .pl { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.pbar .pt { height: 5px; border-radius: 99px; background: rgba(236, 226, 205, .1); overflow: hidden; }
.pbar .pt i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .9s var(--ease); }
.pbar.f i { background: var(--sage); }
.pbar.m i { background: var(--amber); }
.pbar.s i { background: var(--mist); }
.pbar .pv { font-weight: 700; font-size: 14px; text-align: right; }
.pbar.low .pv { color: var(--clay); }
.social-hint { font-size: 12px; color: var(--text-2); font-weight: 500; border-left: 2px solid var(--mist); padding: 2px 0 2px 10px; margin: 12px 0 2px; line-height: 1.45; }
.social-hint b { color: var(--text); font-weight: 700; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.act {
  position: relative; overflow: hidden; height: 58px; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15.5px; transition: transform .15s var(--ease), opacity .2s, background .2s;
}
.act:active { transform: scale(.97); }
.act .lbl { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; }
.act .lbl .ic { width: 18px; height: 18px; }
.act .cd { position: relative; z-index: 1; font-size: 11.5px; font-weight: 600; opacity: .75; margin-top: 2px; }
.act.feed { color: #1b140c; background: linear-gradient(180deg, #ebb46c, var(--amber) 60%, var(--amber-2)); box-shadow: 0 6px 18px rgba(200, 137, 60, .22); }
.act.pet { color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(226, 166, 91, .45); }
.act.wait, .act.full { background: var(--panel-raise) !important; color: var(--text-2) !important; border: 1px solid var(--line); box-shadow: none; }
.act.wait .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(226, 166, 91, .12); transition: width 1s linear; }
.act .fill { width: 0; }
.act.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.act.adopt-cta { grid-column: 1 / -1; color: #1b140c; background: linear-gradient(180deg, #ebb46c, var(--amber) 60%, var(--amber-2)); }

/* ------------------------------------------------------------------ adopt */
.adopt { text-align: center; }
.adopt .stagebox {
  position: relative; height: 240px; margin: 4px 0 12px; display: grid; place-items: center; border-radius: 18px; overflow: hidden;
  background: radial-gradient(60% 55% at 50% 62%, rgba(226, 166, 91, .10), rgba(14, 19, 16, .95) 75%);
  border: 1px solid var(--line);
}
.adopt .stagebox::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 60px rgba(0, 0, 0, .7); }
.halo { position: absolute; width: 260px; height: 200px; border-radius: 50%; bottom: 10px; background: radial-gradient(closest-side, rgba(255, 214, 150, .55), rgba(226, 166, 91, .12) 55%, transparent); opacity: 0; transition: opacity 1.4s ease; }
.adopt.revealed .halo { opacity: 1; }
.baby { position: relative; height: 190px; width: 250px; object-fit: contain; object-position: 50% 100%; filter: brightness(0) opacity(.55); transition: filter 1.6s ease, opacity .3s; transform-origin: 50% 100%; animation: breathe 4.2s ease-in-out infinite; }
.baby.cycling { opacity: .55; }
.baby.shown { filter: none; }
.qmark { position: absolute; font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .3em; text-transform: uppercase; bottom: 14px; }
.reveal-title { font-size: 17px; font-weight: 800; margin: 0 0 4px; display: inline-flex; align-items: center; gap: 8px; }
.reveal-title .rar { font-size: 10.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--text-2); letter-spacing: .06em; text-transform: uppercase; }
.reveal-title .rar.gold { color: var(--amber); border-color: rgba(226, 166, 91, .5); }
.namefield { display: flex; gap: 8px; margin: 4px 0 4px; }
.namefield input {
  flex: 1; min-width: 0; height: 52px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04); padding: 0 16px;
  font-size: 17px; font-weight: 700; color: var(--text); outline: none; text-align: center; user-select: text; -webkit-user-select: text;
}
.namefield input:focus { border-color: rgba(226, 166, 91, .7); box-shadow: 0 0 0 3px rgba(226, 166, 91, .15); }
.dice { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line-strong) !important; background: rgba(255, 255, 255, .04); color: var(--text-2); display: grid; place-items: center; }
.dice:active { transform: rotate(-15deg); }
.hint-small { font-size: 12px; color: var(--text-3); font-weight: 500; min-height: 18px; }
.hint-small.err { color: var(--clay); }
.big-btn {
  width: 100%; height: 54px; border-radius: 15px; margin-top: 10px; font-weight: 700; font-size: 16px; color: #1b140c;
  background: linear-gradient(180deg, #ebb46c, var(--amber) 60%, var(--amber-2)); box-shadow: 0 6px 18px rgba(200, 137, 60, .25);
  transition: transform .15s, opacity .2s;
}
.big-btn:active { transform: scale(.98); }
.big-btn:disabled { opacity: .55; }
.big-btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--text); box-shadow: none; }
.odds { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.odds .chip { font-size: 11px; color: var(--text-2); }

/* ------------------------------------------------------------------ top */
.season { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--panel-raise); font-weight: 600; font-size: 13px; color: var(--text-2); }
.season .ic { color: var(--amber); width: 18px; height: 18px; }
.season b { font-size: 15px; font-weight: 800; color: var(--text); margin-left: auto; }
.lb { list-style: none; margin: 0; padding: 0 0 6px; display: grid; gap: 6px; }
.lb li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 14px; background: var(--panel-raise); border: 1px solid transparent; animation: fade-up .4s var(--ease-out) both; }
.lb li.mine { border-color: rgba(226, 166, 91, .55); background: var(--amber-soft); }
.lb .rk { font-weight: 800; font-size: 15px; text-align: center; color: var(--text-3); }
.lb .rk.medal { color: var(--amber); }
.lb .tt { min-width: 0; }
.lb .tt b { display: block; font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .tt span { font-size: 11.5px; font-weight: 500; color: var(--text-2); display: inline-flex; gap: 10px; }
.lb .pp { font-weight: 800; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 5px; }
.lb .pp .ic { width: 15px; height: 15px; color: var(--amber); }
.lb .sep { text-align: center; color: var(--text-3); font-weight: 700; padding: 2px; background: none; display: block; }

/* ------------------------------------------------------------------ help */
.help-list { display: grid; gap: 8px; margin: 2px 0 4px; }
.help-item { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 11px 12px; border-radius: 14px; background: var(--panel-raise); font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--text-2); }
.help-item .hi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--amber); background: var(--amber-soft); }
.help-item b { font-weight: 700; color: var(--text); }

/* ------------------------------------------------------------------ fx, toasts */
#fxlayer { position: absolute; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.fly { position: absolute; width: 40px; height: 40px; object-fit: contain; left: 0; top: 0; will-change: transform; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); }
.floater { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 20px; color: var(--amber); white-space: nowrap; transform: translate(-50%, -50%);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6); animation: floatup 1.6s var(--ease) forwards; }
.floater.pink { color: #eab0a0; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -20%); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -170%); } }

#toasts { position: absolute; z-index: 30; left: 16px; right: 16px; top: calc(var(--sat) + 116px); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 100%; padding: 10px 15px; border-radius: 12px; background: rgba(14, 18, 15, .92); border: 1px solid var(--line-strong); color: var(--text); font-weight: 600; font-size: 13.5px; box-shadow: 0 10px 28px rgba(0, 0, 0, .4); text-align: center; animation: toast-in .3s var(--ease-out); }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

.offline {
  position: absolute; z-index: 25; left: 50%; top: calc(var(--sat) + 110px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 99px; white-space: nowrap;
  background: rgba(14, 18, 15, .9); border: 1px solid rgba(212, 138, 108, .5); color: var(--text); font-weight: 600; font-size: 12.5px;
  animation: toast-in .3s var(--ease-out); pointer-events: none;
}
.offline i { width: 7px; height: 7px; border-radius: 50%; background: var(--clay); animation: blinkdot 1.2s infinite; }
.offline.out { animation: toast-out .3s forwards; }
@keyframes blinkdot { 50% { opacity: .25; } }

/* ------------------------------------------------------------------ loader & errors */
#loader {
  position: absolute; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(110% 70% at 50% 35%, #263427 0%, #141b16 55%, #0b0f0c 100%);
  transition: opacity .6s, visibility .6s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; color: var(--text); padding: 24px; max-width: 320px; }
.loader-mark { width: 52px; height: 52px; margin: 0 auto; color: var(--amber); animation: pulse 2s ease-in-out infinite; }
.loader-mark .ic { width: 52px; height: 52px; stroke-width: 1.3; }
.loader-title { font-size: 22px; font-weight: 800; margin-top: 14px; letter-spacing: -.01em; }
.loader-sub { font-size: 13.5px; font-weight: 500; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.loader-bar { width: 120px; height: 2px; border-radius: 9px; background: var(--line); margin: 20px auto 0; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 40%; background: var(--amber); animation: loadbar 1.3s ease-in-out infinite; }
#loader.error .loader-bar { display: none; }
#loader.error .loader-mark { animation: none; color: var(--text-2); }
.loader-inner .big-btn { max-width: 260px; margin: 18px auto 0; display: block; }
.loader-inner .big-btn + .big-btn { margin-top: 10px; }
.loader-inner a.big-btn, a.big-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes loadbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

@keyframes fade-down { from { opacity: 0; transform: translateY(-10px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 560px) {
  #hud, #bar { left: 50%; right: auto; width: 520px; transform: translateX(-50%); animation: none; }
  .sheet { left: 50%; right: auto; width: 540px; margin-left: -270px; }
}

/* Compact sheets on short screens: keep the selected panda visible above the card */
@media (max-height: 720px) {
  .sheet { padding: 4px 14px calc(var(--sab) + 12px); border-radius: 20px 20px 0 0; }
  .grab { margin-bottom: 6px; }
  .sheet-x { width: 28px; height: 28px; top: 6px; right: 10px; }
  .card-head { gap: 10px; }
  .portrait { width: 72px; height: 72px; border-radius: 12px; }
  .ident { padding-right: 56px; }
  .ident .name { font-size: 18px; }
  .ident .owner { margin: 2px 0 5px; font-size: 11.5px; }
  .chip { font-size: 10.5px; padding: 3px 7px; }
  .qring { width: 52px; height: 52px; top: 2px; }
  .qring b { font-size: 16px; }
  .qring small { bottom: 10px; font-size: 8px; }
  .bars { margin: 10px 0 2px; gap: 6px; }
  .pbar { grid-template-columns: 18px 1fr 28px; gap: 8px; }
  .pbar .pi .ic { width: 15px; height: 15px; }
  .pbar .pl { font-size: 11px; margin-bottom: 3px; }
  .pbar .pv { font-size: 12.5px; }
  .card .social-hint { display: none; }
  .actions { margin-top: 10px; gap: 8px; }
  .act { height: 48px; font-size: 14px; border-radius: 13px; }
  .act .cd { font-size: 10.5px; }
  .sheet h2 { font-size: 18px; }
  .adopt .stagebox { height: 170px; }
  .baby { height: 135px; width: 200px; }
  #hud { padding: 8px 10px 9px; }
  .hud-row.stats { margin-top: 7px; }
  #bar button { height: 46px; }
  #bar { padding: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.adopt h2 { justify-content: center; }
.namefield input.bad { border-color: rgba(212, 138, 108, .8); box-shadow: 0 0 0 3px rgba(212, 138, 108, .15); }
