/* Fonte do texto: Jersey 10 (Google Fonts), guardada no próprio jogo. size-adjust deixa ela do tamanho
   que a fonte anterior tinha, então nenhum tamanho do CSS precisou mudar. */
@font-face { font-family: 'xDino Texto'; src: url('fonts/jersey10.woff2') format('woff2'); font-display: swap; size-adjust: 126%; }

:root {
  --bg: #10141b;
  --panel: #1c2330;
  --panel-2: #252e3e;
  --edge: #3b475c;
  --edge-dark: #06080c;
  --text: #f1f4f9;
  --muted: #9aa6b8;
  --gold: #ffcc3d;
  --green: #5bd16a;
  --red: #ff5a4f;
  --blue: #2f7dff;
  --wood: #7a4a24;
  --wood-dark: #4a2a12;
  --title: 'Press Start 2P', monospace;
  --body: 'xDino Texto', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font-family: var(--body); font-synthesis: none; }
body { min-height: 100vh; background: var(--bg) radial-gradient(ellipse at top, #1d2a24 0%, var(--bg) 60%) no-repeat; }
button, input { font: inherit; color: inherit; }
img { image-rendering: pixelated; }
[hidden] { display: none !important; }

.app { max-width: 540px; margin: 0 auto; padding: 0 10px 40px; display: flex; flex-direction: column; gap: 10px; }

/* moldura dos painéis: borda preta grossa, brilho em cima e sombra embaixo */
.card, .stage-wrap, .stats, .hint, .buttons button, .feed, .test, .sheet {
  background: var(--panel);
  border: 3px solid var(--edge-dark);
  border-radius: 10px;
  box-shadow: inset 0 3px 0 var(--edge), inset 0 -4px 0 rgba(0, 0, 0, 0.4), 0 3px 0 rgba(0, 0, 0, 0.5);
}

/* ---------- banner ---------- */
.banner {
  position: relative;
  margin: 0 -10px;
  height: 190px;
  background: url('assets/fundos/planicie.png') center 30% / cover;
  image-rendering: pixelated;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-bottom: 4px solid var(--edge-dark);
}
.banner::after { content: ''; position: absolute; inset: auto 0 0 0; height: 50px; background: linear-gradient(transparent, rgba(16, 20, 27, 0.75)); pointer-events: none; }
.sign {
  position: relative; z-index: 1;
  padding: 16px 30px 14px;
  background:
    repeating-linear-gradient(180deg, transparent 0 13px, rgba(0, 0, 0, 0.18) 13px 15px),
    linear-gradient(180deg, #9a5f2f, var(--wood) 55%, var(--wood-dark));
  border: 4px solid #1e1006;
  border-radius: 8px;
  box-shadow: inset 0 3px 0 #c58450, inset 0 -4px 0 #2e1708, 0 6px 0 rgba(0, 0, 0, 0.45);
  text-align: center;
}
.sign::before, .sign::after { content: ''; position: absolute; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: #d9c08a; box-shadow: inset -2px -2px 0 #6b5428; }
.sign::before { left: 9px; }
.sign::after { right: 9px; }
.sign-title {
  font-family: var(--title); font-size: 40px; line-height: 1; letter-spacing: 2px;
  color: #f4f1ea;
  text-shadow: 0 4px 0 #6f8fb8, 3px 0 0 #0d0d14, -3px 0 0 #0d0d14, 0 -3px 0 #0d0d14, 0 7px 0 #0d0d14;
}
.sign-title .x { color: #ffb21f; text-shadow: 0 4px 0 #d9481a, 3px 0 0 #0d0d14, -3px 0 0 #0d0d14, 0 -3px 0 #0d0d14, 0 7px 0 #0d0d14; }
.sign-sub { margin-top: 10px; font-family: var(--title); font-size: 8px; color: #ffe7b8; text-transform: uppercase; letter-spacing: 1px; text-shadow: 1px 1px 0 #1e1006; }
.plaque {
  position: relative; z-index: 1; margin-top: -2px;
  font-family: var(--title); font-size: 11px; color: #ffe2a8;
  background: linear-gradient(180deg, #6a3d1c, var(--wood-dark));
  border: 3px solid #1e1006; border-top: none; border-radius: 0 0 8px 8px;
  padding: 8px 14px 7px;
  box-shadow: inset 0 -3px 0 #2e1708;
}

/* ---------- cartão do jogador ---------- */
.card { display: flex; align-items: center; gap: 8px; padding: 8px; margin-top: 2px; }
.avatar { width: 52px; height: 52px; flex: none; image-rendering: pixelated; background: linear-gradient(180deg, #3f87d6, #1f4f8f); border: 3px solid #0b1f3a; border-radius: 8px; box-shadow: inset 0 0 0 2px #8fc1ff; }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.handle-box { flex: 1; min-width: 0; display: flex; align-items: center; font-size: 19px; font-weight: 700; }
.handle-box span { color: var(--muted); }
.handle-box input { width: 100%; min-width: 0; background: transparent; border: none; border-bottom: 2px dashed transparent; padding: 2px 0; outline: none; font-weight: 700; }
.handle-box input:focus, .handle-box input:placeholder-shown { border-bottom-color: var(--edge); }
.ver { flex: none; background: linear-gradient(180deg, #4b93ff, var(--blue)); border: 3px solid #06142e; border-radius: 7px; padding: 6px 12px; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.ver:active { transform: translateY(1px); }
.avatar.legend { background: radial-gradient(circle, #ffcf4a, #b8560f); border-color: #3a1a00; box-shadow: inset 0 0 0 2px #fff0a0, 0 0 10px rgba(255, 200, 60, 0.7); animation: legend-pulse 1.6s ease-in-out infinite; }
@keyframes legend-pulse { 50% { box-shadow: inset 0 0 0 2px #fff0a0, 0 0 18px rgba(255, 200, 60, 0.95); } }
.legend { display: inline-block; margin-left: 4px; padding: 1px 6px 2px; font-family: var(--title); font-size: 7px; vertical-align: 2px; color: #3a1a00; background: linear-gradient(180deg, #fff3a0, #ffc42e 50%, #e08a12); border: 2px solid #3a1a00; border-radius: 4px; text-shadow: none; }
.chip { display: flex; align-items: center; gap: 5px; background: var(--panel-2); border: 3px solid var(--edge-dark); border-radius: 8px; padding: 5px 8px; white-space: nowrap; font-size: 16px; box-shadow: inset 0 2px 0 var(--edge); }
.chip img { width: 24px; height: 24px; object-fit: contain; }
.chip b { font-size: 17px; }
.food-info { display: flex; flex-direction: column; gap: 3px; min-width: 50px; }
.food-info b { font-size: 14px; line-height: 1; }
.bar { height: 8px; background: #0b0e13; border: 2px solid #000; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(180deg, #8af08f, var(--green)); transition: width 0.4s; }
.food.low .bar i { background: var(--gold); }
.food.zero .bar i { background: var(--red); }

/* ---------- cena ---------- */
.stage-wrap { position: relative; padding: 0; overflow: hidden; aspect-ratio: 688 / 384; background: #0b0e13; border-width: 4px; }
#scene { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.stage-tag { position: absolute; top: 8px; left: 8px; background: rgba(10, 14, 20, 0.85); border: 2px solid #000; border-radius: 7px; padding: 5px 9px; display: flex; flex-direction: column; line-height: 1.15; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.stage-tag b { font-size: 16px; }
.stage-tag span { font-size: 14px; color: #d8ecc9; }
.progress { position: absolute; top: 9px; right: 8px; display: flex; align-items: center; gap: 4px; background: rgba(10, 14, 20, 0.85); border: 2px solid #000; border-radius: 14px; padding: 3px 7px; }
.progress .me { width: 22px; height: 22px; object-fit: contain; }
.progress .goal { width: 22px; height: 22px; object-fit: contain; }
.progress .dots { display: flex; align-items: center; gap: 3px; }
.progress .dots i { width: 7px; height: 7px; border-radius: 50%; background: #4a5566; }
.progress .dots i.on { background: var(--green); box-shadow: 0 0 4px var(--green); }
.boss-timer { position: absolute; top: 46px; right: 8px; width: 46%; display: flex; align-items: center; gap: 6px; background: rgba(70, 10, 10, 0.88); border: 2px solid #000; border-radius: 7px; padding: 4px 7px; font-family: var(--title); font-size: 8px; color: #ffd0c8; }
.boss-timer .bar { flex: 1; }
.boss-timer .bar i { background: var(--red); transition: none; }
.mood { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(10, 14, 20, 0.9); border: 2px solid #000; border-radius: 7px; padding: 5px 10px; font-size: 14px; white-space: nowrap; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; background: linear-gradient(transparent, rgba(8, 10, 16, 0.75)); font-size: 18px; text-shadow: 2px 2px 0 #000; }
.empty p { margin: 4px 0; }
.empty .small { font-size: 15px; }
.empty b { color: var(--gold); }

/* ---------- números ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; }
.stat { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 3px solid var(--edge-dark); border-radius: 8px; padding: 6px 9px; box-shadow: inset 0 2px 0 var(--edge); }
.stat > img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.stat > div { display: flex; flex-direction: column; min-width: 0; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat b { font-size: 22px; line-height: 1.05; }
.stat small { color: var(--muted); font-size: 13px; }
.stat small.can { color: var(--green); font-weight: 700; }
.stat.wide { grid-column: 1 / -1; flex-direction: column; align-items: stretch; gap: 5px; }
.xp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.xp-head b { font-size: 15px; }
.bar.xp { height: 12px; }
.bar.xp i { background: linear-gradient(180deg, #8fc1ff, #3d8bff); }

.hint { padding: 10px 12px; font-size: 16px; line-height: 1.35; background: linear-gradient(180deg, #3a2c14, #2a2010); }
.hint b { color: var(--gold); }

/* ---------- botões ---------- */
.buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.buttons button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 2px 9px; font-family: var(--title); font-size: 9px; cursor: pointer; aspect-ratio: 1 / 0.95; }
.buttons button:hover { background: var(--panel-2); }
.buttons button:active { transform: translateY(2px); }
.buttons img { width: 52px; height: 52px; object-fit: contain; }

/* ---------- feed ---------- */
.feed { padding: 10px; }
.feed h2, .test h2 { margin: 0 0 8px; font-family: var(--title); font-size: 10px; color: var(--gold); letter-spacing: 1px; }
.feed ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.feed li { display: flex; align-items: center; gap: 9px; border-bottom: 2px solid #2b3446; padding: 5px 2px 7px; font-size: 16px; }
.feed li:last-child { border-bottom: none; }
.feed li .i { width: 34px; height: 34px; flex: none; display: grid; place-items: center; background: #11161f; border: 2px solid #000; border-radius: 6px; font-size: 17px; box-shadow: inset 0 1px 0 var(--edge); }
.feed li .i img { width: 26px; height: 26px; object-fit: contain; }
.feed li .t { flex: 1; min-width: 0; }
.feed li .t b { color: #9fd0ff; }
.feed li time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.feed .none { color: var(--muted); font-size: 15px; }

.test { padding: 10px; border-style: dashed; }
.test form, .test-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.test input { flex: 1; min-width: 110px; background: #11151c; border: 2px solid var(--edge-dark); border-radius: 6px; padding: 7px; }
.test button { background: var(--panel-2); border: 2px solid #000; border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.test .reply { margin: 0; color: #c8f5c0; font-size: 14px; min-height: 1em; }

/* ---------- janelas ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: flex-end; justify-content: center; z-index: 10; padding: 10px; }
.sheet { position: relative; width: 100%; max-width: 540px; max-height: 85vh; overflow: auto; padding: 14px; }
.sheet h2 { margin: 0 0 12px; font-family: var(--title); font-size: 13px; color: var(--gold); }
.close { position: absolute; top: 8px; right: 8px; background: var(--panel-2); border: 2px solid #000; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; }
.rank-row, .map-world, .boss-row { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 2px solid var(--edge-dark); border-radius: 7px; padding: 6px 8px; margin-bottom: 5px; font-size: 15px; }
.rank-row .pos { font-family: var(--title); font-size: 10px; width: 30px; color: var(--gold); }
.rank-row .u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row small, .map-world small, .boss-row small { color: var(--muted); }
.rank-row.me { border-color: var(--blue); }
.map-world { flex-direction: column; align-items: stretch; }
.map-world .head { display: flex; justify-content: space-between; gap: 6px; }
.map-world .names { color: var(--muted); font-size: 13px; }
.map-world.here { border-color: var(--green); }
.boss-row img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.boss-row .info { flex: 1; display: flex; flex-direction: column; }
.boss-row.done { opacity: 0.6; }
.boss-row.next { border-color: var(--red); }
.help p { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.help code { font-family: var(--title); font-size: 10px; background: #11151c; padding: 3px 5px; border-radius: 4px; color: var(--gold); }

/* celular: o @ ganha a linha inteira (não corta o nome), Nv e comida embaixo */
@media (max-width: 560px) {
  .card { flex-wrap: wrap; }
  .who { flex-basis: calc(100% - 64px); }
  .chip { flex: 1; justify-content: center; }
}
@media (max-width: 420px) {
  .sign-title { font-size: 32px; }
  .buttons button { font-size: 8px; }
  .buttons img { width: 44px; height: 44px; }
}

/* ---------- insígnias das Eras ---------- */
.card { flex-wrap: wrap; }
.badges { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 5px; padding-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 3px; font-family: var(--title); font-size: 8px; border: 2px solid #000; border-radius: 12px; color: #2a1606; background: linear-gradient(180deg, #f0b27a, #b86b32); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.badge.legend { background: linear-gradient(180deg, #fff3a0, #ffc42e 50%, #e08a12); }
.badge.top { color: #fff; background: linear-gradient(180deg, #c58cff, #7a3cd6); }

/* ---------- chefe mundial ---------- */
.wb-bar { position: absolute; right: 8px; top: 8px; width: 58%; background: rgba(40, 6, 10, 0.9); border: 2px solid #000; border-radius: 7px; padding: 4px 8px 5px; text-align: center; }
.wb-bar b { font-family: var(--title); font-size: 9px; color: #ffb4a8; letter-spacing: 1px; }
.wb-bar .bar { height: 10px; margin: 4px 0 2px; }
.wb-bar .bar i { background: linear-gradient(180deg, #ff7a5a, #d81e1e); transition: width 1s linear; }
.wb-bar small { font-size: 13px; color: #ffd9d0; }
.wb-next { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 9px 10px; font-size: 16px; cursor: pointer; color: #ffe1d8; background: linear-gradient(180deg, #4a1414, #2c0b0b); border: 3px solid #000; border-radius: 10px; box-shadow: inset 0 2px 0 #7a2a22, 0 3px 0 rgba(0, 0, 0, 0.5); }
.wb-next b { color: #ffb21f; }
.wb-next.live { animation: wb-live 1s ease-in-out infinite; }
@keyframes wb-live { 50% { background: linear-gradient(180deg, #7a1c1c, #3c0d0d); } }

.xp-foot { display: flex; justify-content: space-between; gap: 6px; }
.xp-foot small { font-size: 13px; color: var(--muted); }
.streak { color: #ffb070 !important; }

/* ---------- avisos ---------- */
.toast { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(14, 18, 26, 0.94); border: 3px solid #000; border-radius: 10px; padding: 10px 14px; font-size: 17px; text-align: center; box-shadow: 0 0 0 2px var(--gold); animation: toast-in 0.25s ease-out; max-width: 86%; }
.toast b { color: var(--gold); }
@keyframes toast-in { from { transform: translate(-50%, -40%); opacity: 0; } }
.away { text-align: center; }
.away ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.away li { background: var(--panel-2); border: 2px solid var(--edge-dark); border-radius: 7px; padding: 8px; font-size: 17px; }
.away li b { color: var(--gold); }
.away .ver { font-size: 18px; padding: 8px 26px; }
.rank-row .xpbar { width: 60px; height: 6px; }

/* ---------- modo simulação (só no teste acelerado) ---------- */
.sim { padding: 10px; background: linear-gradient(180deg, #16324a, #0f2234); border: 3px solid #000; border-radius: 10px; box-shadow: inset 0 3px 0 #2c5a80, 0 3px 0 rgba(0, 0, 0, 0.5); }
.sim-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.sim-head b { font-family: var(--title); font-size: 10px; color: #8fd1ff; }
.sim-head span { font-size: 13px; color: #b8d4ea; }
.sim-born, .sim-cmds { display: grid; gap: 8px; }
.sim-born { grid-template-columns: repeat(3, 1fr); }
.sim-cmds { grid-template-columns: 1fr 1fr; }
.sim button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; font-family: var(--title); font-size: 12px; cursor: pointer; border: 3px solid #000; border-radius: 9px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3), inset 0 -4px 0 rgba(0, 0, 0, 0.3); background: #3a4b62; }
.sim button img { width: 30px; height: 30px; object-fit: contain; }
.sim button.eat { background: linear-gradient(180deg, #e0752c, #a8481a); }
.sim button.up { background: linear-gradient(180deg, #4b93ff, #2357c4); }
.sim button:active { transform: translateY(2px); }
.sim-reply { margin: 8px 2px 0; font-size: 15px; color: #d8f0ff; min-height: 1.2em; }

.sim-cmds:has(.evo:not([hidden])) { grid-template-columns: 1fr 1fr 1fr; }
.sim button.evo { color: #3a1a00; background: linear-gradient(180deg, #fff3a0, #ffc42e 50%, #e08a12); animation: evo-pulse 0.9s ease-in-out infinite; }
@keyframes evo-pulse { 50% { box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.5), 0 0 18px rgba(255, 220, 90, 0.9); } }
.xp-head small.can { color: #ffe066; font-weight: 700; }

/* durante a evolução, só a animação aparece na cena */
.stage-wrap.evolving > :not(canvas) { display: none !important; }

/* último dia da Era: placa vermelha pulsando */
.plaque.last { color: #fff0e0; background: linear-gradient(180deg, #a8281a, #5a0c06); animation: last-day 1.2s ease-in-out infinite; }
@keyframes last-day { 50% { background: linear-gradient(180deg, #d8402a, #7a140a); } }

/* modo compacto: usado na página dos 3 dinos lado a lado (teste.html) */
body.compact .banner, body.compact .buttons, body.compact .feed, body.compact .test, body.compact .hint { display: none !important; }
body.compact .app { padding-top: 8px; gap: 8px; }

/* insígnias: todas no mesmo quadradinho; a moldura diz o tipo; número da Era no canto */
.badges { flex-direction: column; gap: 6px; cursor: pointer; border-top: 2px solid var(--edge-dark); padding-top: 8px; margin-top: 2px; }
.badges-title { font-size: 15px; line-height: 1; color: #ffe2a8; }
.badges-title small { color: var(--muted); font-size: 13px; }
.badges-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ins { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 8px; background: #11151c; border: 2px solid #4a5566; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08); }
.ins img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.ins b { position: absolute; right: -5px; bottom: -5px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #11151c; border: 2px solid #000; color: #ffe2a8; font-size: 13px; line-height: 12px; text-align: center; }
.ins.t-era { border-color: #8a5a32; }
.ins.t-lendario { border-color: #d9a52a; }
.ins.t-top10 { border-color: #9b5ad6; }
.ins.t-top3 { border-color: #ffd84a; }
.ins.t-fundador { border-color: #ffd84a; background: radial-gradient(circle, #4a3608, #11151c 70%); }
.ins.t-fundador img { animation: founder-glow 1.8s ease-in-out infinite; }
.ins.live { box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.35), 0 0 12px rgba(255, 216, 74, 0.75); }
.ins.more { cursor: pointer; color: #ffe2a8; font-size: 17px; border-style: dashed; }
@keyframes founder-glow { 0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 210, 80, 0.6)); } 50% { filter: drop-shadow(0 0 6px rgba(255, 230, 120, 1)) brightness(1.15); } }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ins-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--panel-2); border: 2px solid var(--edge-dark); border-radius: 8px; padding: 10px 6px; }
.ins-cell small { color: var(--muted); font-size: 14px; line-height: 1.2; }

/* prêmio do top 10: nome dourado (pódio) ou prateado (top 10) no ranking e no feed */
.feed b.gold, .rank-row .gold { color: #ffd84a !important; text-shadow: 0 0 6px rgba(255, 200, 60, 0.6); }
.feed b.silver, .rank-row .silver { color: #dfe8f5 !important; }
.crown-ico { width: 26px; height: auto; margin-left: 2px; flex: none; image-rendering: pixelated; filter: drop-shadow(0 0 4px rgba(255, 210, 80, 0.8)); }
