html,
body {
  margin: 0;
  padding: 0;
  background: #f8fbff;
  color: #23364a;
  font-family: Arial, Helvetica, sans-serif;
}

.pattern-game {
  box-sizing: border-box;
  min-height: 620px;
  padding: 14px;
  background: linear-gradient(#fbfdff, #edf7ff);
}

.pattern-shell {
  max-width: 940px;
  margin: 0 auto;
}

.pattern-topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.pattern-stat {
  min-height: 46px;
  border: 1px solid #b3c9de;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(35, 54, 74, 0.12);
  color: #60778e;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pattern-stat strong {
  margin-top: 2px;
  color: #173b5b;
  font-size: 20px;
}

.rules-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.rule-card {
  min-height: 82px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(35, 54, 74, 0.12);
  cursor: pointer;
  overflow: hidden;
}

.rule-card.is-active {
  border-color: #163b5b;
}

.rule-color {
  height: 11px;
}

.rule-body {
  padding: 8px 10px;
  text-align: left;
}

.rule-name {
  color: #183c5b;
  font-size: 16px;
  font-weight: bold;
}

.rule-example {
  margin-top: 4px;
  color: #5b7188;
  font-size: 13px;
}

.game-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.tile-board,
.side-panel {
  border: 1px solid #b4cbe0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35, 54, 74, 0.12);
}

.tile-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.number-tile {
  aspect-ratio: 1 / 0.72;
  border: 2px solid #adc2d6;
  border-radius: 8px;
  background: #f9fcff;
  color: #173b5b;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
}

.number-tile:hover,
.number-tile:focus {
  border-color: #276da4;
  outline: none;
  transform: translateY(-1px);
}

.number-tile.is-correct {
  color: #fff;
  border-color: rgba(0, 0, 0, 0.25);
}

.number-tile.is-wrong {
  animation: shake 0.22s linear;
  border-color: #d85042;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.side-panel {
  padding: 12px;
}

.feedback {
  min-height: 58px;
  padding: 10px;
  border-radius: 6px;
  background: #f2f7fb;
  color: #24445f;
  font-weight: bold;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.feedback.correct {
  background: #e0f5dd;
  color: #23601d;
}

.feedback.wrong {
  background: #ffe8e2;
  color: #8f3b2f;
}

.progress-list {
  margin: 12px 0;
  display: grid;
  gap: 6px;
}

.progress-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 6px;
  color: #425c73;
  font-size: 13px;
  font-weight: bold;
}

.progress-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.pattern-button {
  width: 100%;
  height: 34px;
  margin-top: 7px;
  border: 1px solid #829bb4;
  border-radius: 5px;
  background: #fff;
  color: #173b5b;
  font-weight: bold;
  cursor: pointer;
}

.pattern-button:hover {
  background: #eaf6ff;
}

@media (max-width: 760px) {
  .pattern-topbar,
  .rules-panel,
  .game-panel {
    grid-template-columns: 1fr;
  }

  .pattern-topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
