/* Fonte: 'NunitoLocal' só existe quando src/config/fonts.js aponta para um arquivo em assets/fonts/
   (carregado por src/ui/localFont.js, sem 404 quando não há arquivo). Depois vem a Nunito do Google
   (link no index.html) e, sem internet, a fonte do sistema. */
:root {
  --cream: #fff8ea;
  --cream-2: #fbefd6;
  --border: #e6cfa4;
  --ink: #4a3420;
  --ink-soft: #8a6a48;
  --green: #5cb338;
  --green-dark: #3d8a22;
  --orange: #f29a2e;
  --red: #e2564a;
  --blue: #3e9ad6;
  --shadow: 0 6px 18px rgba(60, 40, 10, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd3f0; font-family: 'NunitoLocal', 'Nunito', system-ui, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; touch-action: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 58%, rgba(20, 30, 10, 0.16) 100%); }
#ui-root { position: fixed; inset: 0; pointer-events: none; }
.ui { position: absolute; inset: 0; pointer-events: none; }
.ui button, .modal-backdrop, .info-card, .context-bar { pointer-events: auto; }
svg { display: block; width: 100%; height: 100%; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }

/* ---------- HUD ---------- */
.hud-top { position: absolute; top: calc(10px + var(--safe-top)); left: calc(10px + var(--safe-left)); right: calc(10px + var(--safe-right)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hud-left { display: flex; align-items: center; }
.level-badge { position: relative; width: 54px; height: 54px; z-index: 2; filter: drop-shadow(0 3px 4px rgba(60, 40, 10, 0.35)); }
.level-badge b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 900; color: #7a4a10; padding-top: 4px; }
.xp-box { margin-left: -14px; padding: 5px 12px 6px 20px; background: var(--cream); border: 2px solid var(--border); border-radius: 0 14px 14px 0; box-shadow: var(--shadow); min-width: 150px; }
.xp-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 800; }
.farm-name { color: var(--green-dark); }
.clock { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.xp-bar, .bar { position: relative; height: 14px; margin-top: 3px; background: #e9dcc0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 2px 3px rgba(0,0,0,0.12); }
.xp-fill, .bar-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ffd85a, #f2a52a); border-radius: 8px; transition: width .4s ease; }
.bar-fill { background: linear-gradient(#8fd462, #5cb338); }
.xp-text, .bar span { position: relative; display: block; text-align: center; font-size: 10px; font-weight: 900; line-height: 14px; color: #5a3a12; }
.hud-right { display: flex; align-items: center; gap: 8px; }
.coin-pill { display: flex; align-items: center; gap: 6px; padding: 4px 14px 4px 4px; background: var(--cream); border: 2px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
.coin-pill .coin-icon { width: 30px; height: 30px; }
.coin-pill.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.icon-btn { width: 40px; height: 40px; padding: 6px; border-radius: 12px; transition: transform .1s; }
.icon-btn.round { background: var(--cream); border: 2px solid var(--border); border-radius: 50%; box-shadow: var(--shadow); }
/* Toque nos botões: com Web Animations (src/ui/pressFx.js) o botão afunda e quica de volta;
   sem suporte, fica o afundar simples pelo :active. */
html:not(.press-fx) :is(.icon-btn, .tool, .side-btn, .btn, .chip):active { transform: scale(0.95); }

.side-menu { position: absolute; right: calc(10px + var(--safe-right)); top: calc(78px + var(--safe-top)); display: flex; flex-direction: column; gap: 10px; }
.side-btn { position: relative; width: 58px; height: 62px; padding: 6px 6px 0; background: var(--cream); border: 2px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; }
.side-btn svg { width: 34px; height: 34px; }
.side-btn span { font-size: 10.5px; font-weight: 900; margin-top: 1px; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font: 900 11px/20px 'NunitoLocal', Nunito, sans-serif; font-style: normal; text-align: center; border: 2px solid #fff; display: none; }
.badge.show { display: block; }

/* ---------- Base: ferramentas e barras ---------- */
.bottom { position: absolute; left: 0; right: 0; bottom: calc(8px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 8px; }
.toolbar { display: flex; gap: 4px; padding: 6px; background: rgba(255, 248, 234, 0.96); border: 2px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tool { width: 56px; flex: 0 0 auto; padding: 5px 2px 3px; border-radius: 15px; display: flex; flex-direction: column; align-items: center; transition: background .15s, transform .1s; }
.tool svg { width: 32px; height: 32px; }
.tool span { font-size: 10.5px; font-weight: 900; margin-top: 2px; color: var(--ink-soft); }
.tool.active { background: linear-gradient(#a6e07a, #6cc244); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), 0 2px 6px rgba(60,120,20,0.35); }
.tool.active span { color: #1f4a0e; }
.tool-hint { font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.55); text-align: center; min-height: 16px; }
.context-bar { display: flex; gap: 6px; padding: 6px; background: rgba(255, 248, 234, 0.96); border: 2px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.context-bar::-webkit-scrollbar, .toolbar::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; width: 76px; padding: 4px 4px 5px; border-radius: 13px; background: #fff; border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; }
.chip img { width: 40px; height: 40px; object-fit: contain; }
.chip-name { font-size: 10.5px; font-weight: 900; line-height: 1.1; text-align: center; }
.chip-sub { display: flex; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 800; color: var(--ink-soft); height: 15px; }
.chip-sub svg { width: 13px; height: 13px; }
.chip.active { border-color: var(--green); background: #effbe4; }
.chip.locked { opacity: 0.55; filter: grayscale(0.7); }
.build-bar { align-items: center; gap: 10px; }
.build-current { display: flex; align-items: center; gap: 8px; min-width: 0; }
.build-current img { width: 44px; height: 44px; }
.build-current b { display: block; font-size: 13px; }
.build-current small { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.build-actions { display: flex; align-items: center; gap: 6px; }
.btn.confirm { width: 48px; height: 44px; padding: 8px; }

.info-card { position: absolute; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--cream); border: 2px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); font-size: 13px; max-width: min(360px, 94vw); transition: opacity .2s, transform .2s; }
.info-card.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }
.info-card img { width: 42px; height: 42px; }
.info-card > div { flex: 1; min-width: 160px; }
.info-card b { display: block; font-size: 14px; }
.info-card small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.hidden { display: none !important; }
.info-card.hidden { display: flex !important; }

/* ---------- Avisos e textos flutuantes ---------- */
.toasts { position: absolute; top: calc(74px + var(--safe-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(420px, 70vw); }
.toast { padding: 8px 14px; background: rgba(74, 52, 32, 0.92); color: #fff; font-weight: 800; font-size: 13px; border-radius: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast.good { background: rgba(61, 138, 34, 0.94); }
.toast.bad { background: rgba(190, 64, 50, 0.94); }
.toast.tip { background: rgba(214, 120, 30, 0.95); max-width: 100%; }

/* Alerta no topo: o jogador tem animais e ainda não tem moinho. */
.hud-alert { position: absolute; top: calc(78px + var(--safe-top)); left: calc(10px + var(--safe-left)); display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border: 3px solid #5a3a1c; border-radius: 999px; background: linear-gradient(#ffd97a, #f2a93b); color: #4a2a10; font-family: inherit; font-weight: 900; font-size: 12.5px; line-height: 1; box-shadow: 0 3px 0 #5a3a1c, var(--shadow); cursor: pointer; animation: hudAlertPulse 2.4s ease-in-out infinite; }
.hud-alert.hidden { display: none; }
.hud-alert img { width: 22px; height: 22px; }
.hud-alert i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #d93a2b; color: #fff; font-style: normal; font-size: 12px; }
@keyframes hudAlertPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .hud-alert { animation: none; } }

/* Sem conta: aviso persistente no centro, no mesmo estilo do alerta de comida. */
.hud-alert.account-alert {
  left: 50%;
  right: auto;
  max-width: min(420px, calc(100vw - 24px));
  padding: 8px 14px;
  border-radius: 18px;
  line-height: 1.3;
  text-align: left;
  gap: 8px;
  animation: hudAccountPulse 2.4s ease-in-out infinite;
  background: linear-gradient(#fff3d0, #f6c86a);
}
.hud-alert.account-alert .account-alert-ico { font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 0 rgba(90, 50, 10, .25)); }
.hud-alert.account-alert .hud-alert-text { flex: 1; }
.hud-alert[data-feedalert]:not(.hidden) ~ .hud-alert.account-alert { top: calc(118px + var(--safe-top)); }
@keyframes hudAccountPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { .hud-alert.account-alert { animation: none; transform: translateX(-50%); } }

/* Aviso "Faminto!" dentro do painel do pasto. */
.hunger-box { margin: 0 0 10px; padding: 8px 10px; border-radius: 14px; background: #fff1e0; border: 2px solid #f0b46a; }
.hunger-box.short { background: #ffe6e0; border-color: #e2836f; }
.hunger-title { display: flex; align-items: baseline; gap: 8px; }
.hunger-title b { color: #c2412d; font-size: 16px; font-weight: 900; }
.hunger-title span { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.hunger-need { font-size: 12px; font-weight: 700; margin: 2px 0 6px; }
.hunger-box .btn-row { margin: 0; }
.float-layer { position: absolute; inset: 0; overflow: hidden; }
.float-screen { position: fixed; pointer-events: none; z-index: 40; }
.float-text { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 17px; color: #fff; white-space: nowrap; text-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 0 6px rgba(0,0,0,0.25); will-change: transform, opacity; pointer-events: none; }
.float-text.xp { color: #ffe36a; }
.float-text.coin { color: #ffd34a; }
.float-text.coin-loss { color: #ffb4a8; font-size: 15px; }
.float-text.item { color: #c9f59e; }
.float-text.water { color: #9fdcff; }

/* ---------- Janelas ---------- */
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 22, 10, 0.0); display: flex; align-items: center; justify-content: center; padding: 14px; transition: background .18s; }
.modal-backdrop.open { background: rgba(30, 22, 10, 0.45); }
.modal { width: min(560px, 100%); max-height: min(86vh, 720px); display: flex; flex-direction: column; background: var(--cream); border: 3px solid var(--border); border-radius: 24px; box-shadow: 0 20px 50px rgba(30, 20, 5, 0.45); transform: scale(0.92); opacity: 0; transition: transform .18s, opacity .18s; overflow: hidden; }
.modal-backdrop.open .modal { transform: none; opacity: 1; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px 16px; background: linear-gradient(#ffe9b8, #fbd98e); border-bottom: 2px solid var(--border); }
.modal-icon { width: 36px; height: 36px; }
.modal-title { flex: 1; margin: 0; font-size: 21px; font-weight: 900; }
.modal-tabs { display: flex; gap: 6px; padding: 10px 14px 0; }
.tab { padding: 7px 14px; border-radius: 12px 12px 0 0; font-weight: 900; font-size: 13px; background: var(--cream-2); color: var(--ink-soft); border: 2px solid var(--border); border-bottom: 0; }
.tab.active { background: #fff; color: var(--ink); }
.modal-body { padding: 12px 14px 16px; overflow-y: auto; background: #fff; margin: 0 10px 10px; border: 2px solid var(--border); border-radius: 0 14px 14px 14px; flex: 1; }
.modal-tabs[style*="none"] + .modal-body { border-radius: 14px; margin-top: 10px; }
.hint { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { position: relative; padding: 10px; border: 2px solid var(--border); border-radius: 16px; background: var(--cream); display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.card-img { position: relative; width: 74px; height: 74px; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.seed-tag { position: absolute; right: -4px; bottom: -2px; width: 28px; height: 28px; }
.lock-tag { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,248,234,0.6); border-radius: 12px; }
.lock-tag svg { width: 28px; height: 28px; }
.lock-tag b { font-size: 12px; }
.card.locked .card-img img { filter: grayscale(0.8) opacity(0.6); }
.card-title { font-weight: 900; font-size: 15px; }
.card-meta { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: center; }
.card-meta.strong { color: var(--ink); }
.mini-coin { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.btn-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 14px; min-height: 36px; border-radius: 12px; font-weight: 900; font-size: 13.5px; color: #fff; background: linear-gradient(#7ccd4e, var(--green)); box-shadow: inset 0 -3px 0 var(--green-dark), 0 2px 4px rgba(0,0,0,0.15); text-shadow: 0 1px 0 rgba(0,0,0,0.2); transition: transform .1s; }
.btn .mini-coin { width: 16px; height: 16px; }
.btn.small { padding: 6px 11px; min-height: 32px; font-size: 12.5px; }
.btn.big { width: 100%; padding: 12px; font-size: 15px; margin: 6px 0 10px; }
.btn.big svg { width: 24px; height: 24px; }
.btn.alt { background: linear-gradient(#ffd27a, var(--orange)); box-shadow: inset 0 -3px 0 #c06a10, 0 2px 4px rgba(0,0,0,0.15); }
.btn.danger { background: linear-gradient(#f2857a, var(--red)); box-shadow: inset 0 -3px 0 #a03024, 0 2px 4px rgba(0,0,0,0.15); }
.btn.disabled { filter: grayscale(1); opacity: 0.55; }
.card .btn { margin-top: 6px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 14px; background: var(--cream); }
.row-img { width: 46px; height: 46px; object-fit: contain; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 900; font-size: 14px; }
.row-title .qty { color: var(--green-dark); }
.row-meta { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mission .bar { margin: 6px 0 4px; }
.mission.complete { border-color: #9bd679; background: #f1fbe8; }
.empty { text-align: center; padding: 24px 10px; color: var(--ink-soft); font-weight: 800; }
.empty svg { width: 64px; height: 64px; margin: 0 auto 6px; opacity: 0.8; }
.land { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.land-icon { width: 80px; height: 80px; }
.land-info, .land-next { font-size: 14px; font-weight: 700; line-height: 1.6; width: 100%; }
.setting { padding: 12px 0; border-bottom: 2px dashed var(--border); }
.setting:last-of-type { border-bottom: 0; }
.setting-label { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 14px; margin-bottom: 8px; }
.setting-label svg { width: 22px; height: 22px; }
.setting-label small { font-weight: 700; color: var(--ink-soft); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.seg-btn { padding: 7px 12px; border-radius: 10px; border: 2px solid var(--border); background: var(--cream); font-weight: 900; font-size: 13px; }
.seg-btn.active { background: var(--green); border-color: var(--green-dark); color: #fff; }
.toggle { width: 56px; height: 30px; border-radius: 16px; background: #d8ccb4; position: relative; transition: background .2s; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.25); transition: left .2s; }
.toggle.on { background: var(--green); }
.toggle.on span { left: 29px; }
.version { text-align: center; font-size: 11px; color: var(--ink-soft); font-weight: 700; margin: 12px 0 0; }
.levelup { text-align: center; }
.levelup-star { position: relative; width: 110px; height: 110px; margin: 4px auto; animation: spin-in .6s ease; }
.levelup-star b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 900; color: #7a4a10; padding-top: 8px; }
@keyframes spin-in { from { transform: scale(0.2) rotate(-90deg); } to { transform: none; } }
.levelup p { font-weight: 800; }
.levelup h3 { margin: 10px 0 6px; font-size: 15px; }
.unlocks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.unlock { width: 92px; padding: 8px 4px; border: 2px solid var(--border); border-radius: 14px; background: var(--cream); font-size: 12px; font-weight: 800; }
.unlock img, .unlock svg { width: 48px; height: 48px; margin: 0 auto; display: block; }

/* ---------- Tela de abertura (key art / pôster) ----------
   Fundo: quadro renderizado da própria fazenda 3D ao pôr do sol (não desenho vetorial). Logo com
   "COLHEITA" creme/dourado (trigo maduro) e "VERDE" em verde-folha, contorno marrom-escuro e luz quente.
   Barra de terra com preenchimento dourado e broto verde. Sem roxo nem rosa. */
#loader {
  --k-ink: #2a1a0c; --k-warm: 255, 196, 92;
  position: fixed; inset: 0; overflow: hidden; z-index: 10;
  background: linear-gradient(180deg, #1f3550 0%, #34506e 9%, #a8603a 24%, #c8682e 36%, #e0802f 52%, #f2a43a 68%, #ffc85a 84%, #ffe08a 100%);
  transition: opacity .55s ease, visibility .55s;
  animation: loader-fade .6s ease both;
}
@keyframes loader-fade { from { opacity: 0; } }
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.kv { position: absolute; inset: 0; pointer-events: none; }
/* Fundo: quadro renderizado da fazenda 3D ao pôr do sol (KeyArt.js). O degradê do #loader fica
   por trás enquanto a imagem baixa. Por cima, um tratamento de cor de "hora dourada" e sombras
   suaves no alto (logo) e embaixo (barra) para a leitura. */
.kv-photo { position: absolute; inset: 0; background: url('../assets/loader-farm-portrait.webp') center 62% / cover no-repeat;
  animation: kv-photo 18s ease-in-out infinite alternate; transform-origin: 50% 70%; }
@media (orientation: landscape) { .kv-photo { background-image: url('../assets/loader-farm-landscape.webp'); background-position: center 55%; } }
@keyframes kv-photo { from { transform: scale(1.02); } to { transform: scale(1.08) translateY(-1%); } } /* zoom lento, como câmera de trailer */
.kv-grade { position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 30%, rgba(255, 196, 92, .28), transparent 70%),
    linear-gradient(180deg, rgba(20, 30, 50, .35) 0%, transparent 28%, transparent 62%, rgba(42, 22, 8, .55) 86%, rgba(30, 16, 6, .85) 100%),
    linear-gradient(180deg, rgba(255, 150, 60, .16), rgba(255, 120, 40, .22));
  mix-blend-mode: normal; }
.kv-grade::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(30, 14, 4, .55)); } /* vinheta */

/* logo: contorno marrom-escuro, sombra sólida embaixo e uma luz quente de sol em volta */
.kv-logo { position: absolute; left: 0; right: 0; top: 17vh; text-align: center; animation: kv-in .9s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes kv-in { from { opacity: 0; transform: translateY(-24px) scale(.92); } }
.kv-logo h1 { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: .9;
  font-family: 'Lilita One', 'Nunito', system-ui, sans-serif; font-weight: 900; text-transform: uppercase; letter-spacing: 2px;
  filter: drop-shadow(0 5px 0 #2a1608) drop-shadow(0 0 14px rgba(var(--k-warm), .55)); animation: kv-glow 4s ease-in-out infinite; }
.kv-logo h1 span { display: block; color: transparent; -webkit-text-stroke: 5px #2a1608; paint-order: stroke fill; background-clip: text; -webkit-background-clip: text; }
.kv-l1 { font-size: clamp(40px, 13vw, 84px); background-image: linear-gradient(180deg, #fffbe8 0%, #ffecb0 40%, #ffd04a 100%); } /* trigo maduro */
.kv-l2 { font-size: clamp(50px, 17vw, 112px); margin-top: -2px; background-image: linear-gradient(180deg, #b8f070 0%, #5cc02c 45%, #2f8a1a 100%); } /* verde-folha */
@keyframes kv-glow { 50% { filter: drop-shadow(0 5px 0 #2a1608) drop-shadow(0 0 20px rgba(var(--k-warm), .75)); } }
.kv-tag { margin: 10px 0 0; color: #fff2cc; font-weight: 900; font-size: 13px; letter-spacing: .5em; text-transform: uppercase; text-shadow: 0 2px 0 #2a1608, 0 0 10px rgba(var(--k-warm), .6); }

/* barra embaixo: terra escura, preenchimento dourado com broto verde e um brilho de sol passando */
#loader .loader-card { position: absolute; left: 50%; bottom: calc(5vh + env(safe-area-inset-bottom, 0px)); width: min(420px, 84vw); transform: translateX(-50%); text-align: center; }
.loader-bar { position: relative; height: 24px; border-radius: 999px; padding: 3px; overflow: hidden;
  background: linear-gradient(180deg, #2a1709, #3b2412 50%, #2f1b0c); border: 3px solid #2a1608;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .6), 0 0 12px rgba(var(--k-warm), .45); }
#loader-fill { position: relative; height: 100%; width: 0; border-radius: 999px; transition: width .3s ease;
  background: linear-gradient(180deg, #ffe98a, #ffc83a 50%, #e8971e);
  box-shadow: inset 0 -2px 0 #4aa524, inset 0 2px 0 rgba(255, 250, 210, .7); } /* filete verde embaixo = detalhe de folha */
#loader-fill::after { content: ''; position: absolute; right: -3px; top: -1px; width: 14px; height: 14px; border-radius: 0 100% 0 100%;
  background: linear-gradient(135deg, #9be35a, #3f9a22); box-shadow: 0 0 0 1.5px #2a1608; transform: rotate(-20deg); } /* broto na ponta */
.loader-bar::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 244, 200, .55), transparent); animation: kv-shine 2s ease-in-out infinite; }
@keyframes kv-shine { to { left: 110%; } }
#loader-text { margin: 10px 0 0; font-weight: 900; font-size: 13px; letter-spacing: .06em; color: #fff2cc; min-height: 1.3em; text-shadow: 0 2px 0 #2a1608, 0 0 8px rgba(0, 0, 0, .45); }
#loader .loader-conflict { color: #fff2cc; text-shadow: 0 1px 0 var(--k-ink); background: rgba(42, 22, 8, .7); border-radius: 14px; padding: 10px; }
#loader .loader-conflict .btn { background: linear-gradient(#ffa95a, #f28c38 55%, #d8701e); color: #fff6e0; border: 3px solid #2a1608; box-shadow: 0 4px 0 #5a2e10, 0 0 10px rgba(var(--k-warm), .5); }
#loader .loader-conflict .btn.alt { background: linear-gradient(#a4733e, #7a4a22); color: #ffe2a8; }
@media (orientation: landscape) and (max-height: 560px) {
  .kv-logo { top: 6vh; } .kv-l1 { font-size: 40px; } .kv-l2 { font-size: 52px; } .kv-tag { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #loader, .kv-photo, .kv-logo, .kv-logo h1, .loader-bar::after { animation: none; }
}
.loader-error { white-space: pre-wrap; text-align: left; font-size: 12px; background: #fff0ee; color: #8a2a1f; padding: 10px; border-radius: 10px; margin-top: 10px; user-select: text; }

/* ---------- Telas pequenas ---------- */
@media (max-width: 520px) {
  .tool { width: 47px; }
  .tool svg { width: 28px; height: 28px; }
  .tool span { font-size: 9.5px; }
  .xp-box { min-width: 120px; }
  .farm-name { display: none; }
  .side-btn { width: 52px; height: 56px; }
  .side-btn svg { width: 30px; height: 30px; }
  .coin-pill { font-size: 15px; }
  .chip { width: 68px; }
  .toasts { top: calc(124px + var(--safe-top)); width: 76vw; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .build-current small { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .side-menu { top: calc(70px + var(--safe-top)); gap: 6px; }
  .side-btn { height: 52px; }
}

/* ---------- Expansão: animais, instalações, moinho ---------- */
.modal-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.modal-tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; }
.section-title { margin: 16px 0 8px; font-size: 15px; font-weight: 900; }
.cost-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; justify-content: inherit; }
.cost { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; background: #f1fbe8; border: 1.5px solid #bfe3a6; font-size: 12px; font-weight: 800; }
.cost img { width: 18px; height: 18px; }
.cost small { color: var(--ink-soft); font-weight: 700; margin-left: 2px; }
.cost.missing { background: #fff0ee; border-color: #f2b3aa; color: #a03024; }
.row.facility.locked { opacity: 0.65; }
.row.facility .row-meta svg { width: 14px; height: 14px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 9px; background: #eef3fa; color: #3a5a80; font-size: 11.5px; font-weight: 900; }
.tag.good { background: #e4f6d6; color: #2f7a18; }
.tag.bad { background: #ffe6e0; color: #b03a2a; }
.pen-head { display: flex; gap: 12px; align-items: center; font-weight: 700; font-size: 13.5px; }
.pen-head img { width: 84px; height: 84px; flex: 0 0 auto; }
.pen-head p { margin: 0 0 4px; }
.pen-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.pen-stats > div { background: var(--cream); border: 2px solid var(--border); border-radius: 12px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.pen-stats b { font-size: 17px; font-weight: 900; }
.pen-stats small { font-size: 10.5px; font-weight: 800; color: var(--ink-soft); line-height: 1.1; }
.pen-stats img { width: 24px; height: 24px; }
.btn-row.wide { justify-content: stretch; margin-bottom: 8px; }
.btn-row.wide .btn { flex: 1 1 auto; }
.upgrade { margin-top: 12px; padding: 10px; border: 2px dashed var(--border); border-radius: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.upgrade b { display: block; font-size: 14px; }
.upgrade small { font-weight: 700; color: var(--ink-soft); }
.recipe-flow { display: flex; align-items: center; gap: 4px; }
.ri { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.ri img { width: 40px; height: 40px; }
.ri b { font-size: 11px; font-weight: 900; margin-top: -4px; }
.arrow { font-weight: 900; color: var(--green-dark); font-size: 18px; }
@media (max-width: 520px) {
  .pen-stats { grid-template-columns: repeat(2, 1fr); }
  .recipe-flow .ri img { width: 32px; height: 32px; }
}

/* ---------- Livro de missões ---------- */
.modal.book { border-color: #b9783e; background: #f6e3bd; }
.modal.book .modal-head { background: linear-gradient(#c98a4a, #a86a32); border-bottom-color: #8a5226; }
.modal.book .modal-title { color: #fff8e6; text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.modal.book .modal-body { background: #fffaf0; border-color: #e3c28e; box-shadow: inset 8px 0 0 #f3e2c2; }
.modal.book .tab { background: #ecd4a6; border-color: #d9b57e; }
.modal.book .tab.active { background: #fffaf0; }
.book-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 800; font-size: 13px; }
.book-head .bar { flex: 1; margin: 0; }
.book-line { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-weight: 900; font-size: 14px; color: #8a5226; border-bottom: 2px dashed #e3c28e; padding-bottom: 4px; }
.book-line-icon { width: 22px; height: 22px; }
.mcard { display: flex; gap: 10px; align-items: flex-start; padding: 10px; margin-bottom: 8px; border: 2px solid #ead1a2; border-radius: 16px; background: #fff; }
.mcard.ready { border-color: #7ccd4e; background: #f2fce8; box-shadow: 0 0 0 3px rgba(124, 205, 78, 0.25); }
.mcard.done { opacity: 0.8; }
.mcard-icon { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; background: #fff3d9; border-radius: 14px; padding: 4px; }
.mcard-icon img { width: 100%; height: 100%; object-fit: contain; }
.mcard-main { flex: 1; min-width: 0; }
.mcard-title { font-weight: 900; font-size: 14.5px; }
.classic-tag { display: inline-block; margin: 2px 0; padding: 1px 7px; border-radius: 8px; background: #ffe9b8; color: #8a5226; font-size: 10.5px; font-weight: 800; }
.mcard-desc { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 2px 0 4px; }
.goal { font-size: 12px; font-weight: 800; margin: 4px 0; }
.goal .bar { margin-top: 2px; height: 12px; }
.goal .bar span { line-height: 12px; }
.mcard-action { flex: 0 0 auto; display: flex; align-items: center; align-self: center; }
.mcard-action .tag svg, .tag svg { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; }
.btn.claim { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
.rchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rchips.center { justify-content: center; }
.rchip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 3px; border-radius: 12px; background: #fff7e0; border: 1.5px solid #f1d58f; font-size: 11.5px; font-weight: 800; }
.rchip svg, .rchip img { width: 18px; height: 18px; object-fit: contain; }
.rchip.xp { background: #fff3c4; }
.rchip.note { background: #eef3fa; border-color: #c8d8ee; }
.rchips.big .rchip { font-size: 13px; padding: 4px 10px 4px 4px; }
.rchips.big .rchip svg, .rchips.big .rchip img { width: 26px; height: 26px; }
.row-svg { width: 40px; height: 40px; flex: 0 0 auto; }
.gate { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 10px; border-radius: 14px; background: #fff0ee; border: 2px solid #f2b3aa; }
.gate svg { width: 30px; height: 30px; flex: 0 0 auto; }
.gate div { flex: 1; }
.gate b { display: block; }
.gate small { font-weight: 700; color: var(--ink-soft); }
.tool-img { display: grid; place-items: center; }
.tool-img svg { width: 60px; height: 60px; }
.chip.free { border-color: #f2c94a; background: #fff8dc; }

/* ---------- Lote bloqueado ---------- */
.lot-preview { display: flex; justify-content: center; margin-bottom: 8px; }
.lot-grid { display: grid; grid-template-columns: repeat(8, 26px); gap: 3px; padding: 6px; background: #7cc04a; border-radius: 10px; }
.lot-grid i { width: 26px; height: 26px; border-radius: 5px; background: #a8e47e; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18); }
.lot-grid i.open { background: #b97a43; }
.lot-grid i.me { background: #ffd34a; box-shadow: 0 0 0 2px #fff; animation: pulse 1.1s infinite; }
.reqs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.req { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff0ee; border: 2px solid #f2b3aa; font-weight: 800; font-size: 13px; }
.req.ok { background: #effbe4; border-color: #bfe3a6; }
.req svg { width: 20px; height: 20px; flex: 0 0 auto; }
.req.ok svg path { stroke: #3d8a22; }
.req small { color: var(--ink-soft); }

/* ---------- Criação ---------- */
.breed { display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-bottom: 8px; border-radius: 14px; background: #fff7e0; border: 2px solid #f1d58f; }
.breed-lvl { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(#ffe36a, #f2a52a); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 auto; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15); }
.breed-lvl b { font-size: 20px; font-weight: 900; line-height: 1; color: #7a4a10; }
.breed-lvl small { font-size: 9px; font-weight: 900; color: #7a4a10; }
.breed-main { flex: 1; min-width: 0; }
.breed-main small { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }

/* ---------- Comemoração ---------- */
.celebrate { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(30, 20, 5, 0); transition: background .25s; pointer-events: auto; overflow: hidden; z-index: 5; }
.celebrate.show { background: rgba(30, 20, 5, 0.55); }
.rays { position: absolute; width: 900px; height: 900px; left: 50%; top: 50%; margin: -450px 0 0 -450px; background: repeating-conic-gradient(rgba(255, 230, 120, 0.28) 0 10deg, transparent 10deg 20deg); border-radius: 50%; mask-image: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); animation: spin 14s linear infinite; opacity: 0; transition: opacity .3s; }
.celebrate.show .rays { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.celebrate-card { position: relative; width: min(340px, 88vw); padding: 18px 16px 8px; text-align: center; background: var(--cream); border: 3px solid #f1d58f; border-radius: 24px; box-shadow: 0 20px 50px rgba(30, 20, 5, 0.5); transform: scale(0.6); opacity: 0; transition: transform .35s cubic-bezier(.2, 1.6, .4, 1), opacity .2s; }
.celebrate.show .celebrate-card { transform: none; opacity: 1; }
.celebrate-icon { width: 90px; height: 90px; margin: -60px auto 4px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25)); animation: bob 1.6s ease-in-out infinite; }
.celebrate-icon img { width: 100%; height: 100%; object-fit: contain; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.celebrate-card h2 { margin: 0; font-size: 22px; font-weight: 900; color: #3d8a22; }
.celebrate-card p { margin: 4px 0 8px; font-weight: 800; }
.celebrate-card .rchips { justify-content: center; }
.confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.fly-coin { position: fixed; width: 30px; height: 30px; z-index: 20; pointer-events: none; animation: fly 0.8s cubic-bezier(.5, 0, .9, .6) forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) scale(0.6); opacity: 0.2; } }

.mixed-icons { display: flex; gap: 4px; justify-content: center; width: 100%; }
.mixed-icons img { width: 64px; height: 64px; }
.btn-img { width: 22px; height: 22px; margin-right: 2px; }

/* ---------- Ferramenta no ponto tocado ---------- */
.tool-fx { position: fixed; width: 58px; height: 58px; margin: -54px 0 0 -10px; pointer-events: none; z-index: 8; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.35)); transform-origin: 20% 90%; animation: fx-pop .85s ease-out forwards; }
.tool-fx.fx-hand { margin: -6px 0 0 -6px; transform-origin: 10% 10%; animation: fx-tap .7s ease-out forwards; }
.tool-fx.fx-water { animation: fx-pour .85s ease-in-out forwards; }
.tool-fx.fx-plow, .tool-fx.fx-harvest, .tool-fx.fx-remove { animation: fx-dig .8s ease-in-out forwards; }
.tool-fx.fx-spray { animation: fx-spray .8s ease-in-out forwards; }
.tool-fx.fx-plant { animation: fx-drop .8s ease-out forwards; }
@keyframes fx-pop { 0% { transform: scale(0.4); opacity: 0; } 20% { transform: scale(1.1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
@keyframes fx-tap { 0% { transform: scale(1.3); opacity: 0; } 20% { transform: scale(0.85); opacity: 1; } 45% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-pour { 0% { transform: rotate(0) scale(0.6); opacity: 0; } 20% { transform: rotate(0) scale(1); opacity: 1; } 45%, 80% { transform: rotate(-38deg); opacity: 1; } 100% { transform: rotate(-10deg); opacity: 0; } }
@keyframes fx-dig { 0% { transform: rotate(25deg) scale(0.6); opacity: 0; } 20% { transform: rotate(25deg); opacity: 1; } 40% { transform: rotate(-25deg); } 60% { transform: rotate(20deg); } 80% { transform: rotate(-15deg); opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-spray { 0% { transform: scale(0.6); opacity: 0; } 20% { transform: scale(1) translateX(0); opacity: 1; } 35% { transform: translateX(-3px) rotate(-6deg); } 50% { transform: translateX(3px) rotate(6deg); } 65% { transform: translateX(-3px) rotate(-6deg); } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-drop { 0% { transform: translateY(-20px) scale(0.6); opacity: 0; } 30% { transform: translateY(0) scale(1); opacity: 1; } 50% { transform: translateY(-6px); } 70% { transform: translateY(0); opacity: 1; } 100% { opacity: 0; } }

/* ---------- Cards e ícones mais caprichados ---------- */
.card { background: linear-gradient(#fffdf6, #fff3dc); box-shadow: 0 3px 0 #ead3a6, 0 4px 10px rgba(120, 80, 20, 0.12); transition: transform .12s; }
.card:active { transform: translateY(2px); }
.card-img { width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 50% 42%, #ffffff 0, #e8f9d6 48%, #bfe89a 70%, rgba(191, 232, 154, 0) 72%); }
.card-img img { filter: drop-shadow(0 4px 3px rgba(60, 40, 10, 0.28)); }
.card-title { color: #6b3f12; }
.chip img { width: 46px; height: 46px; filter: drop-shadow(0 2px 2px rgba(60, 40, 10, 0.25)); }
.row-img { filter: drop-shadow(0 2px 2px rgba(60, 40, 10, 0.25)); }
.mcard-icon img, .unlock img { filter: drop-shadow(0 3px 2px rgba(60, 40, 10, 0.25)); }
@media (max-width: 520px) { .tool { width: 43px; } .tool svg { width: 26px; height: 26px; } .tool span { font-size: 9px; } }

/* Loja: próximas espécies */
.soon-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.soon-chip { padding: 5px 10px; border-radius: 999px; background: #fff3dc; border: 2px dashed #e2c48c; color: #8a6a3a; font-size: 12px; font-weight: 800; }

/* Etiqueta do modo de teste */
.dev-tag { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: #ff7a2e; color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .5px; vertical-align: middle; }

/* Tela cheia com o celular deitado: interface mais enxuta para sobrar espaço para a fazenda */
@media (orientation: landscape) and (max-height: 520px) {
  .is-fullscreen .side-btn span { display: none; }
  .is-fullscreen .side-btn { height: 44px; }
}

/* Loja de temas */
.theme-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.theme-card.active { border-color: #5bb83a; box-shadow: 0 0 0 3px #bfeaa0, 0 3px 0 #ead3a6; }
.theme-img { position: relative; width: 100%; aspect-ratio: 11 / 7; border-radius: 12px; overflow: hidden; margin-bottom: 4px; }
.theme-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.theme-tag { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 8px; background: rgba(47, 138, 34, .9); color: #fff; font-size: 11px; font-weight: 900; }
.theme-tag.free { background: rgba(58, 154, 208, .92); }
.restore-row { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px 0 6px; text-align: center; }
.restore-row small { color: #8a6a3a; font-size: 12px; }

/* Controle de horário (desenvolvimento) */
.dev-clock { position: absolute; left: calc(10px + var(--safe-left)); top: calc(78px + var(--safe-top)); width: min(300px, calc(100vw - 100px)); padding: 10px 12px 12px; border-radius: 16px; background: rgba(255, 251, 238, .96); border: 2px solid #e2c48c; box-shadow: 0 4px 14px rgba(90, 60, 10, .25); pointer-events: auto; font-weight: 800; color: #5a3a14; z-index: 5; }
.dev-clock.hidden { display: none; }
.dc-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.dc-head b { display: flex; align-items: center; gap: 6px; }
.dc-head svg { width: 20px; height: 20px; }
.dc-x { border: 0; background: none; font-size: 16px; color: #8a6a3a; padding: 2px 6px; }
.dc-time { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.dc-hm { font-size: 30px; font-weight: 900; color: #3a2a10; }
.dc-period { font-size: 12px; color: #8a6a3a; }
.dc-range { width: 100%; accent-color: #5bb83a; margin: 4px 0 8px; }
.dc-row, .dc-presets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.dc-row button, .dc-presets button { flex: 1 1 auto; padding: 6px 8px; border-radius: 10px; border: 2px solid #e2c48c; background: #fff3dc; color: #5a3a14; font: inherit; font-size: 12px; }
.dc-presets button { background: #eefbe4; border-color: #bfe3a6; }
.dc-pause { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin: 2px 0 8px; pointer-events: auto; }
.dc-pause input { width: 18px; height: 18px; accent-color: #5bb83a; }
.dc-auto { width: 100%; padding: 8px; border-radius: 12px; border: 0; background: #5bb83a; color: #fff; font: inherit; font-size: 13px; box-shadow: 0 3px 0 #3d8a22; }

/* Abas das janelas: nunca são espremidas pelo conteúdo e quebram em mais de uma linha,
   assim todas as opções ficam visíveis sem precisar arrastar para o lado. */
.modal-tabs { flex: 0 0 auto; flex-wrap: wrap; overflow: visible; gap: 6px; padding: 10px 12px 8px; }
.tab { flex: 0 0 auto; min-height: 36px; border-radius: 12px; border-bottom: 2px solid var(--border); }
.tab.active { background: #5bb83a; border-color: #3d8a22; color: #fff; }
.modal.book .tab.active { background: #8a5a2a; border-color: #6a4218; color: #fff; }
.modal-body { min-height: 0; border-radius: 14px; }

/* Mercado: quadro de pedidos */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.order { background: #fffaf0; border: 2px solid #ead3a6; border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 3px 0 #ead3a6; }
.order.ready { border-color: #7ad64a; box-shadow: 0 3px 0 #5bb83a; background: #f4ffe9; }
.order.empty { align-items: center; justify-content: center; min-height: 110px; border-style: dashed; box-shadow: none; background: #fffdf7; }
.order-wait { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #8a6a3a; font-weight: 800; font-size: 13px; text-align: center; }
.order-wait svg { width: 30px; height: 30px; opacity: .8; }
.order-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.order-head .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.order-head .urgent { margin-left: auto; display: flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; background: #ffe2d6; color: #b8401f; font-size: 12px; font-weight: 900; }
.order-head .urgent svg { width: 14px; height: 14px; }
.oitems { display: flex; flex-direction: column; gap: 4px; }
.oitem { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 10px; background: #fff; border: 1.5px solid #f0dfbd; font-size: 13px; }
.oitem img { width: 28px; height: 28px; }
.oitem .oname { flex: 1; font-weight: 800; color: #5a3a14; }
.oitem b { color: #c0392b; }
.oitem.ok b { color: #2f8a22; }
.order-actions { display: flex; gap: 6px; align-items: center; }
.order-actions .btn:first-child { flex: 1; }
.sell-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1.5px solid #f3e4c6; }
.sell-row img { width: 36px; height: 36px; }
.sell-main { flex: 1; display: flex; flex-direction: column; }
.sell-main small { color: #8a6a3a; display: flex; align-items: center; gap: 3px; }
.sell-main small svg { width: 14px; height: 14px; }
.mcard.bonus { background: #fff6d8; }

/* Menu lateral com mais botões: mais compacto em telas baixas (celular deitado) */
@media (max-height: 560px) {
  .side-menu { gap: 5px; top: calc(64px + var(--safe-top)); }
  .side-btn { width: 50px; height: 46px; padding-top: 3px; }
  .side-btn svg { width: 26px; height: 26px; }
  .side-btn span { font-size: 9px; }
}

.map-tag { align-self: center; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 900; background: #f1ead8; color: #8a6a3a; }
.map-tag.on { background: #dff5d2; color: #2f8a22; }

/* Diamantes, produção, coleções */
.gem-pill .coin-icon svg { width: 22px; height: 22px; }
.chip.gem { background: #e4f6ff; color: #1f6a9a; }
.fac-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.fac-head small { color: #8a6a3a; }
.ready-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px; border-radius: 14px; background: #f4ffe9; border: 2px solid #7ad64a; margin-bottom: 8px; }
.ready-box img { width: 34px; height: 34px; }
.ready-box .btn { margin-left: auto; }
.qrow, .recipe { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1.5px solid #f3e4c6; }
.qrow img, .recipe > img { width: 38px; height: 38px; }
.qmain, .rmain { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.rmain small { color: #8a6a3a; }
.ings { display: flex; gap: 6px; flex-wrap: wrap; }
.ing { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; color: #c0392b; }
.ing.ok { color: #2f8a22; }
.ing img { width: 22px; height: 22px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.acell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 12px; background: #fffaf0; border: 2px solid #ead3a6; text-align: center; font-size: 12px; }
.acell img { width: 48px; height: 48px; }
.acell.missing img { filter: brightness(0) opacity(.25); }
.acell.got { border-color: #7ad64a; background: #f4ffe9; }
.acell .names { font-size: 10.5px; color: #5a7a3a; }
.ev-list { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
.care { color: #ff5a7a; font-size: 12px; letter-spacing: 1px; }
.side-menu { max-height: calc(100% - 150px); overflow-y: auto; scrollbar-width: none; }

/* ---------- Adubos e proteção de itens ---------- */
.mini-gem { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.mini-gem svg { width: 100%; height: 100%; }
.fert-dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18); }
.fert-dot svg { width: 30px; height: 30px; }
.fert-big { width: 74px; height: 74px; border-radius: 20px; display: grid; place-items: center; box-shadow: inset 0 -5px 0 rgba(0,0,0,0.18), 0 3px 8px rgba(0,0,0,0.15); }
.fert-big svg { width: 56px; height: 56px; }
.lock-btn { width: 34px; height: 34px; opacity: 0.45; }
.lock-btn svg { width: 20px; height: 20px; }
.lock-btn.on { opacity: 1; background: #ffe08a; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); }
.row.protected { background: #fff7dc; }
.info-card small + small { display: block; margin-top: 2px; }

/* ---------- Madeira: barras e botões do HUD em marrom suave (pedido do Alan) ----------
   Fundo marrom-médio que não cansa a vista, texto creme e destaque verde na ferramenta ativa. */
:root { --wood: #7a5434; --wood-2: #8d6440; --wood-dark: #5a3a20; --wood-ink: #fff1d8; --wood-ink-soft: #f0d6aa; }
.toolbar, .context-bar {
  background: linear-gradient(180deg, var(--wood-2), var(--wood));
  border-color: var(--wood-dark);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.18), inset 0 -3px 0 rgba(0, 0, 0, 0.18), var(--shadow);
}
.tool span { color: var(--wood-ink-soft); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.tool.active span { color: #1f4a0e; text-shadow: none; }
.tool:not(.active):hover { background: rgba(255, 235, 200, 0.1); }
.chip { background: #6a462a; color: var(--wood-ink); border-color: rgba(0, 0, 0, 0.12); }
.chip-name { color: var(--wood-ink); }
.chip-sub { color: var(--wood-ink-soft); }
.chip.active { background: #4f7a2a; border-color: #9ad86a; }
.chip.free { background: #7a6020; border-color: #f2c94a; }
.chip.gem { background: #2f5a72; color: #dff4ff; }
.side-btn, .icon-btn.round, .coin-pill, .xp-box {
  background: linear-gradient(180deg, var(--wood-2), var(--wood));
  border-color: var(--wood-dark);
  color: var(--wood-ink);
}
.side-btn span { color: var(--wood-ink-soft); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.xp-box, .xp-box * { color: var(--wood-ink); }
.badge { border-color: var(--wood-dark); }
.xp-box .xp-bar { background: #4a301a; box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35); }
.xp-box .xp-text { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }

/* ---------- Botão de recolher menus (pedido do Alan) ----------
   Um toque esconde a barra de ferramentas e o menu lateral; outro toque traz de volta. */
.menu-toggle {
  position: absolute; right: calc(10px + var(--safe-right)); bottom: calc(96px + var(--safe-bottom));
  width: 54px; height: 54px; padding: 8px; border-radius: 50%; pointer-events: auto; z-index: 3;
  background: linear-gradient(180deg, var(--wood-2), var(--wood)); border: 2px solid var(--wood-dark);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.18), var(--shadow);
  transition: bottom .28s ease, transform .1s;
}
.menu-toggle:active { transform: scale(0.9); }
.menu-toggle > span { position: absolute; inset: 8px; display: block; }
.menu-toggle .mt-open, .menu-toggle .mt-tool { display: none; }
.menus-collapsed .menu-toggle { bottom: calc(12px + var(--safe-bottom)); }
.menus-collapsed .menu-toggle .mt-close { display: none; }
.menus-collapsed .menu-toggle .mt-open { display: block; }
.menus-collapsed .menu-toggle .mt-tool { display: block; inset: auto -6px -6px auto; width: 26px; height: 26px; padding: 2px; border-radius: 50%; background: #4f7a2a; border: 2px solid #9ad86a; }

.side-menu, .bottom .toolbar, .bottom .context-bar, .bottom .tool-hint { transition: transform .28s ease, opacity .28s ease; }
.menus-collapsed .side-menu { transform: translateX(calc(100% + 24px + var(--safe-right))); opacity: 0; pointer-events: none; }
.menus-collapsed .side-menu * { pointer-events: none; }
.menus-collapsed .bottom .toolbar, .menus-collapsed .bottom .context-bar, .menus-collapsed .bottom .tool-hint { transform: translateY(160%); opacity: 0; pointer-events: none; }

/* O menu lateral nunca passa por baixo do botão: se não couber (celular deitado), abre outra coluna à esquerda. */
.side-menu {
  max-height: calc(100% - 78px - var(--safe-top) - 168px - var(--safe-bottom));
  flex-wrap: wrap-reverse; align-content: flex-start;
}
/* A barra de ferramentas deixa espaço para o botão no canto direito. */
.bottom { padding-right: calc(8px + var(--safe-right)); padding-left: calc(8px + var(--safe-left)); }

/* Deitado (paisagem): barra de baixo mais baixa, botão ao lado dela, menu lateral em colunas. */
@media (orientation: landscape) and (max-height: 560px) {
  .menu-toggle { bottom: calc(10px + var(--safe-bottom)); width: 50px; height: 50px; }
  .bottom { padding-right: calc(70px + var(--safe-right)); }
  .side-menu { max-height: calc(100% - 64px - var(--safe-top) - 96px - var(--safe-bottom)); }
  .side-btn span { display: none; }
  .side-btn { height: 46px; width: 50px; padding-top: 6px; }
  .tool-hint { display: none; }
}

/* App na tela inicial do iPhone: já é tela cheia, o botão de tela cheia não serve. */
.is-standalone [data-fullscreen] { display: none; }
html, body { height: 100dvh; }

/* ---------- Correções dos prints do iPhone (23/11) ---------- */
/* Etiqueta TESTE sem esticar */
.dev-tag { align-self: center; line-height: 1.5; flex: 0 0 auto; }
.xp-label { align-items: center; }

/* Celular em pé: as pílulas e os botões redondos não cabem numa linha só.
   Moedas e diamantes ficam em cima; relógio, tela cheia e engrenagem descem para a linha de baixo. */
@media (max-width: 560px) and (orientation: portrait) {
  .hud-right { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 190px); row-gap: 6px; }
  .coin-pill { font-size: 14px; padding: 3px 10px 3px 3px; gap: 4px; }
  .coin-pill .coin-icon { width: 24px; height: 24px; }
  .icon-btn.round { width: 36px; height: 36px; padding: 5px; }
  .xp-box { min-width: 0; width: 128px; }
  .level-badge { width: 46px; height: 46px; }
  .side-menu { top: calc(112px + var(--safe-top)); max-height: calc(100% - 112px - var(--safe-top) - 168px - var(--safe-bottom)); }
}
/* Botão de tela cheia em todos os aparelhos: no Android abre a tela cheia; no iPhone (sem tela cheia de
   página no navegador) ele explica como abrir pela Tela de Início (UI.toggleFullscreen). */

/* Celular deitado: o menu lateral vira uma grade de botões (2 ou 3 colunas) que sempre aparece inteira.
   Grade no lugar de "coluna com quebra", que o Safari do iPhone não desenha direito. */
@media (orientation: landscape) and (max-height: 560px) {
  .side-menu {
    display: grid; grid-template-columns: repeat(2, 48px); grid-auto-rows: 44px; gap: 6px;
    max-height: none; top: calc(62px + var(--safe-top)); direction: rtl;
  }
  .side-menu > * { direction: ltr; }
  .side-btn { width: 48px; height: 44px; padding: 5px; justify-content: center; }
  .side-btn svg { width: 28px; height: 28px; }
  .side-btn span { display: none; }
  .badge { top: -5px; right: -5px; min-width: 18px; height: 18px; font-size: 10px; line-height: 18px; }
  .xp-box { min-width: 0; width: 170px; }
}
@media (orientation: landscape) and (max-height: 380px) {
  .side-menu { grid-template-columns: repeat(3, 46px); grid-auto-rows: 42px; gap: 5px; top: calc(56px + var(--safe-top)); }
  .side-btn { width: 46px; height: 42px; }
  .menu-toggle { width: 46px; height: 46px; }
  .hud-top { top: calc(6px + var(--safe-top)); }
  .level-badge { width: 44px; height: 44px; }
  .coin-pill { font-size: 14px; }
  .icon-btn.round { width: 36px; height: 36px; padding: 5px; }
}
@media (max-width: 560px) and (orientation: portrait) {
  .side-menu { flex-wrap: nowrap; gap: 6px; overflow-y: auto; overflow-x: visible; padding: 6px 6px 0 0; margin-right: -6px; scrollbar-width: none; }
  .side-menu::-webkit-scrollbar { display: none; }
  .side-btn { width: 52px; height: 50px; padding-top: 4px; flex: 0 0 auto; }
  .side-btn svg { width: 28px; height: 28px; }
  .side-btn span { font-size: 9.5px; }
}

/* imagem que não carregou: moldura tracejada com interrogação (o console registra qual item) */
img.img-missing { content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='6' y='6' width='36' height='36' rx='8' fill='none' stroke='%23a07850' stroke-width='3' stroke-dasharray='5 4'/%3E%3Ctext x='24' y='31' font-size='18' text-anchor='middle' fill='%23a07850' font-family='sans-serif'%3E%3F%3C/text%3E%3C/svg%3E"); opacity: 0.8; }

/* ---------- Online: conta, amigos, visita e selo de Fundador ---------- */
.founder-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: 13px; color: #5a3a00; background: linear-gradient(135deg, #fff3b0, #f7c73e 45%, #e0a21c 70%, #fff0a0); border: 2px solid #a86f12; box-shadow: 0 1px 0 #fff8 inset, 0 2px 6px #a86f1244; white-space: nowrap; }
.founder-badge.small { font-size: 11px; padding: 1px 7px; border-width: 1.5px; }
.founder-badge.big { font-size: 17px; padding: 6px 14px; animation: founder-shine 3s ease-in-out infinite; }
@keyframes founder-shine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
.founder-name { color: #b07a06; text-shadow: 0 0 6px #f7c73e66; }
.founder-wrap { margin: 8px 0; text-align: center; }
.acc-buttons { display: grid; gap: 8px; margin-top: 8px; }
.acc-google { background: #fff; color: #333; border-color: #c9c9c9; }
.acc-apple { background: #111; color: #fff; border-color: #000; }
.acc-form { display: grid; gap: 8px; }
.acc-in { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid #c9b48a; font-size: 16px; background: #fffaf0; }
.acc-msg { margin-top: 8px; font-weight: 700; color: #7a4a10; }
.acc-card { text-align: center; display: grid; gap: 8px; justify-items: center; }
.acc-name { font-size: 20px; font-weight: 800; }
.acc-code b { letter-spacing: 3px; font-size: 18px; }
.acc-code.big b { font-size: 26px; }
.link-btn { background: none; border: 0; color: #2f6a14; text-decoration: underline; font-weight: 700; padding: 4px; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #0001; flex-wrap: wrap; }
.friend-row .sp { flex: 1; }
.inbox-line { margin: 4px 0; font-size: 14px; }
.inbox-line.new { font-weight: 800; }
.visit-mode .side-menu, .visit-mode .toolbar, .visit-mode .menu-toggle, .visit-mode .hud-right .coin-pill { display: none !important; }
.visit-banner { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: grid; gap: 6px; justify-items: center; text-align: center; width: min(92vw, 420px); padding: 12px 14px; border-radius: 16px; background: #fffaf0f2; border: 3px solid #8a5a2a; box-shadow: 0 6px 20px #0004; }
.visit-banner small { color: #5a4a30; }
.loader-conflict { margin-top: 14px; display: grid; gap: 8px; text-align: center; }
.loader-conflict .btn { line-height: 1.3; }
.row .fert-big.row-img { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.row .fert-big.row-img svg { width: 34px; height: 34px; }

/* Avisos (toasts) menores no celular em pé: ocupavam muita tela, principalmente os vermelhos */
@media (orientation: portrait) and (max-width: 560px) {
  .toasts { width: 62vw; gap: 4px; top: calc(128px + var(--safe-top)); }
  .toast { font-size: 11px; line-height: 1.25; padding: 5px 10px; border-radius: 10px; font-weight: 700; }
  .toast.bad { font-size: 10.5px; padding: 4px 9px; }
}

/* ---------- Diamantes ---------- */
button.gem-pill { position: relative; cursor: pointer; font: inherit; color: inherit; font-weight: 900; }
.gem-pill .gem-plus { position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(#7fd8ff, #2f9be0); color: #fff; font-style: normal; font-size: 14px; line-height: 17px; text-align: center; border: 2px solid #fff; box-shadow: 0 1px 3px #0004; }
.mini-gem { display: inline-flex; width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.mini-gem svg { width: 16px; height: 16px; }
.gem-balance { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 10px; }
.gem-balance .mini-gem, .gem-balance .mini-gem svg { width: 30px; height: 30px; }
.gem-balance b { font-size: 28px; font-weight: 900; color: #1d6fa8; }
.gem-balance small { font-weight: 800; color: var(--ink-soft); }
.gem-mode.test { background: #fff3c4; border: 2px dashed #d0a020; border-radius: 12px; padding: 8px 10px; color: #6a4a00; font-weight: 800; }
.gem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.gem-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 10px; border-radius: 18px; background: linear-gradient(#ffffff, #eaf6ff); border: 2px solid #9fd0ee; box-shadow: var(--shadow); text-align: center; }
.gem-card.featured { border-color: #2f9be0; background: linear-gradient(#f4fbff, #d6efff); }
.gem-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 2px 10px; border-radius: 999px; background: linear-gradient(#ffd56b, #f0a81e); color: #5a3a00; font-size: 11px; font-weight: 900; border: 2px solid #fff; box-shadow: 0 1px 4px #0003; }
.gem-stack { display: flex; justify-content: center; height: 44px; }
.gem-stack svg { width: 40px; height: 40px; margin: 0 -9px; filter: drop-shadow(0 2px 2px #1d6fa855); }
.gem-qty { font-size: 24px; font-weight: 900; color: #1d6fa8; }
.gem-bonus { font-size: 11px; font-weight: 800; color: #3d8a22; min-height: 14px; }
.gem-card .btn { width: 100%; }
.gem-card .btn.confirm { background: linear-gradient(#7fd8ff, #2f9be0); color: #fff; }
.gem-card .ref { font-size: 10px; color: var(--ink-soft); }
.gem-delta { font-size: 16px; font-weight: 900; }
.gem-delta.plus { color: #3d8a22; }
.gem-delta.minus { color: #b0402e; }
.gem-btn { background: linear-gradient(#e9f7ff, #bfe6ff); border-color: #6bbbe8; color: #124a72; }
.rush-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.rush-row .btn { padding: 4px 10px; font-size: 12px; }

/* ---------- Janelas e menus em tons de madeira e papel kraft (pedido do Alan) ----------
   Antes: fundo branco e creme claro, destoando do marrom do HUD. Agora: moldura de madeira
   igual às barras, miolo em papel envelhecido e cartões em pergaminho, sem branco puro. */
:root { --paper: #f1dfbd; --paper-2: #f7ead0; --paper-3: #ead3a8; --paper-line: #c9a676; --paper-ink: #4a3420; }
.modal { background: linear-gradient(180deg, var(--wood-2), var(--wood)); border-color: var(--wood-dark); }
.modal-head { background: linear-gradient(180deg, #9a6e44, #7f5636); border-bottom-color: var(--wood-dark); }
.modal-title { color: var(--wood-ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.modal-close { color: var(--wood-ink); }
.modal-close svg { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3)); }
.tab { background: #6a462a; color: var(--wood-ink-soft); border-color: var(--wood-dark); }
.tab.active { background: var(--paper); color: var(--paper-ink); border-color: var(--paper-line); }
.modal-body { background: var(--paper); border-color: var(--paper-line); box-shadow: inset 0 2px 6px rgba(90, 58, 32, 0.18); }
.modal.book .modal-body, .modal.book .tab.active { background: var(--paper); }
.card { background: linear-gradient(var(--paper-2), var(--paper-3)); border-color: var(--paper-line); box-shadow: 0 3px 0 #c39a62, 0 4px 10px rgba(90, 58, 20, 0.15); }
.row, .mcard, .order, .acell, .pen-stats > div, .unlock, .seg-btn, .oitem { background: var(--paper-2); border-color: var(--paper-line); }
.seg-btn.active { background: #5c8a2e; color: #fff; border-color: #3d6a1a; }
.setting { border-bottom-color: var(--paper-line); }
.info-card, .celebrate-card, .visit-banner { background: linear-gradient(var(--paper-2), var(--paper)); border-color: var(--paper-line); }
.acc-in { background: var(--paper-2); border-color: var(--paper-line); }
.gem-card { background: linear-gradient(#f7ead0, #dceaf0); border-color: #8fb8cc; }
.gem-card.featured { background: linear-gradient(#f7ead0, #c9e2ee); border-color: #2f8bc4; }
.toggle span { background: var(--paper-2); }
.modal-close { background: var(--paper-2); border: 2px solid var(--wood-dark); border-radius: 50%; width: 38px; height: 38px; padding: 7px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.card-img { background: radial-gradient(circle at 50% 42%, #f8f0d8 0, #e3efc4 48%, #c4dd98 70%, rgba(196, 221, 152, 0) 72%); }

.shop-sub { margin: 14px 2px 8px; font-size: 15px; color: var(--paper-ink, #5a3a1e); font-weight: 800; }

/* Medidor de desempenho (modo dev) */
.perf-panel { position: fixed; left: 8px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 8px; background: rgba(20, 14, 8, 0.72); color: #f4ead8; font: 700 10px/1.25 ui-monospace, Menlo, Consolas, monospace; pointer-events: none; }
.perf-panel b { font-size: 12px; }
.perf-tune { display: flex; gap: 3px; margin-top: 4px; pointer-events: auto; }
.perf-tune button { font: 700 10px/1 ui-monospace, Menlo, monospace; padding: 5px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #f4ead8; }
.perf-tune button.on { background: #f4c84a; color: #2a1d0a; border-color: #f4c84a; }
.perf-panel .perf-info { display: flex; flex-direction: column; gap: 1px; }
.perf-panel span.low { color: #ff7a6a; } .perf-panel span.mid { color: #ffd25a; }
.perf-panel b.ok { color: #8fe27a; } .perf-panel b.mid { color: #ffd25a; } .perf-panel b.low { color: #ff7a6a; }

/* ---------- Polimento: barra de ferramentas no celular em pé ----------
   As 9 ferramentas dividem a largura da barra (antes ela rolava e a última saía cortada).
   Palavras longas são comprimidas na horizontal pelo UI.fitToolLabels(), nunca cortadas. */
.tool span { white-space: nowrap; transform-origin: 50% 50%; }
@media (max-width: 560px) and (orientation: portrait) {
  .bottom .toolbar { width: 100%; gap: 2px; padding: 5px 4px; border-radius: 20px; overflow: visible; }
  .tool { flex: 1 1 0; width: auto; min-width: 0; padding: 5px 0 3px; border-radius: 12px; }
  .tool svg { width: 26px; height: 26px; }
  .tool span { font-size: 9.5px; letter-spacing: -0.1px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .tool svg { width: 23px; height: 23px; }
  .tool span { font-size: 8.5px; }
}

/* ---------- Tutorial inicial (src/ui/TutorialUI.js) ----------
   Camada que não recebe toques (só o cartão): o jogador continua livre durante o tutorial.
   Cartão em papel kraft com moldura de madeira, como os painéis do jogo. */
.tut { position: absolute; inset: 0; pointer-events: none; z-index: 6; transition: opacity .25s; }
.tut[hidden] { display: none; }
.tut.tut-out, .tut.tut-away { opacity: 0; }
.tut-dim { position: absolute; inset: 0; background: rgba(30, 18, 6, 0.45); }
.tut-hole { position: absolute; left: 0; top: 0; border-radius: 16px; box-shadow: 0 0 0 200vmax rgba(30, 18, 6, 0.45), 0 0 0 3px #ffd34a, 0 0 18px 4px rgba(255, 211, 74, 0.8); animation: tut-glow 1.2s ease-in-out infinite; }
.tut-ring { position: absolute; left: 0; top: 0; border-radius: 18px; box-shadow: 0 0 0 3px #ffd34a, 0 0 16px 4px rgba(255, 211, 74, 0.75); animation: tut-glow 1.2s ease-in-out infinite; }
@keyframes tut-glow { 50% { box-shadow: 0 0 0 200vmax rgba(30, 18, 6, 0.45), 0 0 0 5px #ffe58a, 0 0 26px 8px rgba(255, 211, 74, 0.9); } }
.tut-ring { animation-name: tut-ring; }
@keyframes tut-ring { 50% { box-shadow: 0 0 0 5px #ffe58a, 0 0 26px 8px rgba(255, 211, 74, 0.9); } }
.tut-arrow, .tut-pin, .tut-side-arrow { position: absolute; left: 0; top: 0; width: 40px; height: 48px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.4)); }
.tut-arrow svg, .tut-pin svg, .tut-side-arrow svg { width: 100%; height: 100%; display: block; }
.tut-card {
  position: absolute; left: calc(10px + var(--safe-left)); top: calc(118px + var(--safe-top)); width: min(330px, calc(100vw - 96px));
  pointer-events: auto; padding: 4px; border-radius: 18px;
  background: linear-gradient(180deg, var(--wood-2), var(--wood)); border: 3px solid var(--wood-dark); box-shadow: 0 10px 26px rgba(30, 20, 5, 0.45);
}
.tut-card.tut-pop { animation: tut-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes tut-pop { from { transform: scale(0.85); opacity: 0; } }
.tut-head { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px 6px; color: var(--wood-ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.tut-title { flex: 1; font-size: 16px; font-weight: 900; }
.tut-count { font-size: 12px; font-weight: 800; color: var(--wood-ink-soft); }
.tut-text { margin: 0; padding: 10px 12px; background: var(--paper); color: var(--paper-ink); border: 2px solid var(--paper-line); border-radius: 12px; font-size: 14px; font-weight: 700; line-height: 1.35; box-shadow: inset 0 2px 6px rgba(90, 58, 32, 0.18); }
.tut-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 2px; }
.tut-actions .btn[hidden] { display: none; }
.tut-skip { margin-left: auto; padding: 6px 8px; font-size: 12px; font-weight: 800; color: var(--wood-ink-soft); text-decoration: underline; }
/* boas-vindas: tela toda escurecida e cartão no centro */
.tut-welcome .tut-card { left: 50%; top: 50%; translate: -50% -50%; width: min(340px, calc(100vw - 32px)); }
.tut-welcome .tut-title { font-size: 19px; }
.tut-welcome .tut-text { font-size: 15px; }
@media (orientation: landscape) and (max-height: 560px) { .tut-card { top: calc(62px + var(--safe-top)); left: calc(170px + var(--safe-left)); } }

/* ---------- Seletor de alcance do toque: "1 lote | 3×3" (Regador grande, Foice, Semeadeira) ---------- */
.area-bar { padding: 4px; border-radius: 16px; }
.area-switch { display: flex; gap: 4px; }
.area-opt { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; font-weight: 900; font-size: 12.5px; color: var(--wood-ink-soft); background: #6a462a; white-space: nowrap; }
.area-opt.active { background: linear-gradient(#a6e07a, #6cc244); color: #1f4a0e; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), 0 2px 6px rgba(60,120,20,0.35); }
.area-ico { width: 16px; height: 16px; flex: none; }

/* Painel do bloco de terra: custo em moedas e/ou diamantes. */
.lot-cost { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 8px 0; padding: 8px 10px; border-radius: 14px; background: var(--cream); border: 2px solid var(--border); font-weight: 800; }
.lot-cost-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); width: 100%; text-align: center; }
.lot-cost b { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; }
.lot-or { font-size: 12px; color: var(--ink-soft); }
.lot-pay .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bad-hint { color: #b5392a; font-weight: 800; text-align: center; }
.gem-btn.danger { background: linear-gradient(#f2857a, var(--red)); border-color: #a03024; color: #fff; }

/* ---------- Conta: cartão de papel kraft com moldura de madeira ---------- */
.acc-hero { position: relative; margin: 2px 0 12px; padding: 16px 14px 14px; border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, #e9cf9a, #dcbb7e); border: 4px solid #8a5a2c;
  box-shadow: inset 0 0 0 2px #f6e2b4, inset 0 -6px 14px rgba(120, 72, 24, .18), 0 4px 0 #5e3a18;
  background-image: repeating-linear-gradient(8deg, rgba(120, 80, 30, .05) 0 2px, transparent 2px 7px), linear-gradient(180deg, #ecd3a0, #dbb97a); }
.acc-hero-icon { font-size: 34px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(90, 50, 10, .3)); }
.acc-hero-title { margin: 6px 0 8px; font-weight: 900; font-size: 19px; color: #4a2a0e; letter-spacing: .01em; }
.acc-perks { list-style: none; margin: 0 auto 12px; padding: 0; display: grid; gap: 5px; max-width: 320px; text-align: left; font-weight: 700; font-size: 13px; color: #5a3a18; }
.acc-perks li { padding: 6px 10px; border-radius: 10px; background: rgba(255, 246, 220, .55); border: 1.5px dashed rgba(138, 90, 44, .45); }
.acc-hero .acc-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 320px); padding: 11px 16px;
  background: #fff; color: #3c4043; font-weight: 800; border: 2px solid #dadce0; border-radius: 12px; box-shadow: 0 3px 0 #8a5a2c55; }
.acc-hero .acc-google .g-logo { width: 22px; height: 22px; flex: none; }
.acc-hero .acc-buttons { justify-items: center; }
.acc-hero .acc-buttons .btn { width: min(100%, 320px); }
.acc-soon { margin: 8px auto 0; max-width: 320px; font-size: 12px; font-weight: 700; color: #6a4a22; }
.acc-pitch { margin: 2px auto 10px; max-width: 320px; text-align: center; font-size: 15px; font-weight: 800; color: #2f6a2a; }
.acc-hero .acc-msg { color: #8a3a10; }
.acc-wood { border-radius: 14px; border: 3px solid #a8743e; background: linear-gradient(180deg, #fbf0d8, #f1dfb8); box-shadow: 0 3px 0 #7a4e22; }

/* ---------- Ranking ---------- */
.rank-founders { padding: 12px; border-radius: 14px; text-align: center; background: linear-gradient(180deg, #fff3c8, #f6dc8a); border: 3px solid #b8862c; box-shadow: 0 3px 0 #7a5214; margin-bottom: 10px; }
.rank-f-title { font-weight: 900; font-size: 15px; color: #5a3a00; }
.rank-f-msg { margin: 4px 0 8px; font-weight: 900; font-size: 16px; color: #3a2400; }
.rank-f-bar { height: 12px; border-radius: 999px; background: #6a4a1a33; overflow: hidden; border: 2px solid #8a5a10; margin-bottom: 6px; }
.rank-f-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f7c73e, #e0a21c); }
.rank-founders small { color: #6a4a1a; font-weight: 700; }
.rank-list { display: grid; gap: 6px; }
.rank-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--paper-2, #fff8e8); border: 2px solid var(--paper-line, #e2cfa4); }
.rank-row.creator { background: linear-gradient(135deg, #fff6cc, #ffe08a 60%, #ffd05a); border-color: #b8862c; box-shadow: 0 0 0 2px #fff3 inset, 0 3px 10px #e0a21c55; }
.rank-row.me { border-color: #4aa524; box-shadow: 0 0 0 2px #4aa52455; }
.rank-pos { font-weight: 900; font-size: 16px; text-align: center; color: #5a3a18; }
.rank-crown { display: inline-block; width: 32px; height: 32px; }
.rank-crown svg { width: 100%; height: 100%; }
.rank-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.rank-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-you { padding: 1px 6px; border-radius: 6px; background: #4aa524; color: #fff; font-weight: 800; }
.rank-sample { color: #8a7a5a; font-weight: 700; }
.rank-lvl { font-weight: 800; font-size: 13px; color: #6a4a22; white-space: nowrap; }
.rank-note { margin-top: 10px; }
.founder-badge.creator { color: #4a2a00; background: linear-gradient(135deg, #fff8d0, #ffd24a 40%, #f0a818 70%, #fff4b0); border-color: #8a5a10; }
.version[data-version] { cursor: default; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; padding: 12px 0; margin-bottom: 0; }

/* Concluir agora (ui/panels/RushPanel.js) */
.rush-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: linear-gradient(180deg, #fff6df, #f3dfb4); border: 3px solid #b98a4e; box-shadow: inset 0 2px 0 #fffaf0; }
.rush-pic { width: 72px; height: 72px; flex: none; display: grid; place-items: center; border-radius: 14px; background: #fffdf5; border: 2px solid #d8b47a; font-size: 38px; }
.rush-pic img { width: 60px; height: 60px; object-fit: contain; }
.rush-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rush-info b { font-size: 18px; color: #4a2e10; }
.rush-info small { color: #7a5a30; }
.rush-left { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #4a2e10; font-weight: 700; }
.rush-left svg { width: 18px; height: 18px; }
.rush-hint { margin: 12px 0 8px; text-align: center; }
.rush-pay { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.rush-pay .btn.big { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rush-pay .lot-or { text-align: center; }
.rush-wallet { text-align: center; margin-top: 10px; }
.rush-modal .link-btn { display: block; margin: 6px auto 0; }

/* Botão "i" e janela "Você sabia?" (ui/lorePopup.js) */
.info-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #8a5a26; background: linear-gradient(#fff8e2, #f1d9a4); color: #6b3f14; font: 900 15px/1 Georgia, serif; font-style: italic; display: inline-grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 0 #8a5a26; vertical-align: middle; }
.info-btn:active { transform: translateY(2px); box-shadow: none; }
.card-img .info-btn { position: absolute; top: 4px; right: 4px; z-index: 2; }
.row-title .info-btn { margin-left: 6px; width: 22px; height: 22px; font-size: 13px; }
.lore-back { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; background: rgba(40, 24, 8, 0.45); animation: loreIn 0.16s ease-out; }
.lore-back.out { opacity: 0; transition: opacity 0.15s; }
.lore-card { position: relative; width: min(340px, 100%); padding: 26px 22px 20px; text-align: center; border-radius: 18px;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.35), transparent 60%), linear-gradient(170deg, #e9cf9c, #d7b47a 70%, #caa46a);
  border: 6px solid #8b5a2b; box-shadow: inset 0 0 0 3px #b98a4e, 0 10px 0 #5e3a16, 0 18px 30px rgba(0,0,0,0.35); color: #4a2e10; animation: loreCard 0.22s cubic-bezier(.2,1.4,.4,1); }
.lore-pin { position: absolute; top: -12px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a6a, #c8341c); box-shadow: 0 3px 0 #7a1e0e; }
.lore-img { width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 4px 2px rgba(0,0,0,0.2)); }
.lore-name { font-family: 'Lilita One', system-ui, sans-serif; font-size: 24px; color: #5a3410; margin-top: 4px; }
.lore-title { display: inline-block; margin: 6px 0 10px; padding: 3px 12px; border-radius: 999px; background: #6a9a2e; color: #fffbe8; font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.lore-text { margin: 0 0 16px; font-size: 16px; line-height: 1.45; font-weight: 700; }
.lore-ok { min-width: 160px; }
@keyframes loreIn { from { opacity: 0; } }
@keyframes loreCard { from { transform: scale(0.85) rotate(-2deg); opacity: 0; } }

/* Clima no HUD e ferramentas 3D na barra */
.weather-btn { margin-left: 6px; padding: 0 4px; border: 0; background: rgba(255, 255, 255, 0.18); border-radius: 999px; font-size: 14px; line-height: 20px; min-width: 24px; cursor: pointer; }
.weather-btn:empty { display: none; }
.tool .tool-3d { width: 38px; height: 38px; margin: -3px 0; object-fit: contain; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25)); pointer-events: none; }
@media (max-width: 520px) { .tool .tool-3d { width: 28px; height: 28px; } }
.dev-clock .dc-sub { margin: 8px 0 4px; font-size: 12px; font-weight: 800; opacity: 0.8; }
.dev-clock .dc-presets button.on { background: #6a9a2e; color: #fff; }

/* Colher tudo / Regar tudo (acima da barra, à esquerda) */
.mass-btns { position: absolute; left: calc(10px + var(--safe-left, 0px)); bottom: calc(100% + 10px); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; }
.mass-btn { pointer-events: auto; position: relative; width: auto; max-width: 70vw; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: rgba(255, 248, 234, 0.96); border: 2px solid var(--border); box-shadow: var(--shadow); font-weight: 800; font-size: 13px; color: #4a2e10; }
.mass-btn svg, .mass-btn img { width: 26px; height: 26px; object-fit: contain; }
.mass-btn .mass-n { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #e8562a; color: #fff; font-size: 12px; line-height: 22px; text-align: center; border: 2px solid #fff; }
.mass-btn[data-mass="water"] .mass-n { background: #2f8fd6; }
.mass-btn[data-cost]:not([data-cost=""])::after { content: attr(data-cost) " 🪙"; font-size: 11px; color: #8a5a26; margin-left: 2px; }
.mass-btn:active { transform: translateY(2px); }
.menus-collapsed .mass-btns { opacity: 0; pointer-events: none; }

/* Barras de escolha (sementes, adubos, construções): arrastar para os lados no celular */
.context-bar, .seed-bar { overflow-x: auto; overflow-y: hidden; touch-action: pan-x; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; flex-wrap: nowrap; }
.context-bar > *, .context-bar button { flex: 0 0 auto; touch-action: pan-x; }
.toolbar { touch-action: pan-x; }
/* barra de sementes: rola para os lados e nunca passa da largura da tela */
.seed-bar { overflow-x: auto; touch-action: pan-x; max-width: calc(100vw - 16px); min-width: 0; }
.context-bar { cursor: grab; user-select: none; -webkit-user-select: none; }
.context-bar.dragging, .context-bar.dragging * { cursor: grabbing; }
.context-bar img { -webkit-user-drag: none; }
/* Aviso "pronto para colher": sobe do pé da tela, some em 3 s */
.ready-toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom, 0px)); transform: translate(-50%, 140%); opacity: 0; z-index: 900; padding: 8px 16px; border-radius: 999px; background: rgba(24, 20, 16, 0.88); color: #fff8ea; font: 700 14px/1.2 Nunito, system-ui, sans-serif; pointer-events: none; transition: transform .35s ease, opacity .35s ease; white-space: nowrap; }
.ready-toast.show { transform: translate(-50%, 0); opacity: 1; }
/* Tela cheia no iPhone (app na tela inicial): sem margens nem rolagem */
html, body { margin: 0; padding: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; touch-action: none; overscroll-behavior: none; background: #000; }
#game, #ui-root { margin: 0; padding: 0; width: 100vw; height: 100dvh; overflow: hidden; }
/* Áreas seguras do iPhone (notch e barra de gestos): o 3D vai até a borda (atrás do notch, como num app),
   e só a interface (#ui-root) respeita env(safe-area-inset-*) pelas variáveis --safe-* do :root.
   Pôr o padding no body deixaria faixas pretas em volta do jogo no modo app. */
/* com touch-action: none no body, as áreas que rolam liberam o gesto delas */
.modal-body, .fb-list, .rank-list { touch-action: pan-y; }
#game, #game canvas { width: 100vw; height: 100vh; height: 100dvh; margin: 0; padding: 0; }

/* Comunidade e Mensagem do Fundador */
.founder-msg { background: linear-gradient(180deg, #fff8e0, #fff0c4); border: 2px solid #e8c25a; border-radius: 16px; padding: 14px 16px; margin: 4px 0 12px; color: #5a3a12; }
.founder-msg p { margin: 0 0 8px; line-height: 1.45; font-size: 15px; }
.founder-msg .founder-sign { margin: 0; text-align: right; font-weight: 800; font-size: 16px; }
.founder-actions { display: flex; justify-content: center; margin-top: 6px; }
.cm-title { margin: 6px 0 8px; font-size: 16px; }
.cm-types { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cm-chip { padding: 7px 12px; border-radius: 999px; background: #fff; border: 2px solid #d8d0c0; font-weight: 700; }
.cm-chip.active { background: #e8f6d8; border-color: #5aa83a; color: #2a5a1a; }
.cm-text { width: 100%; box-sizing: border-box; border-radius: 12px; border: 2px solid #d8d0c0; padding: 10px; font: inherit; resize: vertical; min-height: 96px; }
.cm-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; }
.fb-list { display: flex; flex-direction: column; gap: 8px; }
.fb-item { background: #fff; border-radius: 12px; padding: 8px 10px; border: 1px solid #e4dccc; }
.fb-item small { display: block; opacity: 0.7; }
.fb-item p { margin: 4px 0 0; white-space: pre-wrap; }

/* Aceite dos Termos e da Política (primeiro acesso, ui/consent.js) */
.consent-screen { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(20, 30, 18, 0.72); }
.consent-card { background: #fffaf0; border-radius: 20px; padding: 22px 20px 18px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.35); color: #3a2a12; }
.consent-logo { font-size: 40px; }
.consent-card h2 { margin: 4px 0 8px; color: #2f6a2a; }
.consent-card p { margin: 0 0 14px; line-height: 1.45; }
.consent-check { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: #f2ecd8; border-radius: 12px; padding: 12px; margin-bottom: 14px; line-height: 1.4; }
.consent-check input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; accent-color: #3a8a2a; }
.consent-check a { color: #2a6ad0; font-weight: 700; }
.consent-go { width: 100%; }
.consent-go:disabled { opacity: 0.45; filter: grayscale(0.6); cursor: not-allowed; }
.consent-reader { position: fixed; inset: 0; z-index: 51; background: #fbf8ef; display: flex; flex-direction: column; }
.consent-reader.hidden { display: none; }
.consent-reader-bar { padding: 10px; background: #2f6a2a; }
.consent-reader iframe { flex: 1; border: 0; width: 100%; }
.vol-slider { width: 100%; margin: 8px 0 2px; accent-color: #3a8a2a; touch-action: pan-x; }

/* Criador Supremo (#0): moldura animada ouro + roxo com brilho de estrelas; Pioneiros (#1–#50): moldura dourada */
.rank-row.creator-frame { position: relative; border: 3px solid transparent; background: linear-gradient(135deg, #fff4c8, #f3d6ff) padding-box, conic-gradient(from var(--cf-a, 0deg), #ffd24a, #b05aff, #ff8a1a, #ffe680, #7a3aff, #ffd24a) border-box; animation: creator-spin 4s linear infinite, creator-glow 2.2s ease-in-out infinite; }
.rank-row.creator-frame::after { content: '✦  ✧   ✦'; position: absolute; right: 54px; top: -9px; font-size: 13px; color: #ffd24a; text-shadow: 0 0 6px #b05aff; animation: creator-twinkle 1.6s ease-in-out infinite; pointer-events: none; }
.creator-title { background: linear-gradient(90deg, #c88a00, #8a2aff, #ff7a1a, #c88a00); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: creator-text 3s linear infinite; font-weight: 900; }
.rank-row.pioneer { border-color: #d8a020; background: linear-gradient(135deg, #fffbe8, #fff1c0); box-shadow: 0 0 0 1px #fff6 inset, 0 2px 6px #e0a21c33; }
@property --cf-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes creator-spin { to { --cf-a: 360deg; } }
@keyframes creator-glow { 0%, 100% { box-shadow: 0 0 8px #ffd24a88, 0 0 0 #b05aff00; } 50% { box-shadow: 0 0 16px #ffb03a, 0 0 22px #b05aff88; } }
@keyframes creator-twinkle { 0%, 100% { opacity: 0.35; transform: translateY(0) scale(0.9); } 50% { opacity: 1; transform: translateY(-2px) scale(1.1); } }
@keyframes creator-text { to { background-position: 300% 0; } }
.founder-badge.creator { background: linear-gradient(135deg, #fff2a0, #ffd24a 35%, #c07aff 70%, #ffe680); border-color: #6a2aa8; color: #3a1260; }

/* Social: chat global, clã e amigos (beta local) */
.chat-beta { background: #fff4d0; border: 1px solid #e8c25a; border-radius: 12px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; color: #5a3a12; }
.chat-log { height: 46vh; max-height: 360px; overflow-y: auto; touch-action: pan-y; background: #f6f2e6; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { background: #fff; border-radius: 12px 12px 12px 4px; padding: 6px 10px; max-width: 85%; align-self: flex-start; box-shadow: 0 1px 2px #0001; }
.chat-msg.mine { align-self: flex-end; background: #e2f4d2; border-radius: 12px 12px 4px 12px; }
.chat-msg b { display: block; font-size: 12px; color: #2f6a2a; }
.chat-msg span { display: block; white-space: pre-wrap; word-break: break-word; }
.chat-msg small { display: block; text-align: right; font-size: 10px; opacity: 0.6; }
.chat-send { display: flex; gap: 8px; margin: 8px 0; }
.chat-in { flex: 1; min-width: 0; border-radius: 10px; border: 2px solid #d8d0c0; padding: 8px 10px; font: inherit; user-select: text; -webkit-user-select: text; }
.chat-in.wide { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; }
.clan-card { display: flex; gap: 10px; align-items: center; background: #f0e8ff; border: 2px solid #b08ae0; border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.clan-card small { display: block; opacity: 0.75; }
.clan-tag { font-weight: 900; font-size: 18px; color: #5a2aa8; }
.friend-me { margin-bottom: 6px; }
.friend-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; background: #fff; border: 1px solid #e4dccc; border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; }
.friend-row small { grid-column: 1; opacity: 0.7; }
.friend-row .link-btn { grid-row: 1 / span 2; grid-column: 2; align-self: center; }

/* Mercado › Vender: tendência do preço (oferta e demanda) */
.mk-tag { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.mk-tag.hot { background: #e7f8d8; color: #2f7a1e; }
.mk-tag.low { background: #ffe6dc; color: #b0451e; }
.xp-fill.mastery { background: linear-gradient(90deg, #ffd24a, #b05aff); }
/* Painel de desempenho: abinha para minimizar (minimizado mostra só o FPS) */
.perf-tab { pointer-events: auto; align-self: flex-start; margin: -2px 0 3px; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.14); color: #f4ead8; font: 800 11px/1 ui-monospace, Menlo, Consolas, monospace; cursor: pointer; }
.perf-panel.min { padding: 4px; }
.perf-panel.min .perf-tab { margin: 0; }
.perf-panel.min > :not(.perf-tab) { display: none; }
/* Bloco de terra: quanto falta (cadeado + número), atualizado ao vivo (rodada 32) */
.lot-deficit { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; color: #b0451e; font-weight: 800; font-size: 14px; }
.lot-deficit svg { width: 16px; height: 16px; flex: none; }
.row-meta.lot-deficit { margin: 2px 0 0; font-size: 12px; }
