:root {
  --cell-size: 66px;
  --grid-gap: 0;
  --color-bg: #f7f6f2;
  --color-cell-letter: #ffffff;
  --color-cell-clue: #2a8fb8;
  --color-cell-clue-alt: #2682a8;
  --color-cell-block: #1a1a1a;
  --color-cell-border: #1a1a1a;
  --color-text: #1a1a1a;
  --color-clue-text: #ffffff;
  --color-focus: #ffd866;
  --color-highlight: #fff6d6;
  --color-wrong: #ffb3b3;
  --color-revealed: #cfe8ff;
  --color-accent: #1f6feb;
  --color-arrow: #ffffff;
  --font-clue: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-letter: "Iowan Old Style", "Palatino", "Georgia", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-clue);
}

.app-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.toolbar button {
  padding: 0.4rem 0.9rem;
  font: inherit;
  background: white;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.toolbar button:hover {
  background: #efefef;
}

.toolbar button:active {
  background: #e0e0e0;
}

.status {
  flex: 1 1 100%;
  font-size: 0.9rem;
  color: #555;
  min-width: 0;
  word-break: break-word;
}

main {
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.grid {
  display: grid;
  gap: var(--grid-gap);
  border: 2px solid var(--color-cell-border);
  background: var(--color-cell-border);
  width: max-content;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background: var(--color-cell-letter);
  border: 1px solid var(--color-cell-border);
  position: relative;
}

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

.cell.letter {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell.letter input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-letter);
  font-size: 1.7rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-text);
  caret-color: var(--color-accent);
  padding: 0;
  outline: none;
}

.cell.letter input:focus {
  background: var(--color-focus);
}

.cell.letter.highlight input {
  background: var(--color-highlight);
}

.cell.letter.highlight input:focus {
  background: var(--color-focus);
}

.cell.letter.wrong input {
  background: var(--color-wrong);
}

.cell.letter.revealed input {
  background: var(--color-revealed);
}

.cell.clue {
  background: var(--color-cell-clue);
  color: var(--color-clue-text);
  display: grid;
  align-items: stretch;
  line-height: 1.05;
  position: relative;
}

.cell.clue.hints-1 {
  grid-template-rows: 1fr;
}

.cell.clue.hints-2 {
  grid-template-rows: 1fr 1fr;
}

.cell.clue .hint {
  position: relative;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 3px 4px 3px 4px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-hyphens: auto;
  min-width: 0;
}

.cell.clue.hints-2 .hint {
  padding: 2px 4px;
  font-size: 0.56rem;
  line-height: 1;
}

.cell.clue .hint.dir-right {
  padding-right: 12px;
}

.cell.clue .hint + .hint {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--color-cell-clue-alt);
}

.cell.clue .arrow {
  position: absolute;
  color: var(--color-arrow);
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.cell.clue .arrow.dir-right {
  right: 2px;
  bottom: 2px;
}

.cell.clue .arrow.dir-down {
  right: 50%;
  bottom: 0;
  transform: translate(50%, 35%);
}

