:root {
  --bg: #070913;
  --panel: #0e1424;
  --panel-border: #27304b;
  --text: #d8e2ff;
  --muted: #94a1c7;
  --accent: #2ef6b6;
  --accent-2: #5d7dff;
  --danger: #ff5f8a;
  --shadow: rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #16203b 0%, var(--bg) 55%);
  min-height: 100vh;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(46, 246, 182, 0.35);
}

.brand-tagline {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#home-title {
  margin-top: 0;
  letter-spacing: 0.04em;
}

.intro-copy {
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.game-card,
.game-screen {
  background: linear-gradient(180deg, #111a31 0%, var(--panel) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
}

.game-card {
  padding: 1rem;
}

.game-card h3 {
  margin-top: 0;
  color: var(--accent);
}

.game-card p {
  color: var(--muted);
  min-height: 42px;
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent-2);
  color: #eff2ff;
}

button:hover,
button:focus-visible {
  border-color: #cbd5ff;
  filter: brightness(1.08);
}

.game-screen {
  padding: 1rem;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.8rem;
}

.game-topbar h2 {
  margin: 0;
}

.score-strip {
  display: flex;
  gap: 1rem;
  color: var(--muted);
}

.instructions-panel,
.playfield-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(7, 10, 22, 0.65);
}

.instructions-panel h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.instructions-panel p {
  margin: 0;
  color: var(--muted);
}

.playfield-placeholder {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  border: 1px dashed #4a587f;
  border-radius: 8px;
  text-align: center;
  color: #b9c6f4;
}

.snake-board {
  width: min(480px, 100%);
  aspect-ratio: 1 / 1;
  display: grid;
  gap: 2px;
  background: #1f2844;
  padding: 2px;
  border-radius: 8px;
}

.snake-cell {
  background: #090f20;
}

.snake-head {
  background: #43ffc1;
}

.snake-body {
  background: #1ecf96;
}

.snake-food {
  background: #ff6f9d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.game-status {
  margin: 0;
  color: #dbe5ff;
}

.playfield-placeholder.game-over .game-status {
  color: #ff89ad;
  font-weight: 700;
}

.playfield-placeholder.match-win .game-status {
  color: #8fffcf;
  font-weight: 700;
}

.pong-board {
  width: min(720px, 100%);
  aspect-ratio: 12 / 7;
  position: relative;
  background: linear-gradient(180deg, #0b1328 0%, #060a17 100%);
  border: 1px solid #2a375d;
  border-radius: 8px;
  overflow: hidden;
}

.pong-center-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    rgba(228, 237, 255, 0.55) 0 16px,
    transparent 16px 28px
  );
}

.pong-paddle {
  position: absolute;
  border-radius: 4px;
}

.pong-player {
  left: 20px;
  background: #58f7c1;
}

.pong-cpu {
  right: 20px;
  background: #ff8db4;
}

.pong-ball {
  position: absolute;
  border-radius: 50%;
  background: #f4f7ff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
}

.breakout-board {
  width: min(720px, 100%);
  aspect-ratio: 3 / 2;
  position: relative;
  background: linear-gradient(180deg, #0d152e 0%, #060a17 100%);
  border: 1px solid #2a375d;
  border-radius: 8px;
  overflow: hidden;
}

.breakout-hud {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 2;
  font-size: 0.9rem;
  font-weight: 700;
  color: #c8d6ff;
  text-shadow: 0 0 8px rgba(90, 140, 255, 0.4);
}

.breakout-brick-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.breakout-brick {
  position: absolute;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.breakout-brick-row-0 {
  background: linear-gradient(180deg, #ff7eb3, #d94a8c);
}

.breakout-brick-row-1 {
  background: linear-gradient(180deg, #ffd56f, #e8a62e);
}

.breakout-brick-row-2 {
  background: linear-gradient(180deg, #9bffcf, #3dd4a4);
}

.breakout-brick-row-3 {
  background: linear-gradient(180deg, #8ecbff, #4a8fe8);
}

.breakout-brick-row-4 {
  background: linear-gradient(180deg, #c4a8ff, #8b6ae0);
}

.breakout-paddle {
  position: absolute;
  border-radius: 4px;
  background: linear-gradient(180deg, #58f7c1, #2bc894);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.breakout-ball {
  position: absolute;
  border-radius: 50%;
  background: #f4f7ff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
}

.action-row {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

#pause-btn {
  background: #58668f;
}

#restart-btn {
  background: var(--danger);
}

@media (max-width: 680px) {
  .game-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-row {
    flex-wrap: wrap;
  }
}
