:root {
  --accent: #4c8bf5;
  --bg: #f5f7fa;
  --dark: #1f2937;
  --card: #ffffff;
  --radius: 16px;
}

/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--dark);
}

/* Layout */
.center,
.game-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Cards */
.game-card {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  text-align: center;
}

.game-card-wide {
  max-width: 900px;
}

/* Logo */
.logo {
  max-width: 180px;
  margin-bottom: 12px;
}

/* Headings */
h1 {
  margin-top: 0;
}

.subtitle {
  margin-top: -10px;
  opacity: 0.7;
}

/* Navigation */
.back {
  display: inline-block;
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--accent);
  font-weight: bold;
}

/* Game elements */
.problem {
  font-size: 2.4rem;
  font-weight: bold;
  margin: 24px 0;
  line-height: 1.3;
}

.timer {
  font-size: 1.5rem;
  font-weight: bold;
}

.stats {
  margin-top: 20px;
  font-size: 1.1rem;
}

.finished {
  margin-top: 16px;
  font-size: 1.6rem;
  font-weight: bold;
  color: green;
}

/* Inputs */
input {
  font-size: 1.6rem;
  padding: 12px;
  width: 140px;
  text-align: center;
  border-radius: 12px;
  border: 2px solid #ccc;
}

/* Buttons */
button,
.game-tile a {
  display: inline-block;
  margin-top: 16px;
  padding: 14px 30px;
  font-size: 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Grid (index page) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.game-tile {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  text-align: center;
  transition: transform .15s ease;
}

.game-tile:hover {
  transform: translateY(-4px);
}

.game-tile h2 {
  margin-top: 0;
}

.game-tile p {
  font-size: 0.95rem;
  opacity: 0.8;
}

.game-tile.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Mobile */
@media (max-width: 480px) {
  .problem {
    font-size: 2rem;
  }

  input {
    width: 100%;
  }

  .game-card {
    padding: 24px;
  }
}
