/*
 * No web fonts and no external stylesheets on purpose. This page's argument is
 * a complete list of the requests it makes; a font or a CDN stylesheet would
 * add rows to that list which have nothing to do with converting an address,
 * and the list is only persuasive while every row can be accounted for.
 *
 * Shares its palette and class vocabulary with the sibling demos
 * (itaiji-normalize, japan-calendar) so the three read as one set.
 */

:root {
  --bg: #fbfaf8;
  --fg: #1d1c1a;
  --muted: #6b6862;
  --line: #ddd8d0;
  --panel: #ffffff;
  --accent: #1c5d99;
  --warn-bg: #fdf5e6;
  --warn-line: #d9a441;
  --warn-fg: #7a5310;
  --ok: #2f6f43;
  --ok-bg: #eef6f0;
  --chip-bg: #eef1f5;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161a;
    --fg: #eae7e1;
    --muted: #a29d95;
    --line: #35323a;
    --panel: #1f1e23;
    --accent: #7db3e0;
    --warn-bg: #2c2415;
    --warn-line: #a9803a;
    --warn-fg: #e8c281;
    --ok: #77c093;
    --ok-bg: #1b2a21;
    --chip-bg: #2b2933;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.75;
  font-size: 16px;
}

.page-head, main, .page-foot {
  max-width: 50rem;
  margin: 0 auto;
}

.page-head { padding: 2.5rem 0 1rem; }

h1 {
  font-size: 1.7rem;
  margin: 0 0 .4rem;
  letter-spacing: .01em;
}

.version {
  font-size: .95rem;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lead { margin: 0 0 1rem; }

.links { margin: 0 0 1.2rem; display: flex; gap: 1.1rem; flex-wrap: wrap; }
.links a, .page-foot a, .guide a, .privacy a, .warn-link { color: var(--accent); }

/*
 * The privacy note. Given more weight than anything else in the header on
 * purpose: this is the one claim a visitor cannot check by looking at the
 * output, and getting it wrong would be worse than shipping no demo.
 */
.privacy {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  border-radius: var(--radius);
  background: var(--panel);
  padding: .9rem 1.1rem;
  margin: 0;
}
.privacy h2 { font-size: 1rem; margin: 0 0 .5rem; }
.privacy p { margin: 0 0 .5rem; font-size: .9rem; }
.privacy p:last-child { margin-bottom: 0; }
.privacy-key {
  border-left: 3px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: 4px;
  padding: .5rem .7rem;
}

.request-meter {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: .5rem .7rem;
  margin: .8rem 0 0;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
}
.meter-label { font-size: .9rem; color: var(--muted); }
.meter-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}
.meter-note {
  grid-column: 1 / -1;
  font-size: .82rem;
  color: var(--muted);
}
.meter-note kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95em;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 .3rem;
}

.panel-guide { border-left: 4px solid var(--accent); }
.guide {
  margin: 0;
  padding-left: 1.3rem;
  display: grid;
  gap: .55rem;
}
.guide li { line-height: 1.65; }

.loading, .load-error { padding: 2rem 0; color: var(--muted); }
.load-error { color: var(--warn-fg); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.4rem;
  margin: 1.6rem 0;
}

.panel h2 {
  font-size: 1.15rem;
  margin: 0 0 .3rem;
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}
.panel h2 code {
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
}

.panel-lead { margin: 0 0 1rem; font-size: .93rem; color: var(--muted); }
.panel-lead code, .guide code, .notes code, .privacy code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--chip-bg);
  border-radius: 3px;
  padding: 0 .25rem;
  overflow-wrap: anywhere;
}

.sub {
  font-size: .95rem;
  margin: 1.4rem 0 .6rem;
  color: var(--fg);
}
#served-list {
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.fact { font-variant-numeric: tabular-nums; }

.presets { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }

/* Stacked rather than the sibling demos' pill row: a preset here is a whole
   Japanese address plus a one-line reason to press it, and side by side those
   two wrap into each other. */
.preset {
  font: inherit;
  font-size: .88rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .35rem .8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  line-height: 1.5;
  text-align: left;
  max-width: 100%;
  flex: 1 1 20rem;
}
.preset:hover { border-color: var(--accent); }
.preset-label { font-weight: 600; }
.preset-note { font-size: .78rem; color: var(--muted); }

.field { display: block; margin-bottom: .9rem; }
.field-label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .3rem;
  padding: 0;
}

input[type="text"], select {
  font: inherit;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .5rem .7rem;
  max-width: 100%;
}
input[type="text"] { width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.options {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 .9rem;
  padding: .6rem .9rem .8rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.2rem;
  align-items: flex-end;
  min-width: 0;
}
.options legend { padding: 0 .3rem; }
.options label {
  display: grid;
  gap: .2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  color: var(--muted);
}
.options select { font-family: inherit; font-size: .85rem; padding: .3rem .5rem; }
.options .check {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding-bottom: .35rem;
}

.output { margin-top: 1.1rem; }

.summary { font-size: .85rem; color: var(--muted); margin: 1rem 0 .5rem; }
/* Truncation is stated, so it is styled to be read rather than skimmed past. */
.summary-truncated {
  border-left: 3px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: 4px;
  padding: .4rem .6rem;
}

/* The headline answer. */
.verdict {
  display: grid;
  gap: .3rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: .7rem 1rem;
}
.verdict-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.verdict-from {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
}
.verdict-in {
  font-size: .85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.verdict-arrow { color: var(--muted); font-size: .8rem; }
.verdict-name {
  font-size: 1.2rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .15rem .8rem;
  margin: .3rem 0 0;
  font-size: .87rem;
}
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; min-width: 0; }
.kv-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  color: var(--muted);
}
.kv-value { overflow-wrap: anywhere; }
.kv-note { display: block; color: var(--muted); font-size: .8rem; }

.formats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: .8rem;
}
.format { min-width: 0; }
.format-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  color: var(--muted);
  margin: 0 0 .3rem;
  font-weight: 400;
}
/* Wrapped rather than scrolled: these blocks are short and a horizontal
   scrollbar hides the end of the very lines a reader came to compare. */
.format-body {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .5rem .7rem;
  font-size: .75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.candidates { list-style: none; margin: .3rem 0 0; padding: 0; }
.candidate {
  display: grid;
  gap: .1rem;
  padding: .4rem .5rem;
  border-top: 1px solid var(--line);
}
.cand-name { font-weight: 600; overflow-wrap: anywhere; }
.cand-meta { font-size: .8rem; color: var(--muted); }

/* Failures are shown as an outcome the library chose, not as a page error. */
.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  margin: 0;
}
/* A limit this page chose, not something the library did. Kept visually
   distinct so a visitor does not read it as a defect in the library. */
.warn-demo {
  background: var(--panel);
  border-color: var(--line);
  border-left: 4px solid var(--muted);
}
/* An uncaught exception, which this library is not supposed to produce. */
.warn-throw { border-left: 4px solid var(--warn-line); }
.warn-head {
  margin: 0 0 .3rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}
.err-name, .case-expr, .req-url, .served-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  background: var(--chip-bg);
  border-radius: 4px;
  padding: .05rem .4rem;
}
.err-lead { font-size: .85rem; color: var(--warn-fg); }
.warn-demo .err-lead { color: var(--fg); }
.err-message { margin: 0 0 .3rem; font-size: .85rem; }
.warn-link { font-size: .82rem; }

/* Panel 3: the request list. */
.requests { list-style: none; margin: 0; padding: 0; counter-reset: req; }
.request {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .15rem .6rem;
  align-items: baseline;
  padding: .45rem .2rem;
  border-top: 1px solid var(--line);
}
.req-kind {
  font-size: .72rem;
  border-radius: 999px;
  padding: 0 .55rem;
  border: 1px solid currentColor;
  white-space: nowrap;
  line-height: 1.7;
  color: var(--muted);
}
.req-data { color: var(--accent); }
.req-index { color: var(--accent); }
.req-foreign { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-line); }
.req-url { overflow-wrap: anywhere; }
.req-parts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .9rem;
  font-size: .8rem;
  color: var(--muted);
}
.req-part-none { color: var(--ok); }
.request-alarm { background: var(--warn-bg); border-radius: 4px; }

.served { list-style: none; margin: 0; padding: 0; }
.served-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .1rem .8rem;
  padding: .35rem .2rem;
  border-top: 1px solid var(--line);
  font-size: .88rem;
}
.served-name { font-weight: 600; }
.served-size {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: .82rem;
}
.served-path { grid-column: 1 / -1; font-size: .74rem; justify-self: start; }

.case-group {
  font-size: .9rem;
  margin: 1.3rem 0 .5rem;
}
.case-group:first-child { margin-top: 0; }

.cases { list-style: none; margin: 0; padding: 0; }
.case {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .2rem .7rem;
  padding: .55rem 0;
  border-top: 1px solid var(--line);
}
.case-expr { justify-self: start; overflow-wrap: anywhere; }
.case-verdict {
  font-size: .75rem;
  border-radius: 999px;
  padding: 0 .6rem;
  border: 1px solid currentColor;
  white-space: nowrap;
  justify-self: end;
  line-height: 1.7;
}
.case-accept { color: var(--ok); }
.case-refuse { color: var(--accent); }
.case-throw { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-line); }
/* Never expected to render — see INPUT_CASES in app.js. */
.case-unexpected {
  color: var(--warn-fg);
  background: var(--warn-bg);
  border-color: var(--warn-line);
  font-weight: 700;
}
.case-result {
  grid-column: 1 / -1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.case-note { grid-column: 1 / -1; font-size: .82rem; }
.case-alarm {
  grid-column: 1 / -1;
  font-size: .82rem;
  color: var(--warn-fg);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 4px;
  padding: .3rem .5rem;
}

.panel-note h2 { margin-bottom: .6rem; }
.notes { margin: 0; padding-left: 1.2rem; }
.notes li { margin-bottom: .6rem; }

.install {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  overflow-x: auto;
  font-size: .85rem;
  margin: 0 0 .8rem;
}

.page-foot {
  border-top: 1px solid var(--line);
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  font-size: .85rem;
  color: var(--muted);
}
.page-foot h2 { font-size: .95rem; color: var(--fg); margin: 0 0 .5rem; }
.page-foot p { margin: 0 0 .6rem; }
.page-foot code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  overflow-wrap: anywhere;
}
.foot-meta { font-size: .8rem; }
