:root {
  color-scheme: light;
  --ink: #111;
  --muted: #4f4f4f;
  --paper: #fffbe8;
  --panel: #fffff7;
  --line: #7f7f7f;
  --blue: #003f9e;
  --red: #c00000;
  --yellow: #fff08a;
  --green: #dff2c2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #d7e9ff url("data:image/gif;base64,R0lGODlhBAAEAIAAAP////f39yH5BAAAAAAALAAAAAAEAAQAAAIFhI8Wa1sAOw==");
  font-family: "MS PGothic", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.65;
}

a {
  color: #0000cc;
}

a:visited {
  color: #660099;
}

.masthead {
  width: min(1080px, calc(100% - 16px));
  margin: 8px auto 0;
  padding: 0 0 10px;
  border: 4px ridge #5f7fb0;
  background: linear-gradient(#ffffff, #dbeaff 46%, #ffffff);
  text-align: center;
}

.masthead.compact {
  text-align: left;
  padding: 8px 10px;
}

.top-ribbon {
  padding: 4px 8px;
  background: #003f9e;
  color: #fff;
  font-size: 0.85rem;
  text-align: left;
}

.masthead h1 {
  margin: 10px 0 2px;
  color: #003f9e;
  font-family: "MS PGothic", "Yu Gothic", Meiryo, sans-serif;
  font-size: clamp(2.2rem, 8vw, 4.7rem);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 #a8bfff;
}

.masthead p,
.subline {
  margin: 0;
  color: #333;
}

.counter {
  display: inline-block;
  margin: 8px auto 0;
  padding: 2px 10px;
  border: 2px inset #aaa;
  background: #000;
  color: #82ff82;
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
}

.home-link {
  display: inline-block;
  color: #003f9e;
  font-size: 2rem;
  font-weight: 900;
  text-decoration: none;
  text-shadow: 1px 1px 0 #fff, 3px 3px 0 #a8bfff;
}

.page-links,
.category-bar {
  width: min(1080px, calc(100% - 16px));
  margin: 8px auto 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-links a,
.category-bar button,
button {
  border: 2px outset #d7d7d7;
  background: linear-gradient(#fff, #d9d9d9);
  color: #000;
  padding: 4px 10px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.page-links a:hover,
.category-bar button:hover,
.category-bar button.active,
button:hover {
  background: linear-gradient(#fff7b0, #ffc64a);
  color: #000;
}

.layout {
  width: min(1080px, calc(100% - 16px));
  margin: 8px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 8px;
}

.headline-box,
.document-box,
.article-card,
.side-section {
  border: 3px double var(--line);
  background: var(--panel);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
}

.headline-box {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #fffde4;
}

.headline-label,
.side-section h2,
.document-stamp {
  margin: 0 0 6px;
  padding: 3px 8px;
  background: linear-gradient(90deg, #003f9e, #7fb1ff);
  color: #fff;
  font-weight: 700;
}

.tools {
  margin: 8px 0;
  display: flex;
  gap: 6px;
}

.tools input {
  min-width: 0;
  width: 100%;
  border: 2px inset #ccc;
  background: #fff;
  padding: 5px 8px;
  font: inherit;
}

.articles {
  display: grid;
  gap: 8px;
}

.article-card {
  padding: 8px 10px;
}

.article-card h2 {
  margin: 4px 0;
  font-size: 1.15rem;
  line-height: 1.45;
}

.article-card p {
  margin: 4px 0;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.new {
  display: inline-block;
  margin-right: 4px;
  padding: 0 4px;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tag {
  border: 1px solid #999;
  background: var(--green);
  padding: 1px 6px;
  color: #222;
  font-size: 0.82rem;
}

.side-section {
  margin-bottom: 8px;
  padding: 8px;
}

dl {
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dotted #999;
  padding: 4px 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
}

.construction {
  background: repeating-linear-gradient(45deg, #fff6a0, #fff6a0 10px, #ffffff 10px, #ffffff 20px);
}

.ad-slot {
  min-height: 90px;
  display: grid;
  place-items: center;
  border-style: dashed;
  color: #555;
  text-align: center;
}

.article-page {
  width: min(860px, calc(100% - 16px));
  margin: 8px auto;
}

.document-box {
  padding: 12px;
}

.document-box h1 {
  margin: 8px 0 10px;
  padding: 6px 8px;
  border-left: 12px solid #003f9e;
  background: #eef4ff;
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  line-height: 1.35;
}

.document-box h2 {
  margin-top: 18px;
  padding: 4px 6px;
  border: 1px solid #999;
  background: #f3f3f3;
  font-size: 1.08rem;
}

.lead {
  padding: 8px;
  border: 1px dotted #888;
  background: #fffde4;
  font-weight: 700;
}

.article-body p {
  margin: 1em 0;
}

.archive-table,
.info-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.archive-table th,
.archive-table td,
.info-table th,
.info-table td {
  border: 1px solid #777;
  padding: 6px 8px;
  vertical-align: top;
}

.archive-table th,
.info-table th {
  background: #dbeaff;
}

.info-table th {
  width: 9em;
  text-align: left;
}

.more-link {
  text-align: right;
}

footer {
  width: min(1080px, calc(100% - 16px));
  margin: 8px auto 16px;
  padding: 8px;
  border: 2px groove #999;
  background: #f0f0f0;
  color: #333;
  font-size: 0.9rem;
}

.footer-note {
  margin-top: 4px;
  color: #666;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .tools {
    flex-direction: column;
  }

  .page-links,
  .category-bar {
    justify-content: flex-start;
  }
}
