:root {
  --bg: #fff9ec;
  --panel: #ffffff;
  --ink: #33302a;
  --muted: #7a7263;
  --accent: #1f7a46;
  --accent-dark: #14572f;
  --melon: #e63950;
  --line: #eadfc6;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
}
a { color: var(--accent-dark); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 18px; }

.site-header { border-bottom: 1px solid var(--line); background: #fffdf6; }
.site-header .wrap { display: flex; align-items: center; gap: 26px; min-height: 58px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.logo em { color: var(--melon); font-style: normal; }
.main-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.main-nav a:hover { color: var(--accent); }

h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.2; margin: 22px 0 8px; }
h2 { font-size: 1.35rem; margin: 34px 0 10px; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 640px; }

/* game shell */
.game-shell {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 18px 0 8px;
}
.scorebar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.scorebar .stat { font-weight: 700; font-size: 1.05rem; }
.scorebar .stat span { color: var(--accent-dark); }
.next-box { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); }
.scorebar button, .btn {
  margin-left: auto; background: var(--accent); color: #fff; border: 0; cursor: pointer;
  font-weight: 700; padding: 9px 18px; border-radius: 10px; font-size: .98rem; text-decoration: none;
}
.scorebar button:hover, .btn:hover { background: var(--accent-dark); }
#restart { margin-left: auto; }
#fullscreen { margin-left: 8px; background: #fff; color: var(--accent-dark); border: 1px solid var(--line); }
#fullscreen:hover { background: #f3f3f3; color: var(--accent-dark); }
.game-shell:fullscreen { background: #0f0f10; border: 0; border-radius: 0; padding: 14px; display: flex; flex-direction: column; height: 100vh; }
.game-shell:fullscreen .scorebar { color: #f4f4f1; }
.game-shell:fullscreen .canvas-holder { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.game-shell:fullscreen canvas#game { width: auto; height: 100%; max-width: 100%; max-height: 100%; }
.canvas-holder { position: relative; }
canvas#game {
  display: block; width: 100%; max-width: 480px; margin: 0 auto; height: auto;
  border-radius: 10px; touch-action: none; cursor: pointer; background: #fff7e8;
}
.gameover {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; background: rgba(255,250,238,0.9);
  border-radius: 10px; text-align: center; padding: 20px;
}
.gameover[hidden] { display: none; }
.gameover h2 { margin: 0; }
.controls-hint { color: var(--muted); font-size: .92rem; text-align: center; margin: 8px 0 0; }

/* evolution chain */
.evolution { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 2px; margin: 12px 0; }
.evo-item { display: flex; flex-direction: column; align-items: center; width: 56px; }
.evo-item span { font-size: .72rem; color: var(--muted); text-align: center; }
.evo-arrow { color: var(--muted); padding-top: 12px; font-size: .85rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 18px 0; }
.faq dt { font-weight: 700; margin-top: 14px; }
.faq dd { margin: 4px 0 0; }
ul.tight li { margin-bottom: 6px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 36px; color: var(--muted); font-size: .92rem; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
