:root {
  --ink: #1c1b18;
  --paper: #f6f2e9;
  --paper-deep: #ece5d8;
  --red: #d84632;
  --red-dark: #a92e20;
  --green: #315f55;
  --yellow: #e9bd4e;
  --line: rgba(28, 27, 24, .18);
  --shadow: 0 10px 0 rgba(28, 27, 24, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.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; }
.paper-noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}

.topbar {
  height: 70px; padding: 0 max(20px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15;
  background: rgba(246, 242, 233, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .26s ease; will-change: transform;
}
.topbar.header-hidden { transform: translateY(calc(-100% - 2px)); }
.brand, .footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; color: inherit; text-decoration: none; }
.brand-stamp { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; background: var(--red); border-radius: 50% 46% 47% 44%; font-family: "Noto Serif JP", serif; font-size: 13px; letter-spacing: -.06em; transform: rotate(-5deg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.brand-stamp.small { width: 31px; height: 31px; font-size: 11px; }
.about-button { border: 0; border-bottom: 1px solid var(--ink); background: transparent; padding: 5px 0; font-size: 13px; font-weight: 700; cursor: pointer; }

main { overflow: hidden; }
.hero { padding: 16px 20px 18px; position: relative; }
.search-shell { height: 56px; border: 2px solid var(--ink); background: #fffdfa; box-shadow: 4px 5px 0 var(--ink); display: flex; align-items: center; padding: 0 13px; position: relative; z-index: 2; }
.search-shell:focus-within { box-shadow: 5px 6px 0 var(--red); border-color: var(--red); }
.search-shell svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 auto; }
.search-shell input { width: 100%; border: 0; outline: 0; background: transparent; padding: 0 11px; font-size: 16px; font-weight: 650; min-width: 0; }
.search-shell input::placeholder { color: #918a7e; font-weight: 500; }
.clear-search { width: 32px; height: 32px; border: 0; border-radius: 50%; display: none; background: var(--paper-deep); font-size: 22px; line-height: 1; cursor: pointer; }
.clear-search.visible { display: block; }
.quick-terms { margin-top: 12px; display: flex; align-items: center; gap: 7px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.quick-terms::-webkit-scrollbar, .filter-scroll::-webkit-scrollbar { display: none; }
.quick-terms span { font-size: 11px; font-weight: 800; color: #7d766d; }
.quick-terms button { border: 1px solid var(--line); background: rgba(255,255,255,.45); border-radius: 99px; padding: 6px 11px; font-size: 11px; font-weight: 700; cursor: pointer; }

.company-directory { padding: 18px 20px 20px; }
.directory { padding: 0 20px 56px; }
.directory-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.company-directory .directory-head { margin-bottom: 0; }
.eyebrow { color: var(--red-dark); font-size: 10px; line-height: 1; letter-spacing: .18em; font-weight: 800; margin: 0 0 8px; }
h2, .section-title { font: 900 30px/1.2 "Noto Serif JP", serif; margin: 0; letter-spacing: -.04em; }
.result-count { display: flex; align-items: baseline; gap: 4px; }
.result-count strong { font: 900 25px/1 "Noto Serif JP", serif; }
.result-count span { font-size: 10px; color: #7d766d; font-weight: 600; }
.company-toggle { display: flex; align-items: center; gap: 6px; padding: 7px 0 5px 10px; border: 0; background: transparent; cursor: pointer; }
.toggle-chevron { width: 20px; height: 20px; display: grid; place-items: center; color: var(--red); transition: transform .2s ease; }
.toggle-chevron svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.company-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(180deg); }
.filter-scroll { display: flex; gap: 8px; width: 100%; margin: 0 0 22px; padding: 0 0 5px; overflow-x: auto; scrollbar-width: none; }
.filter-chip { flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 0; background: transparent; padding: 9px 13px; font-size: 12px; font-weight: 700; cursor: pointer; }
.filter-chip.active { background: var(--ink); color: #fff; }
.company-list { display: grid; gap: 9px; margin-top: 16px; }
.company-list[hidden] { display: none; }
.company-card { width: 100%; min-width: 0; min-height: 76px; padding: 13px 13px 13px 11px; border: 1.5px solid var(--ink); background: rgba(255,253,250,.75); color: var(--ink); text-decoration: none; display: grid; grid-template-columns: 38px minmax(0, 1fr) 32px; align-items: center; gap: 10px; transition: transform .15s, box-shadow .15s; }
.company-card:active { transform: translate(2px, 2px); }
.company-number { color: var(--red); font: 900 17px/1 "Noto Serif JP", serif; text-align: center; }
.company-copy { display: grid; gap: 5px; min-width: 0; }
.company-name { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.company-meta { display: flex; align-items: center; gap: 7px; min-width: 0; }
.company-interface { flex: 0 0 auto; padding: 3px 6px; background: var(--green); color: #fff; font-size: 9px; line-height: 1.2; }
.company-interface.unknown { background: #8a8175; }
.company-service { min-width: 0; color: #7a7369; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.company-note { color: #5d574e; font-size: 10px; line-height: 1.6; }
.company-arrow { width: 32px; height: 32px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 14px; }
.results { display: grid; gap: 14px; }
.merchant-card { width: 100%; min-width: 0; overflow: hidden; border: 1.5px solid var(--ink); background: rgba(255,253,250,.75); transition: box-shadow .2s, transform .2s; }
.merchant-card.open { box-shadow: 4px 5px 0 var(--ink); transform: translate(-2px, -2px); }
.merchant-top { min-height: 92px; padding: 16px 14px; display: flex; align-items: center; gap: 12px; }
.merchant-monogram { flex: 0 0 53px; width: 53px; height: 53px; display: grid; place-items: center; background: var(--paper-deep); border-radius: 50%; font: 900 21px/1 "Noto Serif JP", serif; color: var(--red-dark); }
.merchant-name-wrap { min-width: 0; flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: 9px; font-weight: 800; letter-spacing: .08em; color: var(--green); }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.unpublished { color: #987013; }
.merchant-card h3 { margin: 0; font-size: 18px; line-height: 1.3; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-jp { margin: 3px 0 0; color: #81796e; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expand-button { flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; font-size: 23px; line-height: 1; cursor: pointer; transition: transform .2s; }
.merchant-card.open .expand-button { transform: rotate(180deg); }
.provider-block { border-top: 1px solid var(--line); padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 15px; background: rgba(236,229,216,.47); }
.provider-block span, .detail-grid span { color: #7a7369; font-size: 10px; font-weight: 600; }
.provider-block strong { min-width: 0; text-align: right; font-size: 13px; line-height: 1.45; color: var(--red-dark); overflow-wrap: anywhere; }
.merchant-details { display: none; border-top: 1px dashed var(--line); padding: 16px 14px 14px; }
.merchant-card.open .merchant-details { display: block; animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-grid > div { display: grid; gap: 5px; }
.detail-grid strong { font-size: 12px; line-height: 1.5; }
.merchant-note { margin: 16px 0; padding-left: 10px; border-left: 3px solid var(--yellow); color: #5f594f; font-size: 11px; line-height: 1.75; }
.card-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-links a { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); text-decoration: none; border: 1px solid var(--ink); font-size: 11px; font-weight: 800; }
.card-links a:last-child { background: var(--ink); color: #fff; }
.card-links a.disabled { pointer-events: none; opacity: .35; }
.empty-state { text-align: center; border: 1.5px dashed var(--ink); padding: 38px 24px; background: rgba(255,255,255,.35); }
.empty-state span { display: inline-block; color: var(--red); font: 900 14px "Noto Serif JP", serif; transform: rotate(-4deg); }
.empty-state h3 { margin: 12px 0 7px; font: 900 22px "Noto Serif JP", serif; }
.empty-state p { margin: 0 auto 20px; max-width: 280px; color: #746d63; font-size: 12px; line-height: 1.7; }
.empty-state button { border: 0; background: var(--red); color: #fff; padding: 10px 18px; font-size: 12px; font-weight: 800; cursor: pointer; }

.notice-card { margin: 0 20px 65px; padding: 22px 19px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); display: flex; gap: 15px; }
.notice-mark { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--red); color: var(--red); border-radius: 50%; font: 900 20px "Noto Serif JP", serif; }
.notice-card h2 { font-size: 18px; margin-bottom: 8px; }
.notice-card p { margin: 0; font-size: 12px; color: #625c53; line-height: 1.8; }

footer { padding: 35px 20px calc(35px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; }
footer p { margin: 20px 0; color: #bdb8ae; font-size: 11px; line-height: 1.8; }
footer > a { color: #fff; font-size: 11px; font-weight: 700; text-underline-offset: 4px; }

dialog { width: 100%; max-width: 520px; max-height: 88dvh; margin: auto 0 0; padding: 0; border: 0; background: transparent; color: var(--ink); }
dialog::backdrop { background: rgba(15,14,12,.62); backdrop-filter: blur(3px); }
.dialog-sheet { background: var(--paper); padding: 29px 20px calc(28px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; position: relative; overflow-y: auto; max-height: 88dvh; }
.dialog-close { position: absolute; right: 17px; top: 17px; width: 36px; height: 36px; border: 1px solid var(--ink); background: transparent; font-size: 23px; cursor: pointer; }
.dialog-sheet h2 { font-size: 32px; margin-bottom: 23px; }
.guide-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); counter-reset: guide; }
.guide-list li { counter-increment: guide; position: relative; padding: 16px 0 16px 44px; border-bottom: 1px solid var(--line); display: grid; gap: 5px; }
.guide-list li::before { content: "0" counter(guide); position: absolute; left: 0; top: 17px; color: var(--red); font: 900 18px "Noto Serif JP", serif; }
.guide-list b { font-size: 14px; }
.guide-list span { color: #665f55; font-size: 11px; line-height: 1.7; }
.guide-warning { margin: 20px 0; padding: 13px 14px; background: #eee1be; color: #594713; font-size: 11px; line-height: 1.7; }
.primary-link { height: 50px; display: flex; justify-content: center; align-items: center; gap: 8px; background: var(--red); color: #fff; text-decoration: none; font-size: 12px; font-weight: 800; }

@media (min-width: 700px) {
  body { max-width: 720px; margin: 0 auto; box-shadow: 0 0 80px rgba(28,27,24,.14); }
  html { background: #ddd5c8; }
  .hero { padding-left: 54px; padding-right: 54px; }
  .notice-card { margin-left: 54px; margin-right: 54px; }
  .directory { padding-left: 54px; padding-right: 54px; }
  .company-directory { padding-left: 54px; padding-right: 54px; }
  dialog { margin-left: auto; margin-right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

