:root {
  --paper: #f4ead3;
  --paper-2: #eadbb8;
  --paper-3: #fbf4e2;
  --ink: #3a2616;
  --ink-soft: #7a6146;
  --red: #a52a24;
  --red-2: #7d1d19;
  --green: #4d7a34;
  --green-2: #36591f;
  --gold: #d29b2e;
  --gold-2: #f2cf73;
  --navy: #161b29;
  --navy-2: #252d42;
  --line: #c9ad7e;
  --radius: 14px;
  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14'%3E%3Crect width='28' height='14' fill='%237d1d19'/%3E%3Cpath d='M0 7 7 0 14 7 7 14Z' fill='%23d29b2e'/%3E%3Cpath d='M14 7 21 0 28 7 21 14Z' fill='%23f4ead3'/%3E%3Ccircle cx='7' cy='7' r='2.4' fill='%23a52a24'/%3E%3Ccircle cx='21' cy='7' r='2' fill='%234d7a34'/%3E%3C/svg%3E");
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: #3a2616 radial-gradient(circle at 50% 0, #5a3d24, #2a1a0e 70%);
  color: var(--ink);
  font-family: "PT Serif", Georgia, serif;
  font-size: 15px;
}
button { font: inherit; color: inherit; cursor: pointer; }
.title, h2 { font-family: "Ruslan Display", "PT Serif", serif; font-weight: normal; }

#app {
  max-width: 480px; margin: 0 auto; min-height: 100%;
  background: var(--noise), linear-gradient(var(--paper), var(--paper-2));
  display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,.5);
}

/* ---------- верхняя панель ---------- */
#top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 14px;
  background: linear-gradient(var(--red), var(--red-2));
  color: #fff3dc;
}
#top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 14px; background: var(--orn); background-size: 28px 14px; }
#top .kuny { font-weight: bold; font-size: 18px; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.2); padding: 3px 12px 3px 4px; border-radius: 20px; }
.coin { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b8, var(--gold) 55%, #94661a); box-shadow: inset 0 0 0 2px #b07d22; vertical-align: middle; }
.coin.sm { width: 14px; height: 14px; }
#top .kuny.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.18); } }
#top .lvl { margin-left: auto; text-align: right; font-size: 13px; }
#top .lvl b { font-size: 15px; }
.xpbar { width: 120px; height: 7px; background: rgba(0,0,0,.3); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .6s; }

#screen { flex: 1; padding: 20px 16px 96px; }
#screen.enter > * { animation: enter .35s both; }
#screen.enter > *:nth-child(2) { animation-delay: .04s; }
#screen.enter > *:nth-child(3) { animation-delay: .08s; }
#screen.enter > *:nth-child(4) { animation-delay: .12s; }
#screen.enter > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* ---------- нижняя навигация ---------- */
#nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(#3a2616, #24170c); border-top: 3px solid var(--gold);
  padding-bottom: env(safe-area-inset-bottom);
}
#nav button {
  background: none; border: 0; padding: 7px 0 9px; font-size: 12px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: #c8b08a;
}
#nav svg { width: 26px; height: 26px; transition: transform .2s; }
#nav button.on { color: var(--gold-2); }
#nav button.on svg { transform: translateY(-2px) scale(1.12); filter: drop-shadow(0 0 6px #f2cf7388); }
#nav button.dot::after { content: ''; position: absolute; top: 5px; right: calc(50% - 20px); width: 10px; height: 10px; border-radius: 50%; background: #e2463d; box-shadow: 0 0 0 2px #24170c; animation: pulse 1.2s infinite; }
/* ---------- ивенты: календарь ---------- */
.daytoday { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff6dc, #f2dfae); border: 2px solid var(--gold); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; box-shadow: 0 0 16px #f2cf7366; }
.daytoday.done { border-color: var(--green); box-shadow: none; background: var(--paper-3); }
.daytoday .big { width: 64px; height: 64px; flex: none; border-radius: 14px; background: radial-gradient(#fffaf0, #eadbb8); box-shadow: 0 0 0 2px var(--gold); display: flex; align-items: center; justify-content: center; font-size: 30px; }
.daytoday:not(.done) .big { animation: bob 1.3s ease-in-out infinite; }
.cal { background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 8px; }
.calhead { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; }
.calhead b { font-family: "Ruslan Display", serif; font-weight: normal; font-size: 18px; color: var(--red-2); }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { text-align: center; font-size: 11px; color: var(--ink-soft); font-weight: bold; padding-bottom: 2px; }
.wd.sun { color: #3f7fbf; }
.dc { position: relative; aspect-ratio: .82; border-radius: 9px; border: 0; padding: 2px 1px; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: #fffaf0; box-shadow: 0 0 0 1.5px var(--line); font-size: 10px; overflow: hidden; }
.dc .dn { font-size: 10px; font-weight: bold; color: var(--ink-soft); align-self: flex-start; padding-left: 3px; }
.dc .ri { font-size: 17px; line-height: 1; }
.dc .ri .coin { width: 16px; height: 16px; }
.dc .rl { font-size: 9px; font-weight: bold; white-space: nowrap; }
.dc.week { background: linear-gradient(#eaf2fb, #d5e5f6); box-shadow: 0 0 0 1.5px #3f7fbf; }
.dc.month { background: linear-gradient(#fff3d0, #f2cf73); box-shadow: 0 0 0 2px var(--gold), 0 0 12px #f2cf73aa; }
.dc.month::before { content: '♛'; position: absolute; top: 1px; right: 3px; color: var(--red-2); font-size: 11px; }
.dc.claimed { filter: saturate(.5); opacity: .55; }
.dc.claimed::after { content: '✔'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--green); text-shadow: 0 1px 0 #fff; }
.dc.missed { filter: grayscale(.85); opacity: .6; box-shadow: 0 0 0 1.5px dashed var(--line); }
.dc.missed .rl { color: var(--red-2); display: flex; align-items: center; gap: 1px; }
.dc .rl .coin { width: 9px; height: 9px; }
.dc.today { box-shadow: 0 0 0 3px var(--red), 0 0 14px #a52a2477; animation: selpulse 1.4s infinite; z-index: 1; }
.dc.today.claimed { animation: none; box-shadow: 0 0 0 2px var(--green); }
.calleg { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--ink-soft); margin: 10px 4px 0; }
.calleg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }
@keyframes pulse { 50% { transform: scale(1.3); } }

/* ---------- общие элементы ---------- */
h2 { margin: 0 0 14px; font-size: 26px; color: var(--red-2); display: flex; align-items: center; gap: 10px; }
h2::after { content: ''; flex: 1; height: 8px; background: var(--orn); background-size: 16px 8px; opacity: .55; border-radius: 2px; }
.bigcard h2::after, .sheet h2.plain::after { display: none; }
h3 { margin: 22px 0 10px; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
h3::before, h3::after { content: ''; height: 1px; background: var(--line); flex: 1; }
h3::before { flex: 0 0 14px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.panel {
  background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; box-shadow: 0 2px 0 #c9ad7e66;
}
.row { display: flex; align-items: center; gap: 10px; }
.row .grow, .grow { flex: 1; min-width: 0; }
.btn {
  background: linear-gradient(#bf3a31, var(--red-2)); color: #fff3dc; border: 0; border-radius: 11px;
  padding: 9px 15px; font-weight: bold; box-shadow: 0 3px 0 #5a1310, inset 0 1px 0 #ffffff33;
  transition: transform .08s, box-shadow .08s; display: inline-flex; align-items: center; gap: 5px; justify-content: center;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #5a1310; }
.btn.green { background: linear-gradient(#5e9142, var(--green-2)); box-shadow: 0 3px 0 #22380f, inset 0 1px 0 #ffffff33; }
.btn.gold { background: linear-gradient(var(--gold-2), var(--gold)); color: var(--ink); box-shadow: 0 3px 0 #8a5f14, inset 0 1px 0 #ffffff66; }
.btn.ghost { background: var(--paper-3); color: var(--ink); border: 1.5px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.btn:disabled { filter: grayscale(.8); opacity: .5; cursor: default; }
.btn.wide { width: 100%; padding: 13px; font-size: 16px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
select { font: inherit; padding: 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper-3); width: 100%; }

/* ---------- портреты ---------- */
.art { width: 100%; height: 100%; object-fit: cover; display: block; }
.emo { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 1.9em; filter: drop-shadow(0 2px 2px #0004); }

/* ---------- хутор: сцена ---------- */
.scene { position: relative; border-radius: var(--radius); overflow: hidden; margin: -4px 0 14px; border: 2px solid var(--line); box-shadow: 0 3px 0 #c9ad7e88; }
.scene svg { display: block; width: 100%; height: auto; }
.scene .smoke { animation: smoke 4s infinite ease-out; transform-box: fill-box; transform-origin: center; }
.scene .smoke.s2 { animation-delay: 1.3s; } .scene .smoke.s3 { animation-delay: 2.6s; }
@keyframes smoke { from { transform: translate(0,0) scale(.5); opacity: .8; } to { transform: translate(10px,-30px) scale(1.6); opacity: 0; } }
.scene .cloud { animation: drift 40s linear infinite; }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(520px); } }
.scene .window { animation: flicker 3s infinite; }
@keyframes flicker { 50% { opacity: .75; } }
.scene .label { position: absolute; left: 12px; bottom: 10px; color: #fff3dc; font-family: "Ruslan Display", serif; font-size: 22px; text-shadow: 0 2px 6px #000a; }

.npcs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.npc { background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px 6px 9px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; position: relative; box-shadow: 0 2px 0 var(--line); transition: transform .15s; }
.npc:active { transform: scale(.96); }
.npc .face { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--gold); background: radial-gradient(#fff6dd, #e4cf9f); font-size: 28px; }
.npc b { font-size: 13px; line-height: 1.1; }
.npc small { color: var(--ink-soft); font-size: 11px; line-height: 1.1; }
.npc .alert { position: absolute; top: 4px; right: 8px; background: #e2463d; color: #fff; border-radius: 50%; width: 20px; height: 20px; font-weight: bold; font-size: 13px; display: flex; align-items: center; justify-content: center; animation: pulse 1.2s infinite; }
.npc .meter { width: 80%; height: 5px; border-radius: 3px; background: #0001; overflow: hidden; }
.npc .meter i { display: block; height: 100%; background: var(--green); }

.beds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.bed {
  aspect-ratio: 1; border-radius: 12px; border: 0; position: relative; padding: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 9px, #00000022 9px 11px),
    radial-gradient(circle at 30% 30%, #8a5d36, #5b3a1e);
  box-shadow: inset 0 -4px 0 #00000033, 0 3px 0 #3c2412;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff3dc; font-size: 11px; overflow: visible;
}
.bed .ring { position: absolute; left: 6px; right: 6px; top: 6px; height: 4px; border-radius: 2px; background: #0005; overflow: hidden; }
.bed .ring i { display: block; height: 100%; background: linear-gradient(90deg, #8ab84a, var(--gold-2)); transition: width 1s linear; }
.bed .plant { font-size: 30px; line-height: 1; transition: transform .3s; filter: drop-shadow(0 2px 1px #0006); }
.bed .tm { position: absolute; bottom: 4px; font-size: 11px; background: #0006; padding: 0 6px; border-radius: 8px; }
.bed.empty .plant { font-size: 22px; opacity: .55; }
.bed.empty .tm { background: none; opacity: .8; }
.bed.ripe { box-shadow: inset 0 -4px 0 #00000033, 0 3px 0 #3c2412, 0 0 0 3px var(--gold-2), 0 0 16px #f2cf73aa; }
.bed.ripe .plant { animation: bob 1.1s ease-in-out infinite; }
.bed.pop .plant { animation: pop .45s; }
.bed.buy { background: transparent; border: 2px dashed var(--line); color: var(--ink-soft); box-shadow: none; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
@keyframes pop { from { transform: scale(0); } 60% { transform: scale(1.3); } }

.domovoy { display: flex; gap: 12px; align-items: center; }
.domovoy .face { width: 52px; height: 52px; flex: none; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--gold); background: radial-gradient(#fff6dd, #e4cf9f); font-size: 28px; }
.domovoy .face.busy { animation: wiggle 2.5s infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
.barn { height: 7px; border-radius: 4px; background: #0001; overflow: hidden; margin-top: 5px; }
.barn i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #8ab84a); transition: width .4s; }

.inv { display: flex; gap: 8px; flex-wrap: wrap; }
.inv span { background: var(--paper-3); border: 1.5px solid var(--line); border-radius: 20px; padding: 4px 12px 4px 6px; font-size: 15px; display: flex; align-items: center; gap: 4px; font-weight: bold; }
.inv span.bump { animation: bump .4s; }

/* ---------- карты ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.card {
  --rc: var(--line);
  background: linear-gradient(160deg, #fffaf0, #efe0bf); border: 0; border-radius: 12px;
  padding: 0 0 7px; text-align: center; position: relative; overflow: hidden;
  box-shadow: 0 0 0 2.5px var(--rc), 0 4px 0 color-mix(in srgb, var(--rc) 60%, #000), 0 6px 10px #0002;
  transition: transform .15s;
}
.card:active { transform: scale(.96); }
.card .pic { aspect-ratio: 1; margin: 5px 5px 4px; border-radius: 8px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #fff7e0, color-mix(in srgb, var(--rc) 30%, #e8d6ae)); font-size: 22px; box-shadow: inset 0 0 0 1px #0002; }
.card .nm { font-family: "Ruslan Display", serif; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.card .st { font-size: 11px; color: var(--ink-soft); display: flex; justify-content: center; gap: 8px; }
.card .lv { position: absolute; top: 9px; left: 9px; font-size: 11px; color: #fff; background: var(--rc); font-weight: bold; padding: 0 6px; border-radius: 8px; box-shadow: 0 1px 2px #0005; }
.card .tg { position: absolute; top: 8px; right: 8px; font-size: 11px; background: #fff9; border-radius: 8px; padding: 0 3px; }
.card .badge { display: inline-block; margin-top: 4px; font-size: 10px; background: var(--green); color: #fff; padding: 1px 8px; border-radius: 8px; }
.card .badge.res { background: var(--ink-soft); }
.card.up .pic::after { content: '▲'; position: absolute; bottom: 52px; right: 12px; color: #fff; background: var(--green); width: 20px; height: 20px; border-radius: 50%; font-size: 11px; line-height: 20px; animation: pulse 1.2s infinite; }
.card.off { filter: saturate(.4); opacity: .7; }
.card.r-epic, .card.r-legendary { background: linear-gradient(160deg, #fffaf0, color-mix(in srgb, var(--rc) 25%, #efe0bf)); }
.card.r-epic::before, .card.r-legendary::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, #ffffff88 50%, transparent 60%);
  background-size: 250% 100%; animation: shine 3.5s infinite;
}
@keyframes shine { from { background-position: 150% 0; } 60%, to { background-position: -100% 0; } }

/* ---------- поле ---------- */
.board { padding: 10px; border-radius: var(--radius); background: linear-gradient(#5d7c3d, #3e5a26); box-shadow: inset 0 0 0 3px #2c4219, 0 3px 0 #2c4219; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cell {
  aspect-ratio: 1; border-radius: 10px; background: #ffffff1a; border: 1.5px dashed #ffffff40;
  display: flex; align-items: center; justify-content: center; position: relative; transition: background .2s;
}
.cell.sel .unit { animation: selpulse 1s infinite; }
@keyframes selpulse { 50% { box-shadow: 0 0 0 3px var(--gold-2), 0 0 14px var(--gold-2); } }
.cell.target { background: #f2cf7333; border-color: var(--gold-2); animation: tpulse 1.2s infinite; }
@keyframes tpulse { 50% { background: #f2cf7355; } }
.cell.target .unit { animation: swappulse 1s infinite; }
@keyframes swappulse { 50% { box-shadow: 0 0 0 3px var(--gold-2), 0 0 12px var(--gold-2); transform: scale(.95); } }
.unit { width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 9px; overflow: hidden; background: #fffaf0; box-shadow: 0 0 0 2px var(--rc, var(--line)), 0 3px 0 #0005; position: relative; }
.unit .pic { flex: 1; min-height: 0; font-size: 20px; background: radial-gradient(circle at 50% 40%, #fff7e0, #e3cf9f); }
.unit .nm { font-size: 10px; padding: 1px 2px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; background: #fffaf0; }
.unit.captain { box-shadow: 0 0 0 2.5px var(--gold-2), 0 0 10px #f2cf73, 0 3px 0 #0005; }
.unit.captain::after { content: '♛'; position: absolute; top: -1px; right: 3px; color: var(--gold); font-size: 14px; text-shadow: 0 1px 0 #fff; }
.frontlabel { text-align: center; font-size: 12px; color: #e9f1d8; margin: 0 0 6px; letter-spacing: 1px; }
.frontlabel.bottom { margin: 6px 0 0; }

.syn { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.syn button { position: relative; font-size: 12px; padding: 4px 9px; border-radius: 12px; background: var(--paper-3); color: var(--ink-soft); border: 1px solid var(--line); }
.syn button.on { background: linear-gradient(#5e9142, var(--green-2)); color: #fff; border-color: transparent; box-shadow: 0 0 10px #8ab84a88; }
@media (hover: hover) {
  .syn button:hover::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
    width: 190px; background: var(--navy); color: #f4ead3; font-size: 12px; line-height: 1.3; padding: 7px 10px; border-radius: 9px;
    box-shadow: 0 4px 12px #0005; z-index: 10; pointer-events: none; text-align: left; white-space: normal; animation: fade .15s;
  }
}
.synlist { margin-top: 8px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.synlist > div:not(.muted) { color: var(--green-2); }

/* ---------- Тёмный край ---------- */
.navmap { position: relative; border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 120%, #3c2f5a, #12141f 70%); padding: 14px; margin-bottom: 12px; color: #e8e2d4; }
.navmap .stars i { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; animation: twinkle 3s infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.navmap p { position: relative; margin: 0; font-size: 13px; color: #b9b2c9; }
.loc { position: relative; overflow: hidden; color: #eee6d4; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; box-shadow: 0 4px 0 #0b0d14, inset 0 0 0 1.5px #ffffff22; }
.loc.les { background: linear-gradient(135deg, #1f3a22, #0f1c12); }
.loc.boloto { background: linear-gradient(135deg, #2c3a2a, #1a2420 60%, #24311f); }
.loc.kurgany { background: linear-gradient(135deg, #3a3346, #1a1722); }
.loc::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, #ffffff14, transparent 50%); pointer-events: none; }
.loc .ic { width: 64px; height: 64px; flex: none; border-radius: 12px; overflow: hidden; font-size: 34px; background: #ffffff10; box-shadow: inset 0 0 0 1.5px #ffffff26; }
.loc b { font-family: "Ruslan Display", serif; font-size: 18px; font-weight: normal; }
.loc .muted { color: #a9a49a; }
.loc .stars-r { color: var(--gold-2); font-size: 12px; margin-top: 3px; }
.loc.locked { filter: grayscale(.7); opacity: .6; }
.loc .fog { position: absolute; left: -50%; right: -50%; bottom: -10px; height: 40px; background: radial-gradient(ellipse at center, #ffffff18, transparent 70%); animation: fog 12s ease-in-out infinite alternate; pointer-events: none; }
@keyframes fog { to { transform: translateX(25%); } }

/* ---------- бой ---------- */
#battle {
  position: fixed; inset: 0; z-index: 20; color: #eee6d4;
  background: radial-gradient(circle at 50% 30%, #2b3350, var(--navy) 70%);
  display: flex; justify-content: center; overflow-y: auto;
}
#battle.les { background: radial-gradient(circle at 50% 30%, #24402a, #0c140d 75%); }
#battle.boloto { background: radial-gradient(circle at 50% 30%, #2f3f33, #0f1612 75%); }
#battle .wrap { width: 100%; max-width: 480px; padding: 12px 16px 20px; position: relative; }
#battle .bhead { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 10px; }
#battle .bhead b { font-family: "Ruslan Display", serif; font-weight: normal; font-size: 18px; color: var(--gold-2); }
#battle .pill { background: #0006; padding: 3px 10px; border-radius: 12px; }
#battle .field { padding: 8px; border-radius: 14px; background: #0003; box-shadow: inset 0 0 0 1.5px #ffffff18; }
#battle .grid { gap: 5px; }
#battle .cell { background: #ffffff0a; border: 1px solid #ffffff14; border-style: solid; }
#battle .cell.mine { background: #7fae5a14; border-color: #7fae5a30; }
#battle .divider { grid-column: 1 / -1; height: 10px; display: flex; align-items: center; }
#battle .divider::before { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
#battle .unit { background: #f4ead3; color: var(--ink); transition: transform .14s ease-out; }
#battle .unit.enemy { --rc: #6e2b2b; }
#battle .unit.enemy .pic { background: radial-gradient(circle at 50% 40%, #e9d6d6, #a98989); }
#battle .unit.boss { box-shadow: 0 0 0 2.5px #e2463d, 0 0 14px #e2463d99; }
#battle .unit .nm { font-size: 10px; font-weight: bold; }
.hp { height: 5px; background: #0004; overflow: hidden; }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, #6fae4a, #9bd36b); transition: width .3s; }
.unit.enemy .hp i { background: linear-gradient(90deg, #b8322b, #e2584e); }
.unit.dying { animation: die .55s forwards; }
.unit.hit { animation: hit .3s; }
.unit.lunge-up { transform: translateY(-16px) scale(1.1); z-index: 2; }
.unit.lunge-down { transform: translateY(16px) scale(1.1); z-index: 2; }
.unit.healed { box-shadow: 0 0 0 2px #9be38a, 0 0 16px 4px #7fd36b; }
.unit.zap { box-shadow: 0 0 0 2px #ffb347, 0 0 18px 6px #f0a33a; }
@keyframes hit { 0% { filter: brightness(2.2) saturate(0); } 20% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 80% { transform: translateX(-2px); } }
@keyframes die { 30% { filter: brightness(2.5); } to { opacity: 0; transform: scale(.3) rotate(25deg); } }
.field.shake { animation: fshake .35s; }
@keyframes fshake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, -1px); } 80% { transform: translate(2px, 2px); } }

#battle .log { min-height: 24px; text-align: center; font-size: 14px; margin: 12px 0; color: var(--gold-2); }
#battle .log span { display: inline-block; animation: enter .25s; }
#battle .controls { display: flex; gap: 10px; align-items: center; }
.energy { flex: 1; font-size: 13px; }
.energy .bar { height: 10px; background: #0006; border-radius: 5px; overflow: hidden; margin-top: 4px; box-shadow: inset 0 0 0 1px #ffffff18; }
.energy .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f07a2a, #ffd166); transition: width .3s; }
.btn.spell:not(:disabled) { animation: ready 1s infinite; }
@keyframes ready { 50% { box-shadow: 0 3px 0 #5a1310, 0 0 18px #ffb347; } }
.speed button { background: #ffffff10; border: 1px solid #ffffff2a; color: #eee6d4; border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.speed button.on { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; z-index: 5; pointer-events: none; }
.banner span { display: inline-block; font-family: "Ruslan Display", serif; font-size: 34px; color: var(--gold-2); text-shadow: 0 3px 0 #000, 0 0 24px #000; background: linear-gradient(90deg, transparent, #000a 20%, #000a 80%, transparent); padding: 8px 60px; animation: banner 1.3s forwards; }
@keyframes banner { 0% { transform: scale(2.2); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } to { opacity: 0; transform: scale(.95); } }

/* ---------- эффекты (слой поверх всего) ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.fx { position: absolute; transform: translate(-50%, -50%); will-change: transform, opacity; }
.fx.float { font-weight: bold; font-size: 20px; white-space: nowrap; text-shadow: 0 2px 0 #000, 0 0 6px #000; font-family: "Ruslan Display", serif; }
.fx.float.dmg { color: #ff7b6b; }
.fx.float.heal { color: #a6f08f; }
.fx.float.crit { color: #ffd166; font-size: 26px; }
.fx.float.gain { color: var(--gold-2); font-size: 18px; }
.fx.dot { width: 7px; height: 7px; border-radius: 50%; }
.fx.arrow { width: 26px; height: 3px; background: linear-gradient(90deg, #6b4a2b, #d9c49a); border-radius: 2px; }
.fx.arrow::after { content: ''; position: absolute; right: -6px; top: -3px; border-left: 8px solid #ddd; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.fx.orb { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(#fff, #c38cff 40%, #7b3fbf 70%, transparent 72%); box-shadow: 0 0 14px 5px #b07cff; }
.fx.orb.enemy { background: radial-gradient(#fff, #7cffc1 40%, #2f9f6f 70%, transparent 72%); box-shadow: 0 0 14px 5px #5cf0a8; }
.fx.fire { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(#fff6c8, #ffb347 40%, #e8461f 70%, transparent 72%); box-shadow: 0 0 16px 6px #ff8a3d; }
.fx.slash { width: 60px; height: 60px; border-radius: 50%; border-top: 4px solid #fff; border-right: 2px solid #fff8; filter: drop-shadow(0 0 4px #fff); }
.fx.coinfly { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b8, var(--gold) 55%, #94661a); box-shadow: inset 0 0 0 2px #b07d22; }
.fx.icon { font-size: 26px; }
.flash { position: fixed; inset: 0; z-index: 49; pointer-events: none; animation: flash .45s forwards; }
@keyframes flash { from { opacity: .55; } to { opacity: 0; } }

/* ---------- модальное окно ---------- */
#modal { position: fixed; inset: 0; z-index: 30; background: rgba(20,12,6,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
#modal .sheet {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; position: relative;
  background: var(--noise), linear-gradient(var(--paper-3), var(--paper));
  border-radius: 22px 22px 0 0; padding: 22px 16px 26px;
  animation: up .28s cubic-bezier(.2,1.3,.4,1);
  border-top: 4px solid var(--gold);
}
#modal .sheet::before { content: ''; position: absolute; left: 50%; top: 8px; width: 44px; height: 5px; border-radius: 3px; background: var(--line); transform: translateX(-50%); }
@keyframes up { from { transform: translateY(60px); opacity: 0; } }
.close { position: absolute; right: 12px; top: 12px; background: var(--paper-2); border: 0; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; color: var(--ink-soft); z-index: 3; }
.bigcard { text-align: center; position: relative; }
.bigcard .portrait { width: 132px; height: 132px; margin: 0 auto 8px; border-radius: 18px; overflow: hidden; font-size: 40px; background: radial-gradient(circle at 50% 40%, #fff7e0, color-mix(in srgb, var(--rc, var(--line)) 35%, #e3cf9f)); box-shadow: 0 0 0 3px var(--rc, var(--line)), 0 6px 16px #0003; animation: popin .4s cubic-bezier(.2,1.5,.4,1); }
.bigcard .portrait.round { border-radius: 50%; }
.bigcard .portrait { display: flex; align-items: center; justify-content: center; }
.bigcard .portrait > .chest.mini { transform: scale(2); }
@keyframes popin { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
.bigcard h2 { justify-content: center; margin: 0; }
.bigcard .sub { font-weight: bold; margin-top: 2px; }
.rays { position: absolute; left: 50%; top: 66px; width: 320px; height: 320px; transform: translate(-50%, -50%); background: repeating-conic-gradient(#f2cf7355 0 10deg, transparent 10deg 20deg); border-radius: 50%; -webkit-mask: radial-gradient(#000 30%, transparent 70%); mask: radial-gradient(#000 30%, transparent 70%); animation: spin 14s linear infinite; z-index: -1; }
.sheet .bigcard { z-index: 0; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.stats div { background: var(--paper-3); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; font-size: 14px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .ic { width: 46px; height: 46px; flex: none; border-radius: 10px; overflow: hidden; font-size: 24px; background: radial-gradient(circle at 50% 40%, #fff7e0, #e3cf9f); box-shadow: 0 0 0 2px var(--rc, var(--line)); }
.reward-row { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.reward-row span { background: var(--paper-3); border: 1.5px solid var(--gold); border-radius: 12px; padding: 6px 12px; font-weight: bold; display: flex; gap: 6px; align-items: center; animation: popin .4s both; }
.reward-row span:nth-child(2) { animation-delay: .1s; } .reward-row span:nth-child(3) { animation-delay: .2s; }
.dropcard { animation: popin .5s both; }

#toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(#2c2418, #1a140c); color: #f4ead3; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 60; max-width: 90vw; text-align: center;
  border: 1.5px solid var(--gold); box-shadow: 0 6px 20px #0006;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.quest { border-left: 5px solid var(--gold); position: relative; overflow: hidden; }
.quest.ready { border-left-color: var(--green); box-shadow: 0 0 0 2px #8ab84a66, 0 2px 0 #c9ad7e66; }
.quest.ready::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, #ffffff66 50%, transparent 60%); background-size: 250% 100%; animation: shine 2.5s infinite; pointer-events: none; }
.quest.done { opacity: .6; border-left-color: var(--green); padding: 8px 12px; }
.qprog { display: flex; gap: 4px; margin: 6px 0 12px; }
.qprog i { flex: 1; height: 6px; border-radius: 3px; background: #0001; }
.qprog i.on { background: var(--green); }
.qprog i.cur { background: var(--gold); }
.mihey { display: flex; gap: 12px; align-items: flex-start; }
.mihey .face { width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden; border: 3px solid var(--gold); background: radial-gradient(#fff6dd, #e4cf9f); font-size: 34px; }
.speech { position: relative; background: #fff; border-radius: 12px; padding: 9px 12px; font-style: italic; font-size: 14px; box-shadow: 0 2px 0 var(--line); }
.speech::before { content: ''; position: absolute; left: -7px; top: 18px; border-right: 8px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* ---------- профиль в шапке ---------- */
#top .lvl { background: none; border: 0; color: inherit; padding: 0; text-align: right; }
.starsTop { color: var(--gold-2); }
.starsTop.bump { display: inline-block; animation: bump .5s; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

/* ---------- переключатель ---------- */
.seg { display: flex; background: var(--paper-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; border: 1.5px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-weight: bold; color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; position: relative; }
.seg button small { font-weight: normal; font-size: 11px; }
.seg button.on { background: var(--paper-3); color: var(--red-2); box-shadow: 0 2px 0 var(--line); }
.seg .dot { position: absolute; top: 6px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #e2463d; animation: pulse 1.2s infinite; }

/* ---------- достижения ---------- */
.rankbox { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff6dc, #f2dfae); border-color: var(--gold); }
.bigstar { font-size: 40px; color: var(--gold); line-height: 1; text-align: center; text-shadow: 0 2px 0 #8a5f14; }
.bigstar b { display: block; font-size: 18px; color: var(--ink); text-shadow: none; font-family: "Ruslan Display", serif; font-weight: normal; }
.bigstar.inline { font-size: 26px; margin-top: 6px; }
.bigstar.inline b { display: inline; font-size: 22px; margin-left: 4px; }
.ach { display: flex; gap: 12px; align-items: flex-start; }
.achic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff7e0, #e3cf9f); display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 0 0 2px var(--line); }
.ach.ready { border-color: var(--gold); box-shadow: 0 0 0 2px #f2cf7388, 0 0 14px #f2cf7366; }
.ach.ready .achic { box-shadow: 0 0 0 2px var(--gold); animation: bob 1.4s infinite; }
.ach.done { opacity: .75; }
.ach.done .achic { box-shadow: 0 0 0 2px var(--gold); background: radial-gradient(#fff3c4, var(--gold-2)); }
.tierstars { white-space: nowrap; font-size: 13px; letter-spacing: -1px; }
.tierstars i { font-style: normal; color: #d8c9a8; }
.tierstars i.on { color: var(--gold); text-shadow: 0 1px 0 #8a5f14; }

/* ---------- походы ---------- */
.exp { border-radius: var(--radius); padding: 14px; margin-bottom: 6px; color: #eee6d4; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #5a4426, #33240f); box-shadow: 0 4px 0 #1e1408, inset 0 0 0 1.5px #f2cf7333; }
.exp .muted { color: #cbb894; }
.exp b { font-family: "Ruslan Display", serif; font-weight: normal; font-size: 17px; color: var(--gold-2); }
.expic { font-size: 34px; }
.exp .barn { background: #0005; }
.exp.back { box-shadow: 0 4px 0 #1e1408, 0 0 0 2px var(--gold), 0 0 18px #f2cf7366; }
.trail { position: relative; height: 54px; margin: 0 22px 10px; border-bottom: 2px dashed #f2cf7355; }
.party { position: absolute; bottom: 4px; transform: translateX(-50%); display: flex; gap: 2px; transition: left 1s linear; }
.walker { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: radial-gradient(#fff7e0, #e3cf9f); box-shadow: 0 0 0 2px var(--rc); font-size: 15px; }
.walker.go { animation: walk .6s ease-in-out infinite alternate; }
@keyframes walk { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-5px) rotate(4deg); } }
.cards.small { grid-template-columns: repeat(4, 1fr); gap: 8px 6px; }
.cards.small .nm { font-size: 9.5px; letter-spacing: -.2px; padding: 0 2px; }
.card.picked { box-shadow: 0 0 0 3px var(--gold-2), 0 0 14px var(--gold-2), 0 4px 0 #8a5f14; transform: translateY(-3px); }
.card.picked::after { content: '✔'; position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; font-weight: bold; line-height: 28px; z-index: 3; box-shadow: 0 2px 6px #0005; }
.card .badge.away { background: #8a5f14; }
.unit.away { opacity: .45; filter: grayscale(.7); }

/* ---------- сундуки ---------- */
.seg button { font-size: 13px; }
.achcase { font-size: 12px; margin-top: 2px; }
.chests { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chestcard { position: relative; background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 10px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 0 0 0 var(--cc), 0 2px 0 var(--line); }
.chestcard:not(.empty) { border-color: var(--cc); box-shadow: 0 0 14px color-mix(in srgb, var(--cc) 45%, transparent), 0 2px 0 var(--line); }
.chestcard.empty { opacity: .6; }
.nochests { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink-soft); }
.nochests span { font-size: 40px; opacity: .45; filter: grayscale(1); }
.nochests b { font-size: 16px; }
.chestcard b { font-family: "Ruslan Display", serif; font-weight: normal; font-size: 14px; color: var(--cc); }
.chestcard small { font-size: 11px; color: var(--ink-soft); line-height: 1.25; min-height: 42px; }
.chestcard .cnt { position: absolute; top: 8px; right: 10px; background: var(--red); color: #fff; font-weight: bold; border-radius: 10px; padding: 0 8px; font-size: 13px; }

.chest { --cc: #8a7a5a; width: 72px; height: 58px; position: relative; margin: 0 auto; filter: drop-shadow(0 4px 3px #0004); }
.chest .lid { position: absolute; left: 0; right: 0; top: 0; height: 24px; border-radius: 16px 16px 3px 3px; transform-origin: 50% 100%;
  background: linear-gradient(90deg, transparent 18%, #d29b2e 18% 26%, transparent 26% 74%, #d29b2e 74% 82%, transparent 82%),
              linear-gradient(color-mix(in srgb, var(--cc) 70%, #fff), var(--cc)); box-shadow: inset 0 -2px 0 #0003; }
.chest .body { position: absolute; left: 0; right: 0; bottom: 0; height: 36px; border-radius: 3px 3px 8px 8px;
  background: linear-gradient(90deg, transparent 18%, #d29b2e 18% 26%, transparent 26% 74%, #d29b2e 74% 82%, transparent 82%),
              linear-gradient(var(--cc), color-mix(in srgb, var(--cc) 60%, #000)); }
.chest .lock { position: absolute; left: 50%; top: 17px; width: 15px; height: 17px; transform: translateX(-50%); border-radius: 4px; background: linear-gradient(#ffe7a0, #c9962c); box-shadow: 0 0 0 1.5px #7a5410; }
.chest .lock::after { content: ''; position: absolute; left: 50%; top: 5px; width: 4px; height: 6px; border-radius: 2px; background: #5a3d0c; transform: translateX(-50%); }
.chest.idle { animation: chestidle 2.6s infinite; }
@keyframes chestidle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-5deg); } 80% { transform: rotate(5deg); } 85% { transform: rotate(-3deg); } 90% { transform: rotate(2deg); } }
.chest.opening { width: 96px; height: 78px; margin-bottom: 8px; }
.chest.opening .lid { height: 32px; animation: lidopen .7s .2s forwards; }
.chest.opening .body { height: 48px; }
.chest.opening .lock { top: 24px; animation: fade .3s .1s reverse forwards; }
.chest.opening::after { content: ''; position: absolute; left: 10%; right: 10%; top: 30%; height: 30px; border-radius: 50%; background: radial-gradient(#fff6c8, transparent 70%); opacity: 0; animation: glow 1.2s .5s forwards; }
@keyframes lidopen { to { transform: translateY(-14px) rotateX(70deg) rotate(-8deg); } }
@keyframes glow { 50% { opacity: 1; } to { opacity: .6; } }

.caseopen { text-align: center; }
.roulette { position: relative; overflow: hidden; height: 112px; margin: 6px -16px 0; background: linear-gradient(90deg, var(--paper-2), var(--paper-3) 20% 80%, var(--paper-2)); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.roulette::before, .roulette::after { content: ''; position: absolute; top: 0; bottom: 0; width: 60px; z-index: 2; pointer-events: none; }
.roulette::before { left: 0; background: linear-gradient(90deg, var(--paper-2), transparent); }
.roulette::after { right: 0; background: linear-gradient(-90deg, var(--paper-2), transparent); }
.roulette .marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; background: var(--red); transform: translateX(-50%); z-index: 3; box-shadow: 0 0 8px var(--red); }
.roulette .marker::before, .roulette .marker::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); border-left: 9px solid transparent; border-right: 9px solid transparent; }
.roulette .marker::before { top: 0; border-top: 11px solid var(--red); }
.roulette .marker::after { bottom: 0; border-bottom: 11px solid var(--red); }
.strip { display: flex; gap: 8px; padding: 10px 0; will-change: transform; }
.tile { flex: none; width: 84px; height: 92px; border-radius: 10px; background: #fffaf0; box-shadow: 0 0 0 2.5px var(--tc), inset 0 -26px 0 color-mix(in srgb, var(--tc) 18%, transparent); display: flex; flex-direction: column; overflow: hidden; }
.tile .ti { flex: 1; min-height: 0; font-size: 20px; }
.tile .ti .coin { width: 30px; height: 30px; }
.tile .tl { font-size: 10px; font-weight: bold; padding: 3px 3px 5px; line-height: 1.1; height: 26px; display: flex; align-items: center; justify-content: center; }
.tile.win { animation: winpulse .8s 3; box-shadow: 0 0 0 3px var(--tc), 0 0 22px var(--tc); }
@keyframes winpulse { 50% { transform: scale(1.08); } }
.caseresult { min-height: 90px; margin-top: 12px; }
.won { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--paper-3); border: 2px solid var(--tc); border-radius: 14px; padding: 10px; animation: popin .4s; box-shadow: 0 0 16px color-mix(in srgb, var(--tc) 40%, transparent); }
.won .wi { width: 58px; height: 58px; flex: none; border-radius: 12px; overflow: hidden; font-size: 26px; background: radial-gradient(circle at 50% 40%, #fff7e0, #e3cf9f); box-shadow: 0 0 0 2px var(--tc); }
.won .wi .coin { width: 32px; height: 32px; }
.won b { font-size: 16px; }

/* ---------- загон ---------- */
.pens { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pen { position: relative; border: 0; border-radius: 12px; padding: 14px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  background: repeating-linear-gradient(90deg, #c9a46a 0 3px, transparent 3px 16px), linear-gradient(#e9dcb5, #d4c08c);
  box-shadow: inset 0 0 0 2px #8a6440, 0 3px 0 #6b4a2b; }
.pen .aic { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; font-size: 24px; background: radial-gradient(#fffaf0, #eadbb8); box-shadow: 0 0 0 2px #8a6440; }
.pen b { font-size: 12px; }
.pen small { font-size: 10px; color: var(--ink-soft); }
.pen .nest { font-size: 12px; font-weight: bold; background: #fff9; border-radius: 8px; padding: 0 6px; }
.pen .lvl { position: absolute; top: 4px; left: 5px; font-size: 10px; font-weight: bold; color: #fff; background: var(--green); border-radius: 7px; padding: 0 5px; }
.pen .upb { position: absolute; top: 4px; right: 5px; font-size: 10px; color: #fff; background: var(--green); border-radius: 50%; width: 16px; height: 16px; line-height: 16px; animation: pulse 1.2s infinite; }
.pen .ring { width: 80%; height: 4px; border-radius: 2px; background: #0002; overflow: hidden; margin-top: 2px; }
.pen .ring i { display: block; height: 100%; background: linear-gradient(90deg, #8ab84a, var(--gold-2)); transition: width 1s linear; }
.pen.has { box-shadow: inset 0 0 0 2px #8a6440, 0 3px 0 #6b4a2b, 0 0 0 3px var(--gold-2), 0 0 12px #f2cf7399; }
.pen.has .aic { animation: bob 1.1s ease-in-out infinite; }
.pen.full small { color: var(--red); font-weight: bold; }
.pen.empty { filter: grayscale(.8); opacity: .65; }
.chest.mini { width: 40px; height: 32px; transform: scale(.9); }
.chest.mini .lid { height: 13px; }
.chest.mini .body { height: 20px; }
.chest.mini .lock { top: 9px; width: 9px; height: 10px; }
.chest.mini .lock::after { top: 3px; width: 3px; height: 4px; }

.chestdrop { display: flex; gap: 14px; justify-content: center; margin: 6px 0 10px; }
.chestdrop > div { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: popin .5s .3s both; }
.chestdrop small { font-weight: bold; font-size: 12px; }

/* ---------- снаряжение ---------- */
.herobar { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: var(--paper-3); border: 1.5px solid var(--gold); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 4px; box-shadow: 0 2px 0 var(--line); }
.herobar .hp-pic { width: 46px; height: 46px; flex: none; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--gold); font-size: 24px; background: radial-gradient(#fff6dd, #e4cf9f); }
.herobar b { display: block; font-family: "Ruslan Display", serif; font-weight: normal; font-size: 15px; }
.herobar small { color: var(--ink-soft); font-size: 12px; }
.gmini { display: flex; gap: 4px; }
.gmini i { width: 26px; height: 26px; border-radius: 7px; background: #0000000a; box-shadow: 0 0 0 1.5px var(--rc); font-style: normal; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.gslots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gslot { background: var(--paper-3); border: 0; border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 0 0 2px var(--rc), 0 3px 0 #0002; text-align: center; }
.gslot.empty { box-shadow: 0 0 0 1.5px var(--line); border: 1.5px dashed var(--line); }
.gslot .gi { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; font-size: 22px; background: radial-gradient(circle at 50% 40%, #fff7e0, #e3cf9f); }
.gslot small { font-size: 11px; color: var(--ink-soft); }
.gslot b { font-size: 12px; line-height: 1.15; }

/* ---------- значки снаряжения и руны на карте (справа) ---------- */
.card .pic { position: relative; }
.eq { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 2px; z-index: 2; }
.eq i { width: 17px; height: 17px; border-radius: 5px; font-style: normal; font-size: 10px; line-height: 17px; text-align: center;
  background: #fffaf0; box-shadow: 0 0 0 1.5px var(--ic, var(--line)), 0 1px 2px #0003; }
.eq i.no { background: #0000000d; box-shadow: inset 0 0 0 1px #00000014; }
.eq i.rn { font-family: serif; font-weight: bold; color: var(--ic); }
.card.idle .pic > .emo, .card.idle .pic > .art { filter: saturate(.75); }
.unit .pic { position: relative; }
.ueq { position: absolute; right: 1px; top: 1px; display: flex; flex-direction: column; gap: 1px; }
.ueq i { width: 12px; height: 12px; border-radius: 3px; font-style: normal; font-size: 7px; line-height: 12px; text-align: center; background: #fffaf0; box-shadow: 0 0 0 1px var(--ic); font-family: serif; font-weight: bold; }
.ust { position: absolute; left: 1px; top: 1px; display: flex; gap: 1px; font-size: 10px; }
.ust i { font-style: normal; }
.unit.inert { box-shadow: 0 0 0 2px #c9a6ff, 0 0 12px #8e4fbf; }

.gslots.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gslots.four .gi { width: 44px; height: 44px; }
.gslots.four b { font-size: 11px; }
.gslots.four small { font-size: 10px; }
.runeglyph { font-family: serif; font-weight: bold; color: var(--rc, var(--ink)); }
.list-item .ic.runeic { display: flex; align-items: center; justify-content: center; font-family: serif; font-weight: bold; font-size: 26px; color: var(--rc); }
.lvtag { background: var(--green); color: #fff; border-radius: 6px; padding: 0 5px; font-size: 11px; font-weight: bold; }

/* ---------- кузня ---------- */
.npcs { grid-template-columns: repeat(4, 1fr) !important; gap: 6px !important; }
.npc { padding: 7px 3px 8px !important; }
.npc .face { width: 46px !important; height: 46px !important; font-size: 24px !important; display: flex; align-items: center; justify-content: center; }
.npc b { font-size: 12px !important; }
.npc small { font-size: 10px !important; }
.runecard { background: var(--paper-3); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.runebig { font-family: serif; font-weight: bold; font-size: 26px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: linear-gradient(#f2e6c6, #d9c28c); box-shadow: inset 0 0 0 1.5px #8a6440; color: #5a3a1a; }
.rtiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.rtier { display: flex; flex-direction: column; gap: 3px; padding: 7px 5px; border-radius: 10px; background: #fffaf0; box-shadow: 0 0 0 1.5px var(--rc); text-align: center; }
.rtier b { color: var(--rc); font-size: 14px; }
.rtier small { font-size: 10.5px; line-height: 1.2; }
.rtier .muted { font-size: 11px; }
.rtier .btn.sm { padding: 4px 4px; font-size: 10.5px; }

/* ---------- сложности и боссы ---------- */
.loc { flex-direction: column; align-items: stretch !important; }
.diffrow { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.diffrow .btn { margin-left: auto; }
.diff { background: #ffffff10; border: 1px solid #ffffff30; color: #f2cf73; border-radius: 9px; padding: 5px 10px; font-size: 13px; }
.diff.on { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: bold; }
.diff:disabled { opacity: .4; }
.bossline { font-size: 12px; color: #e9b8b8; margin-top: 4px; line-height: 1.3; }
.bossline b { font-family: inherit; font-size: 12px; color: #ffd0c8; }
.dstar { color: var(--gold-2); font-size: 14px; margin-left: 4px; }
.fx.float.poison { color: #7be36b; }

/* ---------- ежедневные задания ---------- */
.dtask { padding: 10px 12px; }
.dtask.ready { border-color: var(--gold); box-shadow: 0 0 0 2px #f2cf7388, 0 0 12px #f2cf7366; }
.dtask.done { opacity: .6; }

/* ---------- обучение ---------- */
#tutHint { position: fixed; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 28px)); z-index: 25;
  background: linear-gradient(#2c2418, #1a140c); color: #f4ead3; border: 2px solid var(--gold); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 8px 24px #000a; animation: fade .25s; }
#tutHint .tt { font-size: 14px; line-height: 1.4; }
#tutHint .muted { color: #cbb894; }
#tutHint .btn.ghost { background: transparent; color: #f4ead3; border-color: #ffffff40; box-shadow: none; }
#tutHint.arrow-up::before, #tutHint.arrow-down::after { content: ''; position: absolute; left: var(--ax, 50%); transform: translateX(-50%); border-left: 10px solid transparent; border-right: 10px solid transparent; }
#tutHint.arrow-up::before { top: -11px; border-bottom: 11px solid var(--gold); }
#tutHint.arrow-down::after { bottom: -11px; border-top: 11px solid var(--gold); }
.tut-glow { position: relative; z-index: 3; animation: tutglow 1.2s infinite !important; }
@keyframes tutglow { 50% { box-shadow: 0 0 0 4px var(--gold-2), 0 0 22px var(--gold-2); } }
.codebox { width: 100%; height: 110px; font: 11px/1.3 monospace; border-radius: 10px; border: 1.5px solid var(--line); padding: 8px; background: #fffaf0; word-break: break-all; resize: vertical; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===================== Обновление v30 ===================== */
/* верхняя панель: куны + кристаллы, колокольчик, настройки */
#top { gap: 8px; padding-left: 10px; padding-right: 10px; }
#top .money { display: flex; flex-direction: column; gap: 3px; }
#top .money .kuny { font-size: 16px; padding: 2px 10px 2px 3px; }
#top .cry { font-weight: bold; font-size: 13px; display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.2); padding: 1px 10px 1px 4px; border-radius: 20px; }
#top .lvl { font-size: 12px; }
#top .xpbar { width: 96px; margin-left: auto; }
.topbtns { display: flex; gap: 6px; }
.tbtn { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #f2cf7399; background: rgba(0,0,0,.22); color: #fff3dc; display: flex; align-items: center; justify-content: center; padding: 0; }
.tbtn svg { width: 20px; height: 20px; }
.tbtn:active { transform: scale(.92); }
.tbtn .cnt { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #e2463d; color: #fff; font-style: normal; font-size: 11px; font-weight: bold; line-height: 18px; text-align: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--red-2); animation: pulse 1.6s infinite; }
#nav .nl { display: block; }

/* кнопка «Выставить на поле» */
.btn.place { background: linear-gradient(#4fa843, #2f7d2a); color: #fff; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 3px 0 #1d4f1a, inset 0 1px 0 #ffffff44; transition: transform .08s, box-shadow .08s, filter .15s; }
.btn.place svg { width: 18px; height: 18px; flex: none; }
.btn.place:hover:not(:disabled) { filter: brightness(1.07); }
.btn.place:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #1d4f1a, inset 0 2px 4px #0004; }

/* кристаллы */
.btn.crystal { background: linear-gradient(#7fd3ff, #3a8fc9); color: #06243a; box-shadow: 0 3px 0 #1f5c86, inset 0 1px 0 #ffffff88; white-space: nowrap; }

/* карта мира */
.worldmap { position: relative; height: min(62vh, 460px); border-radius: var(--radius); overflow: hidden; border: 2.5px solid var(--gold); box-shadow: 0 4px 18px #0005, inset 0 0 30px #0004; background: #e7d6ad; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.worldmap:active { cursor: grabbing; }
.wm-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.wm-inner svg { display: block; width: 100%; height: 100%; }
.wm-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.wm-zoom button { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--gold); background: #fbf4e2ee; font-size: 20px; font-weight: bold; color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.wm-node { cursor: pointer; }
.wm-node .halo { fill: #f2cf73; opacity: .35; animation: halo 2.4s infinite; transform-box: fill-box; transform-origin: center; }
.wm-node.locked .halo { display: none; }
.wm-node .ring { fill: #fbf4e2; stroke: #d29b2e; stroke-width: 4; }
.wm-node.home .ring { stroke: #a52a24; }
.wm-node.locked .ring { stroke: #6b5a7b; }
.wm-node .fogc { fill: #1c1030; opacity: .62; }
.wm-node .lock { font-size: 26px; text-anchor: middle; }
.wm-node .ico { font-size: 40px; text-anchor: middle; }
.wm-node .lbl rect { fill: #3a2616; opacity: .88; }
.wm-node.locked .lbl rect { fill: #2a1a40; }
.wm-node .lbl text { fill: #fff3dc; font: bold 15px "PT Serif", serif; text-anchor: middle; }
.wm-node .badge { fill: #4d7a34; stroke: #fff; stroke-width: 2; }
.wm-node .badge.trip { fill: #d29b2e; }
.wm-node .bt { fill: #fff; font: bold 13px sans-serif; text-anchor: middle; }
.wm-node:hover .ring { stroke-width: 6; }
@keyframes halo { 50% { transform: scale(1.18); opacity: .1; } }
.worldmap .road { fill: none; stroke: #8a5d36; stroke-width: 6; stroke-dasharray: 2 12; stroke-linecap: round; }
.worldmap .road.closed { stroke: #6b5a7b; opacity: .6; }
.worldmap .river { fill: none; stroke: #6fa3c4; stroke-width: 16; stroke-linecap: round; opacity: .85; }
.worldmap .tree { fill: #3f6a2e; }
.worldmap .mound { fill: #a8925c; stroke: #8a7444; stroke-width: 2; }
.worldmap .reed { fill: none; stroke: #4f6a3a; stroke-width: 2.5; }
.worldmap .mount { fill: #4a3a5a; stroke: #2a1a40; stroke-width: 2; }
.worldmap .region { font: italic bold 22px "PT Serif", serif; fill: #5a3d24; opacity: .55; letter-spacing: 2px; }
.worldmap .region.dark { fill: #c9a6ff; opacity: .75; }
.worldmap .compass circle { fill: #fbf4e2; stroke: #8a5d36; stroke-width: 2; opacity: .8; }
.worldmap .compass path { fill: #a52a24; }
.worldmap .compass text { font: bold 14px serif; text-anchor: middle; fill: #5a3d24; }

/* просмотр сундука */
.lootgroup { border: 1.5px solid var(--gc); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: var(--paper-3); }
.lootgroup .lgh { background: color-mix(in srgb, var(--gc) 22%, var(--paper-3)); color: var(--ink); font-weight: bold; padding: 6px 10px; border-bottom: 1.5px solid var(--gc); }
.lootgroup .lgl { padding: 4px 8px; }
.lgi { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.lgi:last-child { border-bottom: 0; }
.lgi .ic { width: 38px; height: 38px; flex: none; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 22px; background: radial-gradient(#fffaf0, #eadbb8); box-shadow: 0 0 0 1.5px var(--gc); }
.lgi .ic img { width: 100%; height: 100%; object-fit: cover; }
.lgi .pp { font-weight: bold; color: var(--ink-soft); font-size: 13px; }
.chestcard[data-a] { cursor: pointer; }
.wonlist { display: flex; flex-direction: column; gap: 8px; }
.wonlist .won { padding: 8px; }
.wonlist .won .wi { width: 46px; height: 46px; }
.wonlist .won .wi img { width: 100%; height: 100%; object-fit: cover; }

/* неоткрытые карты */
.card.locked { filter: grayscale(.85); opacity: .72; }
.card.locked .pic img { filter: brightness(.7); }
.card .badge.lockb { background: #5a4a6b; }
.card.r-mythic { background: linear-gradient(160deg, #fffaf0, color-mix(in srgb, var(--rc) 28%, #efe0bf)); box-shadow: 0 0 0 2px var(--rc), 0 0 12px color-mix(in srgb, var(--rc) 60%, transparent); }
.dropcard.mythic { border: 2px solid #d23c3c; box-shadow: 0 0 14px #d23c3c88; }

/* уведомления */
.notes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.note { display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--paper-3); border: 1.5px solid var(--line); cursor: pointer; }
.note.unread { border-color: var(--gold); box-shadow: 0 0 0 2px #f2cf7366; background: #fff8e4; }
.note .nic { font-size: 22px; width: 32px; text-align: center; flex: none; }
.note.unread b::after { content: ' •'; color: #e2463d; }

/* настройки */
.setrow { margin-bottom: 10px; }
.range { width: 100%; margin-top: 10px; accent-color: var(--red); height: 28px; }
.switch { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font-weight: bold; color: var(--ink-soft); }
.switch i { width: 46px; height: 26px; border-radius: 13px; background: #b9a888; position: relative; transition: background .2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0005; transition: left .2s; }
.switch.on i { background: var(--green); }
.switch.on i::after { left: 23px; }
.switch.on { color: var(--green); }

/* шапка v32: аватарка, ник, уровень, валюта */
#top { gap: 8px; }
#top .ava { width: 42px; height: 42px; flex: none; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid var(--gold-2); background: #2a1a0e; box-shadow: 0 2px 6px #0006; }
#top .ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
#top .ava:active { transform: scale(.94); }
#top .who { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: inherit; display: flex; flex-direction: column; gap: 1px; }
#top .who .nick { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#top .who .lvtxt { font-size: 12px; opacity: .9; }
#top .who .xpbar { width: 100%; max-width: 110px; margin: 2px 0 0; }
#top .money { flex: none; }
/* ===================== v34: карта мира, заклинания, Бездна ===================== */
.worldmap { height: min(70vh, 540px); }
.wm-node .shadow { fill: #000; opacity: .22; }
.wm-node .ringo { stroke: #3a2616; stroke-width: 2; }
.wm-node .ring { fill: #fbf4e2; stroke: none; }
.wm-node .halo { r: 54; }
.wm-node.abyss .halo { fill: #9b5cff; opacity: .45; }
.wm-node .lbl rect { fill: #2a1a0e; opacity: .9; stroke: #d29b2e; stroke-width: 1.5; }
.wm-node .lbl text { font-size: 16px; }
.wm-node .badge.ab { fill: #6b2fbf; }
.wm-node .swirl { animation: swirl 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes swirl { to { transform: rotate(360deg); } }
.worldmap .roadbed { fill: none; stroke: #b08a5a; stroke-width: 14; stroke-linecap: round; opacity: .45; }
.worldmap .road { stroke-width: 5; stroke-dasharray: 3 13; }
.worldmap .river { stroke-width: 22; }
.worldmap .river.shine { stroke: #d8f0ff; stroke-width: 4; stroke-dasharray: 14 30; opacity: .7; animation: flow 6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -440; } }
.worldmap .sea path { animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.worldmap .cloud { opacity: .75; animation: drift 60s linear infinite alternate; }
.worldmap .cloud.c1 { animation-duration: 80s; } .worldmap .cloud.c2 { animation-duration: 70s; opacity: .5; } .worldmap .cloud.c3 { animation-duration: 90s; opacity: .55; }
@keyframes drift { to { transform: translateX(120px); } }
.worldmap .cloud { transform-box: fill-box; }
.worldmap .bird { animation: flap 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flap { 50% { transform: scaleY(.5); } }
.worldmap .wisp { fill: #b9ff8a; filter: drop-shadow(0 0 6px #b9ff8a); animation: wisp 3s ease-in-out infinite; }
.worldmap .wisp.w1 { animation-delay: 1s; } .worldmap .wisp.w2 { animation-delay: 2s; }
@keyframes wisp { 50% { opacity: .2; transform: translateY(-8px); } }
.worldmap .abyssglow { animation: pulseglow 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulseglow { 50% { opacity: .55; transform: scale(1.08); } }
.worldmap .region { font-size: 30px; }
.worldmap .region.sea { fill: #e6f3fb; opacity: .8; }
.worldmap .compass circle { r: 40; }
.abyssart { background: radial-gradient(#000, #2a0f4a 60%, #7b3fbf) !important; font-size: 44px; }
.btn.abyssbtn { background: linear-gradient(#7b3fbf, #3a1466); color: #f3e8ff; box-shadow: 0 3px 0 #1e0a36, inset 0 1px 0 #ffffff33; }

/* места заклинаний в отряде */
.spellslots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sslot { position: relative; border-radius: 12px; border: 2px solid var(--rc, var(--line)); background: linear-gradient(160deg, #fbf4e2, color-mix(in srgb, var(--rc, #c9ad7e) 22%, #efe0bf)); padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 92px; box-shadow: 0 2px 0 var(--line); }
.sslot.empty { border-style: dashed; color: var(--ink-soft); justify-content: center; background: var(--paper-3); }
.sslot .si { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 26px; background: radial-gradient(#fffaf0, #e3cf9f); box-shadow: 0 0 0 2px var(--rc, var(--line)); }
.sslot .si img { width: 100%; height: 100%; object-fit: cover; }
.sslot b { font-size: 11px; line-height: 1.1; text-align: center; }
.sslot small { font-size: 12px; }
.sslot .lv { position: absolute; top: 3px; left: 5px; font-size: 11px; font-weight: bold; color: #fff; background: var(--rc); border-radius: 8px; padding: 0 5px; }
.card.spell { background: linear-gradient(160deg, #f4ecff, color-mix(in srgb, var(--rc) 20%, #e9dcf7)); }
.card.spell .pic { border-radius: 50%; }

/* заклинания в бою */
#battle .spellbar { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
#battle .spellbar .sp { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 22px; background: radial-gradient(#3a2a4a, #1a1224); box-shadow: 0 0 0 2px var(--rc); opacity: .85; }
#battle .spellbar .sp img { width: 100%; height: 100%; object-fit: cover; }
#battle .spellbar .sp.fire { animation: spfire .8s; }
@keyframes spfire { 30% { transform: scale(1.35); box-shadow: 0 0 0 3px #fff, 0 0 22px var(--rc); opacity: 1; } }
#battle.bezdna { background: radial-gradient(circle at 50% 30%, #3a1466, #0d0618 70%); }

/* рейтинг */
.toprow .place { width: 34px; text-align: center; font-size: 18px; font-weight: bold; }
.toprow .st { color: var(--gold); white-space: nowrap; }
.toprow.me { background: #f2cf7333; border-radius: 10px; padding-left: 6px; padding-right: 6px; }

/* покупка за звёзды Telegram */
.btn.stars { background: linear-gradient(#ffd75e, #f0a800); color: #3a2616; box-shadow: 0 3px 0 #a86f00, inset 0 1px 0 #ffffff88; white-space: nowrap; }
.ic.crysic { font-size: 26px; display: flex; align-items: center; justify-content: center; background: radial-gradient(#e8f6ff, #9fd2f5) !important; }

/* «＋» у кристаллов в шапке */
#top .cry .plus { width: 18px; height: 18px; margin-left: 4px; padding: 0; border-radius: 50%; border: 0; background: #4fc06a; color: #fff; font-size: 14px; font-weight: bold; line-height: 18px; box-shadow: 0 1px 0 #1d5a2a; }
#top .cry .plus:active { transform: scale(.9); }
.crysbig { background: radial-gradient(#e8f6ff, #6fb8e8) !important; font-size: 44px; }

/* друзья */
.reflink { width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fffaf0; font: 13px monospace; color: var(--ink); }
.refladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.refstep { border: 1.5px solid var(--line); border-radius: 10px; padding: 6px; background: var(--paper-3); display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.refstep b { font-size: 16px; color: var(--red-2); }
.refstep.ready { border-color: var(--gold); box-shadow: 0 0 0 2px #f2cf7366; }
.refstep.got { opacity: .65; }
.refstep i { font-style: normal; color: var(--green); font-size: 11px; }

/* PvP */
.btn.pvpbtn { background: linear-gradient(#c0392b, #7d1d19); color: #fff3dc; box-shadow: 0 3px 0 #4a0f0c, inset 0 1px 0 #ffffff33; }
.pvpsquad { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pvpsquad .ic { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 2px var(--rc); display: flex; align-items: center; justify-content: center; font-size: 22px; background: radial-gradient(#fffaf0, #e3cf9f); }
.pvpsquad .ic.sp { border-radius: 50%; }
.pvpsquad .ic img { width: 100%; height: 100%; object-fit: cover; }
#battle.pvp { background: radial-gradient(circle at 50% 30%, #5a1a14, #1a0806 70%); }
/* ===================== v44: чат и кланы ===================== */
.npcs { grid-template-columns: repeat(5, 1fr) !important; gap: 5px !important; }
.npc .face { width: 42px !important; height: 42px !important; }
.npc b { font-size: 11px !important; }
.npc small { font-size: 9.5px !important; }
.topbtns { gap: 4px; }
.tbtn { width: 32px; height: 32px; }
.tbtn svg { width: 18px; height: 18px; }
/* чат */
#modal .sheet:has([data-chat]) { display: flex; flex-direction: column; }
.chatbox { display: flex; flex-direction: column; height: min(78vh, 640px); }
.chattabs { margin-bottom: 8px; }
.chattabs button { position: relative; }
.chattabs .cnt, .dlg .cnt, .cltabs .cnt { position: static; display: inline-block; min-width: 18px; height: 18px; border-radius: 9px; background: #e2463d; color: #fff; font-style: normal; font-size: 11px; line-height: 18px; padding: 0 5px; margin-left: 4px; }
.chatpeer { gap: 8px; margin-bottom: 6px; }
.chatlist { flex: 1; overflow-y: auto; background: var(--paper-2); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--line); }
.cmsg { background: var(--paper-3); border-radius: 12px 12px 12px 4px; padding: 6px 9px; max-width: 86%; box-shadow: 0 1px 0 var(--line); }
.cmsg.mine { align-self: flex-end; background: #fff3cf; border-radius: 12px 12px 4px 12px; }
.cmsg.sys { align-self: center; background: none; box-shadow: none; color: var(--ink-soft); font-size: 12px; font-style: italic; text-align: center; }
.cmsg .chead { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.cmsg .chead b { color: var(--red-2); cursor: pointer; }
.cmsg .chead small { color: var(--ink-soft); }
.cmsg .ctag { color: var(--green); }
.cmsg .cmore { margin-left: auto; border: 0; background: none; color: var(--ink-soft); padding: 0 2px; font-size: 14px; }
.cmsg .ctext { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.chatlist .older { align-self: center; }
.chatform { display: flex; gap: 6px; margin-top: 8px; }
.chatform input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fffaf0; font: inherit; }
.dlg { cursor: pointer; }
/* кланы */
.clhead { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.clemb { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: radial-gradient(#fffaf0, #e3cf9f); box-shadow: 0 0 0 2px var(--gold); font-size: 22px; flex: none; }
.clemb.big { width: 56px; height: 56px; font-size: 32px; border-radius: 14px; }
.cltabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.cltabs button { flex: none; border: 1.5px solid var(--line); background: var(--paper-3); border-radius: 18px; padding: 6px 10px; font-size: 12px; font-weight: bold; color: var(--ink-soft); white-space: nowrap; }
.cltabs button.on { background: var(--red-2); color: #fff3dc; border-color: var(--red-2); }
.cllog { font-size: 12px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.cltop { font-size: 11px; margin-top: 4px; }
.online { color: #3cb043; font-size: 11px; }
.clform label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.clform input, .permrow select, #clHeir { padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fffaf0; font: inherit; color: var(--ink); }
.emblems { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.emb { font-size: 22px; padding: 4px 0; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper-3); }
.emb.on { border-color: var(--gold); box-shadow: 0 0 0 2px #f2cf7388; background: #fff3cf; }
.permrow { gap: 8px; margin: 4px 0; font-size: 13px; }
.bossic { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px #7b3fbf; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.bossic img { width: 100%; height: 100%; object-fit: cover; }
.barn.boss i { background: linear-gradient(90deg, #c0392b, #e2463d); }
#battle.clanboss { background: radial-gradient(circle at 50% 30%, #2a1446, #0d0618 70%); }

.offbadge { display: inline-block; background: #e2463d; color: #fff; font-size: 11px; font-weight: bold; border-radius: 8px; padding: 0 6px; margin-left: 4px; vertical-align: middle; }

#battle .spellbar.enemy { margin: 0 0 8px; }
#battle .spellbar.enemy .sp { box-shadow: 0 0 0 2px #c0392b; }

/* сундуки-картинки */
.chest.pic { width: 76px; height: 76px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 2px var(--cc), 0 0 14px color-mix(in srgb, var(--cc) 60%, transparent); filter: none; }
.chest.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chest.pic.mini { width: 40px; height: 40px; border-radius: 10px; transform: none; box-shadow: 0 0 0 1.5px var(--cc); }
.chest.pic.opening { width: 110px; height: 110px; }
.bigcard .portrait > .chest.pic.mini { transform: scale(2); }
.ic .chest.pic.mini { width: 100%; height: 100%; border-radius: 10px; }

/* подсказки «в первый раз» */
#tipBox { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); z-index: 60; background: #fffaf0; color: var(--ink);
  border: 2px solid var(--gold); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 24px #0006; font-size: 14px; animation: popin .35s; }

/* ---------- мини-чат над нижним меню ---------- */
#miniChat { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 4;
  width: min(472px, calc(100% - 8px)); background: rgba(28, 18, 10, .88); border: 1px solid #8a6a3a; border-radius: 12px; color: #f1e3c4;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); backdrop-filter: blur(3px); font-size: 13px; }
#miniChat.off { width: auto; left: auto; right: 10px; transform: none; background: none; border: 0; box-shadow: none; }
#miniChat .minipill { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); background: linear-gradient(#3a2616, #24170c); font-size: 20px; }
#miniChat .minipill .cnt { position: absolute; top: -4px; right: -4px; }
#miniChat .minihead { display: flex; align-items: center; gap: 6px; padding: 4px 6px 0; }
#miniChat .miniseg { display: flex; gap: 4px; flex: 1; }
#miniChat .miniseg button { border: 1px solid #6b5230; background: none; color: #cbb894; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
#miniChat .miniseg button.on { background: var(--gold); color: #2a1a0c; border-color: var(--gold); font-weight: bold; }
#miniChat .minibtn { border: 0; background: none; color: #cbb894; font-size: 16px; padding: 0 4px; }
#miniChat .minibody { padding: 3px 9px 6px; cursor: pointer; }
#miniChat .mline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.45; }
#miniChat .mline b { color: var(--gold-2); }
#miniChat .mline .mk { margin-right: 4px; font-size: 11px; }
#miniChat .mline .mtag { color: #9fd17a; margin-left: 4px; font-size: 10px; }
#miniChat .mline.sys { color: #b9d99a; }
#miniChat .mline.muted { color: #a8977a; }
body.mini-on #screen { padding-bottom: 170px; }

/* ---------- v54: событие недели, серия входов, сундук дня, альбом, акции ---------- */
.weekev { background: linear-gradient(135deg, #fff6df, #f5e2b3); border-color: var(--gold); }
.weekev .weicon { font-size: 30px; margin-right: 4px; }
.wtask { margin-top: 8px; }
.wtask.done { opacity: .6; }
.wtask .barn, .weekev .barn { margin-top: 4px; }
.wrw { font-size: 12px; margin: 0 6px; white-space: nowrap; }
.wrw .chest.mini, .stc .chest.mini, .reward-row .chest.mini { width: 22px; height: 22px; display: inline-block; vertical-align: middle; }
.wfinal { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-weight: bold; }
.streak .stcells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.stc { border: 1px solid var(--line); border-radius: 8px; background: #fffaf0; text-align: center; padding: 3px 1px 4px; font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; }
.stc small { font-weight: bold; color: var(--ink-soft); }
.stc.got { background: #e4f1d2; border-color: var(--green); opacity: .85; }
.stc.now { border: 2px solid var(--gold); box-shadow: 0 0 8px #f2cf7399; animation: pulse 1.6s infinite; }
.stc.big { background: #fbeec4; }
.dchest { gap: 10px; align-items: center; }
.dchest .dcic .chest.mini { width: 40px; height: 40px; }
.offbadge.ev { background: #7b3fbf; }
.promo { margin-top: 3px; font-size: 12px; color: #a0261e; background: #fde7c9; border-radius: 6px; padding: 2px 6px; display: inline-block; }
.btn s { opacity: .6; font-weight: normal; }
.bed.withered { background: linear-gradient(#8a7a5e, #6b5a40); filter: saturate(.4); }
.bed.withered .tm { color: #f3e1c1; }
.bed.ripe.wilting .tm { color: #a0261e; font-weight: bold; }
.album.done { border-color: var(--green); background: #f0f7e6; }
.albgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; margin-top: 6px; }
.albc { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; text-align: center; }
.albc img, .albc .emo { width: 52px; height: 52px; border-radius: 10px; border: 2px solid var(--rc); object-fit: cover; }
.albc.miss img, .albc.miss .emo { filter: brightness(0) opacity(.35); border-color: var(--line); }
.starter { border: 2px solid var(--gold); background: linear-gradient(135deg, #fff6df, #f7dfa6); }
.wrw .chest, .stc .chest, .dchest .muted .chest, .starter .reward-row .chest { display: inline-block !important; width: 22px !important; height: 22px !important; vertical-align: middle; margin: 0 1px; }
.wrw .chest img, .stc .chest img, .dchest .muted .chest img, .starter .reward-row .chest img { width: 100%; height: 100%; }
.dchest .dcic .chest { width: 44px; height: 44px; }
.albc.miss img { filter: grayscale(1) brightness(.25) blur(1.5px) !important; opacity: .8; }

/* ---------- v55: рамки лиг, сезон PvP, сундук клана, помощь ---------- */
.ava.fr-bronze, #top .ava.fr-bronze { border: 3px solid #b0743c !important; box-shadow: 0 0 0 2px #5a3818, 0 0 8px #b0743c99; }
.ava.fr-silver, #top .ava.fr-silver { border: 3px solid #d7dde3 !important; box-shadow: 0 0 0 2px #6c7680, 0 0 10px #e8eef499; }
.ava.fr-gold, #top .ava.fr-gold { border: 3px solid #f2cf73 !important; box-shadow: 0 0 0 2px #8a5a12, 0 0 12px #f2cf73cc; }
.ava.fr-bogatyr, #top .ava.fr-bogatyr { border: 3px solid #e2463d !important; box-shadow: 0 0 0 2px #f2cf73, 0 0 14px #e2463dcc; animation: pulse 2s infinite; }
.frames { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.frm { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; }
.frm.on { border-color: var(--gold); background: #fff3d4; }
.frm .ava { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; display: block; border: 2px solid var(--line); }
.frm .ava img { width: 100%; height: 100%; object-fit: cover; }
.pvpseason { text-align: center; }
.clchest .chbar { position: relative; height: 12px; background: #e9dcc0; border-radius: 6px; margin: 18px 14px 10px; }
.clchest .chbar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #8ab84a, #f2cf73); border-radius: 6px; }
.clchest .chmark { position: absolute; top: 50%; transform: translate(-50%, -50%); filter: grayscale(1) opacity(.6); }
.clchest .chmark.on { filter: none; }
.clchest .chmark .chest { width: 28px !important; height: 28px !important; display: block; }
.clchest .chmark .chest img { width: 100%; height: 100%; }
.clhelp .list-item { margin-top: 6px; }

/* ---------- v56: пробуждение, летопись, войны кланов ---------- */
.awk { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); color: #f2cf73; font-size: 11px; text-shadow: 0 0 3px #000, 0 0 6px #f2cf73; letter-spacing: -1px; z-index: 2; }
.awk.inl { position: static; transform: none; font-size: 14px; }
.awkline { text-align: center; font-size: 12px; margin: 2px 0 6px; }
.passbox { cursor: pointer; border-color: #7b3fbf; background: linear-gradient(135deg, #f6efff, #eadcff); }
.passbox .pslv { font-weight: bold; color: #7b3fbf; margin-right: 6px; }
.passbox .barn i { background: linear-gradient(90deg, #9d6ad8, #f2cf73); }
.dotr { width: 10px; height: 10px; border-radius: 50%; background: #e2463d; display: inline-block; animation: pulse 1.2s infinite; }
.pshead, .psrow { display: grid; grid-template-columns: 32px 1fr 1fr; gap: 6px; align-items: center; }
.pshead { font-size: 12px; text-align: center; margin: 6px 0; }
.pslist { display: flex; flex-direction: column; gap: 5px; }
.psrow .psn { text-align: center; color: var(--ink-soft); }
.psrow.on .psn { color: #7b3fbf; }
.pscell { border: 1px solid var(--line); border-radius: 8px; padding: 5px; text-align: center; font-size: 12px; background: #fffaf0; min-height: 40px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.pscell .chest { display: inline-block !important; width: 22px !important; height: 22px !important; vertical-align: middle; }
.pscell .chest img { width: 100%; height: 100%; }
.pscell.prem { background: #f3eaff; border-color: #b994e6; }
.pscell.lock { opacity: .5; }
.pscell.got { opacity: .55; background: #e4f1d2; }
.pscell[data-a] { border: 2px solid var(--gold); box-shadow: 0 0 8px #f2cf7388; cursor: pointer; }
.pscell .take { color: #a0261e; font-weight: bold; }
.ava.fr-letopis, #top .ava.fr-letopis { border: 3px solid #9d6ad8 !important; box-shadow: 0 0 0 2px #f2cf73, 0 0 14px #9d6ad8cc; }
.clwar { border-color: #a0261e; }
.warvs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 8px 0; text-align: center; }
.warvs b { display: block; font-size: 13px; }
.warvs .wsc { font-size: 24px; font-weight: bold; color: #a0261e; }
.warvs .vs { font-weight: bold; color: var(--ink-soft); }
.clwar .chest, .clchest .muted .chest { display: inline-block !important; width: 22px !important; height: 22px !important; vertical-align: middle; }
.clwar .chest img, .clchest .muted .chest img { width: 100%; height: 100%; }
#top .ava { position: relative; overflow: visible; }
#top .ava img { border-radius: 50%; }
.primebadge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 14px; filter: drop-shadow(0 1px 2px #000); }
.primecard { border: 2px solid #f2cf73; background: linear-gradient(135deg, #2a1a0e, #4a2f14); color: #f6e7c4; }
.primecard .muted { color: #d6c39a; }
.primelist { margin: 6px 0 4px 18px; padding: 0; font-size: 13px; line-height: 1.5; }
.primebar { border-color: #f2cf73; background: #fff3d4; align-items: center; gap: 8px; }
.speed button.locked { opacity: .55; }

/* ---------- v57: Prime-фишки ---------- */
.cmsg.prime { background: linear-gradient(135deg, #fff6d8, #ffe9a8); border: 1px solid #f2cf73; box-shadow: 0 0 10px #f2cf7399; animation: primeglow 3s ease-in-out infinite; }
@keyframes primeglow { 0%, 100% { box-shadow: 0 0 6px #f2cf7366; } 50% { box-shadow: 0 0 14px #f2cf73cc; } }
.cmsg.prime .chead b { text-shadow: 0 0 6px #f2cf73; }
.cmsg.sys.primehello { color: #8a5a12; font-weight: bold; }
.cmsg.stk { background: none; border: 0; box-shadow: none; animation: none; }
.sticker { font-size: 46px; line-height: 1.1; display: inline-block; }
.stkbtn { padding: 0 10px; font-size: 18px; }
.stkrow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 6px; }
.stkrow button { font-size: 24px; background: #fffaf0; border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; }
.primenick { color: #b8860b; text-shadow: 0 0 6px #f2cf7399; }
#miniChat .mline.prime b { text-shadow: 0 0 6px #f2cf73; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.clr { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: #fffaf0; }
.clr.on { border-color: #2a1a0e; box-shadow: 0 0 0 2px var(--gold); }
.ava.fr-fire, #top .ava.fr-fire { border: 3px solid #ff7a2e !important; box-shadow: 0 0 0 2px #a0261e, 0 0 14px #ff7a2ecc; animation: firefr 1.2s ease-in-out infinite alternate; }
@keyframes firefr { from { box-shadow: 0 0 0 2px #a0261e, 0 0 8px #ff7a2e99; } to { box-shadow: 0 0 0 2px #ffb347, 0 0 18px #ff4500; } }
.ava.fr-rune, #top .ava.fr-rune { border: 3px dashed #6ec8ff !important; box-shadow: 0 0 0 2px #1f3c5a, 0 0 12px #6ec8ffcc; }
.scene.theme-night svg { filter: brightness(.55) saturate(.8) hue-rotate(200deg); }
.scene.theme-night::after { content: '✦ ✧ ✦  ✧ ✦ ✧'; position: absolute; top: 8px; left: 0; right: 0; text-align: center; color: #fff6c8; letter-spacing: 18px; font-size: 12px; text-shadow: 0 0 6px #fff; pointer-events: none; }
.scene.theme-winter svg { filter: saturate(.35) brightness(1.12) hue-rotate(160deg); }
.scene.theme-winter::after { content: '❄ ❅ ❆ ❄ ❅ ❆ ❄'; position: absolute; top: 6px; left: 0; right: 0; text-align: center; color: #fff; letter-spacing: 14px; font-size: 14px; opacity: .9; pointer-events: none; }
.scene.theme-fair svg { filter: saturate(1.4) brightness(1.05); }
.scene.theme-fair::after { content: '🎏 🎪 🎏 🎪 🎏'; position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-size: 14px; letter-spacing: 10px; pointer-events: none; }
.scene { position: relative; }

/* Prime в PvP: золотая половина поля */
#bfield { position: relative; }
.phalo { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 0; border: 2px solid #f2cf73; border-radius: 12px;
  background: radial-gradient(ellipse at center, #f2cf7333, #f2cf7311 60%, transparent); box-shadow: inset 0 0 22px #f2cf7388, 0 0 12px #f2cf7366; animation: primeglow 3s ease-in-out infinite; }
.phalo.e { top: 0; height: 60%; }
.phalo.p { bottom: 0; height: 40%; }
.phalo span { position: absolute; right: 8px; font-size: 11px; font-weight: bold; color: #f2cf73; text-shadow: 0 0 4px #000, 0 0 8px #f2cf73; }
.phalo.e span { top: 4px; }
.phalo.p span { bottom: 4px; }
#bgrid { position: relative; z-index: 1; }
.panel.oppprime { border-color: #f2cf73; box-shadow: 0 0 10px #f2cf7366; }

/* ---------- v59: хутор — заказы, золотой урожай, полив, колодец, стадии ---------- */
.orders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.order { background: linear-gradient(#fffaf0, #f6ead0); border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 6px; display: flex; flex-direction: column; gap: 5px; font-size: 12px; box-shadow: 0 2px 6px #0001; min-height: 96px; }
.order.ready { border-color: var(--green); box-shadow: 0 0 10px #8ab84a66; }
.order.empty { align-items: center; justify-content: center; text-align: center; opacity: .75; border-style: dashed; }
.oneeds { display: flex; flex-wrap: wrap; gap: 3px; }
.oneed { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1px 5px; font-weight: bold; white-space: nowrap; }
.oneed.ok { background: #e4f1d2; border-color: var(--green); }
.orew { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.orew .chest { display: inline-block !important; width: 18px !important; height: 18px !important; }
.orew .chest img { width: 100%; height: 100%; }
.obtns { display: flex; gap: 4px; margin-top: auto; }
.obtns .btn.gold { flex: 1; }
.obtns .btn { padding: 4px 6px; }
.bed.golden { box-shadow: 0 0 0 2px #f2cf73, 0 0 16px #f2cf73cc; animation: goldpulse 1.8s ease-in-out infinite; }
@keyframes goldpulse { 0%, 100% { box-shadow: 0 0 0 2px #f2cf73, 0 0 8px #f2cf7388; } 50% { box-shadow: 0 0 0 2px #fff3c4, 0 0 20px #f2cf73; } }
.bed.golden .plant { filter: drop-shadow(0 0 6px #ffd23f) saturate(1.4); }
.bed .wdrop { position: absolute; top: 12px; right: 6px; font-size: 12px; }
.bed .wcan { position: absolute; top: 12px; right: 6px; font-size: 13px; opacity: .55; animation: bob2 2s ease-in-out infinite; }
@keyframes bob2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.fstage { position: absolute; left: 8px; bottom: 6px; font-size: 11px; color: #fff6dd; background: rgba(30, 18, 8, .62); padding: 2px 8px; border-radius: 10px; backdrop-filter: blur(2px); }
.favbtn { background: none; border: 0; font-size: 20px; color: #c99a2e; padding: 0 2px; }
.pup { color: #3e8a2a; font-weight: bold; }
.pdown { color: #b23a2a; font-weight: bold; }
.scene .well.ready { animation: bob2 2.2s ease-in-out infinite; }
.scene .mill .blades { animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* хутор: нарисованная сцена по стадиям */
.scene { position: relative; overflow: hidden; }
.scene .farmimg { display: block; width: 100%; aspect-ratio: 2.45 / 1; object-fit: cover; transition: filter .6s; animation: farmzoom 30s ease-in-out infinite alternate; }
@keyframes farmzoom { from { transform: scale(1); } to { transform: scale(1.06) translateY(-1%); } }
.scene .farmimg.night { filter: brightness(.5) saturate(.8) hue-rotate(-15deg) contrast(1.05); }
.scene .farmglow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 120%, rgba(255, 190, 90, .35), transparent 60%), linear-gradient(to bottom, rgba(255, 255, 255, .06), transparent 30%, rgba(40, 20, 8, .35)); }
.farmstars { position: absolute; inset: 0; pointer-events: none; }
.farmstars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff8d8; box-shadow: 0 0 6px #fff; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.scene.theme-night .farmimg { filter: brightness(.55) saturate(.8) hue-rotate(200deg); }
.scene.theme-winter .farmimg { filter: saturate(.35) brightness(1.12) hue-rotate(160deg); }
.scene.theme-fair .farmimg { filter: saturate(1.4) brightness(1.05); }
.wellbtn { position: absolute; right: 8px; bottom: 6px; font-size: 11px; border: 1px solid #f2cf73; color: #fff6dd; background: rgba(30, 18, 8, .62); padding: 3px 9px; border-radius: 12px; backdrop-filter: blur(2px); }
.wellbtn.ready { background: linear-gradient(#3f8fd0, #2a6aa8); border-color: #bfe8ff; font-weight: bold; animation: bob2 2s ease-in-out infinite; }
.fstage { top: 6px; bottom: auto !important; }
.wellbtn { top: 6px; bottom: auto !important; }
.bed.wet { background: repeating-linear-gradient(0deg, transparent 0 9px, #00000033 9px 11px), radial-gradient(circle at 30% 30%, #6b4a2c, #3a2614); box-shadow: inset 0 -4px 0 #00000044, 0 3px 0 #3c2412, 0 0 0 2px rgba(110, 200, 255, .6), 0 0 10px rgba(110, 200, 255, .35); }
.bed.wet.golden { box-shadow: 0 0 0 2px #f2cf73, 0 0 16px #f2cf73cc; }
.chanbox { gap: 8px; align-items: center; border-color: #229ed9; background: linear-gradient(135deg, #eef8ff, #fffaf0); } .chanbox .chic { font-size: 26px; }

/* соперники на карте мира */
.wm-pvp { cursor: pointer; }
.wm-pvp .phalo { fill: #d7263d; opacity: .22; animation: pvppulse 2s ease-in-out infinite; }
.wm-pvp.prime .phalo { fill: #f2cf73; opacity: .35; }
@keyframes pvppulse { 0%, 100% { transform: scale(1); opacity: .18; } 50% { transform: scale(1.15); opacity: .35; } }
.wm-pvp .pring { fill: #2a1a10; stroke: #d7263d; stroke-width: 5; }
.wm-pvp.prime .pring { stroke: #f2cf73; }
.wm-pvp .pbadge { fill: #a0261e; stroke: #fff3dc; stroke-width: 2; }
.wm-pvp .pbt { fill: #fff; font-size: 15px; text-anchor: middle; }
.wm-pvp .plbl { fill: rgba(30, 18, 8, .82); stroke: #d7263d; stroke-width: 1.5; }
.wm-pvp.prime .plbl { stroke: #f2cf73; }
.wm-pvp .ptxt { fill: #fff3dc; font-size: 15px; font-weight: bold; text-anchor: middle; }
.wm-pvp .ico { font-size: 26px; text-anchor: middle; }
.powtag b { color: #a0261e; } .pvppow { text-align: center; font-size: 14px; }
.refpass { cursor: pointer; border-color: #2e8b57; background: linear-gradient(135deg, #eafbef, #fff6df); }
.refpass .rpic { font-size: 28px; margin-right: 6px; }
.refpass .barn i { background: linear-gradient(90deg, #2e8b57, #f2cf73); }
.refpass .pslv { font-weight: bold; color: #2e8b57; margin-right: 6px; }
.rprow { display: grid; grid-template-columns: 32px 1fr; gap: 6px; align-items: center; }
.rprow.big .pscell { border-width: 2px; border-color: #d08a1c; background: #fff3d4; }
.rprow.on .psn { color: #2e8b57; }
.ava.fr-druzhina, #top .ava.fr-druzhina { border: 3px solid #2e8b57 !important; box-shadow: 0 0 0 2px #f2cf73, 0 0 14px #2e8b57cc; }
.dailypack { border: 2px solid #3a8fc9; background: linear-gradient(135deg, #eaf6ff, #fffaf0); }
.dpcells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.dpc { border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: center; padding: 3px 0; font-size: 11px; display: flex; flex-direction: column; }
.dpc small { color: var(--ink-soft); font-weight: bold; }
.dpc span { font-weight: bold; color: #2a6aa8; }
.dpc.got { background: #dcefff; border-color: #3a8fc9; }
.dpc.now { border: 2px solid var(--gold); box-shadow: 0 0 8px #f2cf7388; }
.dpc.big { background: #fff3d4; } .dpc.big span { color: #a0261e; }
