:root {
  --paper: #fff8e6;
  --paper-2: #f7e8c4;
  --line: #e3c995;
  --ink: #4a3220;
  --muted: #8a6d52;
  --green: #5cb85c;
  --green-dark: #3e8e3e;
  --orange: #e8a33d;
  --orange-dark: #b97a1f;
  --red: #d9534f;
  --wood: rgba(92, 60, 30, .82);
  --radius: 14px;
  font-family: 'Fredoka', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  background: #a7dcff;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: .85em;
  text-align: center;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
/* No computador as linhas não existem (os itens ficam numa faixa só); no celular viram duas linhas fixas */
.hud-row { display: contents; }
.hud .hud-row { pointer-events: none; }
.hud-row > * { pointer-events: auto; }
.hud .event-pill { order: 1; }
.hud-nav > * { order: 2; }
.pill b, .pill small, #clock { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; pointer-events: none; }
.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--wood);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.pill small { font-size: .75rem; opacity: .9; }
.brand { font-size: 1.15rem; font-weight: 700; }
.coins b { display: inline-block; min-width: 3ch; }
.coins b.bump { animation: bump .35s ease-out; }
.xpbar {
  width: 90px;
  height: 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .35);
  overflow: hidden;
}
.xpbar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffe066, #f5b82e);
  transition: width .3s;
}
.hud-menu { display: flex; gap: 6px; }
.menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--line);
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s;
}
.menu-btn:hover { transform: translateY(-2px); }
.menu-btn.active { background: #fff3b0; box-shadow: 0 3px 0 #e0b84a, inset 0 0 0 2px #f5b82e; }
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}
.badge[hidden] { display: none; }
.hud-btns { display: flex; gap: 6px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--wood);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  font-size: 17px;
  cursor: pointer;
  transition: transform .1s, filter .15s;
}
.icon-btn:hover { filter: brightness(1.15); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.active { background: #e08e1b; }
.icon-btn.dark { color: #fff; font-weight: 700; }
#scene.rotating { cursor: grabbing; }

/* ---------- Barra inferior ---------- */
.bottom {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.prompt {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(40, 26, 12, .82);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  animation: toastIn .15s ease-out;
}
.prompt[hidden] { display: none; }
.prompt kbd { margin-right: 4px; }
.status {
  max-width: 640px;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(255, 248, 230, .9);
  font-size: 13.5px;
  text-align: center;
  pointer-events: none;
}
.status:empty { display: none; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 8px;
  border-radius: 16px;
  background: var(--wood);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}
.tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 62px;
  padding: 6px 8px 5px;
  border: 0;
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  transition: transform .08s;
}
.tool:hover { transform: translateY(-2px); }
.tool.active { background: #fff3b0; box-shadow: 0 3px 0 #e0b84a, inset 0 0 0 3px #f5b82e; }
.tool.empty .ti { opacity: .45; filter: grayscale(.7); }
.tool .ti { font-size: 24px; line-height: 1.1; }
.tool .tn { font-size: 11px; font-weight: 600; }
.tool kbd {
  position: absolute;
  top: 2px;
  left: 3px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 10px;
}
.tool .cnt {
  position: absolute;
  top: -7px;
  right: -6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 2px 0 var(--green-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.tool.empty .cnt { background: var(--red); box-shadow: 0 2px 0 #a63a37; }
.tool-sep { width: 3px; margin: 6px 2px; border-radius: 3px; background: rgba(255, 255, 255, .3); }
.tool .more {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  color: var(--muted);
  transition: transform .15s;
}
.tool.seedslot.open .more { transform: rotate(180deg); }
.placebar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--line), 0 10px 24px rgba(0, 0, 0, .2); font-size: 13px; font-weight: 700; }
.placebar[hidden] { display: none; }
.placebar .btn { padding: 6px 10px; font-size: 13px; }
.storage { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.seed-picker {
  pointer-events: auto;
  width: min(420px, calc(100vw - 24px));
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 16px;
  background: var(--wood);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .25);
  animation: pickerIn .15s ease-out;
}
.seed-picker[hidden] { display: none; }
.sp-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; color: #fff; }
.sp-head .btn { padding: 4px 10px; font-size: 12px; }
.sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; }
.sp-grid .tool { min-width: 0; }
body.picking .action-btn, body.picking .side-ctrl { visibility: hidden; }
@keyframes pickerIn { from { opacity: 0; transform: translateY(8px); } }

.side-ctrl {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.action-btn {
  display: none;
  position: fixed;
  right: 70px;
  bottom: 22px;
  z-index: 16;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 5px 0 #e0b84a, 0 8px 18px rgba(0, 0, 0, .25);
  font-size: 32px;
}
body.joy-right .action-btn { right: auto; left: 70px; }
.action-btn:active, .action-btn.pressed { transform: translateY(3px); box-shadow: 0 2px 0 #e0b84a; }
.action-btn { touch-action: none; -webkit-tap-highlight-color: transparent; }

/* Joystick virtual (aparece onde o dedo toca) */
.joystick {
  position: fixed;
  z-index: 14;
  width: 128px;
  height: 128px;
  margin: -64px 0 0 -64px;
  border: 3px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .12), rgba(40, 26, 12, .28));
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}
.joystick.on { opacity: 1; }
.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 4px 0 #e0b84a, 0 6px 14px rgba(0, 0, 0, .3);
}
@media (pointer: coarse) {
  .action-btn { display: block; }
}

/* ---------- Painel lateral ---------- */
.panel {
  position: fixed;
  top: 64px;
  right: 14px;
  bottom: 14px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 28px);
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 6px 0 var(--line), 0 14px 30px rgba(0, 0, 0, .25);
  transform: translateX(calc(100% + 30px));
  transition: transform .25s ease;
  user-select: text;
}
.panel.open { transform: none; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  background: var(--paper-2);
}
.tab {
  flex: 1;
  padding: 10px 6px;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { background: rgba(255, 255, 255, .5); }
.tab.active { background: var(--paper); }
.tab-close {
  width: 38px;
  margin-bottom: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}
.tab-close:hover { background: rgba(0, 0, 0, .08); }
.tab-content { flex: 1; padding: 14px; overflow: auto; }
.tab-content h3 { margin: 18px 0 8px; font-size: 1rem; }
.tab-content h3:first-child { margin-top: 0; }

.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fffdf6;
}
.card.locked { opacity: .55; filter: grayscale(.6); padding: 5px 10px; }
/* Bloqueado: só o nome e o nível (a descrição aparece quando libera) */
.card.locked .info small, .card.locked .progress { display: none; }
.card.locked .ico, .card.compact .ico { font-size: 22px; }
/* Pronto/comprado: uma linha só */
.card.compact { padding: 5px 10px; }
.card.compact .info > small, .card.compact .progress { display: none; }

/* Barra de categorias no topo do painel (fica visível ao rolar) */
.subtabs {
  position: sticky;
  top: -14px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -14px -14px 12px;
  padding: 10px 14px 9px;
  border-bottom: 2px solid var(--line);
  background: var(--paper);
}
.subtab {
  position: relative;
  padding: 5px 11px;
  border: 2px solid var(--line);
  border-radius: 99px;
  background: #fffdf6;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.subtab:hover { background: #fff6d6; }
.subtab.active { border-color: #f5b82e; background: #fff3b0; }
.subtab .dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; background: var(--red); }

/* Sementes em grade */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 1px; padding: 7px 8px 8px; border: 2px solid var(--line); border-radius: 12px; background: #fffdf6; }
.tile.hot { border-color: #9ccc65; background: #f4fbe9; }
.tile-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.tile-top .tico { font-size: 24px; line-height: 1; }
.tile-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-top .tag { font-size: 14px; }
.tile small { color: var(--muted); font-size: 11.5px; }
.tile .btns { margin-top: 6px; gap: 4px; }
.tile .btns .btn { flex: 1; padding: 6px 4px; font-size: 12.5px; }
.soon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.soon .chip { font-size: 12px; opacity: .8; }
@media (max-width: 600px) {
  /* No celular as categorias ficam numa linha só, que rola para o lado */
  .subtabs { flex-wrap: nowrap; overflow-x: auto; padding: 8px 14px 7px; scrollbar-width: none; }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtab { flex-shrink: 0; padding: 4px 10px; }
}
.card.hired { border-color: var(--green); background: #f1fae6; }
.card .ico { width: 40px; font-size: 30px; text-align: center; flex-shrink: 0; }
.card .info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.card small { color: var(--muted); font-size: 12px; }
.card .req { max-width: 112px; font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--muted); text-align: right; }
.btns { display: flex; gap: 6px; flex-shrink: 0; }

.btn {
  padding: 7px 11px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.btn.alt { background: var(--orange); box-shadow: 0 3px 0 var(--orange-dark); }
.btn.ghost { background: #efe2c2; box-shadow: 0 3px 0 var(--line); color: var(--ink); }
.btn:disabled, .btn.alt:disabled, .btn.ghost:disabled {
  background: #cdc2ab;
  box-shadow: 0 3px 0 #ab9e85;
  color: #fff;
  cursor: not-allowed;
  filter: none;
  transform: none;
}
.btn.big { width: 100%; padding: 12px; font-size: 16px; }

.barn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--paper-2);
}
.barn-head small { display: block; color: var(--muted); font-size: 11px; }
.empty-msg { margin: 16px 0; text-align: center; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 10px;
  border: 2px solid var(--line);
  border-radius: 99px;
  background: #fffdf6;
  font-size: 13px;
  white-space: nowrap;
}
.up { color: var(--green-dark); font-weight: 700; }
.down { color: var(--red); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { padding: 8px 4px; border-radius: 10px; background: var(--paper-2); font-size: 12px; color: var(--muted); }
.stats b { display: block; font-size: 16px; color: var(--ink); }

.order {
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fffdf6;
}
.order.ok { border-color: var(--green); background: #f1fae6; }
.order .who { font-weight: 700; }
.new-badge { padding: 1px 7px; border-radius: 99px; background: #ff1744; color: #fff; font-size: 11px; vertical-align: middle; }
.reqs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.req-item {
  padding: 3px 8px;
  border-radius: 8px;
  background: #f6ecd2;
  font-size: 13px;
  font-weight: 600;
}
.req-item.done { background: #d8f0c4; color: var(--green-dark); }
.order-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reward { font-size: 14px; font-weight: 700; }
.hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.chip.sel { background: #fff3b0; box-shadow: inset 0 0 0 2px #f5b82e; }
button.chip { border: 0; font: inherit; cursor: pointer; }
.ach-list { display: grid; gap: 6px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 var(--line); opacity: .8; }
.ach.ok { opacity: 1; background: #fff8dc; box-shadow: 0 2px 0 #e0b84a; }
.ach-ico { font-size: 24px; width: 32px; text-align: center; }
.ach > div { flex: 1; }
.ach small { display: block; font-size: 11.5px; color: var(--muted); }
.order.quest { border: 2px solid #e0b84a; background: #fffaf0; }
.friends { display: grid; gap: 6px; }
.friend { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 7px 10px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 var(--line); font-size: 13px; font-weight: 700; }
.friend small { grid-column: 1 / -1; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.friend .hearts { font-size: 12px; letter-spacing: -1px; }
.progress { height: 8px; margin-top: 5px; border-radius: 5px; background: rgba(0, 0, 0, 0.12); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #f5b82e, #e08e1b); }
.g-cheat { margin-top: 14px; font-size: 13px; color: var(--muted); }
.g-cheat summary { cursor: pointer; }
.g-cheat form { display: flex; gap: 6px; margin: 8px 0 4px; }
.g-cheat input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 2px solid #e0c98f; font: inherit; }
.notice { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #fff3d6; border: 2px dashed #e0b84a; font-size: 13px; line-height: 1.4; }
.notice .btn { margin-top: 8px; }

/* ---------- Eventos climáticos e mutações ---------- */
.event-pill {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 4px 14px;
  border: 2px solid var(--mc, #f5b82e);
  line-height: 1.15;
  animation: eventPulse 1.6s ease-in-out infinite;
}
.event-pill[hidden] { display: none; }
.event-pill small { display: block !important; font-size: .72rem; }
@keyframes eventPulse { 50% { box-shadow: 0 3px 0 rgba(0, 0, 0, .18), 0 0 0 4px color-mix(in srgb, var(--mc, #f5b82e) 40%, transparent); } }
.toast.event { background: linear-gradient(90deg, #5e35b1, #1e88e5); font-size: 15px; }
.fx.mut { color: #fff; font-size: 16px; text-shadow: 0 2px 0 rgba(60, 20, 100, .7), 0 0 10px rgba(255, 255, 255, .6); }
.card.mutated { border-color: var(--mc); background: linear-gradient(90deg, color-mix(in srgb, var(--mc) 12%, #fffdf6), #fffdf6); }
.mut-tag {
  display: inline-block;
  padding: 0 4px;
  border: 1.5px solid var(--mc);
  border-radius: 6px;
  font-size: 12px;
  line-height: 18px;
}
.mut-mult { color: #8e24aa; }

/* ---------- Atualização e novidades ---------- */
.update-bar {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 66;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(90deg, #2e7d32, #1e88e5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  color: #fff;
  font-size: 14px;
  transform: translateX(-50%);
  animation: toastIn .3s ease-out;
}
.update-bar[hidden] { display: none; }
.update-btns { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.update-bar .tut-link { color: #e3f2fd; }
.update-bar .btn { background: #fff3b0; box-shadow: 0 3px 0 #e0b84a; color: var(--ink); }
.guide-version { color: var(--muted); font-size: .8rem; font-weight: 600; }
.cl-ver { margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid var(--line); border-radius: 8px; background: #fffdf6; }
.cl-ver.new { border-left-color: #1e88e5; background: #eef6ff; }
.cl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cl-head small { color: var(--muted); }
.cl-badge { padding: 1px 8px; border-radius: 99px; background: #1e88e5; color: #fff; font-size: 11px; font-weight: 700; }
.cl-ver .g-list { margin: 6px 0 0; }

/* ---------- Tutorial e dicas ---------- */
.tut {
  position: fixed;
  top: 66px;
  left: 14px;
  z-index: 26;
  width: 340px;
  max-width: calc(100vw - 28px);
  padding: 12px 14px;
  border: 3px solid #f5b82e;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 5px 0 #e0b84a, 0 14px 30px rgba(0, 0, 0, .25);
  font-size: 14px;
  line-height: 1.45;
  animation: toastIn .25s ease-out;
}
.tut[hidden] { display: none; }
.tut.tip { border-color: #64b5f6; box-shadow: 0 5px 0 #3d8fd1, 0 14px 30px rgba(0, 0, 0, .25); }
.tut.flash { border-color: var(--green); box-shadow: 0 5px 0 var(--green-dark), 0 14px 30px rgba(0, 0, 0, .25); }
.tut-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.tut-step { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tut-min {
  width: 26px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, .06);
  font-weight: 700;
  cursor: pointer;
}
.tut-title { display: flex; align-items: center; gap: 8px; font-size: 17px; cursor: default; }
.tut-title span { font-size: 22px; }
.tut-body { margin: 6px 0 8px; }
.tut-body kbd { font-size: .8em; }
.tut-ok { margin: 4px 0; font-size: 15px; }
.tut-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0; }
.tut-flow span {
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--paper-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tut-flow span + span::before { content: '→ '; color: var(--muted); }
.tut-flow.big span { font-size: 14px; padding: 5px 10px; }
.tut-goals { margin: 6px 0; padding-left: 18px; }
.tut-goals li { margin: 3px 0; }
.tut-progress {
  position: relative;
  height: 16px;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--paper-2);
}
.tut-progress[hidden] { display: none; }
.tut-progress i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #9be15d, #5cb85c); transition: width .3s; }
.tut-progress span { position: relative; display: block; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.tut-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tut-btns { display: flex; gap: 6px; margin-left: auto; }
.tut-btns [hidden] { display: none; }
.tut-link { padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.tut-link[hidden] { display: none; }
.tut.min .tut-body, .tut.min .tut-progress, .tut.min .tut-foot { display: none; }
.tut.min .tut-title { cursor: pointer; font-size: 15px; }

.tool.hint { animation: toolHint 1s ease-in-out infinite; }
@keyframes toolHint {
  0%, 100% { box-shadow: 0 3px 0 var(--line), 0 0 0 0 rgba(245, 184, 46, .9); }
  50% { box-shadow: 0 3px 0 var(--line), 0 0 0 6px rgba(245, 184, 46, .45); transform: translateY(-3px); }
}

.guide-edge {
  position: fixed;
  z-index: 24;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #6f4825;
  border-radius: 50%;
  background: #ffd54f;
  color: #6f4825;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.guide-edge[hidden] { display: none; }

/* ---------- Guia da Fazenda ---------- */
.modal.guide {
  display: flex;
  flex-direction: column;
  max-width: 860px;
  height: min(86vh, 680px);
  padding: 0;
  overflow: hidden;
}
.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--paper-2);
}
.guide-head h2 { margin: 0; font-size: 1.3rem; }
.guide-wrap { display: grid; flex: 1; grid-template-columns: 200px minmax(0, 1fr); min-height: 0; }
.guide-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  overflow-y: auto;
  border-right: 2px solid var(--line);
}
.g-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.g-nav span { width: 22px; text-align: center; }
.g-nav:hover { background: rgba(0, 0, 0, .05); }
.g-nav.active { background: #fff3b0; box-shadow: inset 0 0 0 2px #f5b82e; }
.guide-content { padding: 16px 20px 24px; overflow-y: auto; line-height: 1.55; user-select: text; }
.guide-content h3 { margin: 0 0 10px; font-size: 1.2rem; }
.g-list { padding-left: 20px; }
.g-list li { margin: 6px 0; }
.g-table-wrap { margin: 10px 0; overflow-x: auto; }
.g-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.g-table th { padding: 6px 8px; background: var(--paper-2); text-align: left; white-space: nowrap; }
.g-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.g-table.has-ico td:first-child { font-size: 18px; }
.g-lock { color: var(--muted); font-size: 11px; white-space: nowrap; }
.g-road { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.g-lv { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-left: 4px solid var(--line); border-radius: 8px; background: #fffdf6; }
.g-lv span { color: var(--muted); font-size: 13px; }
.g-lv.done { border-left-color: var(--green); }
.g-lv.done span { color: var(--ink); }
.g-lv.next { border-left-color: #f5b82e; background: #fff8d6; }

@media (max-width: 700px) {
  .guide-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .guide-nav { flex-direction: row; padding: 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 2px solid var(--line); }
  .g-nav { flex-shrink: 0; padding: 6px 10px; white-space: nowrap; }
  .guide-content { padding: 12px 14px 20px; }
}
@media (max-width: 600px) {
  .tut { left: 8px; width: auto; right: 8px; max-width: none; font-size: 13px; }
}

/* ---------- Minigame de pesca ---------- */
.fishgame {
  position: fixed;
  top: 50%;
  right: 24px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 5px 0 var(--line), 0 12px 26px rgba(0, 0, 0, .25);
  transform: translateY(-50%);
  animation: toastIn .2s ease-out;
}
.fishgame[hidden] { display: none; }
.fish-title { font-weight: 700; }
.fishgame small { color: var(--muted); font-size: 11px; text-align: center; max-width: 110px; }
.fish-body { display: flex; gap: 8px; }
.fish-track {
  position: relative;
  width: 52px;
  height: 240px;
  overflow: hidden;
  border: 3px solid #6f4825;
  border-radius: 10px;
  background: linear-gradient(#7fc8ef, #2f7fb5);
}
.fish-zone {
  position: absolute;
  left: 3px;
  right: 3px;
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 6px;
  background: rgba(120, 220, 120, .35);
}
.fish-zone.on { background: rgba(120, 230, 120, .65); }
.fish-icon {
  position: absolute;
  left: 50%;
  font-size: 24px;
  line-height: 28px;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3));
}
.fish-meter {
  position: relative;
  width: 12px;
  height: 240px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(0, 0, 0, .25);
}
.fish-meter i { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: #f5b82e; }
@media (max-width: 600px) {
  .fishgame { right: auto; left: 12px; }
}

/* ---------- Efeitos, avisos, modal e carregamento ---------- */
.map-bg { z-index: 72; }
.map-card { width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; padding: 12px 14px; border-radius: 18px; background: var(--paper); box-shadow: 0 5px 0 var(--line), 0 16px 40px rgba(0, 0, 0, .3); }
.map-wrap { overflow-x: auto; border-radius: 12px; }
#map-canvas { display: block; border-radius: 12px; cursor: crosshair; touch-action: manipulation; }
#map-places button { cursor: pointer; }
.photobar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 40; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); padding: 8px 12px; border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--line); font-size: 13px; }
.photobar[hidden] { display: none; }
.photobar .set-check { margin: 0; }
body.photo .hud, body.photo .bottom, body.photo .side-ctrl, body.photo .action-btn, body.photo #tut, body.photo #toasts, body.photo #guide-edge { display: none !important; }
.settings { position: fixed; right: 12px; z-index: 65; width: min(300px, calc(100vw - 24px)); padding: 12px 14px 10px; border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 var(--line), 0 12px 30px rgba(0, 0, 0, .25); animation: pickerIn .15s ease-out; }
.settings[hidden] { display: none; }
.set-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.set-head .tab-close { position: static; }
.set-row { display: grid; grid-template-columns: 1fr 34px; align-items: center; gap: 2px 8px; padding: 6px 0; font-size: 13px; font-weight: 700; }
.set-row span { grid-column: 1 / -1; }
.set-row input { width: 100%; height: 26px; margin: 0; accent-color: #e08e1b; cursor: pointer; }
.set-row output { font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; }
.settings.muted .set-row { opacity: .45; }
.set-check { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 13px; font-weight: 700; cursor: pointer; }
.set-check input { width: 18px; height: 18px; accent-color: #e08e1b; }
.set-hint { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: block; } }
.joy-pick { margin: 0 0 14px; font-size: 13px; font-weight: 700; text-align: left; }
.settings .joy-pick { margin: 10px 0 2px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.seg button { padding: 8px 6px; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 2px 0 var(--line); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.seg button.active { background: #fff3b0; box-shadow: 0 2px 0 #e0b84a, inset 0 0 0 2px #f5b82e; }
.char { position: fixed; inset: 0; z-index: 76; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: linear-gradient(to top, rgba(30, 40, 15, .55), rgba(30, 40, 15, 0) 55%); }
.char[hidden] { display: none; }
.char-card { width: min(440px, 100%); padding: 16px 18px 18px; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 5px 0 var(--line), 0 16px 40px rgba(0, 0, 0, .3); text-align: center; animation: pickerIn .25s ease-out; }
.char-step { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.char-card h2 { margin: 2px 0 12px; font-size: 20px; }
.char-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.char-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--line); color: var(--ink); font: inherit; cursor: pointer; transition: transform .08s; }
.char-opt:hover { transform: translateY(-2px); }
.char-opt span { font-size: 34px; line-height: 1.15; }
.char-opt.active { background: #fff3b0; box-shadow: 0 3px 0 #e0b84a, inset 0 0 0 3px #f5b82e; }
.char-name { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 700; text-align: left; }
.char-name input { display: block; box-sizing: border-box; width: 100%; margin-top: 6px; padding: 10px 12px; border: 2px solid #e0c98f; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
.char-btns { display: flex; gap: 8px; justify-content: center; }
.char-btns .btn { flex: 1; max-width: 220px; padding: 10px; }
.fx-layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.fx {
  position: absolute;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45), 0 0 6px rgba(0, 0, 0, .3);
  animation: floatUp .9s ease-out forwards;
}
.fx.gold { color: #ffe066; }
.fx.neg { color: #ffd0cc; }

.toasts {
  position: fixed;
  top: 66px;
  left: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(60, 40, 20, .93);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: toastIn .25s ease-out;
}
.toast.good { background: rgba(46, 125, 50, .95); }
.toast.bad { background: rgba(170, 50, 40, .95); }
.toast.level { background: linear-gradient(90deg, #f5b82e, #e8873d); font-size: 16px; }
.toast.out { animation: toastOut .3s forwards; }

.fade {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: #0b1030;
  opacity: 0;
  pointer-events: none;
}
.fade.on { animation: sleepFade 1.6s ease-in-out; }

.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 20, 10, .5);
}
.modal-bg[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 24px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--line), 0 20px 50px rgba(0, 0, 0, .3);
  animation: toastIn .25s ease-out;
}
.modal h2 { margin-top: 0; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: linear-gradient(180deg, #a7dcff, #cfeab3);
}
.loading-box { max-width: 420px; text-align: center; font-size: 17px; font-weight: 600; }
.loading-icon { font-size: 64px; animation: spin 2.4s linear infinite; }
.loading code { padding: 1px 6px; border-radius: 6px; background: #fff; }

/* ---------- Animações ---------- */
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.3); color: #ffe066; } 100% { transform: scale(1); } }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -70%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes sleepFade { 0% { opacity: 0; } 35%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Telas menores ---------- */
/* Telas em que a barra não cabe numa faixa: duas linhas fixas (informações em cima, botões embaixo),
   para nada mudar de lugar quando os números crescem ou um evento aparece */
@media (max-width: 1100px) {
  .hud { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .hud-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .hud-info .pill { flex: none; }
  .hud-nav .spacer { display: none; }
  .hud-nav { justify-content: space-between; }
}
@media (max-width: 900px) {
  .brand span, .menu-btn span, .pill small { display: none; }
  .xpbar { width: 60px; }
}
@media (max-width: 600px) {
  .hud { padding: 8px; gap: 6px; }
  .brand { display: none; }
  .hud-info .level { flex: 1 1 auto; min-width: 0; }
  .hud-info .level .xpbar { flex: 1 1 auto; width: auto; min-width: 24px; }
  .hud-menu { gap: 4px; }
  .hud-btns { gap: 4px; }
  .menu-btn { padding: 6px 8px; }
  .hud .event-pill { align-self: flex-start; }
  .pill { padding: 5px 10px; gap: 6px; }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }
  .toolbar { gap: 4px; padding: 6px; }
  .tool { min-width: 40px; padding: 5px 2px 4px; }
  .tool-sep { margin: 6px 0; }
  .sp-grid .tool .tn { display: block; font-size: 10px; }
  .tool .ti { font-size: 20px; }
  .tool .tn { display: none; }
  .status { font-size: 12px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; height: 68vh; transform: translateY(calc(100% + 30px)); }
  .side-ctrl { bottom: 190px; right: 8px; }
  .action-btn { right: 14px; bottom: 120px; }
  body.joy-right .action-btn { right: auto; left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 370px) {
  .hud { padding: 6px; }
  .hud-row, .hud-menu, .hud-btns { gap: 3px; }
  .pill { padding: 4px 8px; gap: 4px; font-size: 14px; }
  .menu-btn { padding: 5px 6px; }
  .icon-btn { width: 30px; height: 30px; font-size: 14px; }
}

/* Backup da fazenda */
.seg.one { grid-template-columns: 1fr; }
.save-card { width: min(460px, calc(100vw - 24px)); }
.save-card textarea { box-sizing: border-box; width: 100%; margin-top: 8px; padding: 8px 10px; border: 2px solid #e0c98f; border-radius: 12px; background: #fff; color: var(--ink); font: 12px/1.35 ui-monospace, monospace; resize: vertical; }

/* Álbum de coleções */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; margin-top: 8px; }
.alb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 2px solid var(--line); border-radius: 10px; background: #fffdf6; text-align: center; }
.alb span { font-size: 22px; line-height: 1.1; }
.alb small { font-size: 10.5px; line-height: 1.15; color: var(--muted); }
.alb.miss { border-style: dashed; background: transparent; opacity: .6; }

/* Roupas do personagem */
.char-look { display: grid; gap: 6px; margin-bottom: 12px; text-align: left; }
.look-row { display: flex; align-items: center; gap: 8px; }
.look-row > span { width: 58px; flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.look-row > div { display: flex; flex-wrap: wrap; gap: 5px; }
.look-row .sw { width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 0 var(--line), 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; padding: 0; }
.look-row .sw.on { box-shadow: 0 0 0 3px #f5b82e; transform: scale(1.1); }
.look-row .hat { width: 32px; height: 30px; border: 0; border-radius: 9px; background: #fff; box-shadow: 0 2px 0 var(--line); font-size: 17px; cursor: pointer; padding: 0; }
.look-row .hat.on { background: #fff3b0; box-shadow: 0 2px 0 #e0b84a, inset 0 0 0 2px #f5b82e; }
@media (max-width: 520px) { .char-opt span { font-size: 26px; } .char-opt { padding: 6px; } .char-card h2 { margin-bottom: 8px; } }
/* Gestos */
.emotes { position: fixed; z-index: 30; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-radius: 14px; background: var(--paper); box-shadow: 0 3px 0 var(--line), 0 10px 24px rgba(0, 0, 0, .2); }
.emotes[hidden] { display: none; }
.emotes button { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 2px 0 var(--line); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.emotes button span { font-size: 18px; }

.notify-pick .set-note { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.3; }
