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

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #e5e5e5;
  background: #121212;
  min-height: 100vh;
  padding: 0.5rem;
  -webkit-tap-highlight-color: transparent;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.back-link {
  font-size: 0.95rem;
  color: #a0a0a0;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus {
  color: #f5f5f5;
  text-decoration: underline;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  color: #f5f5f5;
}

.header-right {
  margin-left: auto;
}

#new-game {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid #505050;
  border-radius: 8px;
  background: #252525;
  color: #e5e5e5;
  cursor: pointer;
}

#new-game:hover,
#new-game:focus {
  background: #333;
  border-color: #666;
}

.main {
  max-width: 420px;
  margin: 0 auto;
}

.mm-board {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #252525;
  border: 2px solid #333;
  border-radius: 12px;
}

.mm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mm-row:last-child {
  margin-bottom: 0;
}

.mm-peg {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.mm-peg-empty {
  background: #1a1a1a;
  border: 2px dashed #404040;
}

.mm-peg-red { background: #dc2626; }
.mm-peg-orange { background: #ea580c; }
.mm-peg-yellow { background: #ca8a04; }
.mm-peg-green { background: #16a34a; }
.mm-peg-blue { background: #2563eb; }
.mm-peg-purple { background: #7c3aed; }

.mm-peg-clickable {
  cursor: pointer;
  border: 2px solid transparent;
}

.mm-peg-clickable:hover {
  border-color: #666;
}

.mm-feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-left: auto;
}

.mm-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.mm-dot-black { background: #e5e5e5; }
.mm-dot-white { background: #525252; border: 1px solid #737373; }

.mm-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #1e1e1e;
  border-radius: 8px;
}

.mm-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mm-color-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}

.mm-color-btn.selected {
  border-color: #f5f5f5;
  box-shadow: 0 0 0 1px #121212;
}

#submit {
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid #505050;
  border-radius: 8px;
  background: #252525;
  color: #e5e5e5;
  cursor: pointer;
  margin-bottom: 1rem;
}

#submit:hover:not(:disabled),
#submit:focus:not(:disabled) {
  background: #333;
  border-color: #666;
}

#submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mm-peg-small {
  width: 1.25rem;
  height: 1.25rem;
}

#win-message,
#lose-message {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#win-message { color: #86efac; }
#lose-message { color: #fca5a5; }

#win-message[hidden],
#lose-message[hidden] {
  display: none;
}

#secret-reveal {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

#secret-reveal[hidden] {
  display: none;
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: #707070;
  text-align: center;
}
