:root {
  --ink: #1c1712;
  --paper: #f3ead6;
  --sheet: #fffaf0;
  --rule: #d8c9a8;
  --rust: #b4411c;
  --soot: #2a241c;
  --mute: #6d6456;
  --key: #7a2e16;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

.paper-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(180, 65, 28, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 65, 28, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  z-index: 0;
}

.masthead {
  position: relative;
  z-index: 2;
  background: var(--soot);
  color: #f6ecd8;
  border-bottom: 6px solid var(--rust);
}
.masthead-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 24px 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 56px;
  height: 56px;
  border: 2px solid #f6ecd8;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Times New Roman", "Songti SC", serif;
  font-weight: 700;
  transform: rotate(-8deg);
}
.brand h1 {
  margin: 0;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  font-size: 32px;
  letter-spacing: 0.18em;
}
.brand p { margin: 4px 0 0; color: #c9b99a; font-size: 13px; }
.masthead-meta {
  text-align: right;
  font-size: 12px;
  color: #c9b99a;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 8px;
}

.query {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  background: var(--sheet);
  border: 1px solid var(--ink);
  padding: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.field span {
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--mute);
}
.field input {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  background: #fff;
  outline: none;
}
.field input:focus { box-shadow: 3px 3px 0 rgba(180, 65, 28, 0.25); }
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 30;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--ink);
  max-height: 240px;
  overflow: auto;
  box-shadow: 4px 4px 0 rgba(28, 23, 18, 0.08);
}
.suggest li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 15px;
}
.suggest li:hover,
.suggest li.on {
  background: #f3d2c4;
}
#searchBtn {
  height: 44px;
  padding: 0 22px;
  border: 0;
  background: var(--rust);
  color: #fff;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.2em;
  cursor: pointer;
}

.hint { color: var(--mute); font-size: 13px; margin: 14px 0 0; }
.hint.error { color: var(--rust); }

.fresh {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--mute);
  border-left: 3px solid var(--rust);
  padding-left: 10px;
}
.fresh.ok { color: #1f5a48; border-left-color: #2b6b58; }
.fresh.fail { color: var(--rust); }

.sheet {
  margin-top: 18px;
  background: var(--sheet);
  border: 1px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(28, 23, 18, 0.08);
}
.sheet-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--rule);
}
.std-code {
  font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  color: var(--rust);
  font-weight: 700;
  font-size: 15px;
}
.std-name {
  margin: 6px 0 12px;
  font-family: "Source Han Serif SC", "Noto Serif SC", serif;
  font-size: 24px;
  letter-spacing: 0.04em;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  font-size: 12px;
  color: var(--mute);
}
.meta-grid b { display: block; color: var(--ink); font-weight: 600; font-size: 13px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  font-size: 11px;
  border: 1px solid var(--ink);
  padding: 1px 6px;
}
.badge.local { background: var(--ink); color: var(--paper); }
.badge.key { background: #f3d2c4; }

.area-block { padding: 8px 22px 20px; }
.area-block + .area-block { border-top: 1px dashed var(--rule); }
.area-title {
  margin: 16px 0 10px;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--key);
  display: flex;
  align-items: center;
  gap: 8px;
}
.area-title::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--rust);
}
.area-block.special .area-title { color: #7a4a00; }
.area-block.special .area-title::before { background: #c49216; }
.area-block.ultra .area-title { color: #1f5a48; }
.area-block.ultra .area-title::before { background: #2b6b58; }

.limit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.limit-table th, .limit-table td {
  border: 1px solid var(--rule);
  padding: 8px 8px;
  text-align: left;
  vertical-align: top;
}
.limit-table th { background: #efe4cc; font-weight: 600; }
.limit-table .num {
  font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  font-weight: 700;
  white-space: nowrap;
}
.limit-table .period {
  color: var(--key);
  font-weight: 600;
  white-space: nowrap;
}
.unit-note, .scope-note {
  margin: 0 22px 18px;
  color: var(--mute);
  font-size: 12px;
}

.colophon {
  max-width: 980px;
  margin: 0 auto 28px;
  padding: 16px 24px 0;
  color: var(--mute);
  font-size: 12px;
  position: relative;
  z-index: 1;
}

@media (max-width: 800px) {
  .query { grid-template-columns: 1fr; }
  #searchBtn { width: 100%; }
  .masthead-inner { flex-direction: column; align-items: flex-start; }
  .masthead-meta { text-align: left; }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
  .limit-table { font-size: 12px; }
}
