/* Mangle Web — editorial, professional, no page scroll. */
:root {
  --paper: #F4EFE6;
  --paper2: #EBE4D8;
  --ink: #1C1814;
  --soft: #5A5248;
  --card: #FFFBF5;
  --line: #8A8278;
  --accent: #5C3220;
  --warn-bg: #F3E4C8;
  --warn-ink: #6B3A12;
  --danger: #8A2A1C;
  --ok: #2C4A3A;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
  --top: 48px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}
body { min-height: 100dvh; }
#app {
  height: 100dvh;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: var(--top) auto 1fr;
  min-height: 0;
  position: relative;
}
header.top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  min-height: var(--top);
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.top-actions { display: flex; gap: 6px; }
button, .btn {
  font: 600 14px/1 var(--sans);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  border-radius: 2px;
}
button.primary, .btn.primary {
  background: var(--accent);
  color: var(--card);
  border-color: var(--accent);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
#pull-handle {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.banner {
  background: var(--warn-bg);
  color: var(--warn-ink);
  padding: 8px 14px;
  font-size: 13.5px;
  line-height: 1.35;
  font-weight: 600;
}
.banner[hidden], [hidden] { display: none !important; }
main {
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
h1, h2 {
  font-family: var(--serif);
  font-weight: 700;
  margin: 0;
}
h1 { font-size: 1.65rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
.lede, .note, .status, .save-label { color: var(--soft); font-size: 13.5px; line-height: 1.4; margin: 0; }
.save-label { font-weight: 600; letter-spacing: 0.01em; }
.home-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 0; }
.demo-slots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 8px;
}
.demo-slots span {
  display: inline-flex;
  width: 28px;
  height: 36px;
  border-bottom: 2px solid var(--ink);
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
input[type="text"], textarea {
  font: 16px/1.35 var(--sans);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  width: 100%;
  border-radius: 2px;
}
textarea { resize: none; height: 72px; }
.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-content: center;
  min-height: 56px;
}
.slots .letter, .slots .blank, .slots .space {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 22px;
  height: 36px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  border-bottom: 2px solid var(--ink);
}
.slots .space { border-bottom-color: transparent; width: 12px; }
.clue { text-align: center; font-family: var(--serif); font-style: italic; margin: 0; font-size: 1.05rem; }
.misses { text-align: center; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 12px; color: var(--soft); }
.keyboard { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.keyboard .row { display: flex; justify-content: center; gap: 4px; }
.keyboard button {
  min-width: 28px;
  width: 9vw;
  max-width: 44px;
  padding: 0;
  font-family: var(--serif);
  font-size: 1rem;
}
.keyboard button.hit { background: var(--paper2); color: var(--ok); }
.keyboard button.miss { background: var(--paper2); color: var(--danger); opacity: 0.7; }
.list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.row-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 8px 10px;
  min-height: 52px;
}
.row-item h3 { margin: 0; font-family: var(--serif); font-size: 1rem; }
.row-item p { margin: 2px 0 0; font-size: 12px; color: var(--soft); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions button { min-height: 36px; padding: 0 10px; }
.credit { font-size: 12px; color: var(--soft); font-style: italic; }
#comment-card {
  position: absolute;
  left: 0; right: 0; top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(28, 24, 20, 0.12);
  z-index: 8;
  transform: translateY(-100%);
  transition: transform 0.22s ease;
  padding: 12px 16px 14px;
  max-height: calc(100dvh - 8px);
  overflow: hidden;
}
#comment-card.open { transform: translateY(0); }
#comment-card h2 { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; border: 0; padding: 0; }
.chips legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chips button { min-height: 40px; font-size: 13px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--card); border-color: var(--accent); }
#fb-count, .fb-row { display: flex; justify-content: space-between; color: var(--soft); font-size: 12px; }
#fb-status { min-height: 1.3em; margin: 4px 0; font-weight: 600; font-size: 14px; }
#fb-status.err { color: var(--danger); }
#fb-status.ok { color: var(--ok); }
.fb-done { font-family: var(--serif); font-size: 1.05rem; margin: 8px 0; }
.empty { color: var(--soft); font-style: italic; padding: 12px 0; }
footer.legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
footer.legal a { color: var(--accent); }
@media (min-width: 800px) {
  .keyboard button { width: 44px; }
  .slots .letter, .slots .blank { width: 28px; height: 42px; font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  #comment-card { transition: none; }
}
