:root {
  --ink: #12306f;
  --ink-soft: #4a6aa8;
  --panel: linear-gradient(180deg, #e9f5ff 0%, #cfe6ff 100%);
  --panel-border: #ffffff;
  --frost: rgba(18, 48, 120, 0.72);
  --green: linear-gradient(180deg, #7be05a 0%, #3ca832 100%);
  --green-edge: #2a7d22;
  --blue: linear-gradient(180deg, #6cc2ff 0%, #2d7fe0 100%);
  --blue-edge: #1d5fb0;
  --pink: linear-gradient(180deg, #ff8be0 0%, #c63fb0 100%);
  --pink-edge: #8e2a7e;
  --red: linear-gradient(180deg, #ff7a7a 0%, #d6283a 100%);
  --red-edge: #9a1626;
  --gold: #ffd23f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a1f5c; font-family: Rubik, system-ui, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ---------- Кнопки ---------- */
.btn {
  font: 700 15px Rubik, sans-serif; color: #fff; border: 0; border-radius: 12px; padding: 8px 16px; cursor: pointer;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 3px 0 var(--edge, #1d5fb0), 0 5px 10px rgba(0,30,90,0.3);
  transition: transform .08s, filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 1px 0 var(--edge, #1d5fb0); }
.btn:disabled { filter: grayscale(0.85) opacity(0.6); cursor: default; transform: none; }
.btn-green { background: var(--green); --edge: var(--green-edge); }
.btn-blue { background: var(--blue); --edge: var(--blue-edge); }
.btn-pink { background: var(--pink); --edge: var(--pink-edge); }
.btn-red { background: var(--red); --edge: var(--red-edge); }
.btn-big { font-size: 20px; padding: 12px 26px; border-radius: 16px; }
.btn-sm { font-size: 13px; padding: 5px 10px; border-radius: 9px; }

/* ---------- Вход ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
  background: radial-gradient(ellipse at 50% 30%, rgba(40,90,190,0.55), rgba(5,18,60,0.9)); }
.login-card { text-align: center; width: min(420px, calc(100vw - 32px)); }
.logo { font: 400 clamp(56px, 11vw, 92px)/0.92 Lobster, cursive; margin: 0; color: #fff;
  text-shadow: 0 0 18px rgba(160,210,255,0.9), 0 4px 0 #2d6fd0, 0 8px 18px rgba(0,0,0,0.4); }
.logo-sub { color: #cfe6ff; margin: 12px 0 20px; letter-spacing: .04em; }
.tip { color: #fff; font-weight: 500; min-height: 44px; opacity: .92; }
.loadbar { height: 12px; border-radius: 8px; background: rgba(255,255,255,0.18); overflow: hidden; margin: 10px 30px 18px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.4); }
#loadfill { height: 100%; width: 0; background: linear-gradient(90deg, #ff9ce8, #c15bff); transition: width .3s; }
.login-form { display: grid; gap: 10px; background: var(--panel); border: 3px solid #fff; border-radius: 22px; padding: 20px; box-shadow: 0 12px 40px rgba(0,10,50,0.5); }
.login-form input { font: 600 18px Rubik, sans-serif; color: var(--ink); padding: 12px 14px; border-radius: 12px; border: 2px solid #9cc6f5; background: #fff; outline: none; }
.login-form input:focus { border-color: #3d8ef0; }
.login-hint { font-size: 13px; color: var(--ink-soft); }
.login-err { color: #c4233a; font-weight: 600; min-height: 1em; }

/* ---------- Верхняя панель ---------- */
.hud { position: fixed; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.res { display: flex; align-items: center; gap: 6px; background: var(--frost); border: 2px solid rgba(190,225,255,0.65); color: #fff; border-radius: 20px; padding: 4px 14px 4px 6px; height: 36px; box-shadow: 0 3px 10px rgba(0,10,50,0.35); font-size: 17px; }
.res b { font-weight: 700; min-width: 30px; }
.res small { font-size: 12px; color: #d9c2ff; }
.ico { width: 26px; height: 26px; display: grid; place-items: center; font-size: 19px; color: #bfe6ff; }
.ico-magic { background: radial-gradient(circle at 40% 35%, #ffe6ff, #d56bff 45%, #7a22c8); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.ico-ruby { background: linear-gradient(135deg, #ffb3c0, #ff2d55 45%, #a3001f); clip-path: polygon(50% 100%, 0 38%, 22% 6%, 78% 6%, 100% 38%); width: 22px; height: 22px; }
.lvl { display: flex; align-items: center; }
.lvl-star { width: 54px; height: 54px; display: grid; place-items: center; position: relative; z-index: 1; color: #fff; font-weight: 800; font-size: 18px; text-shadow: 0 2px 2px rgba(60,0,90,0.7);
  background: radial-gradient(circle at 40% 30%, #ffd9ff, #c65cff 50%, #6d1bb5); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.lvl-star span { margin-top: 6px; }
.bar { position: relative; width: 130px; height: 20px; margin-left: -12px; border-radius: 0 12px 12px 0; background: var(--frost); border: 2px solid rgba(190,225,255,0.65); overflow: hidden; }
.bar div { height: 100%; background: linear-gradient(180deg, #ffe680, #f2a900); width: 0; transition: width .4s; }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(190,225,255,0.7); background: var(--frost); color: #fff; font-size: 17px; cursor: pointer; }
.round.off { opacity: .45; }

/* ---------- Дед Мороз ---------- */
.quest-btn { position: fixed; left: 10px; top: 76px; width: 92px; height: 92px; border-radius: 50%; border: 3px solid #fff; padding: 0; cursor: pointer; z-index: 10;
  background: radial-gradient(circle at 50% 40%, #7fb8ff, #2a5fc8); box-shadow: 0 4px 16px rgba(0,10,50,0.5); overflow: visible; }
.quest-btn canvas { width: 100%; height: 100%; border-radius: 50%; }
.quest-btn:hover { transform: scale(1.05); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #ff2d55; color: #fff; font: 800 13px/22px Rubik; border: 2px solid #fff; animation: pulse 1.2s infinite; font-style: normal; }
@keyframes pulse { 50% { transform: scale(1.18); } }

/* ---------- Низ ---------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 10px; padding: 8px; z-index: 10;
  background: linear-gradient(180deg, rgba(10,30,90,0) 0%, rgba(10,30,90,0.55) 40%); pointer-events: none; }
.bottom > * { pointer-events: auto; }
.friends-wrap { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.friends { display: flex; gap: 6px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 6px 2px 2px; }
.friends::-webkit-scrollbar { display: none; }
.arrow { width: 26px; height: 60px; border: 0; border-radius: 8px; background: var(--frost); color: #fff; font-size: 22px; cursor: pointer; flex: none; }
.friend { flex: none; width: 70px; text-align: center; cursor: pointer; position: relative; }
.friend .ava { width: 58px; height: 58px; margin: 0 auto; border-radius: 12px; border: 3px solid #fff; display: grid; place-items: center; font: 800 26px Rubik; color: #fff; box-shadow: 0 3px 8px rgba(0,10,50,0.4); text-shadow: 0 2px 2px rgba(0,0,0,0.3); }
.friend .name { color: #fff; font-size: 11px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.friend .lv { position: absolute; top: 0; left: 2px; background: #8b3ee0; color: #fff; font: 800 10px/16px Rubik; padding: 0 5px; border-radius: 8px; border: 1.5px solid #fff; }
.friend .dot { position: absolute; top: 2px; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: #9aa; border: 2px solid #fff; }
.friend .dot.on { background: #4bea5a; }
.friend.me .ava { border-color: var(--gold); }
.friend.add .ava { background: rgba(255,255,255,0.18); border-style: dashed; font-size: 30px; }
.menu { display: flex; gap: 6px; flex: none; }
.mbtn { position: relative; width: 66px; height: 66px; border-radius: 16px; border: 3px solid #fff; cursor: pointer; padding: 0;
  background: linear-gradient(180deg, #7cc2ff, #2c6ad4); box-shadow: 0 4px 0 #1d4ea8, 0 6px 14px rgba(0,10,50,0.45); display: grid; place-items: center; align-content: center; }
.mbtn span { font-size: 26px; line-height: 1; }
.mbtn i { font: 700 10px Rubik; color: #fff; font-style: normal; margin-top: 3px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.mbtn:active { transform: translateY(2px); }
.mbtn .badge { top: -8px; right: -8px; }

.feed { position: fixed; left: 10px; top: 182px; width: 280px; z-index: 5; pointer-events: none; display: grid; gap: 4px; }
.feed div { background: rgba(10,30,90,0.55); color: #e6f1ff; font-size: 12px; padding: 4px 10px; border-radius: 10px; animation: fadein .4s; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }

.visit-bar { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 11; display: flex; gap: 14px; align-items: center;
  background: var(--frost); border: 2px solid rgba(190,225,255,0.7); color: #fff; padding: 8px 10px 8px 18px; border-radius: 18px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,10,50,0.4); }
.hang-bar { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 11; display: flex; gap: 14px; align-items: center;
  background: rgba(120,40,170,0.85); color: #fff; padding: 8px 10px 8px 18px; border-radius: 18px; font-weight: 600; border: 2px solid #f1c6ff; }

/* ---------- Тосты ---------- */
.toasts { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: linear-gradient(180deg, #fff, #dcecff); color: var(--ink); border: 2px solid #fff; border-radius: 14px; padding: 8px 16px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,10,50,0.45); animation: toastin .3s; max-width: 80vw; text-align: center; }
.toast.err { background: linear-gradient(180deg, #ffe3e6, #ffc2ca); color: #8e1022; }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px) scale(.95); } }

/* ---------- Окна ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(5,18,60,0.45); display: grid; place-items: center; animation: fadein .2s; padding: 16px; }
.modal { position: relative; width: min(720px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--panel); border: 4px solid var(--panel-border);
  border-radius: 26px; box-shadow: 0 20px 60px rgba(0,10,50,0.6), inset 0 0 0 2px #a9d2ff; animation: pop .25s cubic-bezier(.2,1.4,.5,1); }
.modal.narrow { width: min(460px, 100%); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal-title { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); background: linear-gradient(180deg, #6cb6ff, #2c6ad4); color: #fff; font: 700 20px Rubik;
  padding: 8px 34px; border-radius: 14px; border: 3px solid #fff; white-space: nowrap; text-shadow: 0 2px 2px rgba(0,0,0,0.3); box-shadow: 0 4px 10px rgba(0,20,80,0.4); }
.modal-close { position: absolute; top: -12px; right: -12px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; background: var(--red); color: #fff; font: 800 18px Rubik; cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,0.3); }
.modal-body { padding: 34px 20px 20px; overflow-y: auto; }
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: #9cc6f5; border-radius: 4px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.card { background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 2px 0 #b6d6fa, 0 4px 10px rgba(30,80,160,0.12); }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.tag { display: inline-flex; align-items: center; gap: 4px; background: #e2f0ff; border-radius: 10px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.progress { height: 14px; border-radius: 8px; background: #cfe0f5; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.15); }
.progress div { height: 100%; background: linear-gradient(180deg, #ff9ce8, #c63fb0); }
.progress.green div { background: linear-gradient(180deg, #9cf27a, #3ca832); }
h3 { margin: 0 0 6px; font-size: 17px; }

/* Слоты-игрушки */
.orn { position: relative; background: #fff; border-radius: 14px; padding: 6px; text-align: center; box-shadow: 0 2px 0 #b6d6fa; cursor: pointer; border: 2px solid transparent; }
.orn.sel { border-color: #c63fb0; background: #fff2fd; }
.orn img { width: 56px; height: 56px; display: block; margin: 0 auto; }
.orn .nm { font-size: 11px; font-weight: 600; line-height: 1.15; }
.orn .from { font-size: 10px; color: var(--ink-soft); }
.orn .cnt { position: absolute; top: 4px; right: 6px; font: 800 12px Rubik; color: #8e2a7e; }
.rar1 { box-shadow: 0 2px 0 #f2c94c, 0 0 0 2px #ffe08a inset; }
.rar2 { box-shadow: 0 2px 0 #c15bff, 0 0 0 2px #e7b2ff inset; }

/* Квест */
.quest-modal { display: flex; gap: 14px; align-items: flex-end; }
.quest-modal canvas { width: 170px; height: 220px; flex: none; }
.speech { position: relative; background: #fff; border-radius: 18px; padding: 14px 16px; font-weight: 600; font-size: 16px; line-height: 1.35; box-shadow: 0 3px 0 #b6d6fa; }
.speech::before { content: ''; position: absolute; left: -12px; bottom: 26px; border: 8px solid transparent; border-right: 12px solid #fff; }

/* Экспедиции */
.city { position: relative; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 2px 0 #b6d6fa, 0 4px 10px rgba(30,80,160,0.12); }
.city canvas { width: 100%; height: 96px; display: block; }
.city .cn { position: absolute; top: 8px; left: 10px; color: #fff; font: 700 16px Rubik; text-shadow: 0 2px 3px rgba(0,0,0,0.6); }
.city .ct { position: absolute; top: 8px; right: 10px; color: #fff; font: 600 13px Rubik; background: rgba(0,0,0,0.35); border-radius: 8px; padding: 2px 7px; }
.city .cb { padding: 8px 10px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Таблица рейтинга */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { border: 0; border-radius: 10px; padding: 6px 14px; font: 600 14px Rubik; color: var(--ink); background: #d6e9ff; cursor: pointer; }
.tabs button.on { background: var(--green); color: #fff; }
.rating { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
.rating td, .rating th { padding: 7px 10px; text-align: left; font-size: 14px; }
.rating th { background: #e2f0ff; font-size: 12px; color: var(--ink-soft); }
.rating tr:nth-child(even) td { background: #f3f9ff; }
.rating tr.me td { background: #fff4c2; font-weight: 700; }

/* Почта */
.mail-item { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 8px 10px; box-shadow: 0 2px 0 #b6d6fa; }
.mail-item img { width: 40px; height: 40px; }
.mail-item .em { font-size: 28px; width: 40px; text-align: center; }
.mail-item .tx { flex: 1; font-size: 14px; }

/* Награда */
.reward { text-align: center; }
.reward .big { font-size: 64px; animation: pop .4s cubic-bezier(.2,1.6,.5,1); }
.reward img { width: 96px; height: 96px; }

@media (max-width: 760px) {
  .feed { display: none; }
  .quest-modal { flex-direction: column; align-items: center; }
}

/* Улучшения: полоса уровней и «было → станет» */
.lv-strip { display: flex; align-items: flex-end; gap: 2px; margin: 10px 0 4px; overflow-x: auto; }
.lv-step { flex: 1; min-width: 74px; text-align: center; border-radius: 12px; padding: 6px 4px 4px; background: #eef6ff; border: 2px solid transparent; }
.lv-step img { width: 100%; height: 64px; object-fit: contain; display: block; }
.lv-step span { display: block; font-size: 11px; font-weight: 600; line-height: 1.15; margin-top: 3px; }
.lv-step.own { opacity: 0.8; }
.lv-step.cur { background: #fff4c2; border-color: #ffd23f; }
.lv-step.next { background: #e9ffe0; border-color: #6ad35a; box-shadow: 0 0 12px rgba(110,220,90,0.55); }
.lv-step.future img { filter: grayscale(1) brightness(1.2); opacity: 0.45; }
.lv-step.future span { color: var(--ink-soft); }
.lv-arrow { align-self: center; color: #9cc6f5; font-weight: 800; font-size: 18px; }
.upg-next { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ba { background: #f3f8ff; border-radius: 12px; padding: 8px 10px; font-size: 13px; flex: 1; min-width: 150px; }
.ba.good { background: #e9ffe0; }
.ba.good b { color: #2a7d22; }
.ba-arrow { font-size: 22px; color: #3ca832; }
.upg-buy { display: grid; gap: 6px; justify-items: end; }
.pop { animation: pop .5s cubic-bezier(.2,1.6,.5,1); }

/* ========== Скин из сгенерированных картинок (img/ui_*, icon_*) ========== */
:root { --panel-slice: 150; --panel-w: 56px; --btn-slice: 94; --btn-w: 20px; --plate-slice: 74; --plate-w: 20px; }

.login { background: linear-gradient(rgba(5,18,60,0.45), rgba(5,18,60,0.8)), url(img/bg.jpg) center / cover; }
.logo { line-height: 1; }
.logo-img { width: min(440px, 82vw); filter: drop-shadow(0 8px 20px rgba(0,10,60,0.6)); }

.modal { background: none; border: var(--panel-w) solid transparent; border-image: url(img/ui_panel.webp) var(--panel-slice) fill / var(--panel-w) stretch;
  box-shadow: none; filter: drop-shadow(0 16px 34px rgba(0,10,50,0.6)); }
.modal-body { padding: 18px 4px 4px; }
.modal-title { top: calc(-1 * var(--panel-w) - 26px); background: none; border: 0 40px solid transparent; border-image: url(img/ui_ribbon.webp) 0 150 fill / 0 40px stretch;
  box-shadow: none; padding: 16px 18px 24px; font-size: 21px; -webkit-text-stroke: 0.5px #0d2466; text-shadow: 0 2px 0 #0d2466, 0 0 8px rgba(0,30,120,0.6); }
.modal-close { top: calc(-1 * var(--panel-w) - 6px); right: calc(-1 * var(--panel-w) - 6px); width: 46px; height: 46px; border: 0; color: transparent; font-size: 0;
  background: url(img/ui_close.webp) center / contain no-repeat; box-shadow: none; }
.modal-close:hover { transform: scale(1.08); }

.btn { border: 0 var(--btn-w) solid transparent; box-shadow: none !important; padding: 10px 4px 13px; background: none !important; border-radius: 0;
  text-shadow: 0 1px 0 rgba(0,0,0,0.45), 0 0 6px rgba(0,0,0,0.25); }
.btn-green { border-image: url(img/ui_btn_green.webp) 0 var(--btn-slice) fill / 0 var(--btn-w) stretch; }
.btn-blue { border-image: url(img/ui_btn_blue.webp) 0 var(--btn-slice) fill / 0 var(--btn-w) stretch; }
.btn-pink, .btn-red { border-image: url(img/ui_btn_pink.webp) 0 var(--btn-slice) fill / 0 var(--btn-w) stretch; }
.btn:active { transform: translateY(2px) scale(0.98); }
.btn-ico { width: 22px; height: 22px; vertical-align: middle; margin: -4px 6px -2px 0; }

.res, .visit-bar, .hang-bar { background: none; border: 0 var(--plate-w) solid transparent; border-image: url(img/hud_plate.webp) 0 80 fill / 0 var(--plate-w) stretch;
  border-radius: 0; box-shadow: none; filter: drop-shadow(0 3px 6px rgba(0,10,50,0.4)); }
.res { padding: 4px 6px; height: 40px; }
.res b { text-shadow: 0 1px 2px #000; }
.bar { background: rgba(10,25,80,0.85); border: 2px solid #ffd76a; border-left: 0; }
.lvl-star { background: none; clip-path: none; width: 60px; height: 60px; position: relative; }
.lvl-star img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lvl-star span { position: relative; margin-top: 4px; font-size: 19px; }
.round { background: none; border: 0; width: 44px; height: 44px; padding: 0; }
.round img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,10,50,0.5)); }
.round.off img { filter: grayscale(1) brightness(0.8); }

.quest-btn { border: 4px solid #ffd76a; box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(0,10,50,0.55); }

.mbtn { background: none; border: 0; box-shadow: none; width: 74px; height: 78px; }
.mbtn span { line-height: 0; }
.mbtn span img { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,10,50,0.55)); transition: transform .1s; }
.mbtn:hover span img { transform: scale(1.08); }
.mbtn i { font-size: 11px; font-weight: 800; -webkit-text-stroke: 0.3px #0d2466; text-shadow: 0 1px 0 #0d2466, 0 0 4px #0d2466, 0 0 6px #0d2466; }

.friend .ava { border: 0; border-radius: 8px; position: relative; overflow: visible; }
.friend .ava::after { content: ''; position: absolute; inset: -9px; background: url(img/avatar_frame.webp) center / 100% 100% no-repeat; pointer-events: none; }
.friend.add .ava { background: none !important; border: 0; }
.friend.add .ava::after { background-image: url(img/slot_empty.webp); z-index: -1; }
.friend.add .ava img { width: 34px; height: 34px; object-fit: contain; }
.friend .name { font-weight: 700; }

.card { background: rgba(255,255,255,0.82); border: 2px solid #fff; box-shadow: 0 2px 0 #b6d6fa, inset 0 0 12px rgba(160,205,255,0.35); }
.speech { border: 2px solid #fff; }
.overlay { padding-top: 64px; }
.modal { max-height: calc(100vh - 150px); }

/* ========== Раскладка как в оригинале ========== */
.hud { left: 76px; right: 8px; }
.hud-mid { margin-left: auto; }
.hud-right { gap: 6px; }
.round.sq { width: 40px; height: 40px; border-radius: 10px; position: relative; }
.round.sq .badge { top: -6px; right: -6px; }
.res { position: relative; padding-right: 30px; }
.plus { position: absolute; right: -14px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; padding: 0; background: none; cursor: pointer; }
.plus img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4)); }
.hud-mid { gap: 26px; margin-right: 18px; }

.quest-col { position: fixed; left: 8px; top: 8px; z-index: 11; display: grid; gap: 8px; }
.quest-col .quest-btn { position: relative; left: 0; top: 0; width: 62px; height: 62px; border-radius: 12px; }
.quest-col .quest-btn canvas { border-radius: 8px; }
.feed { left: 8px; top: 84px; width: 240px; }

.side-col { position: fixed; right: 8px; top: 62px; z-index: 10; display: grid; gap: 8px; }
.side-tile { position: relative; width: 76px; border: 0; background: none; cursor: pointer; padding: 0; text-align: center; }
.side-tile img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,10,50,0.55)); }
.side-tile i { display: block; font: 800 11px Rubik; font-style: normal; color: #fff; text-shadow: 0 1px 0 #0d2466, 0 0 4px #0d2466, 0 0 6px #0d2466; }
.side-tile .badge { top: -4px; right: 2px; }

.bottom { background: none; padding: 0 8px 6px; align-items: flex-end; }
.friends-bar { flex: 1; min-width: 0; position: relative; border: 18px solid transparent; border-image: url(img/ui_panel.webp) var(--panel-slice) fill / 18px stretch;
  filter: drop-shadow(0 -2px 8px rgba(0,10,50,0.35)); }
.friends-wrap { margin: -6px -8px; }
.friends { gap: 4px; padding: 4px 2px 0; }
.friend { width: 66px; }
.friend .ava { width: 52px; height: 52px; font-size: 22px; }
.friend .name { color: var(--ink); text-shadow: none; font-size: 11px; }
.arrow { height: 52px; width: 22px; background: rgba(40,110,200,0.85); }
.visit-caption { position: absolute; top: -40px; left: 0; color: #fff; font-weight: 700; font-size: 14px; padding: 4px 14px;
  border: 0 var(--plate-w) solid transparent; border-image: url(img/hud_plate.webp) 0 80 fill / 0 var(--plate-w) stretch; white-space: nowrap; }

.menu { display: grid; grid-template-columns: repeat(3, 58px); gap: 2px 4px; padding: 6px; border: 18px solid transparent;
  border-image: url(img/ui_panel.webp) var(--panel-slice) fill / 18px stretch; margin: -12px; }
.menu .mbtn { width: 58px; height: 54px; }
.menu .mbtn span img { width: 44px; height: 44px; }
.menu .mbtn i { color: var(--ink); text-shadow: none; -webkit-text-stroke: 0; font-size: 10px; margin-top: 0; }
.home-tile { grid-template-columns: 70px; }
.home-tile .mbtn { width: 70px; }

.tutorial { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.tut-guide { position: absolute; height: 46vh; filter: drop-shadow(14px 6px 8px rgba(80,60,150,0.38)); }
.tut-bubble { position: absolute; max-width: 340px; background: #fff; color: var(--ink); border-radius: 6px; padding: 12px 16px; font-weight: 700; font-size: 16px; line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0,10,50,0.4); border: 2px solid #cfe4ff; }
.tut-bubble::before { content: ''; position: absolute; left: -14px; top: 22px; border: 8px solid transparent; border-right: 14px solid #fff; }
.tut-skip { position: absolute; right: 200px; top: 10px; pointer-events: auto; font-size: 13px; }

.menu { grid-template-columns: repeat(3, 66px); }
.menu .mbtn { width: 66px; }
.menu .mbtn i { font-size: 9.5px; white-space: nowrap; letter-spacing: -0.2px; }

.menu.home-tile { grid-template-columns: 72px; }
.menu.home-tile .mbtn { width: 72px; }

/* награды, летящие в счётчик */
.fly-icon { position: fixed; left: 0; top: 0; width: 28px; height: 28px; z-index: 90; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35)); }

/* колонка помощников под Дедом Морозом */
.helper-col { display: grid; gap: 10px; justify-items: center; margin-top: 4px; }
.hq { position: relative; width: 56px; height: 56px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 3px solid #ffd76a; box-shadow: 0 0 0 2px #fff, 0 5px 12px rgba(40,20,90,0.5);
  background: radial-gradient(circle at 50% 35%, #fff6e6, #f2c9a6 70%, #c98d74); overflow: visible; }
.hq > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 15%; display: block; }
.hq:hover { transform: scale(1.06); }
.hq i { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); white-space: nowrap; font: 800 11px Rubik; font-style: normal; color: #fff;
  background: linear-gradient(#3b5fd0, #1d3591); border: 1.5px solid #ffd76a; border-radius: 9px; padding: 0 6px; line-height: 16px; }
.hq .badge { top: -4px; right: -4px; }
.hq.locked { border-color: #b9c3d8; background: #c9d2e6; }
.hq.locked > img { filter: grayscale(1) brightness(0.75) contrast(0.9); opacity: 0.75; }
.hq-lock { position: absolute; inset: 0; display: grid; place-items: center; }
.hq-lock img { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.hq.locked i { background: linear-gradient(#8792ab, #5d6781); border-color: #dfe5f0; }
@media (max-height: 560px) { .hq { width: 46px; height: 46px; } .helper-col { gap: 8px; } }

/* до Нового года */
.countdown { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 9; pointer-events: none;
  height: 46px; min-width: 200px; padding: 0 6px; display: grid; place-items: center;
  border-style: solid; border-width: 0 30px; border-image: url(img/ui_countdown.webp) 0 130 fill / 0 30px stretch; }
.countdown span { font: 800 15px Rubik; color: #fff4d6; text-shadow: 0 1px 0 #3d1a04, 0 0 4px #3d1a04; white-space: nowrap; margin-top: 7px; }


.toast.news { display: flex; align-items: center; gap: 8px; border-left: 5px solid #ffb02e; padding-left: 10px; }
.toast.news img { width: 30px; height: 30px; object-fit: contain; }

/* новый уровень */
.levelup .lv-burst { position: relative; width: 190px; height: 190px; margin: -10px auto 4px; }
.levelup .lv-burst img { width: 100%; height: 100%; object-fit: contain; animation: pop .5s; }
.levelup .lv-burst b { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 10px; font: 800 54px Rubik; color: #fff; text-shadow: 0 3px 0 #b5620a, 0 0 10px #b5620a; }
.lv-new { display: flex; align-items: center; gap: 12px; margin: 10px auto; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,0.7); width: fit-content; text-align: left; }
.lv-new img { width: 58px; height: 58px; border-radius: 50%; border: 3px solid #ffd76a; object-fit: cover; object-position: 50% 15%; background: #f6dcc4; }
.lv-new small { display: block; color: #6a7aa0; font-weight: 700; }
.confetti { position: fixed; left: 0; top: 0; width: 9px; height: 14px; border-radius: 2px; z-index: 200; pointer-events: none; }

/* облачко Деда Мороза в обучении: ледяная рамка с хвостиком */
#tutorial .tut-bubble { background: none; border-radius: 0; padding: 10px 14px 10px 8px; max-width: 360px; border-style: solid; border-width: 34px 26px 22px 40px;
  border-image: url(img/ui_bubble.webp) 90 60 50 95 fill / 34px 26px 22px 40px stretch; box-shadow: none; filter: drop-shadow(0 6px 10px rgba(60,40,120,0.35)); }
#tutorial .tut-bubble::before { display: none; }
#tutorial .tut-skip { background: rgba(40,30,90,0.45); border: 1px solid rgba(255,255,255,0.5); color: #fff; box-shadow: none; border-image: none; padding: 4px 12px; font-size: 12px; font-weight: 600; border-radius: 12px; }

/* ---- Адаптивность: табличка до Нового года уходит под верхнюю панель, только если наверху ей не хватает места (класс ставит main.js) ---- */
.countdown.low { top: 68px; height: 38px; }
.countdown.low span { font-size: 13px; }

/* ---- Низкие экраны (телефон боком, маленький ноутбук): всё компактнее, сцене больше места ---- */
@media (max-height: 560px) {
  .hud { top: 4px; left: 60px; }
  .lvl-star { width: 42px; height: 42px; }
  .lvl-star span { font-size: 15px; }
  .res { height: 32px; font-size: 14px; }
  .res .ico img { width: 22px !important; height: 22px !important; }
  .plus { width: 22px; height: 22px; }
  .hud-mid { gap: 18px; margin-right: 12px; }
  .round.sq { width: 32px; height: 32px; }
  .quest-col { left: 4px; top: 4px; gap: 6px; }
  .quest-col .quest-btn { width: 48px; height: 48px; }
  .hq { width: 40px; height: 40px; border-width: 2px; }
  .helper-col { gap: 9px; }
  .hq i { font-size: 9px; line-height: 13px; bottom: -7px; }
  .countdown { display: none; }
  .side-col { top: 44px; }
  .side-tile { width: 56px; }
  .side-tile img { width: 44px; height: 44px; }
  .side-tile i { font-size: 9px; }
  .bottom { padding: 0 4px 3px; gap: 4px; }
  .friends-bar { border-width: 12px; }
  .friend { width: 50px; }
  .friend .ava { width: 38px; height: 38px; font-size: 16px; }
  .friend .ava::after { inset: -6px; }
  .friend .name { font-size: 9px; }
  .friend .lv { font-size: 8px; line-height: 12px; padding: 0 3px; }
  .menu { grid-template-columns: repeat(6, 46px); border-width: 12px; padding: 2px; gap: 0 2px; }
  .menu .mbtn { width: 46px; height: 46px; }
  .menu .mbtn span img { width: 32px; height: 32px; }
  .menu .mbtn i { font-size: 8px; }
  .menu.home-tile { grid-template-columns: 56px; }
  .menu.home-tile .mbtn { width: 56px; }
  .visit-caption { font-size: 12px; top: -32px; }
}

/* ---- Телефон вертикально: игра горизонтальная, просим повернуть ---- */
.rotate { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  .rotate { display: grid; position: fixed; inset: 0; z-index: 500; place-items: center; text-align: center; padding: 24px;
    background: linear-gradient(#5b4a9a, #c9a6d6); color: #fff; font: 800 20px Rubik; text-shadow: 0 2px 4px rgba(40,20,90,0.6); }
  .rotate img { width: 120px; margin: 0 auto 16px; display: block; animation: tilt 2.4s ease-in-out infinite; }
  @keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
}

/* ---- Верхняя панель: единый набор (плашка с ровным снегом, полоска опыта, круглые кнопки) ---- */
.res { position: relative; height: 36px; min-width: 104px; padding: 2px 26px 0 30px; justify-content: center; gap: 0;
  background: none; box-shadow: none; border-style: solid; border-width: 0 20px; border-color: transparent;
  border-image: url(img/hud_plate.webp) 0 80 fill / 0 20px stretch; }
.res b { font: 800 17px Rubik; color: #fff; text-shadow: 0 1px 0 #000b40, 0 0 3px #000b40; min-width: 0; }
.res .ico { position: absolute; left: -22px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; }
.res .ico img { width: 40px !important; height: 40px !important; filter: drop-shadow(0 2px 3px rgba(0,10,50,0.5)); }
.res .plus { right: -16px; width: 26px; height: 26px; }
#magicRes { padding-right: 4px; }
#magicRes small { position: absolute; left: 50%; bottom: -15px; transform: translateX(-50%); font: 700 11px Rubik; color: #fff; text-shadow: 0 1px 2px #1d0a50; white-space: nowrap; }
.hud-mid { gap: 34px; margin-right: 10px; }
.hud-left { gap: 30px; }

.bar { width: 140px; height: 24px; margin-left: -14px; padding: 0 4px; display: flex; align-items: center; overflow: visible;
  background: none; border-style: solid; border-width: 0 12px; border-color: transparent; border-radius: 0;
  border-image: url(img/hud_bar.webp) 0 60 fill / 0 12px stretch; }
.bar div { height: 13px; margin-top: 3px; min-width: 0; border-radius: 7px; background: url(img/hud_fill.webp) center / 100% 100% no-repeat; }
.bar span { font: 800 11px Rubik; text-shadow: 0 1px 0 #000b40, 0 0 3px #000b40; padding-top: 3px; }

.round.sq { width: 40px; height: 40px; border-radius: 50%; background: url(img/hud_btn.webp) center / contain no-repeat; display: grid; place-items: center; }
.round.sq img { width: 52%; height: 52%; margin-top: 3px; filter: drop-shadow(0 1px 1px rgba(0,10,60,0.5)); }
.round.sq.off img { opacity: 0.45; filter: none; }

@media (max-height: 560px) {
  .res { height: 30px; min-width: 86px; padding: 1px 20px 0 24px; border-width: 0 16px; border-image-width: 0 16px; }
  .res b { font-size: 14px; }
  .res .ico { left: -18px; width: 32px; height: 32px; }
  .res .ico img { width: 32px !important; height: 32px !important; }
  .res .plus { right: -13px; width: 22px; height: 22px; }
  .hud-mid { gap: 26px; }
  .hud-left { gap: 22px; }
  .bar { width: 110px; height: 20px; }
  .bar div { height: 10px; }
  .round.sq { width: 32px; height: 32px; }
}
.round.sq.off { opacity: 1; }
.round.sq.off::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 3px; margin-top: 1px; background: #ff4d6d; border-radius: 2px; transform: rotate(-45deg); box-shadow: 0 0 0 1px #fff; }

/* волшебная палочка вместо курсора: над предметом звезда разгорается */
#scene { cursor: url(img/wand.png) 8 8, auto; }
#scene.hot { cursor: url(img/wand_glow.png) 8 8, pointer; }

/* ---- Новогодний календарь ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 560px; margin: 0 auto; }
.cal-cell { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.cal-cell .cal-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cal-cell b { position: relative; font: 800 clamp(13px, 2.4vw, 20px) Rubik; color: #8a2a14; margin-top: 8%; }
.cal-cell.big b { color: #7a4a00; }
.cal-cell:disabled { cursor: default; filter: saturate(0.75) brightness(0.95); }
.cal-cell.today { cursor: pointer; filter: drop-shadow(0 0 8px #ffd76a) drop-shadow(0 0 3px #fff); }
.cal-cell.today:hover { transform: scale(1.06); }
.cal-cell.open .cal-ic { position: relative; width: 46%; height: 46%; object-fit: contain; margin-top: 6%; animation: pop .45s; }
.cal-cell.open i { position: absolute; left: 0; right: 0; bottom: 4%; font: 700 9px Rubik; font-style: normal; color: #5a3410; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6%; }

/* ---- В гостях: плашка хозяина двора сверху ---- */
.visit-banner { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 12; display: flex; align-items: center; gap: 12px;
  padding: 6px 8px 6px 6px; border: 18px solid transparent; border-image: url(img/ui_panel.webp) var(--panel-slice) fill / 18px stretch; margin-top: -12px; }
.vb-ava { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; font: 800 24px Rubik; color: #fff; overflow: hidden;
  box-shadow: 0 0 0 3px #ffd76a, 0 3px 8px rgba(0,10,50,0.35); text-shadow: 0 2px 2px rgba(0,0,0,0.3); flex: none; }
.vb-ava img { width: 100%; height: 100%; object-fit: cover; }
.vb-info { display: grid; line-height: 1.2; min-width: 0; }
.vb-info b { font: 800 16px Rubik; color: var(--ink); white-space: nowrap; }
.vb-info small { font: 600 12px Rubik; color: #4a5a85; white-space: nowrap; }
.vb-pips { display: flex; gap: 2px; }
.vb-pips img { width: 26px; height: 26px; object-fit: contain; }
.vb-pips img.used { filter: grayscale(1) opacity(0.35); }
#vbHome { padding: 8px 18px; font-size: 16px; }
.visit-caption { display: none !important; }
@media (max-height: 560px) {
  .visit-banner { top: 42px; gap: 8px; border-width: 10px; padding: 0 4px 0 2px; }
  .vb-ava { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }
  .vb-info b { font-size: 13px; } .vb-info small { display: none; }
  .vb-pips img { width: 20px; height: 20px; }
  #vbHome { padding: 5px 12px; font-size: 13px; }
}

/* ---- Плеер музыки под кнопкой с нотой: маленькая тёмная плашка ---- */
.hud-right { position: relative; }
.music-panel { position: absolute; top: 50px; right: 34px; width: 196px; padding: 10px 12px 12px; z-index: 30; pointer-events: auto;
  background: linear-gradient(180deg, rgba(24,36,110,0.94), rgba(12,20,70,0.94)); border: 1.5px solid #ffd76a; border-radius: 18px;
  box-shadow: 0 8px 22px rgba(10,10,50,0.45), inset 0 1px 0 rgba(255,255,255,0.18); color: #fff; animation: pop .2s; }
.music-panel::before { content: ''; position: absolute; top: -7px; right: 22px; width: 12px; height: 12px; transform: rotate(45deg);
  background: rgb(24,36,110); border-left: 1.5px solid #ffd76a; border-top: 1.5px solid #ffd76a; }
.mp-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.mp-btn { width: 34px; height: 34px; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: url(img/hud_btn.webp) center / contain no-repeat; }
.mp-btn.big { width: 46px; height: 46px; }
.mp-btn.on { filter: hue-rotate(-20deg) saturate(1.2); }
.mp-btn:hover { transform: scale(1.08); }
.mp-btn i { display: block; margin-top: 3px; filter: drop-shadow(0 1px 1px rgba(0,10,60,0.6)); }
.ic-play { width: 0; height: 0; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 4px; }
.ic-pause { width: 14px; height: 16px; border-left: 5px solid #fff; border-right: 5px solid #fff; }
.ic-next, .ic-prev { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; position: relative; }
.ic-next { border-left: 9px solid #fff; margin-left: 2px; } .ic-next::after { content: ''; position: absolute; left: 0; top: -6px; height: 12px; border-left: 2.5px solid #fff; }
.ic-prev { border-right: 9px solid #fff; margin-right: 2px; } .ic-prev::after { content: ''; position: absolute; right: 0; top: -6px; height: 12px; border-right: 2.5px solid #fff; }
.mp-title { margin-top: 8px; text-align: center; font: 700 14px Rubik; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000b40; }
.mp-title small { display: block; font: 600 11px Rubik; color: #b9c9ff; margin-top: 1px; }
.mp-bar { height: 4px; margin-top: 8px; border-radius: 2px; background: rgba(255,255,255,0.16); overflow: hidden; }
.mp-bar div { height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, #ffe27a, #ffb02e); transition: width .5s linear; }
@media (max-height: 560px) { .music-panel { top: 40px; } }
.hud { z-index: 13; }

/* переименование двора и питомцев */
.rename-form { display: flex; gap: 8px; }
.rename-form input { flex: 1; min-width: 0; font: 700 17px Rubik; padding: 10px 14px; border-radius: 14px; border: 2px solid #9cc2f0; color: var(--ink); background: #fff; }
.pet-name { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pet-name b { font: 800 20px Rubik; color: var(--ink); }
.cal-daily { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(#fff6dc, #ffe9b0); border: 2px solid #ffd76a; font-weight: 600; color: #6a4210; text-align: center; }

/* в гостях: нарядить ёлку друга и положить подарок */
.vb-acts { display: flex; gap: 4px; }
.vb-act { position: relative; width: 54px; border: 0; background: none; cursor: pointer; padding: 0; text-align: center; }
.vb-act img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,10,50,0.4)); }
.vb-act i { display: block; font: 800 10px Rubik; font-style: normal; color: var(--ink); }
.vb-act:hover img { transform: scale(1.1); }
.vb-act.done { opacity: 0.4; filter: grayscale(0.8); }
@media (max-height: 560px) { .vb-act { width: 40px; } .vb-act img { width: 24px; height: 24px; } .vb-act i { display: none; } }

/* общая гирлянда: табличка «До Нового года» открывает её */
.countdown { pointer-events: auto; cursor: pointer; }
.countdown:hover { filter: brightness(1.08); }
.countdown .badge { top: -6px; right: -36px; }
.goal-bar { position: relative; height: 22px; border-radius: 11px; background: #1c2a6e; box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); margin: 14px 6px 0; }
.goal-bar div { height: 100%; border-radius: 11px; background: linear-gradient(90deg, #ff6b8a, #ffd23f, #8aff7a, #4dd8ff); }
.goal-bar i { position: absolute; top: -5px; width: 14px; height: 32px; margin-left: -7px; border-radius: 7px; background: #fff; box-shadow: 0 0 0 2px #1c2a6e; }
.goal-bar i.on { background: #ffd23f; box-shadow: 0 0 0 2px #1c2a6e, 0 0 10px #ffd23f; }
.goal-step { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-top: 6px; border-radius: 12px; background: rgba(120,160,230,0.15); }
.goal-step b { width: 64px; font: 800 15px Rubik; color: var(--ink); }
.goal-step span { flex: 1; font-weight: 600; }
.goal-step em { font-style: normal; color: #6a7aa0; font-weight: 700; font-size: 13px; }
.goal-step.got { opacity: 0.55; }
.hang-bar { z-index: 14; }
.hang-bar.below-visit { top: 140px; }
@media (max-height: 560px) { .hang-bar.below-visit { top: 96px; } }

/* дела дня */
.task { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px; border-radius: 14px; background: rgba(120,160,230,0.15); }
.task .tx { flex: 1; min-width: 0; }
.task .tx b { display: block; font-size: 14px; margin-bottom: 4px; }
.task .tx small { color: #6a7aa0; font-weight: 700; }
.task em, .task-chest em { font-style: normal; color: #2a8d22; font-weight: 800; font-size: 13px; }
.task.got { opacity: 0.6; }
.task-chest { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(#fff6dc, #ffe9b0); border: 2px solid #ffd76a; }
.task-chest > img { width: 54px; height: 54px; object-fit: contain; }
.task-chest .tx { flex: 1; } .task-chest .tx b { display: block; } .task-chest .tx small { color: #6a4210; font-weight: 600; }
.task-chest em { color: #8a6a20; }
.stamps { margin-top: 12px; text-align: center; font-weight: 700; color: #4a5a85; }
.stamps div { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.stamps img { width: 36px; height: 36px; object-fit: contain; filter: grayscale(1) opacity(0.35); }
.stamps img.on { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3)); }

/* звездопад */
.side-tile.starfall img { filter: drop-shadow(0 0 8px #ffd76a) drop-shadow(0 4px 6px rgba(0,10,50,0.55)); }
.side-tile.starfall i { color: #fff3b0; }

/* открытки городов */
.cards { display: grid; gap: 6px; }
.card-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: rgba(120,160,230,0.12); }
.card-row b { font-size: 14px; }
.pc-slots { display: flex; gap: 6px; }
.pc { position: relative; width: 58px; height: 40px; border-radius: 6px; border: 2px dashed #9cb4dc; background: #eef4ff center / 300% auto no-repeat; }
.pc.on { border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,10,50,0.3), 0 0 0 1px #d9b45a; }
.pc i { position: absolute; right: 3px; bottom: 1px; font: 800 11px Rubik; font-style: normal; color: #fff; text-shadow: 0 1px 2px #000; }
.pc:not(.on) i { color: #9cb4dc; text-shadow: none; }
.pc-friends { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.upg-why { display: block; margin-top: 4px; color: #b3122b; font-weight: 700; font-size: 12px; text-align: right; }
/* открытка: город в рамке старинной открытки */
.pc.on { border: 0; box-shadow: 0 2px 6px rgba(0,10,50,0.3); background: url(img/postcard.webp) center / 100% 100% no-repeat; }
.pc.on span { position: absolute; inset: 4px 5px; border-radius: 2px; background: #ccd center / 300% auto no-repeat; }

/* ---- Профиль и аватарки ---- */
.me-ava { width: 46px; height: 46px; padding: 0; border: 0; background: none; cursor: pointer; margin-right: -4px; flex: none; }
.me-ava span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; font: 800 20px Rubik; color: #fff;
  box-shadow: 0 0 0 3px #ffd76a, 0 0 0 5px #fff, 0 4px 10px rgba(30,20,80,0.45); }
.me-ava img, .vb-ava img, .friend .ava.pic img, .r-ava img, .prof-ava img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.me-ava:hover { transform: scale(1.06); }
.friend .ava.pic { overflow: hidden; }
.r-ava { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; vertical-align: middle; margin-right: 8px; font: 800 12px Rubik; color: #fff; }
.prof-top { display: flex; gap: 16px; align-items: center; }
.prof-ava { width: 110px; height: 110px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; font: 800 46px Rubik; color: #fff;
  box-shadow: 0 0 0 4px #ffd76a, 0 0 0 7px #fff, 0 6px 16px rgba(30,20,80,0.35); }
.prof-name { flex: 1; min-width: 0; }
.prof h3 { margin: 16px 0 8px; }
.linkbtn { border: 0; background: none; padding: 0; color: #2f6fd6; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.ava-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.ava-pick { border: 0; background: rgba(120,160,230,0.14); border-radius: 16px; padding: 6px 4px 4px; cursor: pointer; text-align: center; }
.ava-pick img, .ava-letter { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: #f6dcc4; display: inline-grid; place-items: center; font: 800 26px Rubik; color: #fff; }
.ava-pick i { display: block; font: 700 11px Rubik; font-style: normal; color: var(--ink); margin-top: 2px; }
.ava-pick:hover { background: rgba(120,160,230,0.28); }
.ava-pick.sel { background: linear-gradient(#fff3c4, #ffe08a); box-shadow: 0 0 0 2px #ffb02e; }
.prof-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.prof-stats div { padding: 8px 10px; border-radius: 12px; background: rgba(120,160,230,0.14); }
.prof-stats small { display: block; color: #6a7aa0; font-weight: 700; font-size: 11px; }
.prof-stats b { font: 800 17px Rubik; color: var(--ink); }
@media (max-height: 560px) { .me-ava { width: 36px; height: 36px; } .me-ava span { font-size: 16px; } .prof-ava { width: 80px; height: 80px; } }

/* ---- Правки после разбора интерфейса ---- */
/* значки «!» не пульсируют: ничего не дёргается без дела */
.badge { animation: none; }
/* пока открыто окно, табличка «До Нового года» не лезет под ленту заголовка */
body.modal-open .countdown { display: none; }
/* в гостях подсказки появляются ниже плашки друга, а не поверх её кнопок */
body.visiting .toasts { top: 150px; }
/* календарь целиком помещается в окно */
.cal-grid { grid-template-columns: repeat(7, 64px); justify-content: center; gap: 6px; max-width: none; }
.cal-cell b { font-size: 17px; }
/* отметки ступеней гирлянды — звёздочки */
.goal-bar i { width: 18px; height: 18px; top: 2px; margin-left: -9px; border-radius: 0; background: #fff;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); box-shadow: none; }
.goal-bar i.on { background: #ffd23f; }
/* попадать пальцем: стрелки друзей, «+» у валют, подписи меню */
.arrow { min-width: 36px; }
.res .plus { width: 30px; height: 30px; right: -18px; }
.menu .mbtn i { font-size: 10.5px; white-space: nowrap; letter-spacing: -0.2px; }
/* контраст мелкого текста */
.muted { color: #3a5690; }
.friend .ava img { border-radius: 8px; }
.hq i.call { background: linear-gradient(#4cc25a, #23893a); }
@media (max-height: 560px) {
  .visit-banner { top: 56px; }
  /* окна на телефоне боком — почти во всю высоту, иначе в них ничего не видно */
  .overlay { padding-top: 34px; }
  .modal { --panel-w: 30px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
  .modal-title { transform: translateX(-50%) scale(0.72); transform-origin: 50% 100%; }
  .modal-close { width: 38px; height: 38px; }
  .modal-body { padding-top: 10px; }
}

/* ---- Обучение: Дед Мороз справа от Ёлочки, облачко слева от него, хвостиком к нему ---- */
#tutorial .tut-bubble { left: auto; top: auto; transform: scaleX(-1); }
#tutorial .tut-bubble > span { display: block; transform: scaleX(-1); }
/* картинка помощника в его окне */
.helper-pic { width: 130px; height: 150px; flex: none; display: grid; place-items: center; border-radius: 16px; background: radial-gradient(circle at 50% 70%, #fff, #d5e8ff); }
.helper-pic { overflow: hidden; }
.helper-pic img { width: 92%; height: 92%; min-height: 0; object-fit: contain; }
.helper-pic.none img { filter: grayscale(1); opacity: 0.45; }

.ghosted { opacity: 0 !important; pointer-events: none !important; }
.ghosted * { pointer-events: none !important; }
/* пока открыто окно, подсказки всплывают снизу и не закрывают его заголовок */
body.modal-open .toasts { top: auto; bottom: 14px; }

/* ---- Ярмарка ---- */
.fair { display: grid; gap: 8px; }
.fair-item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 16px; background: rgba(120,160,230,0.14); }
.fair-item > img { width: 96px; height: 96px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 6px rgba(30,20,80,0.25)); }
.fair-item .tx { flex: 1; min-width: 0; }
.fair-item .tx b { display: block; font: 800 17px Rubik; color: var(--ink); }
.fair-item .tx small { display: block; color: #3a5690; font-weight: 600; font-size: 13px; }
.fair-item .tx small.cozy { color: #b3550a; font-weight: 800; margin-top: 2px; }
.fair-item .buy { display: grid; gap: 6px; justify-items: end; flex: none; }
.fair-item em { font-style: normal; font-weight: 800; color: #2a8d22; font-size: 13px; max-width: 150px; text-align: right; }
.fair-item.own { background: linear-gradient(#f3ffe9, #e2f7d2); }
/* календарь: окошки январских каникул */
.cal-sep { grid-column: 1 / -1; text-align: center; font: 800 14px Rubik; color: #6a4210; padding: 6px 0 0; }
.cal-cell.jan b { color: #1d3591; }
@media (max-height: 560px) {
  .side-col { grid-template-rows: repeat(3, auto); grid-auto-flow: column; direction: rtl; }
  .side-col > * { direction: ltr; }
  .fair-item > img { width: 64px; height: 64px; }
}
@media (max-height: 560px) {
  .menu { grid-template-columns: repeat(6, 52px); }
  .menu .mbtn { width: 52px; }
  .menu .mbtn i { font-size: 8.5px; letter-spacing: -0.3px; }
}
@media (max-height: 560px) {
  .menu { grid-template-columns: repeat(6, 56px); gap: 0; }
  .menu .mbtn { width: 56px; }
  .menu .mbtn i { font-size: 8px; letter-spacing: -0.4px; }
}

/* ---- Палочка растит всё: кнопка «Открыть» у предмета и полоска роста в окне ---- */
.open-chip { position: fixed; z-index: 12; transform: translate(-50%, -100%); border: 0; cursor: pointer; white-space: nowrap;
  font: 800 13px Rubik; color: #fff; padding: 7px 14px 8px; border-radius: 16px; background: linear-gradient(#4f8df0, #2456c8);
  box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(20,20,80,0.45); animation: pop .2s; }
.growrow { display: flex; gap: 10px; align-items: center; margin: 10px 0 4px; padding: 8px 12px; border-radius: 14px; background: linear-gradient(#f6ecff, #ffe9f6); border: 2px solid #e2b8ff; }
.growrow img { width: 38px; height: 38px; flex: none; }
.growrow .tx { flex: 1; min-width: 0; }
.growrow b { font-size: 14px; color: #5a2a8a; }
.growrow small { display: block; color: #6a4a8a; font-weight: 600; font-size: 12px; margin-top: 3px; }
.progress.grow { margin: 4px 0 0; }
.progress.grow > div { background: linear-gradient(90deg, #d77bff, #ffd23f); }

/* ---- Наряд Ёлочки ---- */
.style-panel { position: fixed; left: 86px; bottom: 96px; z-index: 14; width: 292px; padding: 10px 12px 12px; color: #fff;
  background: linear-gradient(180deg, rgba(24,36,110,0.95), rgba(12,20,70,0.95)); border: 1.5px solid #ffd76a; border-radius: 18px;
  box-shadow: 0 8px 22px rgba(10,10,50,0.45), inset 0 1px 0 rgba(255,255,255,0.18); animation: pop .2s; }
.style-panel > b { display: block; font: 700 12px Rubik; color: #b9c9ff; margin: 8px 0 4px; }
.sp-head { display: flex; justify-content: space-between; align-items: center; }
.sp-head b { font: 800 16px Rubik; }
.sp-close { flex: none; border: 3px solid #fff; background: var(--red); color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font: 800 15px Rubik; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { border: 0; background: rgba(255,255,255,0.08); border-radius: 12px; padding: 5px 6px 3px; cursor: pointer; width: 62px; text-align: center; }
.sw span { display: block; height: 22px; border-radius: 8px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.5); }
.sw i { display: block; font: 600 9px/1.15 Rubik; font-style: normal; color: #e6ecff; margin-top: 3px; min-height: 21px; }
.sw.on { background: rgba(255,215,106,0.25); box-shadow: 0 0 0 2px #ffd76a; }
.style-panel small { display: block; margin-top: 8px; color: #b9c9ff; font-size: 11px; }
@media (max-height: 560px) { .style-panel { left: 64px; bottom: 76px; width: 268px; padding: 6px 10px 8px; } .sw { width: 56px; } .sw span { height: 16px; } }

/* ---- Переключатель: палочка колдует, рука открывает ---- */
.mode-switch { position: absolute; left: 50%; top: -38px; transform: translateX(-50%); display: flex; padding: 3px; border-radius: 20px; z-index: 2;
  background: rgba(14,24,84,0.88); border: 1.5px solid #ffd76a; box-shadow: 0 4px 12px rgba(10,10,50,0.4); }
.mode-switch button { display: flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; padding: 4px 14px 4px 8px; border-radius: 16px;
  font: 800 13px Rubik; color: #b9c9ff; white-space: nowrap; }
.mode-switch img { width: 24px; height: 24px; object-fit: contain; }
.mode-switch button.on { background: linear-gradient(#ffe27a, #f2a900); color: #4a2a00; box-shadow: inset 0 1px 0 rgba(255,255,255,0.6); }
body.visiting .mode-switch { display: none; }
.bottom { position: fixed; }
#scene.hand { cursor: default; }
#scene.hand.hot { cursor: pointer; }
@media (max-height: 560px) { .mode-switch { top: -32px; } .mode-switch button { font-size: 11px; padding: 2px 10px 2px 6px; } .mode-switch img { width: 18px; height: 18px; } }

/* ---- Наборы игрушек ---- */
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.set { padding: 8px 10px; border-radius: 14px; background: rgba(120,160,230,0.14); }
.set.done { background: linear-gradient(#fff6dc, #ffe9b0); box-shadow: 0 0 0 2px #ffd76a; }
.set-h { display: flex; justify-content: space-between; font-weight: 800; color: var(--ink); }
.set-h span { font-size: 12px; color: #3a5690; }
.set.done .set-h span { color: #2a8d22; }
.set-i { display: flex; gap: 4px; margin: 6px 0 4px; }
.set-i span { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,0.6); }
.set-i img { width: 34px; height: 34px; object-fit: contain; filter: grayscale(1) opacity(0.35); }
.set-i .on img { filter: none; }
.set-i .have img { filter: grayscale(0.4) opacity(0.75); }
.set-i .have::after { content: ''; position: absolute; right: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: #ffb02e; border: 1.5px solid #fff; }
.set small { display: block; color: #6a4210; font-weight: 700; font-size: 12px; }

/* ---- Бурмалда ---- */
.spin { margin-top: 12px; }
.spin-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.spin-row .btn { flex: 1; min-width: 150px; }
.spin-took { display: flex; justify-content: center; align-items: center; gap: 4px; opacity: 0.7; }
.spin-took img { width: 34px; height: 34px; object-fit: contain; }
.spin-took span { font: 800 20px Rubik; color: #3a5690; margin-left: 6px; }
.spin-reel { width: 130px; height: 130px; margin: 8px auto; display: grid; place-items: center; border-radius: 24px;
  background: radial-gradient(circle at 50% 40%, #fff, #ffe9b0); box-shadow: 0 0 0 3px #ffd76a, inset 0 -6px 12px rgba(200,140,20,0.25); }
.spin-reel img { width: 96px; height: 96px; object-fit: contain; }

/* ---- Анимации интерфейса: только в ответ на действие ---- */
.overlay.closing { animation: fadeout .15s forwards; pointer-events: none; }
.overlay.closing .modal { animation: popout .15s forwards; }
@keyframes fadeout { to { opacity: 0; } }
@keyframes popout { to { transform: scale(.94); opacity: 0; } }
.modal { animation: modalin .22s cubic-bezier(.2,1.3,.5,1); }
@keyframes modalin { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.btn, .side-tile img, .friend .ava, .orn, .cal-cell, .ava-pick, .sw, .hq, .me-ava { transition: transform .12s ease, filter .12s ease, box-shadow .12s ease; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(2px) scale(0.97); }
.side-tile:hover img { transform: scale(1.08); }
.side-tile:active img { transform: scale(0.95); }
.friend:hover .ava { transform: translateY(-3px); }
.orn:hover { transform: translateY(-2px); box-shadow: 0 4px 0 #b6d6fa; }
.orn:active { transform: scale(0.96); }
.mode-switch button { transition: background .15s, color .15s; }

/* ---- Бурмалда: слоты, барабан, шансы ---- */
.bm-top { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.bm-slots { display: flex; gap: 6px; }
.bm-slot { width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center; padding: 0; font: 800 22px Rubik; color: #9cb4dc;
  border: 2px dashed #9cb4dc; background: rgba(255,255,255,0.5); }
.bm-slot.on { border: 2px solid #b6d6fa; background: #fff; cursor: pointer; transition: transform .12s; }
.bm-slot.on.new { animation: pop .25s cubic-bezier(.2,1.6,.5,1); }
.bm-slot.on:hover { transform: translateY(-2px); }
.bm-slot.on.rar1 { border-color: #ffc94d; } .bm-slot.on.rar2 { border-color: #d77bff; box-shadow: 0 0 8px rgba(215,123,255,0.6); }
.bm-slot img { width: 46px; height: 46px; object-fit: contain; }
.bm-arrow { font: 800 26px Rubik; color: #3a5690; }
.bm .spin-reel { width: 104px; height: 104px; margin: 0; border-radius: 22px; }
.bm .spin-reel img { width: 78px; height: 78px; }
.spin-reel.res.rar1 { box-shadow: 0 0 0 3px #ffc94d, 0 0 18px rgba(255,200,80,0.8); }
.spin-reel.res.rar2 { box-shadow: 0 0 0 3px #d77bff, 0 0 22px rgba(215,123,255,0.9); }
.bm-text { text-align: center; min-height: 24px; margin-top: 10px; font-weight: 600; color: var(--ink); }
.bm-odds { display: flex; justify-content: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bm-odds span { padding: 4px 12px; border-radius: 12px; background: #e3eefc; font: 600 13px Rubik; color: var(--ink); }
.bm-odds .r1 { background: #fff1c9; } .bm-odds .r2 { background: #f3dcff; }
.bm-odds.off { opacity: 0.4; }
@media (max-height: 560px) { .bm-slot { width: 46px; height: 46px; } .bm-slot img { width: 36px; height: 36px; } .bm .spin-reel { width: 80px; height: 80px; } .bm .spin-reel img { width: 60px; height: 60px; } }

/* ---- Мини-игра ---- */
.mg { position: relative; border-radius: 16px; overflow: hidden; background: #14204f; line-height: 0; }
.mg canvas { width: 100%; height: auto; display: block; cursor: none; touch-action: none; }
.mg-cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 16px; text-align: center; line-height: 1.35;
  background: rgba(10,18,70,0.72); color: #fff; }
.mg-cover img { width: 84px; }
.mg-cover p { margin: 0; font-weight: 600; }
/* ---- Записки на табличке ---- */
.notes { display: grid; gap: 6px; }
.note { position: relative; padding: 8px 34px 8px 12px; border-radius: 12px; background: linear-gradient(#fff9e8, #ffefc4); border: 1.5px solid #f0d28a; }
.note b { color: #6a4210; } .note small { color: #9a7a40; margin-left: 8px; font-weight: 600; }
.note p { margin: 3px 0 0; color: #4a3210; font-weight: 600; overflow-wrap: anywhere; }
.note-x { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(120,80,20,0.15); color: #6a4210; cursor: pointer; font-weight: 800; }
.vb-info { min-width: 0; overflow: hidden; } .vb-info small { overflow: hidden; text-overflow: ellipsis; }
.visit-banner { max-width: calc(100vw - 180px); }
@media (max-width: 1100px) { #vbSub { max-width: 210px; } }

.mg-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mg-pick { display: grid; gap: 6px; justify-items: center; align-content: start; }
.mg-pick img { width: 84px; height: 84px; object-fit: contain; }
.mg-pick h3 { margin: 0; } .mg-pick p { margin: 0; font-size: 13px; min-height: 52px; }
@media (max-width: 640px) { .mg-menu { grid-template-columns: 1fr; } .mg-pick p { min-height: 0; } }

/* ---- Большие мониторы (2К и шире): интерфейс крупнее, иначе кнопки и счётчики теряются ---- */
@media (min-width: 2200px) and (min-height: 1200px) {
  /* окна (#modalRoot) не увеличиваем: внутри zoom их высота «по экрану» вылезает за низ и перестаёт прокручиваться */
  #hud, #questCol, #sideCol, #bottom, #countdown, #visitBanner, #toasts, #feed, #stylePanel, #hangBar, #yardBar { zoom: 1.3; }
  /* внутри zoom проценты экрана тоже умножаются на 1.3 — делим обратно, иначе панель наряда уезжает верхом за экран */
  #stylePanel.style-panel { max-height: calc(100dvh / 1.3 - 120px); }
  #yardBar.yard-bar { max-width: calc(100vw / 1.3 - 24px); }
}

/* ---- Мелкие правки вида ---- */
.task-chest small span { white-space: nowrap; }
.style-panel { width: 316px; max-height: calc(100dvh - 120px); overflow-y: auto; }
.sw { width: 68px; } .sw i { overflow-wrap: anywhere; }
/* телефон боком: панель наряда ниже и уже, игра в мини-играх целиком влезает по высоте */
@media (max-height: 560px) {
  .style-panel { width: 268px; bottom: 70px; max-height: calc(100dvh - 84px); }
  .sw { width: 56px; }
  .mg canvas { width: auto; max-width: 100%; max-height: calc(100dvh - 120px); margin: 0 auto; }
}
/* плашка гостей стоит по центру через left:50%, поэтому ширину задаём сами — иначе браузер сжимает её до половины экрана */
.visit-banner { width: max-content; }

/* ---- Кнопки не вылезают из своих карточек: шире блока не бывают, длинный текст переносится ---- */
.btn { max-width: 100%; min-width: 0; }
.card .btn, .grid .btn, .card-row .btn, .task .btn, .fair-item .btn { white-space: normal; line-height: 1.15; }
/* нужды помощника: карточки шире, кнопки во всю ширину */
.needs { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); }
.needs .btn { width: 100%; font-size: 12.5px; padding-left: 0; padding-right: 0; }

/* ---- Плеер: перемотка и громкость ---- */
.music-panel { width: 224px; }
.mp-seek, .mp-vol { display: grid; align-items: center; gap: 6px; margin-top: 8px; font: 600 10.5px Rubik; color: #b9c9ff; }
.mp-seek { grid-template-columns: 28px 1fr 28px; } .mp-seek span:last-child { text-align: right; }
.mp-vol { grid-template-columns: 16px 1fr 22px; } .mp-vol span { text-align: right; }
.ic-vol { width: 16px; height: 14px; background: #dbe6ff; clip-path: polygon(0 32%, 28% 32%, 62% 0, 62% 100%, 28% 68%, 0 68%); }
.music-panel input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: none; cursor: pointer; touch-action: none; }
.music-panel input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #ffd23f var(--fill, 0%), rgba(255,255,255,0.18) var(--fill, 0%)); }
.music-panel input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #ffd23f var(--fill, 0%), rgba(255,255,255,0.18) var(--fill, 0%)); }
.music-panel input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%; background: #fff; border: 2px solid #ffb02e; box-shadow: 0 1px 3px rgba(0,10,60,0.6); }
.music-panel input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid #ffb02e; }
.music-panel input[type=range]:disabled { opacity: 0.45; cursor: default; }

/* ---- Сезон ---- */
.season-note { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(#fff6dc, #ffe9b0); border: 2px solid #ffd76a; color: #6a4210; font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.season-card { margin: 12px 0 4px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(#fff6dc, #ffe9b0); border: 2px solid #ffd76a; }
.season-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 14px; margin-top: 8px; font-size: 13px; color: #6a4210; }
.season-parts span { display: flex; justify-content: space-between; gap: 8px; } .season-parts b { color: #3d2606; }
table.rating tr.out td { opacity: 0.6; }
a.btn { text-decoration: none; display: inline-block; }
/* лесенка из 10 уровней: два ряда по пять, без прокрутки вбок */
.lv-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; overflow: visible; align-items: stretch; }
.lv-step { min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.lv-step img { height: 52px; }
.lv-step span { font-size: 10.5px; overflow-wrap: anywhere; }

/* ---- Экран входа: всегда можно долистать до формы; на низких экранах логотип слева, форма справа ---- */
.login { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 0; }
.logo-img { max-height: 38vh; object-fit: contain; }
@media (max-height: 560px) and (min-width: 560px) {
  .login-card { width: min(760px, calc(100vw - 24px)); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto 1fr; column-gap: 20px; align-items: center; }
  .login-card > .logo { grid-column: 1; grid-row: 1; }
  .login-card > .logo-sub { grid-column: 1; grid-row: 2; margin: 4px 0 6px; font-size: 13px; }
  .login-card > .tip { grid-column: 1; grid-row: 3; min-height: 34px; font-size: 13px; }
  .login-card > .loadbar { grid-column: 2; grid-row: 1 / -1; margin: 0 20px; }
  .login-card > .login-form { grid-column: 2; grid-row: 1 / -1; padding: 12px 14px; gap: 7px; }
  .logo-img { width: 100%; max-height: 52vh; }
  .login-form input { font-size: 16px; padding: 8px 12px; }
  .login-form .btn-big { font-size: 17px; padding-top: 8px; padding-bottom: 10px; }
  .login-hint { font-size: 11.5px; }
}

/* ---- Панель просмотра (только на своём компьютере) ---- */
.dev-panel { position: fixed; left: 86px; top: 70px; z-index: 60; padding: 8px 10px; border-radius: 12px; background: rgba(10,16,50,0.86); color: #fff; font: 600 12px Rubik; display: grid; gap: 5px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
.dev-panel > b { cursor: pointer; color: #ffd76a; }
.dev-panel.min > div { display: none; }
.dev-panel div { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; max-width: 330px; }
.dev-panel span { width: 56px; color: #b9c9ff; }
.dev-panel button { border: 0; border-radius: 7px; padding: 4px 8px; background: #2c4bb8; color: #fff; font: 600 12px Rubik; cursor: pointer; }
.dev-panel button:hover { background: #3f63e0; }

/* ---- Плеер и «Наряд Ёлочки» в том же ледяном стиле, что и остальные окна ---- */
.music-panel, .style-panel { background: linear-gradient(180deg, rgba(240,248,255,0.97), rgba(214,233,255,0.97)); border: 3px solid #fff; color: var(--ink);
  box-shadow: 0 8px 22px rgba(10,30,90,0.4), 0 0 0 2px #7fb8f5, inset 0 0 14px rgba(160,205,255,0.5); }
.music-panel::before { background: #f0f8ff; border-left: 3px solid #fff; border-top: 3px solid #fff; top: -9px; }
.mp-title { text-shadow: none; } .mp-title small, .mp-seek, .mp-vol { color: #4a5a85; }
.ic-vol { background: #4a5a85; }
.music-panel input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ffb02e var(--fill, 0%), rgba(60,90,160,0.22) var(--fill, 0%)); }
.music-panel input[type=range]::-moz-range-track { background: linear-gradient(90deg, #ffb02e var(--fill, 0%), rgba(60,90,160,0.22) var(--fill, 0%)); }
.style-panel > b { color: #4a5a85; } .style-panel small { color: #4a5a85; }
.sw { background: rgba(255,255,255,0.75); box-shadow: 0 1px 0 #b6d6fa; } .sw i { color: var(--ink); }
.sw span { box-shadow: inset 0 0 0 1.5px rgba(40,70,140,0.25); }
/* ---- Экран входа: мягкое сияние за логотипом и тихий снег ---- */
.login-card { position: relative; z-index: 1; }
.logo-img { filter: drop-shadow(0 8px 20px rgba(0,10,60,0.6)) drop-shadow(0 0 34px rgba(150,205,255,0.45)); }
/* снег закреплён на экране (fixed): иначе он растягивал прокрутку, и поле имени уезжало за верх экрана */
.login::before, .login::after { content: ''; position: fixed; inset: -100% 0 0 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(3px 3px at 90px 140px, rgba(255,255,255,.9), transparent), radial-gradient(2px 2px at 160px 80px, rgba(255,255,255,.8), transparent), radial-gradient(4px 4px at 230px 200px, rgba(255,255,255,.7), transparent), radial-gradient(2px 2px at 280px 20px, #fff, transparent);
  background-size: 320px 260px; animation: loginsnow 16s linear infinite; opacity: .8; }
.login::after { background-size: 520px 420px; animation-duration: 26s; opacity: .55; }
@keyframes loginsnow { to { transform: translateY(50%); } }
.sw.on { background: #fff4c2; box-shadow: 0 0 0 2px #ffb02e; }

/* ---- Серия заходов ---- */
.streak { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.streak i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 13px Rubik; font-style: normal; background: rgba(120,160,230,0.2); color: #6a7aa0; }
.streak i.on { background: linear-gradient(#ffe27a, #ffb02e); color: #6a4210; box-shadow: 0 1px 0 #c98510; }
.streak i.now { background: #fff; color: #2a8d22; box-shadow: 0 0 0 2px #4cc25a, 0 0 10px rgba(76,194,90,0.6); }

/* ---------- Украшения двора: ярмарка и режим «Расставить» ---------- */
.cozy-card { background: linear-gradient(#fff8e6, #ffeccc); border-radius: 16px; padding: 10px 14px; }
.cozy-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cozy-head b { font: 800 18px Rubik; color: #9a4a06; }
.cozy-head small { color: #9a6a3a; font-weight: 700; }
.cozy-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; margin-top: 6px; }
.cozy-tiers span { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; color: #8a7560; }
.cozy-tiers span i { font-style: normal; min-width: 34px; text-align: center; border-radius: 10px; background: #f0dcc0; padding: 1px 4px; font-size: 12px; }
.cozy-tiers span.on { color: #2a7d1e; }
.cozy-tiers span.on i { background: #bfeaa8; }
.yd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.yd-item { display: grid; justify-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px; background: rgba(120,160,230,0.14); text-align: center; }
.yd-item img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(30,20,80,0.25)); }
.yd-item b { font: 800 14px Rubik; color: var(--ink); line-height: 1.15; }
.yd-item small.cozy { color: #b3550a; font-weight: 800; font-size: 12px; }
.yd-item .btn { padding: 5px 14px; font-size: 14px; }
.yard-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 14; max-width: calc(100vw - 24px);
  background: rgba(30,40,90,0.88); color: #fff; border: 2px solid #c9dcff; border-radius: 18px; padding: 8px 12px; display: grid; gap: 6px; }
.yb-hint { font-weight: 700; font-size: 14px; text-align: center; }
.yb-hint .muted { color: #b8c8ee; font-weight: 600; }
.yb-row { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.yb-it { position: relative; width: 54px; height: 54px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,0.14); padding: 3px; cursor: pointer; }
.yb-it img { width: 100%; height: 100%; object-fit: contain; }
.yb-it i { position: absolute; right: -4px; top: -6px; font-style: normal; font: 800 12px Rubik; background: #ff4d6d; color: #fff; border-radius: 10px; padding: 0 5px; }
.yb-it.on { border-color: #ffd23f; background: rgba(255,210,63,0.25); }
body.yard-editing #bottom, body.yard-editing #questCol, body.yard-editing #sideCol, body.yard-editing #feed, body.yard-editing #countdown { display: none !important; }
@media (max-height: 560px) {
  .yard-bar { bottom: 6px; padding: 4px 8px; gap: 3px; border-radius: 14px; display: flex; align-items: center; max-width: calc(100vw - 16px); }
  .yb-hint { font-size: 11px; max-width: 220px; text-align: left; line-height: 1.2; }
  .yb-hint .muted { display: none; }
  .yb-row { flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .yb-it { width: 38px; height: 38px; flex: none; border-radius: 9px; }
  .yard-bar .btn { padding: 4px 10px; font-size: 13px; flex: none; }
}
/* узкий экран стоя (планшет): счётчики сверху занимают всю ширину — плашка гостей встаёт под них */
@media (max-width: 860px) and (min-height: 561px) {
  .visit-banner { top: 96px; gap: 8px; max-width: calc(100vw - 200px); }
  .vb-act { width: 44px; } .vb-act i { display: none; }
}

.mg-pick .mg-top { display: block; color: #3a5690; font-size: 12px; margin: 2px 0 6px; }

/* Призы сезона в окне «Рейтинг» */
.prizes { margin: 0 0 12px; padding: 12px; border-radius: 16px; background: radial-gradient(120% 90% at 50% 0%, #2f5fb8 0%, #1b3473 70%); color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.prizes-h { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; font-size: 19px; letter-spacing: .3px; margin-bottom: 10px; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.prizes-h img { width: 30px; height: 30px; object-fit: contain; }
.prize-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 8px; align-items: end; }
.prize { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 10px 6px 9px; border-radius: 13px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.22); min-width: 0; }
.prize img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.prize.p1 { padding-top: 14px; padding-bottom: 13px; background: linear-gradient(#ffe68a, #f5b83d); border-color: #fff3b8; color: #5a3500; box-shadow: 0 0 18px rgba(255,214,90,.55); }
.prize.p1 img { width: 54px; height: 54px; }
.prize.p2 { background: linear-gradient(rgba(230,240,255,.3), rgba(190,210,240,.18)); border-color: #dbe7fb; }
.prize.p3 { background: linear-gradient(rgba(240,180,120,.32), rgba(200,120,60,.18)); border-color: #f2c79b; }
.prize-place { font-size: 12px; font-weight: 800; text-transform: uppercase; opacity: .85; }
.prize-title { font-size: 14px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.prize.p1 .prize-title { font-size: 16px; }
.prize-text { font-size: 12px; line-height: 1.25; opacity: .9; overflow-wrap: anywhere; }
.prize-me { margin-top: 10px; text-align: center; font-size: 14px; padding: 7px 10px; border-radius: 10px; background: rgba(255,230,140,.18); }
.prize-me b { color: #ffe27a; }
.r-gift { width: 18px; height: 18px; vertical-align: -3px; }
@media (max-width: 560px) {
  .prize-grid { grid-template-columns: 1fr 1fr; }
  .prize.p1 { grid-column: 1 / -1; }
}

/* Шкатулка: вход в расстановку украшений по двору */
.yd-promo { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(#eaf8ee, #d3f0dc); border: 2px solid #9fdcb2; }
.yd-promo .pics { display: flex; flex: none; }
.yd-promo .pics img { width: 44px; height: 44px; object-fit: contain; margin-left: -10px; filter: drop-shadow(0 2px 3px rgba(0,40,20,.3)); }
.yd-promo .pics img:first-child { margin-left: 0; }
.yd-promo .tx { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.3; }
.yd-promo .acts { display: flex; flex-direction: column; gap: 6px; flex: none; }
@media (max-width: 700px) { .yd-promo { flex-wrap: wrap; } .yd-promo .acts { flex-direction: row; width: 100%; } .yd-promo .acts .btn { flex: 1; } }

/* Макушки: картинки в «Наряде Ёлочки», рамка по редкости, невыпавшие — тёмный силуэт */
.sw.top { padding-top: 4px; }
.sw.top img { display: block; width: 40px; height: 40px; margin: 0 auto; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(30,40,90,.3)); }
.sw.top.r1 { box-shadow: 0 0 0 1.5px #6fb7ff; } .sw.top.r2 { box-shadow: 0 0 0 1.5px #c27bff; } .sw.top.r3 { box-shadow: 0 0 0 2px #ffb02e, 0 0 10px rgba(255,176,46,.6); }
.sw.top.on { box-shadow: 0 0 0 2.5px #ffb02e; background: #fff4c2; }
.sw.top.lock img { filter: brightness(0) opacity(.28); }
.sw.top.lock i { color: #7a86a8; }
@media (max-height: 560px) { .sw.top img { width: 30px; height: 30px; } }
.top-drop { display: flex; align-items: center; gap: 12px; margin: 0 auto 12px; padding: 10px 14px; max-width: 360px; border-radius: 16px; background: linear-gradient(#fffbe6, #ffeaa8); border: 2px solid #ffd76a; text-align: left; }
.top-drop img { width: 84px; height: 84px; object-fit: contain; flex: none; }
.top-drop small { display: block; color: #9a6400; font-weight: 800; }
.top-drop b { display: block; font-size: 18px; margin: 2px 0 6px; }
.top-drop.r2 { background: linear-gradient(#f8efff, #e6d1ff); border-color: #c27bff; }
.top-drop.r3 { background: linear-gradient(#fff3d6, #ffc96b); border-color: #ff9d00; box-shadow: 0 0 18px rgba(255,170,40,.55); }
/* заголовок с крестиком не уезжает, когда панель наряда листается */
.style-panel .sp-head { position: sticky; top: -10px; z-index: 1; margin: -10px -12px 0; padding: 8px 12px 6px; background: #eef6ff; border-radius: 14px 14px 0 0; }
@media (max-height: 560px) { .style-panel .sp-head { top: -6px; margin: -6px -10px 0; padding: 6px 10px 4px; } }

/* «Как висит гирлянда»: значки-схемы ёлки */
.sw.lay svg { display: block; width: 40px; height: 26px; margin: 0 auto; }
@media (max-height: 560px) { .sw.lay svg { width: 32px; height: 20px; } }

.mail-item.prize { background: linear-gradient(#fffbe6, #ffeaa8); border: 2px solid #ffd76a; }
/* мини-игры: четыре карточки, звёзды за результат, строка призов */
.mg-menu { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .mg-menu { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .mg-menu { grid-template-columns: 1fr; } }
.mg-pick img { width: 72px; height: 72px; }
.mg-pick p { font-size: 12.5px; min-height: 64px; }
.mg-stars i { font-style: normal; color: rgba(60,80,130,0.25); text-shadow: none; margin: 0 1px; }
.mg-stars i.on { color: #ffc21a; text-shadow: 0 0 8px rgba(255,190,40,0.7), 0 2px 0 #b97400; }
.mg-cover .mg-stars i { animation: mgStar .5s cubic-bezier(.3,1.6,.5,1) both; }
.mg-cover .mg-stars i:nth-child(2) { animation-delay: .28s; } .mg-cover .mg-stars i:nth-child(3) { animation-delay: .56s; }
@keyframes mgStar { from { transform: scale(0) rotate(-60deg); opacity: 0; } to { transform: none; opacity: 1; } }
.mg-prizes { margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(#fff6dc, #ffe9b0); border: 2px solid #ffd76a; color: #6a4210; font-size: 13px; line-height: 1.45; text-align: center; }
/* телефон боком: четыре компактные карточки в ряд, правила мелко */
@media (max-height: 560px) and (min-width: 600px) {
  .mg-menu { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .mg-pick { gap: 3px; padding: 6px; }
  .mg-pick img { width: 40px; height: 40px; }
  .mg-pick h3 { font-size: 13px; line-height: 1.1; }
  .mg-pick p { font-size: 10.5px; min-height: 0; line-height: 1.25; }
  .mg-pick small { font-size: 10.5px; }
  .mg-prizes { font-size: 11.5px; padding: 5px 8px; margin-bottom: 6px; }
  .mg-cover h3 { font-size: 20px !important; } .mg-cover .mg-stars { font-size: 28px !important; } .mg-cover p { font-size: 12px; }
}
/* Призы: пьедестал 2–1–3 с фото и особый приз за полянку */
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; gap: 10px; align-items: end; }
.prize { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 12px; border-radius: 16px; text-align: center; min-width: 0; }
.prize-place { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; }
.prize-place img { width: 26px; height: 26px; object-fit: contain; }
.prize.p1 .prize-place img { width: 34px; height: 34px; }
.prize-pics { display: flex; align-items: center; justify-content: center; gap: 6px; height: 128px; }
.prize-pics img { max-height: 128px; max-width: 100%; min-width: 0; object-fit: contain; border-radius: 8px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.prize-pics:has(i) img { max-width: 44%; }
.prize-pics i { font-style: normal; font-weight: 900; font-size: 12px; opacity: .85; }
.prize-pics img.gift { height: 70px; }
.prize.p1 .prize-pics { height: 150px; }
.prize.p2 { background: linear-gradient(rgba(230,240,255,.28), rgba(190,210,240,.14)); border: 2px solid #dbe7fb; }
.prize.p3 { background: linear-gradient(rgba(240,180,120,.3), rgba(200,120,60,.16)); border: 2px solid #f2c79b; }
.prize.p1 { padding-top: 14px; background: linear-gradient(#ffe68a, #f5b83d); border: 2px solid #fff3b8; color: #5a3500; box-shadow: 0 0 22px rgba(255,214,90,.6); }
.prize-title { font-size: 15px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.prize.p1 .prize-title { font-size: 24px; }
.prize-text { font-size: 12px; line-height: 1.3; opacity: .92; overflow-wrap: anywhere; }
/* монета USDT */
.usdt { width: 124px; height: 124px; margin: 13px 0; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #5fe0b6, #26a17b 55%, #157a5a); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 0 0 5px #fff6c9, 0 0 0 8px #e0a526, 0 8px 18px rgba(90,53,0,.35); }
.usdt span { font: 900 72px/1 Rubik, sans-serif; color: #fff; text-shadow: 0 3px 0 rgba(0,60,40,.35); }
/* особый приз */
.prize-special { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(100deg, rgba(255,255,255,.16), rgba(255,215,120,.18)); border: 2px dashed #ffd76a; }
.prize-special .prize-pics { height: 110px; flex: none; background: #fff; border-radius: 12px; padding: 4px 8px; }
.prize-special .prize-pics img { max-height: 102px; filter: none; }
.ps-tx { min-width: 0; }
.ps-h { font-size: 17px; font-weight: 900; }
.ps-prize { display: inline-block; margin: 4px 0; padding: 2px 10px; border-radius: 10px; background: #ffe27a; color: #5a3500; font-weight: 900; font-size: 13px; }
.prize-note { margin-top: 8px; text-align: center; font-size: 11.5px; opacity: .75; }
@media (max-width: 600px) {
  .podium { grid-template-columns: 1fr; }
  .prize.p1 { order: -1; }
  .prize-special { flex-direction: column; text-align: center; }
}
@media (max-height: 560px) and (min-width: 600px) {
  .prize-pics { height: 92px; } .prize-pics img { max-height: 92px; } .prize.p1 .prize-pics { height: 104px; }
  .usdt { width: 86px; height: 86px; margin: 9px 0; } .usdt span { font-size: 50px; }
  .prize.p1 .prize-title { font-size: 19px; }
  .prize-special .prize-pics { height: 84px; } .prize-special .prize-pics img { max-height: 76px; }
}
.prize .prize-pics img, .prize.p1 .prize-pics img, .prize-special .prize-pics img { width: auto; height: auto; }
.prize .prize-place img, .prize.p1 .prize-place img { height: 26px; width: 26px; } .prize.p1 .prize-place img { height: 34px; width: 34px; }
.prize .prize-pics img { max-height: 128px; } .prize.p1 .prize-pics img { max-height: 150px; }
@media (max-height: 560px) and (min-width: 600px) { .prize .prize-pics img { max-height: 92px; } }
/* два приза на выбор — веером внахлёст, «или» значком посередине */
.prize-pics:has(i) { position: relative; gap: 0; }
.prize .prize-pics:has(i) img { max-width: 64%; max-height: 118px; }
.prize-pics:has(i) img:first-child { transform: rotate(-7deg); margin-right: -14%; z-index: 1; }
.prize-pics:has(i) img:last-child { transform: rotate(6deg); margin-left: -14%; z-index: 2; }
.prize-pics:has(i) i { position: relative; z-index: 3; padding: 3px 7px; border-radius: 10px; background: #fff; color: #1b3473; font-size: 11px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
@media (max-height: 560px) and (min-width: 600px) { .prize .prize-pics:has(i) img { max-height: 86px; } }

/* ---- Телефон стоя, а браузер не поворачивается: страница развёрнута на 90° (rotate.js) ----
   Размеры body ставит rotate.js в пикселях; vh/vw здесь считаются по вертикальному экрану, поэтому
   высоту окон берём из --lh (высота повёрнутой страницы), ширину — из --lw. */
html.rot, html.rot body { overflow: hidden; }
html.rot body { position: fixed; top: 0; left: 0; transform-origin: 0 0; transform: rotate(90deg) translateY(-100%); }
html.rot .rotate { display: none !important; }
html.rot .modal { max-height: calc(var(--lh) - 40px) !important; }
html.rot .style-panel { max-height: calc(var(--lh) - 84px) !important; }
html.rot .mg canvas { max-height: calc(var(--lh) - 120px) !important; }
html.rot .visit-banner { max-width: calc(var(--lw) - 180px) !important; }
html.rot .yard-bar { max-width: calc(var(--lw) - 16px) !important; }
html.rot .login-card { width: min(760px, calc(var(--lw) - 24px)) !important; }
/* невысокий ноутбук (1366×650, 1280×620): шесть плиток справа (со звездопадом) не должны уходить под меню */
@media (min-height: 561px) and (max-height: 760px) {
  .side-col { gap: 3px; }
  .side-tile { width: 66px; }
  .side-tile img { width: 48px; height: 48px; }
  .side-tile i { font-size: 10px; }
}
/* маленький телефон боком (iPhone SE, 667×375): шапка ужимается, чтобы кнопки звука и «во весь экран» не уезжали за край */
@media (max-height: 560px) and (max-width: 720px) {
  .hud { gap: 4px; }
  .lvl .bar { width: 84px; }
  .lvl .bar span { font-size: 9px; }
  .hud-mid { gap: 4px !important; margin-right: 2px !important; }
  .hud .res { min-width: 0; padding-left: 26px; padding-right: 24px; }
  .hud .res b { font-size: 13px; min-width: 0; }
  .hud-right { gap: 3px; }
  .hud-right .round { width: 28px; height: 28px; }
}
@media (max-height: 560px) and (max-width: 700px) {
  .lvl .bar { width: 66px; }
  /* место под кнопку фото: музыка и «во весь экран» (на iPhone он всё равно не работает) прячутся */
  #musicBtn, #musicPanel, #fullBtn { display: none !important; }
}
/* пока открыт экран входа — без просьбы повернуть телефон: форму удобно заполнять стоя */
body:has(#login:not(.hidden)) .rotate { display: none !important; }

/* режим «Нарядить Ёлочку»: как расстановка украшений — панели прячем, внизу лента игрушек */
body.decorating #bottom, body.decorating #questCol, body.decorating #sideCol, body.decorating #feed, body.decorating #countdown { display: none !important; }
.decor-bar .yb-row { flex-wrap: nowrap; overflow-x: auto; max-width: min(900px, calc(100vw - 24px)); justify-content: flex-start; padding: 4px 2px; scrollbar-width: thin; }
.decor-bar .yb-it { flex: none; }
.decor-bar .yb-it.rar1 { box-shadow: 0 0 0 2px #6fb7ff inset; } .decor-bar .yb-it.rar2 { box-shadow: 0 0 0 2px #c27bff inset, 0 0 8px rgba(194,123,255,.6); }
.decor-bar .yb-it.on { border-color: #ffd23f; background: rgba(255,210,63,0.3); transform: translateY(-3px); }
.decor-bar .btn { flex: none; }

/* лента наряда: игрушки прокручиваются, «Готово» всегда видна справа */
.decor-bar .yb-row { overflow: visible; flex-wrap: nowrap; }
.decor-bar .dk-list { display: flex; gap: 6px; overflow-x: auto; min-width: 0; flex: 1; padding: 6px 2px 4px; scrollbar-width: thin; }
@media (max-height: 560px) {
  .decor-bar.yard-bar { left: 6px; right: 6px; transform: none; max-width: none; }
  .decor-bar .yb-hint { max-width: 190px; font-size: 10.5px; flex: none; }
  .decor-bar .yb-row { flex: 1; min-width: 0; max-width: none; }
}

/* отразить и размер украшения в режиме расстановки */
.yb-style { display: inline-flex; gap: 3px; padding: 2px 4px; border-radius: 12px; background: rgba(255,255,255,0.12); }
.yb-style .btn { padding: 5px 10px; min-width: 34px; font-weight: 900; }

/* Ярмарка: атмосфера двора */
.atm-card { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: linear-gradient(#eef4ff, #dde8ff); border: 2px solid #b8ccf5; }
.atm-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.atm-row > b { width: 132px; font-size: 13px; color: #3a4f85; }
.atm-opts { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.atm { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 12px; border: 2px solid #c9d7f2; background: #fff; font: 700 13px Rubik; color: var(--ink); cursor: pointer; }
.atm.on { border-color: #ffb02e; background: #fff4c2; box-shadow: 0 0 0 2px rgba(255,176,46,.3); }
.atm-ico { font-size: 16px; line-height: 1; }
.atm-dots { display: inline-flex; gap: 2px; } .atm-dots i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 4px rgba(0,0,0,.2); }
@media (max-height: 560px) { .atm-row > b { width: auto; } .atm { padding: 3px 8px; font-size: 12px; } }

/* фоторежим: прячем весь интерфейс, двор во весь экран */
body.photo #hud, body.photo #questCol, body.photo #sideCol, body.photo #bottom, body.photo #feed, body.photo #countdown, body.photo #toasts,
body.photo #visitBanner, body.photo #tutorial, body.photo #hangBar, body.photo #yardBar, body.photo #decorBar, body.photo #openChip { display: none !important; }
.photo-overlay { position: fixed; inset: 0; z-index: 60; cursor: pointer; }
.photo-overlay span { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 8px 16px; border-radius: 14px; background: rgba(10,20,60,.6); color: #fff;
  font: 700 14px Rubik, sans-serif; white-space: nowrap; animation: photoHint 4s forwards; pointer-events: none; }
@keyframes photoHint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#photoBtn svg { display: block; margin: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }

/* конкурс полянок: строка в карточке приза и список для голосования */
.ps-vote { margin-top: 6px; font-size: 13px; }
.ps-vote.open { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ps-vote.win { padding: 4px 10px; border-radius: 10px; background: rgba(255,226,122,.25); }
.vote-list { display: grid; gap: 6px; }
.vote-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #f3f8ff; border: 2px solid #dbe7fb; }
.vote-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-row.on { background: #fff4c2; border-color: #ffb02e; }

.sw.top[data-part=skirt] img { width: 54px; height: 34px; object-fit: contain; }
