/* Samurai Penguin Studios — página de jogos (toddyn.com/games)
   Visual tirado do próprio Lumberjack Clicker: sprites reais, HUD verde-musgo,
   botões de madeira e a fonte Press Start 2P do jogo. */

@font-face { font-family: "Press Start 2P"; src: url("lumberjack-clicker/Fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("assets/fonts/pixelify-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("assets/fonts/pixelify-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --soil: #2f243c;        /* chão da floresta, mesma cor da base do background.png */
  --soil-deep: #211a2c;
  --hud: #1c302ce6;       /* painel do HUD do jogo */
  --moss: #92aa67;        /* borda do HUD do jogo */
  --cream: #fff4cc;       /* texto do HUD do jogo */
  --cream-soft: #e4dab8;
  --ink: #291a13;         /* contorno dos textos do jogo */
  --bark: #98502a;
  --bark-hi: #dd9043;
  --bark-lo: #653c28;
  --bark-edge: #392319;
  --pixel: "Press Start 2P", monospace;
  --body: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --outline: 2px 0 var(--ink), -2px 0 var(--ink), 0 2px var(--ink), 0 -2px var(--ink), 2px 3px var(--ink);
  --outline-thin: 1px 0 var(--ink), -1px 0 var(--ink), 0 1px var(--ink), 0 -1px var(--ink), 1px 2px var(--ink);
  background: var(--soil);
  color: var(--cream);
  font-family: var(--body);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--soil); min-height: 100vh; font-size: 20px; line-height: 1.45; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; }

/* ---------- Topo ---------- */
.topbar {
  position: absolute; z-index: 5; inset: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) max(24px, 4vw) 0;
  text-shadow: var(--outline);
}
.studio-mark { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; font-size: 20px; text-shadow: var(--outline-thin); }
.studio-mark img { width: 44px; height: auto; border: 3px solid var(--ink); image-rendering: auto; }
.home-link { font-size: 18px; font-weight: 700; text-shadow: var(--outline-thin); text-decoration: none; padding: 6px 2px; border-bottom: 3px solid transparent; }
.home-link:hover { border-bottom-color: var(--cream); }

/* ---------- Hero: a cena do jogo ---------- */
.hero { position: relative; overflow: hidden; height: clamp(600px, 100svh, 62.5vw); min-height: 600px; background: #234a73; }
.scene { position: absolute; inset: 0; container-type: size; }
/* Palco sempre em 16:9 cobrindo o hero, ancorado no chão. Assim os sprites (todos 1920×1080)
   ficam alinhados e as coordenadas em % batem com o desenho. */
.stage {
  position: absolute; left: 50%; bottom: 0;
  width: max(100cqw, 177.78cqh); aspect-ratio: 16 / 9;
  transform: translateX(-50%);
}
/* No desktop a árvore fica um pouco à direita, para o painel do jogo não cobrir o machado. */
@media (min-width: 901px) {
  .stage { left: 58%; width: max(116cqw, 177.78cqh); }
}
.layer { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.tree.hit { animation: tree-hit .16s steps(2) 1; }
.axe { transform-origin: 57.3% 77.3%; }
.axe.swing { animation: axe-swing .24s ease-out 1; }

/* Área clicável = tronco do sprite (x 43,6–56,6%, y 0–92%) */
.chop-target {
  position: absolute; left: 43.6%; top: 6%; width: 13%; height: 86%;
  background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.chop-target:focus-visible { outline: 4px dashed var(--cream); outline-offset: 0; }

.fx { position: absolute; inset: 0; pointer-events: none; }
.pop {
  position: absolute; display: flex; align-items: center; gap: 6px;
  font-family: var(--pixel); font-size: 22px; color: var(--cream); text-shadow: var(--outline);
  transform: translate(-50%, -50%); animation: pop-up .8s ease-out forwards;
}
.pop img { width: 34px; image-rendering: pixelated; }
.leaf { position: absolute; top: -2%; width: 2.6%; min-width: 22px; image-rendering: pixelated; animation: leaf-fall var(--fall, 1.6s) ease-in forwards; }

.wallet {
  position: absolute; z-index: 2; right: max(24px, 6vw); top: 104px;
  width: 232px; height: 76px; padding: 0 22px 4px 18px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: url("assets/scene/wood-panel.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 0 #172a27a8);
  font-family: var(--pixel); font-size: 20px; line-height: 1; text-shadow: var(--outline);
}
.wallet img { width: 46px; image-rendering: pixelated; }
.wallet.bump { animation: bump .18s steps(2) 1; }
.chop-hint {
  position: absolute; z-index: 2; right: max(24px, 6vw); top: 188px; width: 232px; margin: 0;
  text-align: center; font-size: 18px; font-weight: 700; text-shadow: var(--outline-thin);
}

.game-panel {
  position: absolute; z-index: 3; left: max(24px, 5vw); top: 50%; transform: translateY(-46%);
  width: min(440px, 36vw); padding: 30px 30px 26px;
  background: var(--hud); border: 3px solid var(--moss); outline: 3px solid var(--ink);
  box-shadow: 0 7px 0 #172a27b3;
}
h1, h2 { font-family: var(--pixel); font-weight: 400; margin: 0; text-shadow: 0 4px 0 var(--ink); }
h1 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.35; }
.game-panel p { margin: 18px 0 0; color: var(--cream-soft); max-width: 34ch; }
.game-panel .wood-button { margin-top: 26px; }
.game-panel .fine { margin-top: 16px; font-size: 17px; color: #c8c3a3; }

.wood-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 14px 26px 16px;
  font-family: var(--pixel); font-size: 15px; line-height: 1.3; text-decoration: none; color: var(--cream); text-shadow: var(--outline);
  background: var(--bark); border: 3px solid var(--bark-edge); border-radius: 10px;
  box-shadow: inset 3px 3px var(--bark-hi), inset -3px -4px var(--bark-lo), 0 5px #182921a6;
  cursor: pointer;
}
.wood-button:hover { background: #a85b31; }
.wood-button:active { transform: translateY(3px); box-shadow: inset 3px 3px var(--bark-hi), inset -3px -4px var(--bark-lo), 0 2px #182921a6; }
.wood-button.small { min-height: 48px; padding: 12px 20px 14px; font-size: 12px; }
.wood-button.ready { animation: ready .5s steps(3) 2; }

/* ---------- Estúdio ---------- */
.studio {
  display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 560px); gap: clamp(32px, 6vw, 80px);
  align-items: center; justify-content: center;
  padding: clamp(64px, 9vw, 120px) max(24px, 5vw) clamp(72px, 9vw, 120px);
}
.studio-portrait { position: relative; aspect-ratio: 640 / 618; }
.studio-logo { position: absolute; left: 18.5%; right: 18%; top: 19.5%; bottom: 19%; width: 63.5%; height: 61.5%; object-fit: cover; }
.studio-frame { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(0 6px 0 #0000004d); }
h2 { font-size: clamp(18px, 1.9vw, 24px); line-height: 1.45; }
.studio-copy p { margin: 18px 0 0; color: var(--cream-soft); max-width: 46ch; }
.studio-links { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 30px; }
.text-link { font-weight: 700; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.text-link:hover { color: #fff; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 24px max(24px, 5vw) max(24px, env(safe-area-inset-bottom));
  background: var(--soil-deep); color: #a99fb6; font-size: 16px;
}
.footer a { color: var(--cream-soft); }

/* ---------- Animações (só respondem ao clique) ---------- */
@keyframes tree-hit { 0% { transform: translateX(0); } 50% { transform: translateX(.35%); } 100% { transform: translateX(-.2%); } }
@keyframes axe-swing { 0% { transform: rotate(0); } 40% { transform: rotate(12deg); } 70% { transform: rotate(-3deg); } 100% { transform: rotate(0); } }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, -30%); } 10% { opacity: 1; } 65% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }
@keyframes leaf-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--drift, 40px), var(--drop, 55cqh)) rotate(var(--spin, 220deg)); }
}
@keyframes bump { 50% { transform: translateY(-3px); } }
@keyframes ready { 50% { transform: translateY(-4px); filter: brightness(1.15); } }

/* ---------- Tablet / celular ---------- */
@media (max-width: 900px) {
  .hero { height: auto; min-height: 0; background: var(--soil); }
  .scene { position: relative; height: min(72svh, 560px); min-height: 400px; }
  .game-panel { position: relative; left: auto; top: auto; transform: none; width: auto; margin: -28px 16px 0; }
  .wallet { right: auto; left: 16px; top: 76px; width: 196px; height: 64px; font-size: 17px; padding: 0 18px 4px 14px; }
  .wallet img { width: 38px; }
  .chop-hint { right: auto; left: 16px; top: 146px; width: 196px; font-size: 16px; }
  .studio { grid-template-columns: 1fr; justify-items: start; padding-top: 64px; }
  .studio-portrait { width: min(240px, 64vw); }
}
@media (max-width: 480px) {
  body { font-size: 18px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .studio-mark { font-size: 15px; gap: 10px; }
  .studio-mark img { width: 36px; }
  .home-link { font-size: 15px; }
  .game-panel { padding: 24px 20px 22px; }
  h1 { font-size: 22px; }
  .game-panel .wood-button { width: 100%; }
  .studio { padding-left: 16px; padding-right: 16px; }
  .footer { padding-left: 16px; padding-right: 16px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .tree.hit, .axe.swing, .wallet.bump, .wood-button.ready { animation: none; }
  .pop { animation: fade-only .7s linear forwards; }
  .leaf { display: none; }
  @keyframes fade-only { 0% { opacity: 1; } 100% { opacity: 0; } }
}
