:root {
  color-scheme: light;
  --paper: #fbf8ef; --ink: #30372b; --accent: #2d553e;
  --bar: #e7ecdd; --line: #9ca58e; --muted: #59614e;
  --link: #225a45; --visited: #725442; --panel: #fffdf7;
}
:root[data-palette="navy"] {
  --paper: #fafbfc; --ink: #222b36; --accent: #183e68;
  --bar: #e4ecf4; --line: #98a8ba; --muted: #505d6b;
  --link: #174fa0; --visited: #654181; --panel: #fff;
}
:root[data-palette="wine"] {
  --paper: #f8f6f6; --ink: #372f32; --accent: #75364b;
  --bar: #efe2e7; --line: #b3a0a7; --muted: #65555c;
  --link: #7e2648; --visited: #654d80; --panel: #fff;
}
* { box-sizing: border-box; }
body { margin: 8px; height: calc(100vh - 16px); height: calc(100dvh - 16px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--paper); color: var(--ink); font: 16px/1.55 "Yu Mincho", "Hiragino Mincho ProN", serif; }
html[lang="en"] body { font-family: Georgia, "Times New Roman", serif; }
main { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
a { color: var(--link); text-underline-offset: .12em; }
a:visited { color: var(--visited); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; top: -60px; z-index: 1; padding: 4px 8px; background: var(--panel); }
.skip:focus { top: 4px; }
.language { text-align: right; font-size: 13px; padding: 0 4px 7px; border-bottom: 1px solid var(--line); }
.title { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 6px 0; }
.title img { flex: none; }
h1 { margin: 0; font-size: clamp(22px, 4.5vw, 30px); color: var(--accent); }
section { border-top: 1px solid var(--line); padding-top: 4px; margin-bottom: 8px; }
h2 { margin: 0 0 6px; padding: 1px 8px; text-align: center; background: var(--accent); color: var(--paper); font-size: 17px; }
p { margin: 6px 0; }
.intro, .centered { text-align: center; }
.intro { padding: 0 8px; }
.small { font-size: 13px; color: var(--muted); }
.news { width: fit-content; max-width: 100%; margin: 0 auto; padding: 0 14px; border: 3px double var(--accent); background: var(--panel); }
.news p { margin: 4px 0; }
.news time { margin-right: 5px; }
.downloads { width: min(780px, 100%); margin: 0 auto; border: 1px solid var(--accent); border-spacing: 2px; background: var(--paper); font-size: 15px; text-align: center; }
caption { margin-bottom: 4px; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 3px 8px; }
th { background: var(--bar); font-weight: normal; }
td { background: var(--panel); }
td:first-child { overflow-wrap: anywhere; }
td:not(:first-child) { white-space: nowrap; }
#history { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; margin-bottom: 4px; }
.history-scroll { min-height: 0; width: min(900px, 100%); margin: 0 auto; overflow: auto; scrollbar-gutter: stable; }
.history-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.history { display: grid; grid-template-columns: max-content auto; column-gap: 14px; row-gap: 4px; width: fit-content; max-width: 100%; margin: 0 auto; padding: 0 8px; font-size: 15px; }
.history dd { margin: 0; }
footer { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 24px; background: var(--paper); border-top: 1px solid var(--line); padding-top: 6px; text-align: center; font-size: 14px; }
footer p { margin: 5px 0; }
@media (max-width: 800px), (max-height: 680px) {
  body { height: auto; min-height: calc(100vh - 16px); min-height: calc(100dvh - 16px); grid-template-rows: auto 1fr auto; }
  main, #history { display: block; }
  .history-scroll { max-height: 10rem; }
}
@media (max-width: 540px) {
  body { font-size: 14px; }
  .title { gap: 10px; padding: 14px 0; }
  h2 { font-size: 16px; }
  .news { padding: 0 9px; }
  .downloads { font-size: 12px; }
  th, td { padding: 3px 4px; }
  .history { font-size: 13px; column-gap: 9px; padding: 0; }
}
@media print {
  body, main, #history { display: block; height: auto; }
  .history-scroll { max-height: none; overflow: visible; }
  footer { position: static; }
}
