h1 {
  margin: 40px auto 30px;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  text-align: center;
}

.container {
  background: #394555;
  padding: 25px;
  margin: 40px auto;
  border-radius: 10px;
  width: calc(100% - 30px);
  max-width: 520px;
  box-shadow: 0 0 15px rgba(0,0,0,.3);
  border: 1px solid #3a3a5e;
}

h2 {
  margin: 0 0 10px;
  font-size: 17px;
  text-align: left;
}

p {
  line-height: 1.6;
}

.hidden {
  display: none;
}

.intro {
  margin: 0 0 18px;
  font-size: 14px;
  color: #cbd5e1;
}

select {
  padding: 10px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
}

button {
  width: 100%;
  padding: 12px;
  font-size: 17px;
  border: none;
  border-radius: 5px;
  background-color: #4caf50;
  color: #fff;
  cursor: pointer;
  margin-top: 10px;
}

button:hover {
  background-color: #45a049;
}

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

button:disabled:hover {
  background-color: #4caf50;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.controls select {
  flex: 1;
  min-width: 120px;
}

.controls button {
  flex: 1;
  width: auto;
  min-width: 120px;
  margin-top: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.stat-item {
  background: #2d3a4a;
  padding: 10px 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

#targetBox {
  margin-bottom: 12px;
  padding: 14px 10px;
  background: #2d3a4a;
  border-radius: 10px;
  text-align: center;
}

#targetLabel {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #cbd5e1;
}

#target {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.1;
  color: #c9a84c;
}

#target.solved {
  color: #2ecc71;
}

#targetNote {
  min-height: 18px;
  font-size: 13px;
  color: #cbd5e1;
}

#message {
  min-height: 44px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.msg-good {
  color: #2ecc71;
}

.msg-bad {
  color: #ff8a80;
}

.msg-info {
  color: #cbd5e1;
}

#tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.tile {
  margin-top: 0;
  padding: 0;
  height: 68px;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  background: #2d3a4a;
  border: 2px solid #4a5a70;
  border-radius: 10px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.tile:hover {
  background: #364659;
  transform: translateY(-2px);
}

.tile:disabled:hover {
  background: #2d3a4a;
  transform: none;
}

.tile.selected {
  background: #4a5a70;
  border-color: #c9a84c;
}

#operators {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.op-btn {
  margin-top: 0;
  padding: 0;
  height: 56px;
  font-size: 28px;
  font-weight: 700;
  background: #1e252e;
  border: 2px solid #4a5a70;
  border-radius: 10px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.op-btn:hover {
  background: #2a343f;
  transform: translateY(-2px);
}

.op-btn:disabled:hover {
  background: #1e252e;
  transform: none;
}

.op-btn.selected {
  background: #4caf50;
  border-color: #c9a84c;
}

.tile.hint,
.op-btn.hint {
  border-color: #2ecc71;
  animation: hintPulse 1s ease-in-out infinite;
}

@keyframes hintPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, .6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.actions button {
  margin-top: 0;
  padding: 11px 6px;
  font-size: 15px;
  background: #2d3f52;
}

.actions button:hover {
  background: #3a5169;
}

.actions button:disabled:hover {
  background: #2d3f52;
}

.panel {
  margin-top: 14px;
  padding: 14px 16px;
  background: #2d3a4a;
  border-radius: 10px;
}

.panel ol {
  margin: 0;
  padding-left: 22px;
  font-size: 16px;
  line-height: 1.8;
}

.panel p {
  margin: 0 0 6px;
  font-size: 14px;
  color: #cbd5e1;
}

@media (max-width: 400px) {
  .container {
    padding: 15px;
  }

  #target {
    font-size: 46px;
  }

  .tile {
    height: 60px;
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile.hint,
  .op-btn.hint {
    animation: none;
  }
}
