:root {
  --cell: 44px;
  --bg: #f6f4ef;
  --line: #c9c4b8;
  --ink: #2b2a26;
  --hl: #ffe9a8;
  --hl-head: #ffd454;
  --solved: #d7eedd;
  --accent: #3a6ea5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

h1 { margin: 0; font-size: 20px; }

button {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #f0ede5; }
button:disabled { opacity: 0.5; cursor: default; }

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

#board { overflow: auto; max-width: 100%; }

#grid {
  display: grid;
  gap: 2px;
  width: max-content;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.cell.block {
  background: transparent;
  border: none;
  cursor: default;
}

.cell .num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 10px;
  color: #8a8578;
}

.cell .ch { font-size: 20px; font-weight: 600; }

.cell.hl { background: var(--hl); }
.cell.hl-head { background: var(--hl-head); }
.cell.solved { background: var(--solved); }
.cell.solved.hl { background: #bfe3c8; }
.cell.hinted .ch { color: var(--accent); }

#side {
  flex: 1;
  min-width: 300px;
  max-width: 460px;
}

#clue-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.clue-label { font-weight: 700; margin-bottom: 6px; }
.clue-text { min-height: 1.4em; margin-bottom: 12px; line-height: 1.5; }

.answer-row { display: flex; gap: 8px; }

#answer {
  flex: 1;
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}
#answer:focus { outline: 2px solid var(--accent); border-color: transparent; }

#message { margin-top: 10px; min-height: 1.2em; font-size: 14px; }
#message.ok { color: #2e7d46; }
#message.bad { color: #b4423a; }

#clues {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#clues li {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}
#clues li:hover { background: #f0ede5; }
#clues li.active { border-color: var(--accent); background: #eef4fb; }
#clues li.done { opacity: 0.55; text-decoration: line-through; }

#mic.listening {
  background: #fde4e1;
  border-color: #b4423a;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 5px rgba(180, 66, 58, 0.25); }
}

footer {
  padding: 12px 24px 20px;
  font-size: 12px;
  color: #8a8578;
}
footer a { color: inherit; }

@media (max-width: 700px) {
  :root { --cell: 36px; }
  main { padding: 12px; gap: 16px; }
}
