:root {
  --accent: #ff8f00;
  --accent-deep: #e86a00;
  --ink: #1f2224;
  --navy: #02323f;
  --cream: #fffaf3;
  --paper: #fffdf9;
  --yellow: #ffe3a3;
  --line: #1f222426;
  --muted: #6f6a63;
  --side-w: 330px;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: Georgia, "Noto Serif TC", serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #eadfd2; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, a { font: inherit; }
button, a { touch-action: manipulation; }
button {
  cursor: pointer; border: 1px solid var(--line); background: var(--cream); color: var(--ink);
  min-height: 44px; border-radius: 10px; padding: 9px 13px;
}
button:hover { background: var(--yellow); }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
button[aria-pressed="true"], button.active { background: var(--ink); color: var(--cream); }
a { color: inherit; text-underline-offset: 4px; }
h1, h2, h3, h4, p { margin: 0; }
.eyebrow { font: 700 10px var(--mono); letter-spacing: 2px; text-transform: uppercase; }
.mob-only { display: none; }

#app {
  position: relative; width: 100%; height: 100dvh; min-height: 640px; overflow: hidden;
  background: radial-gradient(ellipse at 44% 35%, #fffdf9 0%, #fff6ea 44%, #efdcc6 100%);
}
#stage { position: absolute; inset: 0 var(--side-w) 0 0; touch-action: none; z-index: 0; isolation: isolate; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- 島嶼名牌 ---------- */
.island-label {
  pointer-events: auto; font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 7px; min-height: 28px;
  border: 1px solid #1f222435; border-radius: 6px; background: #fffaf3ee; box-shadow: 0 2px 0 #1f222414;
  white-space: nowrap; transition: opacity .25s, transform .25s, background .2s; display: flex; align-items: center; gap: 5px;
}
.island-label strong { color: var(--c, var(--accent)); font: 700 10px var(--mono); }
.island-label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.island-label:hover, .island-label.hover { background: var(--yellow); transform: translateY(-2px); }
.island-label.selected { background: var(--ink); color: var(--cream); border-color: var(--c); }
.island-label.selected strong { color: var(--yellow); }
.island-label.dim { opacity: .3; }
.hide-names .island-label:not(.selected):not(.hover) { opacity: 0; pointer-events: none; }

/* ---------- 主角對話框 ---------- */
.hero-bubble {
  pointer-events: auto; position: relative; min-height: 30px; padding: 5px 11px; border-radius: 12px; border: 2px solid var(--accent);
  background: #fffaf3; color: var(--ink); font-size: 11.5px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 14px #53311b2a;
  display: flex; align-items: center; gap: 5px;
}
.hero-bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; background: inherit; border: inherit; border-width: 0 2px 2px 0; transform: translateX(-50%) rotate(45deg); }
.hero-bubble b { font: 700 10px var(--mono); color: var(--accent-deep); }
.hero-bubble i { font-style: normal; font-weight: 600; color: #fff; background: var(--accent); border-radius: 99px; padding: 1px 7px; font-size: 10.5px; }
.hero-bubble.walking { border-color: #1f222433; font-weight: 600; color: var(--muted); }
.hero-bubble.walking b { color: var(--muted); }
.hero-bubble:hover { background: var(--yellow); }
.hide-names .hero-bubble.walking { opacity: 0; }

/* ---------- 品牌與標語 ---------- */
.brand { position: absolute; top: 26px; left: 30px; z-index: 2; display: flex; gap: 14px; align-items: flex-end; pointer-events: none; }
.wordmark {
  pointer-events: auto; text-decoration: none; display: flex; align-items: center; gap: 8px;
  font: 900 clamp(28px, 3vw, 42px)/1 Arial, sans-serif; letter-spacing: -1.5px; color: var(--navy);
}
.wordmark img { width: 1.05em; height: 1.05em; }
.wordmark b { color: var(--accent); font-weight: inherit; }
.brand h1 { font-size: 18px; letter-spacing: 4px; }
.tagline { font-size: 11.5px; margin-top: 5px; color: var(--muted); }
.tagline em { font: italic 700 11px var(--serif); color: var(--cream); background: var(--accent); padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.hero-note { position: absolute; left: 30px; top: 118px; max-width: 200px; pointer-events: none; z-index: 1; transition: opacity .3s; }
.hero-note .number { font: italic 64px/.95 var(--serif); color: var(--accent); }
.hero-note h2 { font-size: 17px; line-height: 1.5; margin: 8px 0; }
.hero-note p { font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.card-open .hero-note { opacity: 0; }

/* ---------- 工具列 ---------- */
.toolbar { position: absolute; right: calc(var(--side-w) + 20px); top: 26px; display: flex; gap: 7px; z-index: 5; }
.toolbar button { background: #fffaf3e8; font-size: 12.5px; backdrop-filter: blur(8px); }
.toolbar .square { width: 44px; padding: 0; }

/* ---------- 側邊清單 ---------- */
.sidebar {
  position: absolute; right: 0; top: 0; bottom: 0; width: var(--side-w); background: #fffaf3ec;
  border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 7; backdrop-filter: blur(16px);
}
.side-head { padding: 28px 22px 14px; position: relative; }
.side-head .eyebrow { color: var(--accent-deep); margin-bottom: 10px; }
.side-head h2 { font-size: 25px; font-weight: 900; letter-spacing: -.5px; }
.side-head p { font-size: 11.5px; color: var(--muted); margin: 9px 0 14px; line-height: 1.65; }
.mobile-close { display: none; position: absolute; right: 12px; top: 14px; width: 44px; padding: 0; border: 0; background: transparent; font-size: 18px; }
.search { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); padding: 10px 12px; font-size: 13px; color: var(--ink); }
.side-tabs { display: flex; gap: 5px; margin-top: 10px; }
.side-tabs button { flex: 1; font-size: 12.5px; padding: 6px; }
.tree { overflow: auto; padding: 0 14px 18px; scrollbar-width: thin; flex: 1; }
.cat-h { font: 700 10px var(--mono); letter-spacing: 1.5px; color: var(--c); padding: 16px 8px 6px; display: flex; align-items: center; gap: 8px; }
.cat-h::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .25; }
.tree details { border-bottom: 1px solid var(--line); }
.tree summary { min-height: 52px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 6px 8px; border-radius: 8px; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary:hover { background: #ffe3a355; }
.tree .index { font: italic 21px var(--serif); color: var(--accent); width: 26px; flex: none; }
.tree .dot { width: 9px; height: 9px; background: var(--c); transform: rotate(45deg); border-radius: 2px; flex: none; }
.tree .item-name { font-size: 13.5px; font-weight: 700; flex: 1; }
.tree .count { font: 10px var(--mono); color: var(--muted); }
.tree details[open] summary, .tree details.current summary { background: #ffe3a370; }
.tree details.current .item-name { color: var(--accent-deep); }
.tree .children { padding: 4px 6px 12px 44px; display: grid; gap: 4px; }
.tree .children p { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 4px; }
.tree .children button { text-align: left; font-size: 12px; line-height: 1.5; min-height: 36px; padding: 7px 10px; background: transparent; border-color: transparent; border-radius: 7px; }
.tree .children button:hover { background: var(--paper); border-color: var(--line); }
.tree .children .go { color: var(--accent-deep); font-weight: 700; }
.tree .empty { padding: 20px 8px; color: var(--muted); font-size: 13px; }
.flow-list { list-style: none; padding: 6px 0 0; margin: 0; display: grid; gap: 4px; }
.flow-list button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: flex-start; background: transparent; border-color: transparent; }
.flow-list button:hover { background: var(--paper); border-color: var(--line); }
.flow-list button.active { background: var(--ink); color: var(--cream); }
.flow-list i { flex: none; width: 22px; height: 3px; background: var(--c); margin-top: 9px; border-radius: 2px; }
.flow-list i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.flow-list b { display: block; font-size: 13px; }
.flow-list small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.flow-list button.active small { color: #fffaf3b0; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 22px 14px; font-size: 11px; color: var(--muted); }
.side-foot .dl { display: block; text-align: center; text-decoration: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; border-radius: 10px; padding: 11px; margin-bottom: 9px; }
.side-foot .dl:hover { background: var(--accent-deep); }

/* ---------- 詳細卡片 ---------- */
.card {
  position: absolute; left: 28px; top: 140px; bottom: 84px; width: 380px; background: #fffaf3f7;
  border: 1px solid var(--line); border-top: 4px solid var(--c, var(--accent)); border-radius: 14px; box-shadow: 0 16px 60px #53311b1f;
  overflow: auto; z-index: 6; padding: 24px 24px 18px; backdrop-filter: blur(20px); scrollbar-width: thin;
  animation: cardIn .35s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateX(-14px); } }
.card[hidden] { display: none; }
.card .close { position: absolute; right: 8px; top: 8px; width: 44px; padding: 0; border: 0; background: transparent; font-size: 24px; }
.card .eyebrow { color: var(--accent-deep); margin-bottom: 12px; padding-right: 34px; line-height: 1.6; }
.card-title { display: flex; gap: 12px; align-items: flex-start; }
.card-title img, .hex-ico { width: 40px; height: 40px; flex: none; }
.hex-ico { display: grid; place-items: center; background: var(--c); color: #fff; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hex-ico .ico { width: 22px; height: 22px; }
.card h2 { font-size: 22px; line-height: 1.35; letter-spacing: -.3px; }
.card .cat { display: inline-block; font: 700 10px var(--mono); letter-spacing: 1px; color: var(--c); border: 1px solid var(--c); border-radius: 99px; padding: 2px 9px; margin: 12px 0 2px; }
.card p, .card li, .card dd { font-size: 13px; line-height: 1.8; }
.card .lead { margin: 10px 0 6px; color: #3b3a38; }
.card h3 { font-size: 15px; margin: 22px 0 8px; }
.card h4 { font-size: 14px; margin: 3px 0 4px; }
.card ul.items { padding-left: 0; list-style: none; margin: 12px 0; }
.card ul.items li { position: relative; padding: 6px 8px 6px 22px; border-radius: 7px; }
.card ul.items li::before { content: ""; position: absolute; left: 7px; top: 15px; width: 6px; height: 6px; background: var(--c, var(--accent)); transform: rotate(45deg); }
.card ul.items li.hl { background: var(--yellow); }
.card figure { margin: 14px 0; }
.card figure img { width: 100%; border-radius: 9px; border: 1px solid var(--line); display: block; background: #fff; }
.card figcaption { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.card .note { font-size: 11.5px; color: var(--muted); margin: 8px 0; }
.card .mono { font: 11px/1.7 var(--mono); color: var(--muted); margin: 10px 0; }
.card .addon { background: #f0e9fb; border: 1px dashed #8a5bd6; border-radius: 9px; padding: 10px 12px; margin: 12px 0; font-size: 12px; }
.card .addon b { display: block; color: #6b4fc4; font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip { font-size: 11.5px; border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 4px 10px; }
.chip::before { content: "✓ "; color: var(--accent-deep); font-weight: 700; }
.links { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); text-decoration: none; font-size: 13px; font-weight: 600; }
.btn:hover { background: var(--yellow); }
.btn.primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 6px 0; }
.points { margin: 10px 0; display: grid; gap: 8px; }
.points div { border-left: 3px solid var(--c, var(--accent)); padding: 2px 0 2px 11px; }
.points dt { font-weight: 700; font-size: 13px; }
.points dd { margin: 0; color: var(--muted); }
.numbered { display: grid; gap: 10px; margin: 14px 0; }
.numbered section { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.numbered .eyebrow { margin: 0; color: var(--c, var(--accent-deep)); }
.numbered p { color: var(--muted); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 12px 4px; font-weight: 700; font-size: 13.5px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: "+"; color: var(--accent-deep); font-weight: 900; }
.faq details[open] summary::after { content: "–"; }
.faq summary::-webkit-details-marker { display: none; }
.faq p { padding: 0 4px 12px; color: #3b3a38; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.stats div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stats b { display: block; font: italic 34px/1 var(--serif); color: var(--c, var(--accent)); }
.stats span { font-size: 11px; color: var(--muted); line-height: 1.5; display: block; margin-top: 4px; }
.stack { list-style: none; padding: 0; margin: 14px 0; }
.stack li:not(.arrow) { display: flex; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stack img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.stack p { font-size: 12px; color: var(--muted); line-height: 1.6; }
.stack .tag { display: inline-block; font: 10px var(--mono); background: #f0e9fb; color: #6b4fc4; border-radius: 4px; padding: 1px 6px; margin-top: 4px; }
.stack .arrow { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.4; }
.platforms { display: grid; gap: 8px; margin: 14px 0; }
.platforms section { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.platforms p { font-size: 11.5px; color: var(--muted); }
.platforms ul { list-style: none; padding: 0; margin: 6px 0 0; }
.platforms li { font-size: 13px; padding: 3px 0; }
.platforms li span { color: var(--muted); }
.company { width: 200px; margin: 10px 0; display: block; }
.clips { margin: 14px 0; }
.clips video { width: 100%; border-radius: 10px; background: #111; display: block; aspect-ratio: 16 / 9; }
.clip-list { display: grid; gap: 5px; margin-top: 8px; }
.clip { text-align: left; display: grid; gap: 1px; padding: 8px 12px; background: var(--paper); }
.clip .meta { font: 10px var(--mono); letter-spacing: 1px; color: var(--muted); }
.clip b { font-size: 13px; }
.clip span:last-child { font-size: 11.5px; color: var(--muted); }
.clip.active { background: var(--ink); color: var(--cream); }
.clip.active span { color: #fffaf3b0 !important; }
.rel-h { font-size: 12px !important; font-family: var(--mono); letter-spacing: 1.5px; color: var(--muted); }
.rel { display: grid; gap: 5px; }
.rel button { text-align: left; display: flex; gap: 10px; align-items: flex-start; background: var(--paper); }
.rel i { width: 9px; height: 9px; background: var(--c); transform: rotate(45deg); border-radius: 2px; flex: none; margin-top: 6px; }
.rel b { display: block; font-size: 13px; }
.rel small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.card-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-nav button { font-size: 12px; min-height: 38px; padding: 6px 11px; }
.card-nav span { font: 11px var(--mono); color: var(--muted); }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: var(--side-w); top: 84px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; z-index: 4; pointer-events: none; }
.seg { display: flex; align-items: center; background: #fffdfae8; border: 1px solid #fff; border-radius: 999px; padding: 3px; box-shadow: 0 2px 10px #4a2a1416; pointer-events: auto; backdrop-filter: blur(8px); }
.seg button { min-height: 36px; width: 38px; padding: 0; border: 0; border-radius: 999px; background: transparent; display: grid; place-items: center; color: #8a7a70; }
.seg button:hover { background: #fff1d6; }
.seg button[aria-pressed="true"] { background: #ffe8c2; color: #c06200; box-shadow: 0 1px 3px #4a2a1420; }
.seg svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.seg output { font: 700 11px var(--mono); color: var(--muted); padding: 0 10px 0 6px; }
.seg2 button { width: auto; padding: 0 11px 0 9px; display: flex; gap: 5px; font-size: 11.5px; }

/* ---------- Dock ---------- */
.dock { position: absolute; left: 0; right: var(--side-w); bottom: 22px; display: flex; justify-content: center; gap: 5px; z-index: 4; pointer-events: none; flex-wrap: wrap; padding: 0 20px; }
.dock button {
  pointer-events: auto; width: 40px; height: 40px; min-height: 40px; padding: 0; display: grid; place-items: center;
  border-radius: 11px; background: #fffaf3e8; backdrop-filter: blur(8px); color: var(--c); border-color: #fff; box-shadow: 0 2px 8px #4a2a1414; transition: transform .2s;
}
.dock button:hover { transform: translateY(-4px); background: #fff; }
.dock img { width: 24px; height: 24px; }
.dock .ico, .ico { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Legend / Mascot ---------- */
.legend { position: absolute; right: calc(var(--side-w) + 20px); bottom: 80px; z-index: 4; background: #fffaf3e8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: 11px; display: grid; gap: 4px; backdrop-filter: blur(8px); }
.legend[hidden] { display: none; }
.legend b { font-size: 11px; margin-bottom: 2px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 20px; height: 3px; background: var(--c); border-radius: 2px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.mascot { position: absolute; left: 30px; bottom: 28px; display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); pointer-events: none; z-index: 3; transition: opacity .3s; }
.mascot .face {
  background: var(--accent); border: 2px solid #b85c00; outline: 3px dotted var(--accent); width: 34px; height: 30px;
  border-radius: 45% 50% 42% 44%; color: #fff; text-align: center; font: bold 14px/27px monospace; transform: rotate(-8deg);
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 50% { transform: rotate(-4deg) translateY(-3px); } }
.card-open .mascot { opacity: 0; }
@media (min-width: 1101px) { .mascot { bottom: 84px; } }

/* 夜晚：深色天空上的文字改用淺色 */
.is-night .wordmark, .is-night .brand h1 { color: var(--cream); }
.is-night .tagline, .is-night .hero-note p, .is-night .mascot { color: #e9dccb; }
.is-night .hero-note h2 { color: var(--cream); }
.wordmark, .brand h1, .hero-note h2, .hero-note p, .tagline, .mascot { transition: color .6s; }

/* ---------- Intro / Loading ---------- */
.intro { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: #1f222438; backdrop-filter: blur(5px); }
.intro[hidden] { display: none; }
.intro-box { width: min(460px, calc(100% - 36px)); background: var(--cream); border-radius: 18px; padding: 32px; box-shadow: 0 30px 100px #1f222433; }
.intro-box .eyebrow { color: var(--accent-deep); margin-bottom: 16px; }
.intro-box h2 { font-size: 26px; line-height: 1.35; margin-bottom: 14px; }
.intro-box p { font-size: 13.5px; line-height: 1.8; color: #4a4744; }
.intro-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; }
.intro .next { background: var(--ink); color: var(--cream); outline: 3px solid var(--accent); outline-offset: 2px; }
.intro .next:hover { background: var(--accent-deep); }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #1f222430; }
.dots i.on { background: var(--accent); width: 18px; border-radius: 4px; }
.loading { position: absolute; inset: 0; z-index: 40; background: var(--cream); display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; gap: 8px; transition: opacity .6s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading img { width: 64px; animation: spin 2.4s ease-in-out infinite; }
@keyframes spin { 50% { transform: rotate(180deg) scale(.9); } }
.loading h2 { font: 900 30px Arial, sans-serif; color: var(--navy); letter-spacing: -1px; }
.loading p { color: var(--muted); font-size: 13px; }

/* ---------- 無 WebGL：退回清單 ---------- */
.webgl-msg { position: absolute; z-index: 9; left: 50%; top: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: #fff3e0; border: 1px solid var(--accent); border-radius: 12px; padding: 14px 18px; font-size: 13px; line-height: 1.7; box-shadow: 0 10px 40px #53311b22; }
.webgl-msg[hidden] { display: none; }
.webgl-msg b { color: var(--accent-deep); }
.webgl-msg code { display: block; font: 11px var(--mono); color: var(--muted); margin-top: 4px; word-break: break-all; }
.no-webgl .side-head { padding-top: 150px; }
.no-webgl #stage, .no-webgl .hud, .no-webgl .dock, .no-webgl .mascot, .no-webgl .hero-note { display: none; }
.no-webgl .sidebar { width: auto; left: 0; right: 0; top: 0; }
.no-webgl .card { left: auto; right: 20px; z-index: 8; }

/* ---------- 手機 ---------- */
@media (max-width: 1100px) {
  .dock { display: none; }
  .hero-note { display: none; }
}
@media (max-width: 800px) {
  :root { --side-w: 0px; }
  #app { min-height: 560px; }
  .mob-only { display: inline-flex; align-items: center; }
  /* 頂端漸層：讓 3D 名牌在 Logo 與按鈕下方淡出，不再疊字 */
  #app::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 118px; z-index: 1; pointer-events: none;
    background: linear-gradient(#fffaf3f5 0%, #fffaf3d9 55%, #fffaf300 100%); transition: background .6s;
  }
  .is-night #app::before { background: linear-gradient(#18203af5 0%, #18203ad0 55%, #18203a00 100%); }
  /* 直式畫面全景時島很小，名牌跟著縮小，減少互相重疊 */
  .island-label { font-size: 9.5px; min-height: 20px; padding: 1px 6px 1px 5px; gap: 3px; border-radius: 4px; }
  .island-label strong { font-size: 8.5px; }
  .island-label::before { display: none; }
  .island-label.selected, .island-label.hover { font-size: 11px; min-height: 26px; }
  .hero-bubble { font-size: 10px; min-height: 24px; padding: 3px 8px; }
  .brand { top: 16px; left: 16px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .wordmark { font-size: 26px; }
  .brand h1 { font-size: 14px; letter-spacing: 2px; }
  .tagline { display: none; }
  .toolbar { right: 16px; top: 16px; gap: 5px; }
  .toolbar button { padding: 8px 10px; font-size: 12px; }
  #home { display: none; }
  .hud { top: auto; bottom: 18px; left: 16px; right: 16px; }
  .seg2 span { display: none; }
  .seg2 button { padding: 0 9px; }
  .seg output { display: none; }
  .mascot { display: none; }
  .legend { right: 16px; bottom: 70px; }
  .sidebar {
    top: auto; height: min(78dvh, 640px); width: 100%; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .35s ease; box-shadow: 0 -20px 60px #4a2a1420;
  }
  .sidebar-open .sidebar { transform: none; }
  .mobile-close { display: block; }
  .card { left: 0; right: 0; width: auto; top: auto; bottom: 0; max-height: 58dvh; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; animation-name: sheetIn; padding: 22px 18px 18px; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .card-open .hud { display: none; }
  .no-webgl .sidebar { transform: none; height: auto; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}
