:root {
  --ink: #191a18;
  --muted: #696b65;
  --paper: #f2f0e9;
  --panel: #faf9f5;
  --line: #d9d5ca;
  --accent: #245f52;
  --accent-soft: #dce9e3;
  --warm: #c7653e;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Yu Gothic UI", "Hiragino Sans", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(25,26,24,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25,26,24,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: var(--sans);
}

button, textarea { font: inherit; }
.shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 28px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); align-items: end; gap: 48px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 11px; color: var(--accent); font: 700 11px/1.4 var(--mono); letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(42px, 6.2vw, 88px); line-height: .98; letter-spacing: -.055em; font-weight: 700; }
h1 span { color: var(--accent); }
.lead { max-width: 410px; margin: 0 0 7px; padding-left: 20px; border-left: 3px solid var(--warm); color: var(--muted); font-size: 15px; line-height: 1.9; }

.input-panel { position: relative; padding: 25px; border: 1px solid var(--line); background: rgba(250,249,245,.93); box-shadow: 8px 8px 0 rgba(36,95,82,.12); }
.panel-heading, .input-footer, .results-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.panel-heading label { font-weight: 700; font-size: 14px; }
.counter { color: var(--muted); font: 400 12px var(--mono); }
.counter strong { color: var(--ink); font-size: 18px; }
.counter.over strong { color: var(--warm); }
textarea { width: 100%; min-height: 116px; margin: 15px 0 12px; padding: 18px 20px; resize: vertical; border: 1px solid var(--line); border-radius: 0; outline: none; background: #fff; color: var(--ink); font-size: clamp(22px, 3vw, 34px); line-height: 1.55; letter-spacing: .02em; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.actions { display: flex; gap: 8px; flex-shrink: 0; }
.button { min-height: 42px; padding: 0 22px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-weight: 700; }
.button:hover { filter: brightness(1.08); }
.button:focus-visible { outline: 3px solid rgba(36,95,82,.25); outline-offset: 2px; }
.button-quiet { background: transparent; color: var(--accent); }
.message { min-height: 0; margin: 0; color: var(--warm); font-size: 13px; font-weight: 600; }
.message:not(:empty) { margin-top: 13px; }

.results { margin-top: 62px; }
.results-heading { margin-bottom: 18px; align-items: end; }
.results-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.results-heading > p { margin: 0; color: var(--muted); font: 12px var(--mono); }
.empty { min-height: 240px; display: grid; place-items: center; align-content: center; gap: 12px; border: 1px dashed #bbb7ad; color: var(--muted); text-align: center; }
.empty-glyph { display: grid; place-items: center; width: 70px; height: 70px; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-size: 35px; box-shadow: 5px 5px 0 var(--accent-soft); }
.empty p { margin: 0; font-size: 13px; }
.table-wrap { overflow-x: auto; border-top: 2px solid var(--ink); background: var(--panel); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { padding: 12px 10px; border-bottom: 1px solid var(--ink); color: var(--muted); font: 700 10px/1.4 var(--mono); text-align: left; letter-spacing: .04em; }
td { padding: 16px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
tbody tr:hover { background: #fff; }
th:nth-child(1) { width: 78px; } th:nth-child(2) { width: 116px; } th:nth-child(3) { width: 220px; }
th:nth-child(4) { width: 120px; } th:nth-child(5) { width: 165px; } th:nth-child(6) { width: 155px; }
th:nth-child(7) { width: 190px; } th:nth-child(8) { width: 180px; }
.glyph { display: grid; place-items: center; width: 54px; min-height: 54px; border: 1px solid var(--line); background: #fff; font-size: 29px; line-height: 1; }
.mono { font-family: var(--mono); font-size: 11px; }
.code { color: var(--accent); font-weight: 700; white-space: nowrap; }
.name { font-family: var(--mono); font-size: 10px; font-weight: 700; }
.sub { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.label { display: inline-block; margin: 0 4px 4px 0; padding: 2px 6px; background: var(--accent-soft); color: var(--accent); font: 700 10px var(--mono); }
.normalization { display: grid; gap: 4px; }
.normalization div { display: grid; grid-template-columns: 34px 1fr; gap: 5px; }
.normalization b { color: var(--muted); font: 400 9px var(--mono); }
.wiki-stack { display: grid; gap: 8px; }
.wiki-line { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; }
.wiki-line > b { color: var(--muted); font: 700 9px var(--mono); letter-spacing: .08em; }
.wiki { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.wiki::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #aaa; }
.wiki.found { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.wiki.found::before { background: #3c8a68; }
.wiki.missing::before { background: #aaa; }
.wiki.error::before { background: var(--warm); }
.wiki.loading::before { background: var(--warm); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font: 10px var(--mono); }
footer p { margin: 0; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 680px); padding-top: 34px; }
  .hero { grid-template-columns: 1fr; gap: 25px; margin-bottom: 28px; }
  .lead { max-width: none; }
  .input-panel { padding: 17px; box-shadow: 5px 5px 0 rgba(36,95,82,.12); }
  .input-footer { align-items: stretch; flex-direction: column; }
  .actions { justify-content: stretch; }
  .button { flex: 1; }
  .results { margin-top: 48px; }
  .results-heading { align-items: start; flex-direction: column; gap: 7px; }
  .table-wrap { overflow: visible; border-top: 0; background: transparent; }
  table, tbody { display: block; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: 72px 1fr; margin-bottom: 14px; border: 1px solid var(--line); border-top: 3px solid var(--accent); background: var(--panel); }
  td { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  td::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--muted); font: 700 9px var(--mono); letter-spacing: .06em; }
  td:first-child { grid-row: span 7; padding: 12px 9px; border-right: 1px solid var(--line); }
  td:first-child::before { text-align: center; }
  td:last-child { border-bottom: 0; }
  .glyph { width: 52px; }
  footer { flex-direction: column; gap: 6px; }
}
