:root {
  --bg: #f5f2ea;
  --panel: #fff3cc;
  --accent: #0b4a6f;
  --text: #111111;
  --grid-bg: #efe6d4;
  --cell-bg: #ffffff;
  --cell-border: #b7aa93;
  --correct: #8fe6b2;
  --wrong: #ef7d7d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #fff7e0, var(--bg));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3.5vw, 20px);
  overflow-y: scroll;
}

.app {
  width: min(700px, 100%);
  max-width: 100%;
  display: grid;
  gap: clamp(12px, 3.5vw, 20px);
  overflow-x: clip;
}

.panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  padding: clamp(10px, 3vw, 16px) clamp(12px, 4vw, 20px);
  border-radius: 12px;
  border: 1px solid #d7c9ab;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
  gap: 12px;
  max-width: 100%;
  overflow-x: clip;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.timer {
  font-size: 1.05rem;
  font-weight: 600;
}

.board {
  background: var(--grid-bg);
  border-radius: 16px;
  padding: clamp(10px, 3.5vw, 18px);
  border: 1px solid #ccbfa6;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(6px, 2.5vw, 10px);
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.cell {
  background: var(--cell-bg);
  border: 2px solid var(--cell-border);
  border-radius: clamp(8px, 2.5vw, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 7vw, 1.9rem);
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  user-select: none;
  color: #0f0f0f;
  min-width: 0;
  outline: none;
}

.cell:disabled {
  opacity: 1;
  cursor: default;
}

.cell:hover {
  transform: scale(1.02);
  border-color: var(--accent);
}

.cell.flash {
  box-shadow: 0 0 0 2px rgba(11, 74, 111, 0.9);
}

.results {
  background: #fffdf7;
  border-radius: 12px;
  padding: clamp(10px, 3vw, 14px) clamp(12px, 3.5vw, 18px);
  border: 1px solid #d7c9ab;
  max-width: 100%;
}

.results h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3f2f18;
}

#resultsList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  font-weight: 600;
}

@media (max-width: 520px) {
  .panel {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .controls {
    width: 100%;
  }

  .controls button {
    flex: 1;
  }

  .timer {
    text-align: center;
  }

  .grid {
    gap: clamp(5px, 2.2vw, 8px);
  }

  .cell {
    border-radius: clamp(8px, 2.5vw, 10px);
  }
}

@media (max-width: 416px) {
  .controls {
    flex-direction: column;
  }

  .controls button {
    width: 100%;
  }
}
