:root {
  --bg: #1a1d23;
  --panel: #232730;
  --panel-2: #2c313c;
  --text: #e7e9ee;
  --muted: #9098a8;
  --accent: #5a9bff;
  --good: #5dd39e;
  --bad: #e26b6b;
  --border: #3a404d;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { 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);
  line-height: 1.4;
}

a { color: var(--accent); }

header {
  padding: 1.5rem 2rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}
.tagline {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  padding: 1.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  background: var(--panel);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}
.control label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
select, input[type="number"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
  font-family: inherit;
}
select:focus, input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  background: var(--accent);
  color: #0b1220;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
  font-family: inherit;
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--panel-2);
  color: var(--muted);
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 480px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .game { grid-template-columns: 1fr; }
}

.board {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  box-shadow: var(--shadow);
}

.info {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.status {
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  min-height: 2.5em;
}
.status.idle    { color: var(--muted); }
.status.playing { color: var(--text); }
.status.good    { color: var(--good);  border-color: var(--good); }
.status.bad     { color: var(--bad);   border-color: var(--bad); }

.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.meta-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  margin-right: 0.5rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.actions button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  flex: 1;
}
.actions button:hover:not(:disabled) {
  background: var(--border);
}

.moves summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.25rem 0;
}
.moves ol {
  margin: 0.5rem 0 0;
  padding-left: 1.5rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
}

footer {
  padding: 1rem 2rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Highlight squares for hint / wrong-move feedback */
.square-hint-from { box-shadow: inset 0 0 0 4px rgba(90, 155, 255, 0.7); }
.square-hint-to   { box-shadow: inset 0 0 0 4px rgba(90, 155, 255, 0.9); }
.square-bad-from  { box-shadow: inset 0 0 0 4px rgba(226, 107, 107, 0.7); }
.square-bad-to    { box-shadow: inset 0 0 0 4px rgba(226, 107, 107, 0.9); }
