:root {
  --bg: #102418;
  --panel: rgba(255, 255, 255, 0.92);
  --ink: #173120;
  --muted: #597064;
  --accent: #ffb703;
  --accent-dark: #d98900;
  --leaf: #66bb6a;
  --danger: #e76f51;
  --shadow: 0 24px 70px rgba(0,0,0,.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(102,187,106,.45), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(255,183,3,.30), transparent 26rem),
    linear-gradient(135deg, #08140e, var(--bg));
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-x: hidden;
}

.app-shell {
  width: min(1060px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 460px);
  gap: 24px;
  align-items: center;
}
.hero { color: white; padding: 20px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 800; margin: 0 0 8px; }
h1 { font-size: clamp(3rem, 8vw, 6rem); line-height: .9; margin: 0 0 16px; text-shadow: 0 8px 22px rgba(0,0,0,.3); }
.intro { max-width: 32rem; color: rgba(255,255,255,.82); font-size: 1.12rem; line-height: 1.55; }

button { font: inherit; }
.ghost-btn, #messageBtn, #startBtn, .player-row button {
  border: 0; border-radius: 999px; background: var(--accent); color: #2d2100; font-weight: 900;
  padding: 13px 20px; box-shadow: 0 10px 24px rgba(0,0,0,.22); cursor: pointer;
  transition: transform .16s ease, filter .16s ease;
}
.ghost-btn:hover, #messageBtn:hover, #startBtn:hover, .player-row button:hover { transform: translateY(-1px); filter: brightness(1.04); }

.player-card, .mini-panel {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px;
  padding: 14px;
  margin: 14px 0;
  color: white;
  backdrop-filter: blur(8px);
}
.player-card label, .mini-panel h2 { display: block; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; color: var(--accent); margin: 0 0 8px; }
.player-row { display: flex; gap: 8px; }
.player-row input { min-width: 0; flex: 1; border: 0; border-radius: 999px; padding: 12px 14px; font-weight: 800; color: var(--ink); }
.player-row button { padding: 10px 16px; }
#playerStatus { margin: 8px 0 0; color: rgba(255,255,255,.75); font-size: .9rem; }
.side-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.leaderboard, .achievements { margin: 0; padding-left: 22px; color: rgba(255,255,255,.9); font-size: .92rem; line-height: 1.55; }
.achievements { padding-left: 0; list-style: none; }
.achievements li { opacity: .55; }
.achievements li.unlocked { opacity: 1; font-weight: 800; }

.game-card { background: var(--panel); border: 1px solid rgba(255,255,255,.58); border-radius: 28px; box-shadow: var(--shadow); padding: 14px; backdrop-filter: blur(10px); }
.hud { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.hud > div { background: white; border-radius: 18px; padding: 10px 12px; min-height: 58px; display: grid; align-content: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.label { display: block; font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; font-weight: 800; }
.hud strong { font-size: 1.35rem; }
.next-dino { font-size: 1rem !important; line-height: 1; white-space: nowrap; }
.canvas-wrap { position: relative; width: 100%; aspect-ratio: 420 / 640; border-radius: 22px; overflow: hidden; background: #bfe8ff; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; background: linear-gradient(#a9e3ff 0 48%, #8fd47c 48% 100%); }
.controls { color: var(--muted); font-size: .95rem; line-height: 1.45; padding: 10px 4px 2px; }
.controls p { margin: 0; }

.message, .start-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(9, 24, 15, .42); padding: 20px; }
.message.hidden, .start-overlay.hidden { display: none; }
.message-box, .start-box { background: white; color: var(--ink); border-radius: 24px; padding: 26px; text-align: center; max-width: 320px; box-shadow: 0 24px 60px rgba(0,0,0,.36); animation: popIn .42s cubic-bezier(.2,1.4,.3,1); }
.message-box.win { animation: winDance .75s ease both; }
.message-box.loss { animation: lossDrop .55s ease both; }
.message-box h2, .start-box h2 { font-size: 2rem; margin: 0 0 8px; }
.message-box p, .start-box p { color: var(--muted); margin: 0 0 18px; }
.egg { display: block; font-size: 4rem; animation: eggWiggle 1.2s ease-in-out infinite; }

@keyframes popIn { from { transform: scale(.75); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes eggWiggle { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(7deg) scale(1.06); } }
@keyframes winDance { 0% { transform: scale(.65) rotate(-8deg); opacity: 0; } 55% { transform: scale(1.12) rotate(5deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes lossDrop { from { transform: translateY(-80px) rotate(-4deg); opacity: 0; } to { transform: translateY(0) rotate(0); opacity: 1; } }

@media (max-width: 820px) {
  body { padding: 12px; place-items: start center; }
  .app-shell { grid-template-columns: 1fr; gap: 12px; }
  .hero { padding: 8px 4px 0; text-align: center; }
  .intro { margin-inline: auto; font-size: 1rem; }
  .side-grid { grid-template-columns: 1fr; }
  .ghost-btn { display: none; }
  .game-card { border-radius: 22px; padding: 10px; }
  .canvas-wrap { max-height: calc(100vh - 220px); margin-inline: auto; width: min(100%, 420px); }
}
