*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #f5f5f5;
}

#app {
  height: 100vh;
  width: 100vw;
  max-height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #222 0, #111 60%);
}

.top-bar,
.bottom-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  gap: 0.4rem;
}

.top-bar {
  justify-content: space-between;
}

.bottom-bar {
  justify-content: space-between;
  font-size: 0.7rem;
  color: #aaa;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.brand {
  border: none;
  background: #f5f5f5;
  color: #111;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.brand:active {
  transform: translateY(1px);
}

.game-switcher {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.nav-btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.7);
  color: #f5f5f5;
  border-radius: 999px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  min-width: 2rem;
}

.nav-btn:active {
  transform: translateY(1px);
}

.game-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
  text-align: right;
}

.game-area {
  flex: 1 1 auto;
  padding: 0.25rem 0.5rem 0.4rem;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(145deg, #171717, #111);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Shared game layout */

.game-root {
  width: 100%;
  height: 100%;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.game-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.game-header-left {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.game-label {
  font-size: 0.7rem;
  color: #999;
}

.game-value {
  font-weight: 600;
  color: #fff;
}

.game-main {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-radius: 0.6rem;
  background: radial-gradient(circle at center, #191919 0, #101010 60%);
  overflow: hidden;
  position: relative;
}

.game-main-inner {
  flex: 1;
  position: relative;
}

.game-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.game-button {
  border-radius: 999px;
  border: none;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 4rem;
}

.game-button.primary {
  background: #f5f5f5;
  color: #111;
}

.game-button.secondary {
  background: #262626;
  color: #eee;
}

/* Tap grid games */

.tap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.15rem;
  width: 100%;
  height: 100%;
  padding: 0.3rem;
}

.tap-cell {
  border-radius: 0.35rem;
  background: #161616;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #666;
}

.tap-cell.active {
  background: #16a34a;
  color: #f5f5f5;
}

.tap-cell.bad {
  background: #b91c1c;
  color: #f5f5f5;
}

/* Reaction target */

.reaction-target {
  width: 5rem;
  height: 5rem;
  border-radius: 999px;
  background: #262626;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.75rem;
}

.reaction-target.ready {
  background: #22c55e;
  color: #0a0a0a;
}

.reaction-target.too-soon {
  background: #b91c1c;
}

/* Dodge games */

.dodge-board {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.dodge-player {
  position: absolute;
  width: 14%;
  aspect-ratio: 1 / 1;
  border-radius: 0.4rem;
  background: #facc15;
  left: 43%;
  bottom: 5%;
}

.dodge-obstacle {
  position: absolute;
  width: 12%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: #ef4444;
}

/* Memory game */

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.2rem;
  padding: 0.3rem;
  width: 100%;
  height: 100%;
}

.memory-card {
  border-radius: 0.4rem;
  background: #171717;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: transparent;
}

.memory-card.revealed {
  background: #22c55e;
  color: #0a0a0a;
}

.memory-card.matched {
  background: #16a34a;
  color: #0a0a0a;
}

/* Tapping & timing */

.tap-button-big {
  width: 6rem;
  height: 6rem;
  border-radius: 999px;
  background: #22c55e;
  border: none;
  color: #0a0a0a;
  font-size: 1.2rem;
  margin: auto;
}

/* Path & maze-ish */

.path-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.1rem;
  padding: 0.3rem;
  width: 100%;
  height: 100%;
}

.path-cell {
  border-radius: 0.3rem;
  background: #181818;
}

.path-cell.path {
  background: #27272a;
}

.path-cell.player {
  background: #facc15;
}

.path-cell.goal {
  background: #22c55e;
}

/* Pong-ish single player */

.paddle-board {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 100%;
  margin: 0 auto;
}

.paddle {
  position: absolute;
  width: 30%;
  height: 0.4rem;
  border-radius: 999px;
  background: #e5e5e5;
  bottom: 8%;
  left: 35%;
}

.ball {
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #22c55e;
}

/* Flappy-ish */

.flappy-board {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 100%;
  margin: 0 auto;
}

.flappy-bird {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.35rem;
  background: #facc15;
}

.flappy-pipe {
  position: absolute;
  width: 1.1rem;
  background: #22c55e;
}

/* Slider puzzle / 2048-lite */

.slide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.15rem;
  padding: 0.3rem;
  width: 100%;
  height: 100%;
}

.slide-cell {
  border-radius: 0.4rem;
  background: #18181b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e5e5;
  font-size: 0.85rem;
}

.slide-cell.value-2 {
  background: #27272a;
}

.slide-cell.value-4 {
  background: #22c55e;
  color: #0a0a0a;
}

.slide-cell.value-8,
.slide-cell.value-16 {
  background: #16a34a;
  color: #0a0a0a;
}

/* Meta text */

.game-meta {
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-index {
  font-variant-numeric: tabular-nums;
}