:root {
  --paper: #f1efe9;
  --sheet: #fbfaf6;
  --ink: #1b1b19;
  --muted: #77756e;
  --rule: #cbc8bf;
  --faint: #e5e2da;
  --red: #c83c24;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }

.site-header { width: min(1180px, calc(100% - 48px)); height: 72px; display: flex; align-items: center; margin: 0 auto; border-bottom: 1px solid var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; color: var(--paper); background: var(--ink); font: 700 13px var(--mono); }

main { width: min(980px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 96px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
h1, h2, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(40px, 6vw, 62px); font-weight: 400; line-height: .95; letter-spacing: -.045em; }
.total { color: var(--muted); font: 13px var(--mono); }
.total strong { color: var(--ink); font-weight: 700; }

.editor { border: 1px solid var(--ink); background: var(--sheet); }
.editor-header { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--ink); font: 13px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.editor-header span { color: var(--muted); text-transform: none; letter-spacing: 0; }
textarea { display: block; width: 100%; min-height: 176px; padding: 22px; resize: none; border: 0; border-radius: 0; outline: 0; color: var(--ink); background: transparent; caret-color: var(--red); font: 16px/1.65 var(--mono); }
textarea::placeholder { color: #aaa79e; }
textarea:focus { box-shadow: inset 3px 0 0 var(--red); }

.results-section { margin-top: 76px; }
.results-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 15px; border-bottom: 1px solid var(--ink); }
.results-header > div { display: flex; align-items: baseline; gap: 12px; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 400; letter-spacing: -.025em; }
.result-count { color: var(--muted); font: 13px var(--mono); text-transform: uppercase; letter-spacing: .03em; }
.search-wrap { width: 210px; }
.search-wrap input { width: 100%; height: 37px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; outline: 0; background: transparent; font: 13px var(--mono); }
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-bottom: 2px solid var(--red); }

.category-tabs { display: flex; gap: 24px; min-height: 58px; align-items: center; overflow-x: auto; border-bottom: 1px solid var(--rule); }
.tab { position: relative; align-self: stretch; padding: 0; white-space: nowrap; border: 0; background: transparent; color: var(--muted); font: 13px var(--mono); text-transform: uppercase; letter-spacing: .02em; }
.tab:hover, .tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--red); }

.results-table { background: transparent; }
.table-heading, .result-card { display: grid; grid-template-columns: 170px minmax(0, 1fr) 72px; gap: 22px; align-items: center; }
.table-heading { height: 44px; padding: 0 10px; border-bottom: 1px solid var(--ink); color: var(--muted); font: 13px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.table-heading span:last-child { text-align: right; }
.result-card { min-height: 88px; padding: 14px 10px; border-bottom: 1px solid var(--rule); }
.result-card:hover { background: rgba(255, 255, 255, .35); }
.card-top { min-width: 0; }
.card-label { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.card-tag { margin-top: 5px; color: var(--muted); font: 13px var(--mono); text-transform: uppercase; letter-spacing: .02em; }
.output { min-width: 0; max-height: 65px; overflow: auto; color: #34332f; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; scrollbar-width: thin; }
.output.mono { font: 13px/1.55 var(--mono); }
.output.placeholder { color: #a19e95; font: 13px var(--mono); }
.copy-button { justify-self: end; width: 70px; height: 36px; padding: 0; border: 1px solid var(--ink); border-radius: 0; background: transparent; font: 13px var(--mono); text-transform: uppercase; }
.copy-button:hover { color: var(--paper); background: var(--ink); }
.empty-state { padding: 64px 0; border-bottom: 1px solid var(--ink); color: var(--muted); text-align: center; font: 13px var(--mono); }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 4; padding: 11px 15px; color: var(--paper); background: var(--ink); font: 13px var(--mono); transform: translateY(10px); opacity: 0; pointer-events: none; transition: .15s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .site-header, main { width: calc(100% - 28px); }
  .site-header { height: 60px; }
  main { padding: 42px 0 68px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  h1 { font-size: 44px; }
  textarea { min-height: 160px; padding: 17px; font-size: 15px; }
  .results-section { margin-top: 58px; }
  .results-header { align-items: stretch; flex-direction: column; gap: 18px; }
  .search-wrap { width: 100%; }
  .category-tabs { gap: 20px; }
  .table-heading { display: none; }
  .result-card { grid-template-columns: minmax(0, 1fr) 62px; gap: 12px 16px; min-height: 108px; padding: 15px 6px; }
  .card-top { grid-column: 1; }
  .copy-button { grid-column: 2; grid-row: 1; }
  .output { grid-column: 1 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
