#app {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

.board-wrap {
  flex: 3 1 720px;
  min-width: 340px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.clue-current {
  font-size: 0.95rem;
  font-weight: bold;
  background: var(--panel);
  border: 1px solid var(--cell-border);
  border-radius: 8px;
  padding: 8px 12px;
  flex: 1 1 240px;
  min-height: 1.2em;
}

.board-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.board-actions button {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--cell-border);
  background: var(--panel);
  cursor: pointer;
}

.board-actions button:hover { background: #efe9d8; }

.grid-container {
  width: 100%;
  overflow: auto;
  border: 3px solid var(--ink);
  background: var(--ink);
}

.grid {
  display: grid;
  width: min(100%, 1000px);
  margin: 0 auto;
}

.cell {
  position: relative;
  background: #fff;
  border-right: 1px solid var(--cell-border);
  border-bottom: 1px solid var(--cell-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell.block { background: var(--block); }

.cell input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(16px, 3.4vw, 34px);
  text-transform: uppercase;
  padding: 0;
  outline: none;
  color: var(--ink);
}

.cell.focus-word input { background: var(--focus-word); }
.cell.focus-cell input { background: var(--focus-cell); }
.cell.correct input { background: var(--correct); }
.cell.incorrect input { background: var(--incorrect); }

.cell .num {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: clamp(8px, 1.6vw, 13px);
  color: var(--muted);
  font-family: sans-serif;
  pointer-events: none;
}

.status {
  min-height: 1.4em;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.clues-wrap {
  flex: 1 1 300px;
  display: flex;
  gap: 16px;
  min-width: 260px;
  max-width: 420px;
}

.clue-list {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--cell-border);
  border-radius: 8px;
  padding: 10px 14px;
  max-height: 640px;
  overflow-y: auto;
}

.clue-list h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 4px;
}

.clue-list ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.clue-list li {
  font-size: 0.85rem;
  margin-bottom: 6px;
  cursor: pointer;
  line-height: 1.3;
}

.clue-list li.active {
  background: var(--focus-word);
  border-radius: 4px;
  font-weight: bold;
}

.clue-list li.done {
  color: var(--muted);
  text-decoration: line-through;
}

@media (max-width: 720px) {
  #app { flex-direction: column; padding: 12px; gap: 14px; }
  .clues-wrap { flex-direction: column; }
  .clue-list { max-height: 260px; }
}
