:root {
  --bg: #fbfaf7;
  --fg: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e1da;
  --field: #8f8a80;
  --card: #ffffff;
  --accent: #0f6b5c;
  --accent-soft: #e3f1ed;
  --warn: #9a4b00;
  --warn-soft: #fbeedd;
  --closed: #5b5b66;
  --closed-soft: #ececf0;
  --restricted: #6a3fa0;
  --restricted-soft: #efe8f8;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --fg: #ececee;
    --muted: #9c9ca4;
    --line: #2c2c31;
    --field: #6e6e78;
    --card: #1c1c20;
    --accent: #5fd0b8;
    --accent-soft: #163a33;
    --warn: #f0b26b;
    --warn-soft: #3a2a17;
    --closed: #b4b4be;
    --closed-soft: #2a2a30;
    --restricted: #c7a6f2;
    --restricted-soft: #2f2440;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.75 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--fg); }
input { caret-color: var(--accent); }
.skip { position: absolute; left: 16px; top: -60px; z-index: 10; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--bg); }
.skip:focus { top: 8px; }
h1, h2, h3, h4 { line-height: 1.35; margin: 1.6em 0 .5em; }
h1 { font-size: 2rem; margin-top: .6em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; margin: 0; }
h4 { font-size: .95rem; margin: 1em 0 .2em; color: var(--muted); }
p { margin: .5em 0; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.muted, .orig, .meta, .src { color: var(--muted); }
.lead { font-size: 1.1rem; }

.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); margin-left: 2px; }
.top nav { display: flex; gap: 16px; font-size: .95rem; }
.top nav a { color: var(--fg); text-decoration: none; white-space: nowrap; }
.top nav a:hover { color: var(--accent); }
.top nav a[aria-current] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }

.tld { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.intro h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); margin-top: 1em; text-wrap: balance; }

.anatomy { margin: 1.4em 0 1.6em; display: inline-grid; grid-template-columns: auto auto; max-width: 100%; }
.anatomy .url, .anatomy figcaption { display: contents; }
.anatomy .host, .anatomy .slot { font-family: var(--mono); font-weight: 600; font-size: clamp(1.5rem, 7vw, 2.4rem); line-height: 1.3; padding: .15em .1em; white-space: nowrap; }
.anatomy .host { color: var(--muted); }
.anatomy .slot {
  color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding-inline: .25em;
  transition: opacity .22s cubic-bezier(.16, 1, .3, 1), filter .22s cubic-bezier(.16, 1, .3, 1), color .3s, background-color .3s;
}
.anatomy .slot.old { color: var(--fg); background: var(--closed-soft); }
.anatomy .slot.swap { opacity: 0; filter: blur(6px); }
.anatomy .cap-host, .anatomy .cap-tld { font-size: .85rem; color: var(--muted); margin-top: 8px; padding-top: 6px; border-top: 2px solid var(--line); line-height: 1.5; }
.anatomy .cap-host { margin-right: 6px; }
.anatomy .cap-tld { border-top-color: var(--accent); }
.anatomy.old .cap-tld { border-top-color: var(--fg); }
.anatomy .cap-tld b { display: block; color: var(--fg); font-size: .95rem; }

.search, .filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 1.2em 0; }
input[type=search], select {
  font: inherit; font-size: 1rem; color: var(--fg); background: var(--card);
  border: 1px solid var(--field); border-radius: 10px; padding: 10px 12px; min-height: 46px;
}
input[type=search] { flex: 1 1 260px; min-width: 0; }
.combo { position: relative; flex: 1 1 260px; min-width: 0; display: flex; }
.combo input[type=search] { flex: 1; }
.suggest {
  position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--field); border-radius: 12px; max-height: min(70vh, 520px); overflow: auto;
  box-shadow: 0 12px 32px -12px rgb(0 0 0 / .25);
}
.suggest[hidden] { display: none; }
.suggest a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; padding: 8px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; line-height: 1.5; }
.suggest a:hover, .suggest [aria-selected] a { background: var(--accent-soft); }
.suggest .tld { color: var(--accent); font-size: 1.05rem; }
.suggest .m { font-size: .95rem; }
.suggest .n { margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.suggest .who { flex-basis: 100%; font-size: .85rem; color: var(--muted); }
.suggest mark { background: var(--warn-soft); color: inherit; border-radius: 3px; }
.suggest .all { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.suggest .all a { color: var(--accent); font-size: .95rem; }
.filters select { flex: 1 1 140px; }
.more-filters { flex: 1 1 100%; border: 0; padding: 0; }
.more-filters > summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--accent); }
.more-filters > summary::after { content: ""; width: 7px; height: 7px; margin-left: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.more-filters[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.filter-set { display: flex; gap: 8px; flex-wrap: wrap; }
.count { margin: .5em 0; }
button.link { background: none; color: var(--accent); padding: 0 4px; min-height: 0; text-decoration: underline; text-underline-offset: 3px; font-size: .95rem; }
button.link[hidden] { display: none; }
@media (min-width: 481px) { .more-filters > summary { display: none; } }
.check { display: flex; align-items: center; gap: 6px; min-height: 46px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
button {
  font: inherit; font-size: 1rem; border: 0; border-radius: 10px; padding: 10px 18px;
  background: var(--accent); color: var(--bg); cursor: pointer; min-height: 46px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 1.5em 0; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stats b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: .9rem; }

.timeline { list-style: none; padding: 0; margin: 1em 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1em 20px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .55em; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--line);
}
.timeline li.done::before { background: var(--muted); border-color: var(--muted); }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.now b::after { content: "現在"; margin-left: 8px; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--accent); color: var(--bg); vertical-align: 2px; }
.timeline li.done b, .timeline li.done time { color: var(--muted); }
.timeline div { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: baseline; }
.timeline time { color: var(--muted); font-size: .9rem; }
.timeline p { margin: .1em 0 0; color: var(--muted); font-size: .95rem; }
.timeline.compact li { padding-bottom: .5em; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--fg); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .tld { font-size: 1.15rem; color: var(--accent); }
.card .m { font-size: .9rem; }
.card .n { font-size: .8rem; color: var(--muted); }
.hl { margin-top: 2.2em; }
.hl h2 { margin-bottom: .1em; }

.rank { padding-left: 1.6em; }
.rank li { padding: 3px 0; }
.rank li span:last-child { color: var(--muted); margin-left: 10px; font-size: .9rem; }
.pill { white-space: nowrap; }
a.pill { text-decoration: none; }

.faq details, details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--fg); }

.crumb { margin-top: 1.5em; font-size: .95rem; }
.crumb a::before { content: "← "; }
.hero-tld { font-size: clamp(2.4rem, 10vw, 3.6rem); margin: .2em 0 .1em; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 1em 0; }
.chip {
  display: inline-block; font-size: .85rem; line-height: 1.5; padding: 2px 10px; border-radius: 99px;
  background: var(--closed-soft); color: var(--closed);
}
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.open { background: var(--accent-soft); color: var(--accent); }
.chip.restricted { background: var(--restricted-soft); color: var(--restricted); }
.chip.closed { background: var(--closed-soft); color: var(--closed); }
.story { font-size: 1.05rem; }
.todo { color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.lead.todo { font-size: .9rem; }
.note { background: var(--warn-soft); border-radius: 12px; padding: 12px 16px; margin: 1.2em 0; }
.note b { color: var(--warn); }
.context { margin: 0 0 .8em; font-size: .9rem; color: var(--muted); }
.overview { margin: .8em 0 1.4em; }
.overview td:first-child { min-width: 9em; }

.app { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 12px 0; }
.app { scroll-margin-top: 72px; transition: border-color .3s; }
.app:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.app .orig { margin: 0; font-size: .9rem; }
.app .meta { font-size: .9rem; margin: .3em 0 .6em; }
.app .src { font-size: .85rem; margin-top: .8em; }
.app details { margin-top: .6em; padding-bottom: 0; }
.app summary { font-weight: 400; color: var(--accent); font-size: .95rem; }
.raw { white-space: pre-wrap; font-size: .9rem; color: var(--muted); max-height: 60vh; overflow: auto; margin-top: .5em; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { border-top: 1px solid var(--line); padding: 12px 0; }
.list .row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.list .tld { font-size: 1.1rem; }
.list .feat .tld { color: var(--accent); }
.list .m { font-size: .95rem; }
.list .n { margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.list .who { font-size: .9rem; color: var(--muted); margin: 2px 0 0; }
.list .who a { color: var(--muted); }
.list mark { background: var(--warn-soft); color: inherit; border-radius: 3px; }
.more { display: block; margin: 16px auto; }
.more[hidden] { display: none; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

.gloss dt { font-weight: 700; margin-top: 1.2em; scroll-margin-top: 70px; }
.gloss dd { margin: .2em 0 0; }
.gloss dt:target { color: var(--accent); }

.foot { border-top: 1px solid var(--line); margin-top: 3em; padding-top: 1em; padding-bottom: 2em; font-size: .85rem; color: var(--muted); }
.foot p { margin: .3em 0; }

@media (prefers-reduced-motion: reduce) {
  .card, .anatomy .slot { transition: none; }
  .card:hover { transform: none; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .top nav { gap: 4px; font-size: .9rem; }
  .top nav a { padding: 10px 6px; }
  .brand span { display: none; }
}
