:root {
  --bg: #1a1a2e;
  --panel: #23233b;
  --text: #e8e8f0;
  --muted: #9a9ab0;
  --border: #3a3a55;
  --gray: #5a5a72;
  --yellow: #c9a227;
  --green: #4a9e5c;
  --accent: #5b7cfa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: 2px;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 2px;
}
.dot.gray { background: var(--gray); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }
.dot.auto { background: rgba(232, 232, 240, 0.55); }

.row {
  display: flex;
  gap: clamp(4px, 1vw, 6px);
  margin-bottom: 8px;
  align-items: center;
}

.row input {
  width: clamp(72px, 24vw, 110px);
  font-size: clamp(0.9rem, 3.5vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  padding: 10px 4px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.row input.invalid { border-color: #c0504d; }
.row input:focus { border-color: var(--accent); }
.row input::placeholder { color: var(--muted); font-weight: 400; letter-spacing: 0; }
.row input:disabled { opacity: 0.4; }

.tile {
  width: clamp(36px, 12vw, 44px);
  height: clamp(36px, 12vw, 44px);
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  font-weight: 700;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s, border-color 0.1s, transform 0.05s;
  padding: 0;
  position: relative;
}

/* carried down from an earlier row - click to override */
.tile.auto::after {
  content: '';
  position: absolute;
  top: 3px; right: 3px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}
.tile:hover:not(:disabled) { transform: scale(1.06); }
.tile:disabled { cursor: default; opacity: 0.45; }

.tile[data-state="1"] { background: var(--gray); border-color: var(--gray); }
.tile[data-state="2"] { background: var(--yellow); border-color: var(--yellow); color: #1a1a2e; }
.tile[data-state="3"] { background: var(--green); border-color: var(--green); color: #fff; }

.row.locked .tile { opacity: 0.25; }

.controls {
  margin: 16px 0;
}

.btn {
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }

.results h2 {
  font-size: 1.15rem;
  margin: 24px 0 10px;
}
.results h2 small {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--panel);
  border: 2px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: clamp(0.8rem, 3vw, 0.95rem);
  letter-spacing: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.1s, transform 0.05s;
}
.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 12px;
}
