:root {
  --paper: #f3ecdf;
  --ink: #1e2430;
  --muted: #5c6573;
  --line: #c9bfae;
  --tile: #efe6d6;
  --correct: #2457d6;
  --present: #e07a3d;
  --absent: #5d6675;
  --key: #e7dcc8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible { outline: 2px solid var(--correct); outline-offset: 2px; }
#app { min-height: 100%; }
.screen { max-width: 520px; margin: 0 auto; padding: 12px 12px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mark { font-family: Georgia, "Iowan Old Style", Palatino, serif; font-weight: 700; font-size: 28px; letter-spacing: 0.04em; margin: 0; line-height: 1; }
.mark span { color: var(--correct); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tools button, .wide { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 12px; }
.tools button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.legal { margin: 0; font-size: 12px; line-height: 1.4; background: #fff8ee; border-left: 3px solid var(--present); padding: 6px 8px; }
.stats { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.stats b { color: var(--ink); }
.board { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.row { display: flex; gap: 6px; }
.tile {
  width: 52px; height: 52px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: Georgia, Palatino, serif; font-size: 26px; font-weight: 700;
  background: var(--tile); border: 2px solid var(--line); text-transform: uppercase;
  position: relative;
}
.tile.filled { border-color: #8d8374; animation: pop .12s ease; }
.tile.correct { background: var(--correct); color: #fff; border-color: var(--correct); }
.tile.present { background: var(--present); color: #1e2430; border-color: var(--present); }
.tile.absent { background: var(--absent); color: #f3ecdf; border-color: var(--absent); }
#app.cb .tile.correct { box-shadow: inset 0 0 0 4px #fff; }
#app.cb .tile.present {
  background: repeating-linear-gradient(135deg, #e07a3d, #e07a3d 6px, #9a4d22 6px, #9a4d22 12px);
  color: #1e2430;
}
#app.cb .tile.absent {
  background-color: #3a4150;
  background-image: linear-gradient(to top right, transparent calc(50% - 1px), #d9d3c7 calc(50% - 1px), #d9d3c7 calc(50% + 1px), transparent calc(50% + 1px));
}
.row.shake { animation: shake .35s linear; }
@keyframes pop { 50% { transform: scale(1.06); } }
@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.msg { min-height: 1.3em; margin: 0; text-align: center; font-size: 14px; }
.msg.bad { color: #9a3b2f; }
.legend { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.keys { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.krow { display: flex; gap: 4px; justify-content: center; }
.key {
  flex: 1; min-width: 0; height: 48px; border: 0; border-radius: 8px;
  background: var(--key); font-weight: 700; text-transform: uppercase; font-size: 13px;
}
.key.wide { flex: 1.5; font-size: 11px; }
.key.correct { background: var(--correct); color: #fff; }
.key.present { background: var(--present); color: #1e2430; }
.key.absent { background: var(--absent); color: #f3ecdf; }
#app.cb .key.correct { box-shadow: inset 0 0 0 3px #fff; }
#app.cb .key.present { background: repeating-linear-gradient(135deg, #e07a3d, #e07a3d 5px, #9a4d22 5px, #9a4d22 10px); color: #1e2430; }
#app.cb .key.absent { background: #3a4150; color: #f3ecdf; }
.actions { display: flex; gap: 8px; justify-content: center; }
.actions button { background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
@media (max-width: 380px) {
  .tile { width: 46px; height: 46px; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile.filled, .row.shake { animation: none; }
}
