/* ===========================================================
   Dino Run — styles
   Mobile-first, compatible iOS Safari / Android Chrome & Firefox
   =========================================================== */

:root {
  --bg-1: #f4f4f4;
  --bg-2: #e6e6e6;
  --surface: #ffffff;
  --text: #202020;
  --text-dim: #6b6b6b;
  --primary: #444444;
  --primary-contrast: #ffffff;
  --border: #d6d6d6;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #141414; --bg-2: #1c1c1c; --surface: #1f1f1f;
    --text: #eeeeee; --text-dim: #a5a5a5; --primary: #cfcfcf; --primary-contrast: #141414;
    --border: #333333; --shadow: 0 8px 28px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  user-select: none;
}

.page {
  max-width: 680px; margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 14px calc(20px + var(--safe-bottom));
  min-height: 100dvh; display: flex; flex-direction: column;
}

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.game-title { font-size: 19px; margin: 0; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 42px; height: 42px; font-size: 18px; cursor: pointer; text-decoration: none;
  color: var(--text); display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.95); }

.canvas-wrap {
  position: relative; width: 100%; aspect-ratio: 600 / 180; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
#game-canvas { width: 100%; height: 100%; display: block; }

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; background: rgba(255,255,255,0.0); cursor: pointer; text-align: center;
}
.overlay.hidden { display: none; }
.overlay p { margin: 0; color: var(--text-dim); font-size: 14px; }
.overlay p:first-child { font-size: 34px; }
.over-title { font-size: 20px !important; font-weight: 800; color: var(--text) !important; }
#final-score { font-size: 13px !important; }

.btn { border: none; border-radius: 12px; font-weight: 700; cursor: pointer; transition: transform .08s ease; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: var(--primary-contrast); padding: 11px 20px; font-size: 14px; }

.touch-controls { display: flex; gap: 10px; margin-top: 14px; }
.touch-btn {
  flex: 1; padding: 16px 6px; font-size: 14px; background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
}

.tip { text-align: center; color: var(--text-dim); font-size: 12px; margin-top: 12px; }
kbd { background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11px; }

@media (min-width: 700px) {
  .touch-controls { display: none; }
}
