@font-face {
  font-family: 'DotGothic16';
  src: url('fonts/dotgothic16.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --band: #16181a;
  --band-ink: #f4f4f1;
  --paper: #ffffff;
  --panel: #f2f3ef;
  --ink: #16181a;
  --muted: #545a5e;
  --line: #cfd3cd;
  --frame: #16181a;
  --red: #c62a1c;
  --red-ink: #ffffff;
  --red-soft: #fbe9e6;
  --ok: #1d6b45;
  --warn: #8a4b00;
  --bad: #b3261e;
  --focus: #1b5fd0;
  --dot: 'DotGothic16', ui-monospace, 'Courier New', monospace;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --cjk: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Apple SD Gothic Neo', 'Noto Sans CJK JP', 'Noto Sans CJK KR', 'Noto Sans CJK SC', 'Malgun Gothic', 'Microsoft YaHei', 'Yu Gothic', sans-serif;
  --r: 4px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121415;
    --band: #050606;
    --band-ink: #e9ebe6;
    --paper: #1b1e20;
    --panel: #1f2325;
    --ink: #eceee9;
    --muted: #a7adab;
    --line: #353b3e;
    --frame: #c9cdc8;
    --red: #ff6a55;
    --red-ink: #1a0b08;
    --red-soft: #3a1c18;
    --ok: #63cf95;
    --warn: #f1aa48;
    --bad: #ff8173;
    --focus: #7fb0ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
[lang="ja"], [lang="ko"], [lang="zh"] { font-family: var(--cjk); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 18px; }
a { color: inherit; text-decoration-color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* header band, like the black strip a date printer leaves */
.top { background: var(--band); color: var(--band-ink); }
.top-in { display: flex; align-items: center; min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 18px/1 var(--dot); letter-spacing: .5px; }
.brand:hover { color: var(--band-ink); }
.top-in { flex-wrap: wrap; column-gap: 18px; }
.guides { display: flex; gap: 4px; margin-left: auto; font-size: 15px; }
.guides a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; text-decoration: none; color: var(--band-ink); }
.guides a:hover { color: var(--band-ink); text-decoration: underline; text-decoration-color: var(--red); }
.guides a[aria-current] { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; }
@media (max-width: 459px) { .guides { margin-left: -8px; width: 100%; margin-top: -6px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.crumbs { margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.crumbs + h1 { margin-top: 6px; }

h1 { font: 400 clamp(27px, 6.4vw, 40px)/1.15 var(--dot); margin: 26px 0 10px; letter-spacing: -.3px; }
.lede { margin: 0 0 20px; color: var(--muted); max-width: 60ch; }

/* ---- the form ---- */
.tool { display: grid; gap: 16px; }
.countries { display: flex; gap: 0; border: 2px solid var(--frame); border-radius: var(--r); overflow: hidden; width: fit-content; max-width: 100%; }
.countries label { position: relative; }
.countries input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.countries span { display: block; padding: 9px 14px; min-height: 44px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.countries label + label span { border-left: 2px solid var(--frame); }
.countries i { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; font-size: 15px; }
.countries input:checked + span { background: var(--frame); color: var(--bg); }
.countries input:checked + span i { color: inherit; }
.countries input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -5px; }

.stamp { position: relative; padding-top: 4px; }
.stamp-label { display: inline-block; background: var(--red); color: var(--red-ink); font-weight: 700; font-size: 15px; padding: 3px 10px; border-radius: var(--r) var(--r) 0 0; }
.stamp-input {
  display: block; width: 100%; font: 400 clamp(28px, 8vw, 38px)/1.2 var(--dot); letter-spacing: 2px;
  color: var(--ink); background: var(--paper); border: 2px solid var(--frame); border-radius: 0 var(--r) var(--r) var(--r);
  padding: 10px 14px; min-height: 64px;
}
.stamp-input::placeholder { color: var(--line); }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

.words { border: 0; margin: 0; padding: 0; min-width: 0; }
.words legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .chips { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.chip span { display: grid; gap: 1px; height: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); cursor: pointer; }
.chip b { font-size: 19px; font-weight: 700; line-height: 1.25; }
.chip small { font-size: 14px; color: var(--muted); font-style: italic; }
.chip em { font-style: normal; font-size: 15px; line-height: 1.3; }
.chip input:checked + span { border: 2px solid var(--red); background: var(--red-soft); padding: 7px 9px; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip.none b { font-family: var(--body); font-size: 16px; }

.extra label { display: block; font-weight: 700; margin-bottom: 6px; }
.pair { display: flex; gap: 8px; }
.extra input, .extra select { font: 18px/1.2 var(--body); color: var(--ink); background: var(--paper); border: 2px solid var(--frame); border-radius: var(--r); padding: 9px 10px; min-height: 46px; }
.pair input { width: 7ch; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button, .share button { font: 15px/1 var(--body); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; min-height: 36px; cursor: pointer; }
.quick button:hover, .share button:hover { border-color: var(--red); }
.pao-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pao-grid input { width: 100%; }

/* ---- result: the one card on the page ---- */
.result { margin: 6px 0 10px; min-height: 180px; scroll-margin-top: 12px; }
.card { position: relative; background: var(--paper); border: 2px solid var(--frame); border-radius: var(--r); padding: 18px 18px 14px; box-shadow: 5px 5px 0 var(--red); }
.card.quiet { box-shadow: none; border-style: solid; border-color: var(--line); }
.card.ask { box-shadow: 5px 5px 0 var(--warn); }
.tab { position: absolute; top: -2px; right: -2px; background: var(--frame); color: var(--bg); font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: 0 var(--r) 0 var(--r); }
.example { display: inline-block; font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; margin-bottom: 6px; }
.label-line { margin: 0; font-weight: 700; color: var(--red); }
.date { margin: 2px 0 0; font: 400 clamp(32px, 9vw, 50px)/1.1 var(--dot); letter-spacing: .5px; overflow-wrap: anywhere; }
.sub { margin: 4px 0 0; color: var(--muted); }
.status { margin: 10px 0 0; font-weight: 700; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.status::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; }
.status.left { color: var(--ok); }
.status.today { color: var(--warn); }
.status.past { color: var(--bad); }
.status.neutral { color: var(--muted); }
.kind { margin: 10px 0 0; max-width: 62ch; }
.msg { margin: 6px 0 0; }
.big-msg { margin: 0; font-weight: 700; font-size: 21px; padding-right: 70px; }
.warn { margin: 10px 0 0; color: var(--warn); font-weight: 600; }
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choices button { display: grid; text-align: left; gap: 2px; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; min-height: 48px; }
.choices button:hover { border-color: var(--red); }
.choices b { font: 400 24px/1.2 var(--dot); }
.choices span { color: var(--muted); font-size: 15px; }
.how { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.how summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.how ul { margin: 6px 0 4px; padding-left: 20px; }
.how li { margin: 4px 0; }
code { font-family: var(--dot); background: var(--panel); padding: 0 4px; border-radius: 3px; font-size: .95em; }
code[lang] { font-family: var(--cjk); }
button.link { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; cursor: pointer; text-align: left; }
.share { margin: 12px 0 0; }

/* ---- reading content ---- */
.prose { padding-bottom: 30px; }
.prose h2 { font-size: 23px; line-height: 1.25; margin: 36px 0 8px; }
.prose p { max-width: 68ch; }
.table-wrap { margin: 12px 0; }
.formats { width: 100%; border-collapse: collapse; font-size: 16px; }
.formats th, .formats td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
.formats thead th { font-size: 15px; color: var(--muted); border-bottom: 2px solid var(--frame); }
.formats tr.group th { padding-top: 16px; color: var(--red); border-bottom: 0; }
.formats td:first-child { width: 48%; }
.formats code { white-space: nowrap; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; }
.faq details p { margin: 0 0 14px; }
.sources { font-size: 15px; color: var(--muted); margin-top: 28px; }

footer { border-top: 1px solid var(--line); padding: 20px 0 34px; font-size: 15px; color: var(--muted); }
footer a { color: var(--ink); }
.nf { padding: 40px 0 60px; }
.btn { display: inline-block; background: var(--red); color: var(--red-ink); padding: 12px 18px; border-radius: var(--r); text-decoration: none; font-weight: 700; }
.btn:hover { color: var(--red-ink); }

@media (max-width: 400px) {
  .countries span { padding: 9px 10px; }
  .countries i { display: none; }
  .formats code { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
