:root {
  --ink: #1d1a17; --muted: #5d544b; --paper: #fbf7f0; --line: #e6dccb; --accent: #9a5516;
  --nature: #4f7a3c; --family: #a8501c; --home: #3f6f90; /* round 7e: darker so text / white-on-colour reach ~4.5:1 (orange was ~3.3:1) */
  font-family: system-ui, "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fdad6; }
a { color: inherit; }
:focus-visible { outline: 3px solid #f4b860; outline-offset: 2px; }
.bar { position: fixed; inset: 0 0 auto 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; padding: max(10px, env(safe-area-inset-top)) 18px 10px; }
.brand { text-decoration: none; font-size: 18px; letter-spacing: .3em; font-weight: 300; color: var(--ink); background: rgba(251,247,240,.9); padding: 8px 14px; border-radius: 999px; }
.brand span { font-size: 12px; letter-spacing: .14em; margin-left: 8px; font-weight: 600; color: var(--accent); }
.bar nav { display: flex; gap: 6px; }
.bar nav a { min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; text-decoration: none; font-size: 14px; background: rgba(251,247,240,.9); }
#stage { position: fixed; inset: 0; }
#island3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.chip { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 0;
  background: rgba(255,253,248,.94); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); white-space: nowrap; }
.chip b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; }
.chip.g-nature b { background: var(--nature); } .chip.g-family b { background: var(--family); } .chip.g-home b { background: var(--home); }
.chip.on, .chip:hover { background: #1d1a17; color: #fff; }
.chip[hidden] { display: none; }
.labels.compact .chip { padding: 2px; gap: 4px; font-size: 11px; } .labels.compact .chip b { width: 20px; height: 20px; font-size: 10.5px; }
.labels.compact .chip span { display: none; } .labels.compact .chip.named { padding-right: 8px; } .labels.compact .chip.named span { display: inline; }
/* phones (round 7e): number for every entrance, short name only for the 6 nearest ones and the selected one (review: names on all 20 were too dense) */
.intro { position: absolute; left: 22px; top: 70px; z-index: 3; pointer-events: none; max-width: 520px;
  background: rgba(251, 247, 240, .9); border-radius: 12px; padding: 8px 12px; } /* round 7f: solid paper behind the text (the orange kicker sat on the 3D scene: low contrast) */
.intro h1 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 38px); letter-spacing: .04em; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.kicker { margin: 0 0 4px; font-size: 13px; letter-spacing: .2em; color: #7a4210; font-weight: 700; } /* ~7:1 on the paper panel */
.sub { margin: 0; font-size: 14px; color: var(--muted); }
.g-nature { color: var(--nature); } .g-family { color: var(--family); } .g-home { color: var(--home); }
.tools { position: absolute; left: 18px; bottom: 18px; z-index: 4; display: flex; gap: 8px; }
.tools button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: rgba(29,26,23,.82); color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.hint { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3; margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(29,26,23,.6); color: #fff; font-size: 13px; pointer-events: none; transition: opacity .5s; }
.hint.gone { opacity: 0; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 8; background: #9fdad6; letter-spacing: .4em; font-size: 22px; }
.loading[hidden] { display: none; }
.fallback { position: absolute; left: 20px; right: 380px; top: 160px; z-index: 5; padding: 14px; border-radius: 14px; background: var(--paper); }
.fallback[hidden] { display: none; }
/* list (desktop: right column) */
.list { position: fixed; z-index: 5; top: 64px; right: 14px; bottom: 14px; width: 300px; display: flex; flex-direction: column; border-radius: 18px; background: rgba(251,247,240,.96); box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow: hidden; }
.list-toggle { display: none; }
.list-body { overflow: auto; padding: 10px 12px 14px; }
.grp h2 { margin: 10px 4px 6px; font-size: 13px; letter-spacing: .2em; }
.grp.g-nature h2 { color: var(--nature); } .grp.g-family h2 { color: var(--family); } .grp.g-home h2 { color: var(--home); }
.grp ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.grp li { display: flex; gap: 4px; }
.zone { flex: 1; min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.zone b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; flex: none; }
.g-nature .zone b { background: var(--nature); } .g-family .zone b { background: var(--family); } .g-home .zone b { background: var(--home); }
.zone span { font-weight: 700; }
.zone small { margin-left: auto; color: var(--muted); font-size: 11px; }
.zone[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.go { min-width: 40px; display: grid; place-items: center; border-radius: 12px; background: #1d1a17; color: #fff; text-decoration: none; }
/* card (desktop: left-bottom panel) */
.card { position: fixed; z-index: 6; left: 18px; bottom: 76px; width: min(380px, calc(100% - 360px)); max-height: calc(100% - 200px); overflow: auto; padding: 16px 16px 14px; border-radius: 18px; background: var(--paper); box-shadow: 0 16px 44px rgba(0,0,0,.25); }
.card[hidden] { display: none; }
.close { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; font-size: 20px; cursor: pointer; }
.card-cat { margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.card h2 { margin: 6px 36px 6px 0; font-size: 19px; line-height: 1.4; }
.card-who { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.card-story { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-products { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.card-products li { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.card-products img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; background: #eee; }
.cta { display: flex; justify-content: center; align-items: center; min-height: 48px; border-radius: 14px; background: #1d1a17; color: #fff; font-weight: 700; text-decoration: none; }
.fine { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
/* phone: list becomes a collapsible bottom sheet; card sits above it */
@media (max-width: 1023px) {
  .brand { font-size: 15px; letter-spacing: .22em; } .brand span { display: none; }
  .intro { left: 14px; right: 14px; top: 62px; } .intro h1 { font-size: 22px; } .sub { font-size: 13px; color: #4a423a; }
  .list { top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 18px 18px 0 0; max-height: 64px; transition: max-height .25s; }
  body.list-open .list { max-height: 70%; }
  .list-toggle { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 56px; border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; flex: none; padding-bottom: env(safe-area-inset-bottom); }
  .list-toggle::after { content: "▲"; font-size: 11px; } body.list-open .list-toggle::after { content: "▼"; }
  .tools { left: auto; right: 10px; bottom: 74px; } .tools button { min-height: 40px; padding: 0 12px; font-size: 13px; }
  .hint { display: none; }
  body.focus .intro { display: none; } /* a selected district takes the top area */
  .card { left: 8px; right: 8px; width: auto; bottom: 122px; max-height: 50%; } /* above the tools row and the sheet bar */
  .list-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 12px; align-content: start; }
  .fallback { right: 20px; }
}
/* poster export: only world, labels and title */
body.export .bar, body.export .tools, body.export .hint, body.export .list, body.export .card { display: none !important; }
body.export .intro { left: 3%; top: 3.5%; max-width: none; }
body.export .intro h1 { font-size: 5.2vh; } body.export .kicker { font-size: 1.6vh; } body.export .sub { font-size: 2.1vh; }
body.export .chip { font-size: 1.55vh; padding: .3vh 1vh .3vh .3vh; } body.export .chip b { width: 2.3vh; height: 2.3vh; font-size: 1.3vh; }
body.no-webgl #island3d { display: none; }
