:root {
  color-scheme: light;
  --steel: #1c5a6b;
  --steel-light: #2d7584;
  --deep: #123640;
  --oxide: #2b7a78;
  --mint: #d8ece8;
  --forge: #f08a3e;
  --paper: #f3f7f5;
  --white: #ffffff;
  --ink: #17373f;
  --muted: #5d7479;
  --line: #cbd9d7;
  --shadow: 0 12px 34px rgba(18, 54, 64, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 18px; }
body { margin: 0; overflow-x: hidden; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif; line-height: 1.65; }
button, input, select, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }
.live-wrap { width: min(100%, 1180px); margin: auto; padding: 24px 20px 120px; }

.live-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.live-header > div { min-width: 0; }
.live-kicker { color: var(--steel-light); font-size: .9rem; font-weight: 700; letter-spacing: .06em; }
.live-header h1 { margin: 2px 0 0; font-size: clamp(1.95rem, 6vw, 2.75rem); line-height: 1.12; letter-spacing: -.03em; }
.logo { position: relative; display: block; width: 68px; height: 68px; flex: none; text-decoration: none; }
.nut { position: absolute; inset: 4px; background: linear-gradient(145deg, var(--steel-light), var(--deep)); clip-path: polygon(25% 3%,75% 3%,98% 50%,75% 97%,25% 97%,2% 50%); }
.nut::after { content: ""; position: absolute; inset: 19px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 3px rgba(18,54,64,.2); }
.stem { position: absolute; width: 13px; height: 28px; left: 28px; bottom: 0; background: repeating-linear-gradient(165deg,var(--forge) 0 5px,#c5682f 6px 9px); border-radius: 2px 2px 6px 6px; }
.help-link { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--deep); text-decoration: none; font-size: 1.35rem; font-weight: 800; }

.live-grid { display: grid; gap: 16px; grid-template-columns: minmax(0,1fr); }
.live-card { position: relative; overflow: hidden; min-height: 270px; padding: 20px; border: 1px solid rgba(28,90,107,.13); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.card-title { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; }
.card-title h2 { margin: 0; font-size: 1.08rem; }
.status-dot { width: 11px; height: 11px; flex: none; border-radius: 50%; background: var(--oxide); box-shadow: 0 0 0 4px rgba(43,122,120,.13); }
.status-dot.light { background: #b9fff2; box-shadow: 0 0 0 4px rgba(255,255,255,.16); }
.metrics { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.metric { min-height: 76px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfc; }
.metric strong { display: block; font-family: Georgia,"Noto Serif TC",serif; font-size: 1.45rem; line-height: 1.2; }
.metric span { color: var(--muted); font-size: .78rem; }
.observed { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }

.product-card { color: white; background: linear-gradient(140deg,var(--steel-light),var(--deep)); border: 0; }
.product-card .card-title { color: white; }
.product-visual { position: absolute; right: 24px; top: 46px; width: 116px; height: 90px; opacity: .22; transform: rotate(18deg); }
.visual-nut { position: absolute; right: 0; width: 68px; height: 60px; background: white; clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); }
.visual-nut::after { content: ""; position: absolute; inset: 19px; border-radius: 50%; background: var(--deep); }
.visual-bolt { position: absolute; width: 25px; height: 74px; right: 22px; top: 48px; background: repeating-linear-gradient(165deg,#fff 0 7px,#8bb7bd 8px 12px); }
.top-products { position: relative; z-index: 1; display: grid; gap: 9px; max-width: 76%; }
.top-product { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; background: rgba(255,255,255,.09); }
.top-product span { font-size: .88rem; }
.top-product strong { color: #d9fff8; }
.live-message { position: relative; margin: 14px 0 0; color: #d5eaed; font-size: .78rem; }

.explore-section, .map-section, .directory-section { margin-top: 30px; padding: 24px; border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 18px; }
.section-title span, .eyebrow { display: block; color: var(--steel-light); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.section-title h2, .about h2 { margin: 3px 0 0; font-family: Georgia,"Noto Serif TC",serif; font-size: clamp(1.65rem,5vw,2.35rem); line-height: 1.2; }
.text-action { border: 0; padding: 0; background: none; color: var(--steel); font-size: .85rem; font-weight: 800; cursor: pointer; }
.category-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.category-card { min-height: 108px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #f9fcfb; text-align: left; cursor: pointer; transition: transform .18s,border-color .18s,background .18s; }
.category-card:hover, .category-card.active { transform: translateY(-2px); border-color: var(--steel-light); background: var(--mint); }
.category-card b { display: block; margin-bottom: 5px; font-size: .95rem; }
.category-card span { color: var(--muted); font-size: .76rem; letter-spacing: 0; }
.category-icon { display: grid; place-items: center; width: 31px; height: 31px; margin-bottom: 9px; border-radius: 10px; background: var(--steel); color: white; font-size: .85rem; }

.map-title-row { align-items: center; margin-bottom: 8px; }
.map-count { display: flex; align-items: baseline; gap: 6px; color: var(--muted); }
.map-count strong { color: var(--forge); font-family: Georgia,"Noto Serif TC",serif; font-size: 2rem; line-height: 1; }
.map-count span { color: var(--muted); letter-spacing: 0; }
.map-intro { margin: 0 0 16px; color: var(--muted); font-size: .82rem; }
.map-filters { margin-bottom: 12px; }
.map-shell { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #d8e6e3; }
#fastener-map { width: 100%; height: clamp(430px,65vh,680px); min-height: 430px; background: #d8e6e3; }
.map-legend { position: absolute; z-index: 500; left: 10px; bottom: 24px; display: flex; flex-wrap: wrap; gap: 8px 12px; max-width: calc(100% - 20px); padding: 7px 10px; border: 1px solid rgba(18,54,64,.14); border-radius: 11px; background: rgba(255,255,255,.92); box-shadow: 0 4px 18px rgba(18,54,64,.12); color: var(--muted); font-size: .68rem; backdrop-filter: blur(8px); }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.precision-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--oxide); }
.precision-dot.street { background: var(--forge); }
.precision-dot.area { background: #7a8790; }
.fastener-marker-wrap { background: none; border: 0; }
.fastener-marker { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid white; border-radius: 50% 50% 50% 8px; background: var(--oxide); box-shadow: 0 5px 13px rgba(18,54,64,.34); transform: rotate(-45deg); }
.fastener-marker i { width: 12px; height: 12px; border: 3px solid white; border-radius: 50%; }
.fastener-marker.street { background: var(--forge); }
.fastener-marker.area { background: #7a8790; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(28,90,107,.28); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: var(--steel); color: white; font-weight: 800; }
.leaflet-container { font-family: inherit; color: var(--ink); }
.leaflet-popup-content-wrapper { border-radius: 15px; box-shadow: 0 9px 30px rgba(18,54,64,.18); }
.leaflet-popup-content { margin: 14px 16px; }
.map-popup h3 { margin: 4px 0 8px; font-family: Georgia,"Noto Serif TC",serif; font-size: 1.05rem; line-height: 1.35; }
.map-popup p { margin: 9px 0 4px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.map-popup small { display: block; margin-bottom: 10px; color: #788a8e; font-size: .65rem; }
.map-popup a { color: var(--steel); font-size: .75rem; font-weight: 800; }
.popup-city { color: var(--steel-light); font-size: .68rem; font-weight: 800; }
.popup-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.popup-tags span { padding: 2px 6px; border-radius: 999px; background: var(--mint); color: var(--deep); font-size: .62rem; }

.directory-title { margin-bottom: 20px; }
.download { flex: none; color: var(--steel); font-weight: 800; text-underline-offset: 5px; }
.filters { display: grid; grid-template-columns: 1fr; gap: 10px; }
.filters input, .filters select, .filters button { width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfc; color: var(--ink); }
.search-box { position: relative; }
.search-box > span[aria-hidden] { position: absolute; left: 16px; top: 10px; font-size: 1.25rem; }
.search-box input { padding-left: 43px; }
.clear-button { cursor: pointer; color: var(--muted) !important; }
.active-filter { margin-top: 12px; padding: 9px 13px; border-radius: 11px; background: #e6f1ef; color: var(--deep); font-size: .82rem; font-weight: 700; }
.result-bar { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.company-grid { display: grid; grid-template-columns: 1fr; gap: 10px; padding-top: 14px; }
.company-card { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: #fbfdfc; }
.company-card h3 { margin: 0; font-family: Georgia,"Noto Serif TC",serif; font-size: 1.2rem; line-height: 1.4; }
.card-top { display: flex; justify-content: space-between; gap: 12px; }
.city-chip { flex: none; align-self: start; padding: 3px 9px; border: 1px solid var(--steel); border-radius: 999px; color: var(--steel); font-size: .7rem; }
.product-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.product-tags span { padding: 4px 8px; border-radius: 999px; background: var(--mint); color: var(--deep); font-size: .7rem; font-weight: 700; }
.product-summary { margin: 10px 0; color: var(--muted); font-size: .86rem; }
.company-card address { margin: 10px 0; color: var(--muted); font-style: normal; font-size: .82rem; }
.card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .79rem; }
.card-meta span { display: block; color: var(--muted); font-size: .68rem; }
.card-bottom { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 12px; color: var(--muted); font-size: .7rem; }
.card-bottom a { color: var(--steel); font-weight: 800; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.map-link { border: 0; padding: 0; background: none; color: var(--forge); font-size: inherit; font-weight: 800; cursor: pointer; }
.status-badge.official { color: #156b55; }
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state p { color: var(--muted); }

.about { display: grid; gap: 26px; margin-top: 30px; padding: 30px 24px; border-radius: 20px; background: var(--deep); color: white; }
.about p { margin: 0 0 12px; color: #cfe0e1; }
.about .eyebrow { color: #89cec5; }
.about-links { display: flex; flex-wrap: wrap; gap: 16px; }
.about-links a { color: #baf2e8; text-underline-offset: 5px; }

.quick-nav { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; height: 80px; padding: 8px max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); background: rgba(243,247,245,.94); border-top: 1px solid #dce6e4; backdrop-filter: blur(12px); }
.quick-nav button { appearance: none; border: 0; border-radius: 15px; background: transparent; color: #50686d; display: grid; place-items: center; gap: 1px; cursor: pointer; }
.quick-nav button.active { background: var(--mint); color: var(--deep); }
.quick-nav b { font-size: 1.15rem; line-height: 1; }
.quick-nav span { font-size: .75rem; }

@media (max-width: 430px) {
  .live-wrap { padding-inline: 14px; }
  .live-header { gap: 10px; }
  .live-header h1 { font-size: 1.75rem; }
  .live-kicker { font-size: .76rem; white-space: nowrap; }
  .logo { width: 58px; height: 58px; }
  .nut::after { inset: 17px; }
  .stem { left: 24px; width: 11px; height: 24px; }
  .help-link { display: none; }
  .live-card, .explore-section, .map-section, .directory-section { border-radius: 18px; }
  .map-section { padding-inline: 12px; }
  .map-title-row, .map-intro { padding-inline: 8px; }
  #fastener-map { height: 62vh; min-height: 440px; }
  .section-title { align-items: start; flex-direction: column; }
  .directory-title .download { align-self: start; }
  .result-bar { align-items: start; flex-direction: column; }
}

@media (min-width: 680px) {
  .category-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .filters { grid-template-columns: minmax(260px,1fr) 210px 170px auto; }
  .clear-button { width: auto !important; }
  .company-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .about { grid-template-columns: .8fr 1.2fr; padding: 42px; }
}

@media (min-width: 850px) {
  .live-wrap { padding: 32px 32px 126px; }
  .live-grid { grid-template-columns: 1fr 1fr; }
  .explore-section, .map-section, .directory-section { margin-top: 20px; padding: 30px; }
  .category-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .quick-nav { width: min(640px,calc(100% - 40px)); left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); border: 1px solid #dce6e4; border-radius: 22px; box-shadow: var(--shadow); }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
