:root {
  --bg: #dbeafe;
  --panel: rgba(255, 255, 255, 0.85);
  --accent: #f59e0b;
  --accent2: #22c55e;
  --text: #0f172a;
  --glow: rgba(59, 130, 246, 0.25);
}

* {
  box-sizing: border-box;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
}

#ui {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  position: relative;
}

@media (orientation: landscape) {
  #ui {
    width: 100vw;
    height: 100dvh;
    height: 100svh;
  }
  .touch {
    padding: calc(20px + env(safe-area-inset-top)) calc(28px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(28px + env(safe-area-inset-left));
  }
}

@supports (-moz-appearance: none) {
  @media (orientation: landscape) {
    #ui {
      height: 100dvh;
      height: 100svh;
    }
    .touch {
      padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
  }
}


#game {
  width: 100%;
  height: 100%;
  display: block;
  background: radial-gradient(circle at 20% 20%, #bfdbfe 0%, #dbeafe 65%);
}

.touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
}

.touch-left,
.touch-right {
  display: grid;
  gap: 12px;
  pointer-events: auto;
}

.touch-left {
  grid-template-columns: repeat(2, 1fr);
  background: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
}

.touch-right {
  grid-template-columns: repeat(1, 1fr);
  background: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
}

.touch button {
  font-size: 18px;
  font-weight: 800;
  padding: 16px 10px;
  border: none;
  border-radius: 16px;
  color: #0f172a;
  background: linear-gradient(180deg, #f8fafc, #e2e8f0);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35), 0 10px 18px rgba(15, 23, 42, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
  min-height: 58px;
  min-width: 70px;
}

.touch button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3), 0 4px 10px rgba(0, 0, 0, 0.3);
}

#switch {
  background: #2563eb;
  color: #fff;
}

#action {
  background: #e11d48;
  color: #fff;
}

#jump {
  background: #22c55e;
  color: #fff;
}

#overlay,
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(219, 234, 254, 0.85);
}

#overlay.hidden,
.overlay.hidden {
  display: none;
}

.panel {
  background: var(--panel);
  padding: 24px;
  border-radius: 18px;
  width: min(420px, 92vw);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.panel h1 {
  margin-top: 0;
  font-size: 22px;
}

.panel p {
  margin: 10px 0 16px;
}

.panel button {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  font-weight: 600;
}

.bullets {
  text-align: left;
  margin: 0 0 16px;
  padding-left: 18px;
}

.panel-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#leaderboard-list {
  text-align: left;
  padding-left: 18px;
}
