:root {
  --paper: #f3efe4;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #d9d0c0;
  --card: #fffaf3;
  --exact: #1f7a4d;
  --partial: #e6b325;
  --miss: #9d2b24;
  --exact-ink: #f4fff8;
  --partial-ink: #1c1608;
  --miss-ink: #fff7f6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.screen {
  max-width: 760px; margin: 0 auto; height: 100%; min-height: 0;
  padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.brand { display: flex; gap: 8px; align-items: center; min-width: 0; }
.mark { margin: 0; font-family: Georgia, "Iowan Old Style", Palatino, serif; font-size: 26px; line-height: 1; letter-spacing: 0.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.stamps { width: 36px; height: 28px; flex: none; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.stats b { color: var(--ink); }
.primary, .ghost {
  border-radius: 999px; font-weight: 700; min-height: 40px; padding: 8px 14px;
}
.primary { border: 0; background: var(--ink); color: var(--paper); }
.ghost { background: transparent; border: 1px solid var(--line); }
.legal, .credit { margin: 0; font-size: 11px; line-height: 1.35; }
.legal { background: #fff6f2; border-left: 3px solid var(--miss); padding: 6px 8px; }
.credit { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.legend li {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 8px;
}
.legend .exact { background: var(--exact); color: var(--exact-ink); }
.legend .partial { background: var(--partial); color: var(--partial-ink); }
.legend .miss { background: var(--miss); color: var(--miss-ink); }
.ask { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 700; }
.field { display: flex; gap: 8px; }
input {
  flex: 1; min-width: 0; font-size: 16px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 10px 12px;
}
.suggest { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 168px; overflow: auto; }
.suggest button {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 16px; min-height: 40px;
}
.suggest button.on { border-color: var(--ink); background: #fff6df; }
.msg { margin: 0; min-height: 1.3em; font-size: 14px; }
.msg.bad { color: var(--miss); font-weight: 700; }
.msg.good { color: var(--exact); font-weight: 700; }
.win {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
}
.win p { margin: 0; font-weight: 700; }
.win .primary { min-height: 44px; }
.log { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }
.guess {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
}
.guess header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.guess header b { font-size: 15px; }
.guess header span { color: var(--muted); font-size: 12px; }
.attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.chip { border-radius: 8px; padding: 5px 7px; min-width: 0; }
.chip .k { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.9; }
.chip .v { display: block; font-size: 13px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.chip.exact { background: var(--exact); color: var(--exact-ink); }
.chip.partial { background: var(--partial); color: var(--partial-ink); }
.chip.miss { background: var(--miss); color: var(--miss-ink); }
.retry { align-self: flex-start; }
@media (min-width: 560px) {
  .attrs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 800px) {
  .attrs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .screen { padding: 8px; }
  .mark { font-size: 22px; }
  .legal { font-size: 10px; }
  .win { align-items: stretch; }
  .win .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
