:root {
  --bg: #111;
  --surface: #1a1a1a;
  --text: #fff;
  --muted: rgba(255,255,255,0.75);
  --accent: #e74c3c;
  --accent-hover: #c0392b;
  --accent-glow: rgba(231,76,60,0.45);
  --gold: #f1c40f;
  --radius: 999px;
  --shadow: 0 4px 12px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%; min-height: 100%;
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  scroll-behavior: smooth;
}

/* Landing */
.landing { display: block; }
body.playing .landing { display: none; }

.nav {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 4vw;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
}
.logo-icon { width: 28px; height: 28px; }

.btn-play {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn-play:hover { transform: translateY(-2px); background: var(--accent-hover); box-shadow: 0 6px 18px var(--accent-glow); }

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 6rem 4vw;
  text-align: center;
  background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.72)), url('../assets/img/hero-bg.jpg') center/cover no-repeat;
}

.hero-content {
  max-width: 760px;
  animation: fadeInUp 0.8s ease-out both;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  margin: 0 0 0.75rem;
  text-shadow: 0 4px 14px rgba(0,0,0,0.7);
}
.hero p {
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  line-height: 1.55;
  margin: 0 auto 1.75rem;
  max-width: 620px;
  color: var(--muted);
}
.hero-cta { padding: 0.9rem 2.6rem; font-size: 1.25rem; }

.features, .howto {
  padding: 5rem 4vw;
  background: var(--bg);
}
.features:nth-child(even), .howto { background: var(--surface); }
.features h2, .howto h2 {
  text-align: center;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 2.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
}
.feature-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon { width: 52px; height: 52px; color: var(--accent); margin-bottom: 1rem; }
.feature-card h3 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.5; }

.howto-list {
  list-style: none;
  max-width: 560px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.howto-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
.howto-icon { width: 28px; height: 28px; color: var(--gold); flex-shrink: 0; }
.howto-list b { color: var(--gold); }

footer.landing {
  padding: 2rem 4vw;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Game */
#game {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
}
body.playing #game { display: block; }
#game canvas { display: block; width: 100%; height: 100%; }

#ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: none;
}
body.playing #ui { display: block; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: auto;
}
.screen.active, .screen.visible { display: flex; }

#menu {
  background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.7)), url('../ipi-generated/menu-bg.jpg') center/cover no-repeat;
}
#menu h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin: 0 0 0.5rem;
  text-shadow: 0 4px 12px rgba(0,0,0,0.7);
}
#menu p { font-size: clamp(1rem, 2.5vw, 1.4rem); max-width: 560px; margin: 0 1rem 1.5rem; opacity: 0.95; }
#menu button, #game-over button {
  padding: 0.85rem 2.4rem;
  font-size: 1.3rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--accent-glow);
  transition: transform .1s, box-shadow .1s;
}
#menu button:hover, #game-over button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }
.controls-hint { margin-top: 1.2rem; font-size: 0.9rem; opacity: 0.8; }

#hud {
  inset: 0.6rem 1rem auto 1rem;
  height: auto;
  flex-direction: row;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: clamp(0.85rem, 2.2vw, 1.1rem);
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.7);
  pointer-events: none;
}
#hud span { background: rgba(0,0,0,0.35); padding: 0.35rem 0.7rem; border-radius: var(--radius); }
#hud b { color: var(--gold); }

#level-msg {
  background: rgba(0,0,0,0.45);
  animation: fadeOut 1.8s forwards;
}
#level-msg h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 0.5rem; text-shadow: 0 3px 8px rgba(0,0,0,0.7); }
#level-msg p { font-size: 1.1rem; opacity: 0.9; }

#game-over { background: rgba(0,0,0,0.78); }
#game-over h2 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 0.5rem; }
#game-over p { font-size: 1.3rem; margin-bottom: 1.5rem; }

#touch {
  inset: auto 0 1rem 0;
  height: auto;
  flex-direction: row;
  justify-content: space-between;
  padding: 0 1rem;
  pointer-events: none;
}
.touch-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.22);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
  pointer-events: auto;
  user-select: none;
}
#touch-jump { margin-left: auto; }

@keyframes fadeOut {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
