/* Homestead — тёмная тема. Этот файл ЗАМЕНЯЕТ старый style.css целиком. */
:root {
  --bg: #0f1712;
  --surface: #17221b;
  --surface-2: #1f2d24;
  --surface-3: #2a3b30;
  --line: #2b3d32;
  --ink: #e9f1e5;
  --muted: #8fa38b;
  --green: #5fa467;
  --green-deep: #3d7a47;
  --green-bright: #8fd197;
  --gold-ink: #f0d595;
  --gold-soft: #2f2916;
  --gold-line: #4a3f20;
  --danger: #ef7b73;
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; font-weight: 850; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 23px; font-weight: 850; letter-spacing: -.045em; }
h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .14em; }

.app-shell { width: min(100% - 28px, 520px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 0 calc(100px + env(safe-area-inset-bottom)); }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 23px; }

/* Шапка */
.topbar { display: flex; align-items: center; gap: 11px; margin: 2px 1px 14px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 17px; background: var(--surface-3); font-size: 27px; }
.brand-copy { min-width: 0; }

/* Компактная строка HUD: уровень | энергия | баланс | опыт. Прилипает к верху экрана на всех страницах */
.energy-bar { position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 15; display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 7px 9px; border: 1px solid var(--gold-line); border-radius: 16px; background: #1b2218; box-shadow: 0 4px 14px #00000055; }
.hud-level { display: grid; place-items: center; flex: 0 0 32px; height: 32px; padding: 0; border: 1px solid var(--gold-line); border-radius: 10px; color: var(--gold-ink); background: var(--gold-soft); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hud-level:active { filter: brightness(1.15); }
/* Можно повысить уровень — значок мягко пульсирует */
.hud-level.can-level { color: #10200f; background: var(--green-bright); border-color: var(--green-bright); animation: level-pulse 1.6s ease-in-out infinite; }
@keyframes level-pulse { 0%, 100% { box-shadow: 0 0 0 0 #8fd19766; } 50% { box-shadow: 0 0 0 5px #8fd19700; } }
.energy-body { min-width: 62px; max-width: 120px; flex: 1 1 86px; }
.energy-label { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; color: var(--muted); font-size: 11px; line-height: 1; }
.energy-icon { display: inline-grid; place-items: center; font-size: 12px; line-height: 1; }
.energy-label b { color: var(--gold-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.energy-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.energy-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #d9a93a, #f6dc8e); transition: width .4s linear; }
.energy-bar.empty { border-color: #6b3a36; }
.energy-bar.empty .energy-fill { background: var(--danger); }
.hud-stats { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: auto; }
.hud-chip { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); font-size: 11px; font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-chip b { font-weight: 850; }
.hud-chip .pic { width: 1.2em; height: 1.2em; vertical-align: 0; }
.hud-coins b { color: var(--gold-ink); }
.hud-xp b { color: var(--green-bright); }

/* Hero */
.hero { position: relative; display: flex; min-height: 154px; overflow: hidden; margin-bottom: 13px; padding: 21px 18px; color: #f1f7ed; background: linear-gradient(119deg, #1b3526 0%, #2d5a3a 70%, #447a4b 100%); border: 0; }
.hero-copy { position: relative; z-index: 1; max-width: 66%; }
.hero .eyebrow { color: #bcd7b6; }
.hero h2 { margin-bottom: 8px; font-size: clamp(23px, 6vw, 30px); }
.hero .muted { max-width: 240px; margin-bottom: 0; color: #cfe2c9; font-size: 12px; line-height: 1.45; }
.hero-art { position: absolute; right: 0; bottom: 0; width: 38%; height: 100%; }
.sun { position: absolute; top: 15px; right: 21px; font-size: 28px; }
.barn { position: absolute; right: 10px; bottom: 8px; font-size: 69px; filter: drop-shadow(0 3px 0 #0a1a0f88); }
.sprout { position: absolute; right: 73px; bottom: 7px; font-size: 30px; }

/* Тулбар и подвкладки */
.farm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 13px; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.farm-toolbar > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.toolbar-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; background: var(--surface-3); font-size: 22px; }
.farm-toolbar b { display: block; font-size: 12px; }
.farm-toolbar small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.farm-toolbar button { flex: 0 0 auto; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--green-deep); color: #f3f8ef; font-size: 10px; font-weight: 850; cursor: pointer; }
.farm-subnav { display: flex; gap: 6px; padding: 4px; margin: 0 0 14px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.subnav-item { flex: 1; padding: 10px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; cursor: pointer; }
.subnav-item.active { background: var(--green-deep); color: #f3f8ef; }

/* Статы (теперь над подвкладками Посевы / Животные / Производство) */
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat-card { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 12px 9px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat-icon { flex: 0 0 auto; font-size: 21px; }
.stat-card p { margin: 0 0 3px; color: var(--muted); font-size: 10px; line-height: 1.2; }
.stat-card strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: clamp(14px, 3.8vw, 19px); font-weight: 850; font-variant-numeric: tabular-nums; }

/* Опыт и цель уровня (теперь на странице профиля) */
.level-section { margin: 0 0 16px; }
.level-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.xp-track, .growth-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.xp-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6fb06f, #8fd197); transition: width .25s ease; }
.level-goal { margin-top: 11px; }
.level-goal-card, .level-goal-complete { padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); color: var(--ink); }
.level-goal-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.level-goal-title > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.level-goal-title b { font-size: 12px; }
.level-goal-title span { color: var(--muted); font-size: 10px; }
.level-goal-title strong { flex: 0 0 auto; padding: 7px 9px; border-radius: 9px; color: var(--green-bright); background: var(--surface-3); font-size: 10px; }
.level-requirement { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 9px 10px; margin-top: 6px; border-radius: 10px; color: var(--gold-ink); background: var(--gold-soft); border: 1px solid var(--gold-line); font-size: 10px; }
.level-requirement b { text-align: right; white-space: nowrap; font-size: 10px; }
.level-requirement.requirement-met { color: var(--green-bright); background: #1b3324; border-color: #2f5a3a; }
.level-up-button { width: 100%; min-height: 40px; margin-top: 10px; padding: 9px 11px; border: 0; border-radius: 11px; color: #f3f8ef; background: var(--green-deep); font-size: 11px; font-weight: 850; cursor: pointer; }
.level-up-button:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }
.level-goal-card > small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.level-goal-complete { display: flex; flex-direction: column; gap: 4px; background: #1b3324; border-color: #2f5a3a; }
.level-goal-complete b { font-size: 12px; }
.level-goal-complete span { color: var(--muted); font-size: 10px; }

/* Заголовок секции */
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 0 2px 12px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.subtab-hidden { display: none; }
.plot-counter { padding: 7px 9px; border-radius: 10px; background: var(--surface-2); color: var(--green-bright); font-size: 11px; font-weight: 750; white-space: nowrap; }

/* Грядки */
.plots-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plot-card { min-width: 0; padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 0 #0a110c; color: var(--ink); }
.plot-topline { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 10px; }
.plot-number { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.plot-status { border-radius: 7px; padding: 4px 6px; font-size: 9px; font-weight: 800; }
.empty-status { background: var(--surface-3); color: var(--muted); }
.growing-status { background: var(--gold-soft); color: var(--gold-ink); }
.ready-status { background: #1f4128; color: var(--green-bright); }
.empty-field, .crop-art { position: relative; display: grid; place-items: center; height: 91px; overflow: hidden; margin-bottom: 10px; border-radius: 14px; }
.empty-field { border: 1px dashed #3d5546; background: repeating-linear-gradient(0deg, #1c2b21 0px, #1c2b21 17px, #18261d 18px, #18261d 20px); }
.empty-field span { position: absolute; top: 7px; right: 8px; color: var(--green); font-size: 22px; font-weight: 300; }
.empty-field i { font-size: 39px; font-style: normal; filter: drop-shadow(0 2px #0a110c); opacity: .55; }
.crop-art { background: linear-gradient(180deg, #25392b, #1b2a20); }
.crop-art span { position: relative; z-index: 1; font-size: 46px; filter: drop-shadow(0 3px 2px #00000055); }
.crop-art small { position: absolute; left: 50%; bottom: 6px; z-index: 2; transform: translateX(-50%); width: max-content; max-width: 90%; padding: 4px 7px; border-radius: 99px; color: var(--green-bright); background: #0f1712e6; border: 1px solid #35523f; font-size: 8px; line-height: 1; font-weight: 900; letter-spacing: .04em; }

/* Тап по всей карточке */
.plot-card.tappable { cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; border-color: #35523f; }
.plot-card.tappable:active { filter: brightness(1.12); transform: scale(.985); }
.plot-card.tap-pop .crop-art span { animation: tap-pop .22s ease-out; }
@keyframes tap-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }

.plot-note { min-height: 16px; margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.seed-options { display: grid; gap: 6px; }
.seed-option { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; column-gap: 6px; width: 100%; padding: 7px 8px; text-align: left; border: 1px solid #35493c; border-radius: 10px; color: var(--ink); background: var(--surface-2); cursor: pointer; }
.seed-option:active { background: var(--surface-3); transform: translateY(1px); }
.seed-option:disabled { opacity: .45; }
.seed-emoji { grid-row: span 2; font-size: 18px; }
.seed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 800; }
.seed-meta { color: var(--muted); font-size: 8px; }
.growth-track { height: 6px; margin: 12px 0 6px; }
.growth-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6fb06f, #8fd197); transition: width .3s linear; }
.growth-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.harvest-button, .buy-plot-button { width: 100%; margin-top: 11px; min-height: 39px; padding: 9px 6px; border: 0; border-radius: 11px; color: #f3f8ef; background: var(--green-deep); font-size: 11px; font-weight: 800; cursor: pointer; }
.harvest-button:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }

/* Закрытые участки */
.locked-plot { display: flex; min-height: 228px; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-style: dashed; border-color: #35493c; background: #121b15; box-shadow: none; }
.locked-art { display: grid; place-items: center; width: 63px; height: 63px; margin-bottom: 13px; border-radius: 20px; background: var(--surface-2); font-size: 31px; }
.locked-title { font-size: 15px; font-weight: 850; }
.locked-plot .plot-note { min-height: auto; margin: 6px 0 3px; }
.lock-caption { color: #6a7c66; font-size: 9px; }
.locked-plot .buy-plot-button { margin-top: 9px; }

/* Амбар */
.warehouse, .friends-panel { margin-top: 19px; padding: 17px 15px; }
.compact-heading { margin: 0 0 5px; align-items: center; }
.warehouse-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--gold-soft); font-size: 23px; }
.warehouse-subtitle { margin: 8px 0 13px; font-size: 11px; line-height: 1.4; }
.inventory-list { display: grid; gap: 8px; }
.inventory-empty { display: flex; align-items: center; gap: 11px; padding: 13px; border-radius: 14px; background: var(--surface-2); }
.inventory-empty > span { font-size: 28px; }
.inventory-empty b { font-size: 12px; }
.inventory-empty p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.inventory-item { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.inventory-crop { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; background: var(--surface-3); font-size: 22px; }
.inventory-details { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.inventory-details b { font-size: 12px; }
.inventory-details span { color: var(--muted); font-size: 9px; }
.sell-button { padding: 9px 12px; border: 1px solid var(--gold-line); border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); font-size: 10px; font-weight: 850; cursor: pointer; }
.sell-all-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--gold-line); border-radius: 13px; background: var(--gold-soft); }
.sell-all-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sell-all-row b { font-size: 12px; color: var(--gold-ink); }
.sell-all-row span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.sell-all-button { flex: 0 0 auto; padding: 10px 14px; border: 0; border-radius: 10px; background: #d9a93a; color: #2a2008; font-size: 11px; font-weight: 900; cursor: pointer; }
.sell-all-button:disabled { background: var(--surface-3); color: var(--muted); }

/* Совет */
.tip-card { display: flex; align-items: start; gap: 10px; margin-top: 13px; padding: 13px; border-radius: 16px; border: 1px solid var(--gold-line); background: var(--gold-soft); }
.tip-icon { font-size: 20px; }
.tip-card p { margin: 1px 0 0; color: var(--gold-ink); font-size: 11px; line-height: 1.45; }

/* Рейтинг */
.leaderboard-list { display: grid; gap: 7px; margin-top: 13px; }
.leader-row { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.leader-row.is-me { border-color: #3f7447; background: #1b3324; }
.leader-rank { width: 21px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 850; }
.leader-avatar { display: grid; place-items: center; flex: 0 0 33px; height: 33px; border-radius: 12px; color: var(--green-bright); background: var(--surface-3); font-weight: 900; }
.leader-name { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.leader-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.leader-name span { color: var(--muted); font-size: 9px; }
.leader-coins { white-space: nowrap; font-size: 10px; font-variant-numeric: tabular-nums; }

/* Вторичные страницы */
.content-page { padding: 17px 14px; margin-top: 8px; }
.page-heading { margin-bottom: 15px; }
.page-heading h2 { margin-bottom: 5px; }
.page-heading p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.upgrade-list { display: grid; gap: 10px; }
.upgrade-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); }
.upgrade-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--surface-3); font-size: 23px; }
.upgrade-copy b { display: block; font-size: 12px; }
.upgrade-copy p { margin: 4px 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.upgrade-copy small { color: var(--green-bright); font-size: 9px; }
.upgrade-card button { grid-column: 1 / -1; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: var(--green-deep); color: #f3f8ef; font-size: 11px; font-weight: 800; cursor: pointer; }
.upgrade-card button:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }
.profile-stats { display: grid; gap: 8px; }
.profile-stat { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 12px; }
.profile-stat span { color: var(--muted); }
.profile-stat b { color: var(--green-bright); text-align: right; }
.placeholder-page { padding: 25px 18px; margin-top: 10px; text-align: center; }
.placeholder-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 12px; border-radius: 22px; background: var(--surface-3); font-size: 34px; }
.placeholder-page h2 { margin-bottom: 8px; }
.placeholder-page p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* Нижняя навигация */
.bottom-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #121b15; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 5px 2px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; cursor: pointer; }
.bottom-nav-item span { font-size: 20px; line-height: 1; }
.bottom-nav-item small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 750; }
.bottom-nav-item.active { color: var(--green-bright); background: var(--surface-2); }

/* Сообщения и футер */
.message { min-height: 18px; margin: 15px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: center; }
.message.error { color: var(--danger); }
.loading-card { grid-column: 1 / -1; padding: 32px 15px; text-align: center; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); font-size: 12px; }
footer { padding: 18px 0 5px; text-align: center; color: var(--muted); font-size: 10px; }

@media (max-width: 360px) {
  .app-shell { width: min(100% - 20px, 520px); }
  .hero { padding: 17px 14px; }
  .hero-copy { max-width: 72%; }
  .barn { right: 3px; font-size: 57px; }
  .sprout { right: 57px; }
  .stat-card { align-items: flex-start; flex-direction: column; gap: 4px; }
  .plot-card { padding: 9px; }
  .farm-toolbar small { max-width: 170px; }
  .bottom-nav-item small { font-size: 9px; }
  .energy-bar { gap: 6px; padding: 6px 7px; }
  .hud-chip { padding: 5px 6px; font-size: 10px; }
  .hud-stats { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ===== Разделы грядок (категории) ===== */
.category-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -2px 14px; padding: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.category-tab.active { background: var(--green-deep); border-color: var(--green-deep); color: #f3f8ef; }
.category-tab.soon { opacity: .55; }
.crop-preview { margin-top: 8px; font-size: 15px; letter-spacing: 3px; }
.upgrade-copy .upgrade-effect { display: block; margin-top: 5px; color: var(--green-bright); font-size: 9px; }
.upgrade-card.upgrade-soon { opacity: .6; }

/* ===== Производство: подразделы, Мельница ===== */
.production-page { padding: 17px 14px; margin-top: 8px; }
.production-tabs { margin-top: 12px; }
.production-content { display: grid; gap: 10px; }
.building-card { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.building-card.owned { border-color: #35523f; }
.building-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--surface-3); font-size: 25px; }
.building-copy { min-width: 0; }
.building-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.building-title b { font-size: 14px; letter-spacing: -.02em; }
.building-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 7px; color: var(--green-bright); background: #1f4128; font-size: 9px; font-weight: 800; }
.building-copy p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.building-buy { grid-column: 1 / -1; width: 100%; min-height: 40px; padding: 10px; border: 0; border-radius: 11px; color: #2a2008; background: #d9a93a; font-size: 11px; font-weight: 900; cursor: pointer; }
.building-buy:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }
.recipe-list { grid-column: 1 / -1; display: grid; gap: 8px; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.recipe-info { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.recipe-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 11px; font-weight: 800; }
.recipe-flow i { color: var(--muted); font-style: normal; }
.recipe-flow .pic { width: 1.35em; height: 1.35em; vertical-align: -.3em; }
.recipe-have { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.recipe-buttons { display: flex; gap: 5px; }
.recipe-buttons button { padding: 9px 10px; border: 0; border-radius: 10px; color: #f3f8ef; background: var(--green-deep); font-size: 10px; font-weight: 850; cursor: pointer; white-space: nowrap; }
.recipe-buttons button.recipe-max { color: var(--gold-ink); background: var(--gold-soft); border: 1px solid var(--gold-line); }
.recipe-buttons button:disabled { color: var(--muted); background: var(--surface-3); border-color: transparent; opacity: 1; }

/* ===== Картинки вместо эмодзи (static/pic) ===== */
/* Размер картинки = размер шрифта контейнера (1em), поэтому вёрстка осталась прежней. */
.pic { display: inline-block; flex: none; width: 1em; height: 1em; object-fit: contain; vertical-align: -.14em; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.pic-coin { width: 1.25em; height: 1.25em; vertical-align: -.25em; }
.crop-preview .pic { width: 1.2em; height: 1.2em; }
.category-tab .pic { width: 1.25em; height: 1.25em; vertical-align: -.3em; }
.tip-card p .pic { width: 1.2em; height: 1.2em; vertical-align: -.25em; }
.level-requirement .pic, .level-goal-complete .pic { width: 1.3em; height: 1.3em; vertical-align: -.3em; }
/* ===== Стройка: клеточная карта фермы ===== */
.build-page { padding: 17px 14px; margin-top: 8px; }
.build-hint { min-height: 16px; margin: 8px 0 12px; font-size: 11px; line-height: 1.4; }
.build-stage { position: relative; }
.build-map { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 68vh; overflow: hidden; border: 1px solid #35523f; border-radius: 16px; background: #2f6a35; user-select: none; -webkit-user-select: none; touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
.build-map:active { cursor: grabbing; }
.build-map.placing { border-color: var(--green-bright); box-shadow: 0 0 0 2px #8fd19733; cursor: pointer; }
/* «Мир» 40×40 клеток: двигается и масштабируется через transform (см. app.js). Трава — плитка 1 клетка; без файла видна шахматка. */
.build-world { --cell: 48px; position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; background-color: #2f6a35; background-image: url("/static/pic/grass.png"), repeating-conic-gradient(#3a7a3f 0 25%, #336e38 0 50%); background-size: var(--cell) var(--cell), calc(var(--cell) * 2) calc(var(--cell) * 2); background-repeat: repeat; }
.build-item { position: absolute; z-index: 1; display: grid; place-items: center; border-radius: 9px; background: none; border: 0; box-shadow: none; overflow: visible; }
.build-art { display: grid; place-items: center; width: 100%; height: 100%; font-size: calc(var(--cell) * .55); line-height: 1; }
.build-art .pic { width: 100%; height: 100%; vertical-align: 0; filter: drop-shadow(0 2px 0 #00000040); }
.build-house { background: none; }
.build-num { position: absolute; left: 8px; bottom: 6px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; font-size: 12px; font-style: normal; font-weight: 900; }
.build-dot { position: absolute; top: 4px; left: 50%; margin-left: -6px; width: 12px; height: 12px; border: 2px solid #2a1810; border-radius: 50%; background: var(--gold-ink); }
.status-ready .build-art { filter: drop-shadow(0 0 5px #8fd197) drop-shadow(0 2px 0 #00000040); }
.status-ready .build-dot { background: var(--green-bright); animation: level-pulse 1.6s ease-in-out infinite; }
.build-item.selected { z-index: 2; outline: 2px dashed var(--green-bright); outline-offset: -2px; border-radius: 10px; background: #8fd19726; filter: brightness(1.15); }

.build-fab { position: absolute; right: 10px; bottom: 10px; z-index: 5; display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 2px solid var(--green-bright); border-radius: 50%; color: #f3f8ef; background: var(--green-deep); font-size: 26px; box-shadow: 0 4px 14px #000a; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.build-fab:active { filter: brightness(1.15); }
.build-fab.open { background: var(--surface-3); }
.build-fab::after { content: attr(data-count); position: absolute; top: -6px; right: -6px; display: none; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; color: #2a2008; background: #d9a93a; font-size: 11px; font-weight: 900; }
.build-fab:not([data-count=""])::after { display: grid; }

.build-tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); max-height: 300px; overflow-y: auto; }
.tray-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 10px 4px; border: 1px solid #35493c; border-radius: 12px; background: var(--surface); cursor: pointer; }
.tray-item:active { background: var(--surface-3); }
.tray-item b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.tray-item small { color: var(--muted); font-size: 9px; }
.tray-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); font-size: 22px; }
.tray-empty { grid-column: 1 / -1; margin: 0; padding: 6px; font-size: 11px; line-height: 1.45; text-align: center; }
.build-selection { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--gold-line); border-radius: 14px; background: var(--gold-soft); }
.sel-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sel-info > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sel-info b { font-size: 12px; color: var(--gold-ink); }
.sel-info small { color: var(--muted); font-size: 9px; line-height: 1.3; }
.sel-buttons { display: flex; flex: 0 0 auto; gap: 6px; }
.sel-buttons button { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-3); color: var(--ink); font-size: 10px; font-weight: 850; cursor: pointer; }
.sel-buttons .sel-remove { color: var(--danger); }
.build-legend { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 9px; }
.build-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.dot-ready { background: var(--green-bright); }
.dot-growing { background: var(--gold-ink); }

/* ===== Друзья ===== */
.friend-block { margin-top: 18px; }
.block-title { margin: 0 0 8px; font-size: 14px; font-weight: 850; letter-spacing: -.02em; }
.block-title .pic { width: 1.2em; height: 1.2em; vertical-align: -.25em; }
.friend-add { display: grid; gap: 10px; margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.my-id-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.my-id-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.my-id-row small, .friend-hint { color: var(--muted); font-size: 9px; line-height: 1.4; }
.my-id-row b { overflow: hidden; text-overflow: ellipsis; color: var(--gold-ink); font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.my-id-row button, .friend-form button { flex: 0 0 auto; padding: 10px 13px; border: 0; border-radius: 10px; color: #f3f8ef; background: var(--green-deep); font-size: 10px; font-weight: 850; cursor: pointer; }
.my-id-row button { color: var(--gold-ink); background: var(--gold-soft); border: 1px solid var(--gold-line); }
.friend-form { display: flex; gap: 8px; }
.friend-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #35493c; border-radius: 10px; color: var(--ink); background: var(--surface); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.friend-form input::placeholder { color: #6a7c66; }
.friend-form input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.eye-button { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; padding: 0; border: 1px solid #35523f; border-radius: 10px; background: var(--surface-3); font-size: 18px; cursor: pointer; }
.eye-button:active { filter: brightness(1.2); }
.request-buttons { display: flex; flex: 0 0 auto; gap: 5px; }
.request-buttons button { padding: 8px 9px; border: 0; border-radius: 9px; color: #f3f8ef; background: var(--green-deep); font-size: 9px; font-weight: 850; cursor: pointer; }
.request-buttons .req-decline { color: var(--muted); background: var(--surface-3); }
.request-wait { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.friend-view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.friend-view-head h2 { font-size: 20px; }
.back-button { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-2); font-size: 10px; font-weight: 850; cursor: pointer; }

/* ===== Достижения (профиль) ===== */
.achievements-block { margin-top: 18px; padding: 15px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; background: var(--surface-2); }
.achievements-block .block-title { margin-bottom: 6px; }
.achievements-soon { margin: 0; color: var(--muted); font-size: 12px; }

.friend-error { margin: 0; padding: 10px 12px; border: 1px solid #6b3a36; border-radius: 12px; color: var(--danger); background: #2a1a19; font-size: 11px; line-height: 1.45; }
/* ===== Часовой сундук ===== */
.chest-card { border-color: var(--gold-line); background: var(--gold-soft); }
.chest-card .toolbar-icon { background: #3d3418; }
.chest-card b { color: var(--gold-ink); }
.chest-card small.chest-win { color: var(--green-bright); font-weight: 800; font-size: 10px; }
.chest-card button { min-width: 78px; color: #2a2008; background: #d9a93a; font-variant-numeric: tabular-nums; }
.chest-card button:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }

/* ===== Продажа: ×1 / ×5 / Все ===== */
.sell-buttons { display: flex; flex: 0 0 auto; gap: 4px; }
.sell-buttons .sell-button { min-width: 34px; padding: 8px 7px; }
.sell-buttons .sell-button:disabled { color: var(--muted); background: var(--surface-3); border-color: transparent; opacity: 1; }
.sell-buttons .sell-max { color: #2a2008; background: #d9a93a; border-color: #d9a93a; }
.sell-buttons .sell-max:disabled { color: var(--muted); background: var(--surface-3); }


/* ===== Магазин и алмазы ===== */
.hud-dia b { color: #8fd8ff; }
.shop-balance { display: flex; align-items: center; gap: 5px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 850; color: #8fd8ff; font-variant-numeric: tabular-nums; }
#shop-list .block-title { margin-top: 16px; }
.shop-group { display: grid; gap: 8px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.shop-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; background: var(--surface-3); font-size: 22px; }
.shop-title { flex: 1; min-width: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.shop-buttons { display: flex; flex: 0 0 auto; gap: 6px; }
.shop-buttons button { display: inline-flex; align-items: center; gap: 4px; min-width: 62px; justify-content: center; padding: 9px 10px; border: 0; border-radius: 10px; font-size: 11px; font-weight: 900; cursor: pointer; }
.shop-buttons .shop-stars { color: #2a2008; background: #d9a93a; }
.shop-buttons .shop-dia { color: #06202e; background: #8fd8ff; }
.shop-buttons button:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }


/* ===== Уведомления (профиль) ===== */
.notify-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.notify-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notify-row b { font-size: 12px; }
.notify-row small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.notify-toggle { flex: 0 0 auto; min-width: 92px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface-3); font-size: 10px; font-weight: 850; cursor: pointer; }
.notify-toggle.on { color: #f3f8ef; background: var(--green-deep); border-color: var(--green-deep); }
.notify-toggle:disabled { opacity: .6; }

/* Узкие экраны: строка HUD (уровень, энергия и три валюты) должна помещаться */
@media (max-width: 380px) {
  .energy-body { min-width: 44px; flex-basis: 54px; }
  .hud-chip { padding: 5px 5px; gap: 3px; }
}

/* ===== Промокоды (низ магазина) ===== */
.promo-block { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.promo-block .friend-hint { display: block; margin-top: 8px; }
#promo-input { text-transform: uppercase; }
#promo-input::placeholder { text-transform: none; }

/* ===== Ускорение роста за алмазы ===== */
.skip-row { display: flex; gap: 6px; margin-top: 8px; }
.skip-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 7px 6px; border: 1px solid #2f5d78; border-radius: 10px; color: #8fd8ff; background: #14222b; font-size: 10px; font-weight: 850; white-space: nowrap; cursor: pointer; }
.skip-btn:active { filter: brightness(1.2); }
.skip-btn:disabled { color: var(--muted); background: var(--surface-3); border-color: transparent; opacity: 1; }
.skip-btn .pic { width: 1.2em; height: 1.2em; vertical-align: -.25em; }

/* ===== Календарь ежедневных наград ===== */
.daily-card { border-color: #2f5d78; background: #14222b; }
.daily-card .toolbar-icon { background: #1d3340; }
.daily-card b { color: #8fd8ff; }
.farm-toolbar.daily-card button { background: #2a7fa8; }
.farm-toolbar.daily-card button.pulse { animation: level-pulse 1.6s ease-in-out infinite; }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: #000000b8; }
.modal-card { width: min(100%, 420px); padding: 18px 14px 14px; border: 1px solid #2f5d78; border-radius: 22px; background: var(--surface); box-shadow: 0 10px 40px #000a; text-align: center; }
.modal-card h2 { margin-bottom: 6px; }
.daily-sub { margin: 0 0 14px; font-size: 11px; line-height: 1.45; }
.daily-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.daily-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); }
.daily-cell small { font-size: 8px; font-weight: 800; }
.daily-cell span { font-size: 18px; line-height: 1.1; }
.daily-cell b { color: #8fd8ff; font-size: 12px; font-variant-numeric: tabular-nums; }
.daily-cell.done { border-color: #2f5a3a; background: #1b3324; opacity: .7; }
.daily-cell .daily-check { position: absolute; top: 2px; right: 4px; color: var(--green-bright); font-size: 10px; font-style: normal; font-weight: 900; }
.daily-cell.today { border-color: #d9a93a; background: var(--gold-soft); color: var(--gold-ink); animation: level-pulse 1.6s ease-in-out infinite; }
.daily-claim { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 12px; color: #2a2008; background: #d9a93a; font-size: 13px; font-weight: 900; cursor: pointer; }
.daily-claim:disabled { color: var(--muted); background: var(--surface-3); opacity: 1; }
.daily-claim .pic { width: 1.2em; height: 1.2em; vertical-align: -.25em; }
.daily-close { width: 100%; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }

/* skip v2: кнопки ускорения столбиком, текст не выходит за рамки */
.skip-row { flex-direction: column; gap: 5px; }
.skip-btn { flex: 0 0 auto; width: 100%; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
