:root {
  --cell-size: 42px;
  --border-color: #222;
  --highlight-color: #a8d8ff;
  --selected-color: #ffda6b;
  --correct-color: #c8f7c5;
  --incorrect-color: #f7c5c5;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: #f5f5f5;
  color: #333;
  padding: 20px;
}

#app {
  max-width: 960px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

#error {
  display: none;
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  text-align: center;
}

#main {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ---- Grid ---- */

#grid-container {
  flex-shrink: 0;
  position: relative;
}

#mobile-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  z-index: -1;
  font-size: 16px; /* prevents iOS zoom on focus */
}

#grid {
  display: grid;
  gap: 1px;
  background: var(--border-color);
  border: 2px solid var(--border-color);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  cursor: pointer;
}

.cell.black {
  background: var(--border-color);
  cursor: default;
}

.cell.highlighted { background: var(--highlight-color); }
.cell.selected    { background: var(--selected-color); }

.cell .number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 10px;
  line-height: 1;
  color: #555;
  pointer-events: none;
}

.cell .letter {
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
}

/* ---- Current clue bar ---- */

#current-clue {
  margin-top: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  min-height: 38px;
  line-height: 1.4;
}

/* ---- Buttons ---- */

#controls {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

#controls button {
  padding: 8px 20px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
}

#controls button:hover { background: #eee; }

/* ---- Clues panel ---- */

#clues {
  flex: 1;
  min-width: 200px;
  max-height: calc(var(--cell-size) * 11 + 80px);
  overflow-y: auto;
}

#clues h2 {
  font-size: 1rem;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--border-color);
}

#clues > div:first-child h2 { margin-top: 0; }

#clues ul {
  list-style: none;
  padding: 0;
}

#clues li {
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
}

#clues li:hover { background: #eee; }
#clues li.active { background: var(--highlight-color); }

#clues li .clue-num {
  font-weight: 700;
  margin-right: 2px;
}
