/* 學習島 v2 介面:明亮兒童風、圓潤黏土感(白/奶油底 + 四島主色) */
@font-face { font-family: "OpenHuninnLogo"; src: url("openhuninn-logo.woff2") format("woff2"); font-display: swap; }
:root {
  --ink: #23302d; --soft: #5d706b; --faint: #8a9a95; --line: #efe5d1;
  --paper: #fffaf0; --white: #fffdf8; --cream: #fff3d6; --track: #f5eedf;
  --yellow: #ffd34d; --yellow-d: #e8a522; --lime: #d9ef73; --lime-d: #a9c43c; --navy: #1d3766;
  --c1: #f4b63f; --c2: #4a97dd; --c3: #3fae7a; --c4: #f07848;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --shadow: 0 14px 34px rgba(48, 78, 70, .16), 0 3px 8px rgba(48, 78, 70, .08);
  --shadow-s: 0 6px 16px rgba(48, 78, 70, .16), 0 1px 3px rgba(48, 78, 70, .1);
  --clay: inset 0 -3px 0 rgba(35, 48, 45, .06), inset 0 2px 0 rgba(255, 255, 255, .95);
  --hex: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #d6f0f7; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #4a97dd; outline-offset: 2px; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
body.hovering #stage canvas { cursor: pointer; }
body.nohud .hud { display: none !important; }
[hidden] { display: none !important; }

/* 圖示 */
[data-icon] { display: inline-grid; place-items: center; flex: none; font-style: normal; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.ava { width: 30px; height: 30px; }

/* 六角形數字章(呼應島的形狀) */
.hex { display: grid; place-items: center; flex: none; width: 30px; height: 27px; clip-path: var(--hex); background: var(--c); color: #fff; font-weight: 900; font-size: 14px; line-height: 1;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .13), inset 0 3px 0 rgba(255, 255, 255, .38); }

/* ---------- 共用的白色黏土面板 ---------- */
.brand, .toolbar, .index, .rail, .card, .dock .chips, .caption, .tag, .intro-card {
  background: rgba(255, 253, 248, .95); box-shadow: var(--shadow), var(--clay); }
@supports (backdrop-filter: blur(8px)) {
  .brand, .toolbar, .index, .rail, .dock .chips { background: rgba(255, 253, 248, .86); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); }
}

/* ---------- 左上品牌 ---------- */
.brand { position: absolute; z-index: 20; top: 16px; left: 16px; display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 9px; border-radius: 22px; }
.logo { display: flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; }
.logo img { width: auto; height: 42px; transition: transform .25s; }   /* 圖是 3:2,只定高度,寬度照比例 */
.logo:hover img { transform: rotate(-8deg) scale(1.06); }
.word { display: grid; line-height: 1; font-family: "OpenHuninnLogo", var(--font); }
.word b { color: var(--navy); font-size: 21px; letter-spacing: 2px; }
.word i { color: #f0a91c; font-style: normal; font-weight: 900; font-size: 11px; margin-top: 3px; letter-spacing: .5px; }
.title { display: grid; padding-left: 12px; border-left: 2px dashed rgba(35, 48, 45, .18); line-height: 1.15; }
.title em { font-style: normal; font-weight: 900; font-size: 21px; letter-spacing: 1px; }
.title span { color: var(--soft); font-size: 11.5px; font-weight: 700; margin-top: 2px; }

/* ---------- 上方工具列 ---------- */
.toolbar { position: absolute; z-index: 20; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 999px; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--track); box-shadow: inset 0 1px 2px rgba(35, 48, 45, .08); }
.seg button, .tool { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px 0 10px; border: 0; border-radius: 999px; background: none; font-weight: 900; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--soft); transition: background .18s, color .18s, transform .12s; }
.seg button:hover, .tool:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button:active, .tool:active, .follow:active { transform: translateY(1px) scale(.97); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(48, 78, 70, .14), inset 0 -2px 0 rgba(35, 48, 45, .06); }
.time button[data-time="day"][aria-pressed="true"] svg { color: #f2a516; }
.time button[data-time="dusk"][aria-pressed="true"] svg { color: #f07848; }
.time button[data-time="night"][aria-pressed="true"] svg { color: #5b6fd6; }
.acts #btn-tags[aria-pressed="false"] { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.time-cycle { display: none; }
.follow { display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 18px 0 6px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 900; font-size: 15px; white-space: nowrap;
  background: var(--yellow); color: var(--ink); box-shadow: inset 0 -4px 0 var(--yellow-d), inset 0 3px 0 rgba(255, 255, 255, .55), 0 4px 10px rgba(232, 165, 34, .3); transition: background .2s, transform .12s; }
.follow:hover { background: #ffdb6b; }
.follow[aria-disabled="true"] { filter: grayscale(.55); opacity: .6; }
.follow [data-icon] { width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08); }
.follow[aria-pressed="true"] { background: var(--lime); box-shadow: inset 0 -4px 0 var(--lime-d), inset 0 3px 0 rgba(255, 255, 255, .55), 0 4px 10px rgba(120, 150, 40, .3); }
.follow[aria-pressed="true"] [data-icon] { animation: bob 1.1s ease-in-out infinite; }

/* ---------- 右側學習地圖索引 ---------- */
.index { position: absolute; z-index: 20; top: 16px; right: 16px; width: 312px; max-height: calc(100% - 32px); overflow: auto; padding: 20px 14px 14px; border-radius: 28px; scrollbar-width: thin; }
.index .kicker { margin: 0 6px; font-weight: 900; font-size: 11px; letter-spacing: .22em; color: #e58a2b; }
.index h2 { margin: 4px 6px 4px; font-size: 26px; font-weight: 900; letter-spacing: 1px; }
.index .lead { margin: 0 6px 12px; color: var(--soft); font-size: 13px; line-height: 1.65; font-weight: 500; }
.isl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.isl-list button { display: grid; grid-template-columns: 54px 1fr 18px; gap: 12px; align-items: center; width: 100%; padding: 10px 10px 10px 8px; border: 2px solid transparent; border-radius: 20px; background: none; text-align: left; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.isl-list button:hover { background: color-mix(in srgb, var(--c) 11%, #fff); transform: translateX(-2px); }
.isl-list button[aria-current="true"] { background: color-mix(in srgb, var(--c) 15%, #fff); border-color: var(--c); }
.isl-list .hex { width: 54px; height: 48px; font-size: 22px; }
.isl-list .txt { display: grid; gap: 3px; min-width: 0; }
.isl-list b { font-size: 17px; font-weight: 900; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; }
.isl-list b small { white-space: nowrap; font-size: 11.5px; font-weight: 900; color: color-mix(in srgb, var(--c) 75%, var(--ink)); background: color-mix(in srgb, var(--c) 16%, #fff); padding: 2px 7px; border-radius: 999px; }
.isl-list em { font-style: normal; text-wrap: pretty; font-size: 12.5px; color: var(--soft); line-height: 1.5; font-weight: 500; }
.isl-list [data-icon] { color: var(--c); }
.index .hint { display: flex; align-items: center; gap: 6px; margin: 12px 6px 0; padding-top: 11px; border-top: 2px dashed var(--line); font-size: 12px; color: var(--faint); font-weight: 700; }
.index .hint svg.i { width: 16px; height: 16px; }

/* 選了島之後,索引縮成一排六角章 */
.rail { position: absolute; z-index: 20; top: 16px; right: 16px; display: none; flex-direction: column; gap: 6px; padding: 8px; border-radius: 26px; }
.rail button { position: relative; display: grid; place-items: center; width: 50px; height: 50px; border: 0; border-radius: 16px; background: none; cursor: pointer; transition: background .18s; }
.rail button:hover { background: var(--track); }
.rail .hex { width: 40px; height: 36px; font-size: 17px; transition: transform .2s; }
.rail button[aria-current="true"] { background: color-mix(in srgb, var(--c) 18%, #fff); }
.rail button[aria-current="true"] .hex { transform: scale(1.12); }
.rail .rail-home { color: var(--soft); border-top: 2px dashed var(--line); border-radius: 0 0 16px 16px; }
.rail .tip { position: absolute; right: calc(100% + 10px); top: 50%; transform: translate(6px, -50%); opacity: 0; pointer-events: none; padding: 5px 11px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 900; white-space: nowrap; transition: opacity .15s, transform .15s; }
.rail button:hover .tip, .rail button:focus-visible .tip { opacity: 1; transform: translate(0, -50%); }

/* ---------- 說明卡(桌機在左) ---------- */
.card { position: absolute; z-index: 21; top: 96px; left: 16px; width: 372px; max-height: calc(100% - 96px - 46px); overflow: auto; padding: 0 20px 18px; border-radius: 30px; scrollbar-width: thin; overscroll-behavior: contain;
  animation: cardIn .38s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes cardIn { from { opacity: 0; transform: translateX(-18px) scale(.98); } }
.card .grab { display: none; }
.card .close { position: absolute; z-index: 2; top: 14px; right: 14px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: var(--soft); cursor: pointer; box-shadow: var(--shadow-s); transition: transform .15s, color .15s; }
.card .close:hover { color: var(--ink); transform: rotate(90deg); }
.card-head { position: relative; margin: 0 -20px; padding: 22px 60px 16px 20px; display: flex; gap: 14px; align-items: center;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c) 30%, #fff) 0%, color-mix(in srgb, var(--c) 10%, #fff) 55%, rgba(255, 255, 255, 0) 100%); border-radius: 30px 30px 0 0; }
.card-head .hex { width: 62px; height: 55px; font-size: 27px; }
.card-head .eyebrow { margin: 0 0 3px; font-weight: 900; font-size: 12px; letter-spacing: .14em; color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.card-head h2 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: 1px; line-height: 1.15; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head .more { display: none; position: absolute; right: 56px; top: 18px; align-items: center; gap: 2px; padding: 4px 10px 4px 6px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 900; color: var(--soft); box-shadow: var(--shadow-s); }
.card-head .more svg.i { width: 15px; height: 15px; transform: rotate(-90deg); }
.card-head h2 small { font-size: 12.5px; font-weight: 900; padding: 3px 9px; border-radius: 999px; background: var(--c); color: #fff; letter-spacing: 0; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.journey { display: flex; align-items: center; margin: 4px 2px 14px; }
.journey button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: var(--c); font-weight: 900; font-size: 12px; cursor: pointer;
  box-shadow: 0 0 0 2.5px var(--c) inset; transition: transform .15s; flex: none; }
.journey button:hover { transform: scale(1.12); }
.journey button.on { width: 32px; height: 32px; background: var(--c); color: #fff; font-size: 14px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .12); }
.journey i { flex: 1; height: 0; border-top: 3px dotted #dccfb4; margin: 0 4px; }
.card .desc { margin: 0 0 14px; font-size: 15px; line-height: 1.8; font-weight: 500; color: #34433f; }
.card h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 13px; font-weight: 900; color: var(--soft); letter-spacing: .06em; }
.card h3 .whole { display: none; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 7px; border: 0; border-radius: 999px; background: var(--track); font-size: 12px; font-weight: 900; color: var(--ink); cursor: pointer; }
.card h3 .whole svg.i { width: 15px; height: 15px; }
.card.focused h3 .whole { display: flex; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.items button { display: grid; grid-template-columns: 32px 1fr 22px; gap: 11px; align-items: center; width: 100%; min-height: 54px; padding: 9px 12px 9px 10px; border: 2px solid transparent; border-radius: 18px; background: #faf5e9; text-align: left; font-size: 15px; font-weight: 700; line-height: 1.45; cursor: pointer; transition: background .18s, border-color .18s, transform .15s; }
.items button:hover, .items button.hl { background: color-mix(in srgb, var(--c) 10%, #fff); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.items button.on { background: color-mix(in srgb, var(--c) 15%, #fff); border-color: var(--c); }
.items .n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 900; font-size: 14px; box-shadow: 0 0 0 3px #fff, 0 3px 6px rgba(35, 48, 45, .2); }
.items [data-icon] { color: color-mix(in srgb, var(--c) 80%, var(--ink)); opacity: .55; transition: opacity .15s, transform .2s; }
.items button:hover [data-icon], .items button.on [data-icon] { opacity: 1; transform: translateY(-2px); }
.card-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 2px dashed var(--line); }
.card-nav button { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; background: var(--track); font-size: 13.5px; font-weight: 900; cursor: pointer; transition: background .15s; }
.card-nav button:last-child { padding: 0 8px 0 14px; }
.card-nav button:hover { background: #ece2cc; }
.card-nav .nx { color: color-mix(in srgb, var(--cn) 70%, var(--ink)); }
.card-nav .nx::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cn); margin-right: 3px; }
.card-nav button:last-child.nx::before { order: 0; }

/* ---------- 「探長在這裡」小頭像 ---------- */
.isl-list button, .chips button, .rail button { position: relative; }
.hero-here::after { content: ""; position: absolute; z-index: 2; width: 26px; height: 26px; border-radius: 50%; background: #fff var(--hero-img) center / 22px no-repeat;
  box-shadow: 0 3px 8px rgba(35, 48, 45, .25), 0 0 0 2px #ffd34d; animation: bob 1.6s ease-in-out infinite; pointer-events: none; }
.isl-list .hero-here::after { left: 40px; top: 2px; }
.rail .hero-here::after { left: -4px; top: -4px; width: 22px; height: 22px; background-size: 18px; }
.chips .hero-here::after { left: calc(50% + 6px); top: -6px; width: 22px; height: 22px; background-size: 18px; }
.tag.hero-here::after { left: -12px; top: -16px; }

/* ---------- 3D 島名牌 ---------- */
#labels, #pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels { z-index: 5; } #pins { z-index: 6; }
/* 3D 裡的對話框:位置大小由 kit.flushBubbles() 每格更新,用 em 排版,字級一變整個框跟著縮放 */
#bubbles { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; contain: strict; }
.bubble { position: absolute; left: 0; top: 0; white-space: pre; line-height: 1.25; text-align: center; font-family: var(--font, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif);
  padding: .32em .6em .38em; margin-bottom: .55em; background: var(--bg); border: max(1.5px, .1em) solid var(--bd); border-radius: .53em; }   /* 不加 will-change:名牌用 scale 縮放,加了瀏覽器會把字先畫好再拉伸,變糊 */
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -.5em; width: .55em; height: .55em; background: var(--bg);
  border-right: max(1.5px, .1em) solid var(--bd); border-bottom: max(1.5px, .1em) solid var(--bd); transform: translateX(-50%) rotate(45deg); border-bottom-right-radius: .12em; }
.bubble.hero { border-width: max(2px, .14em); padding-left: .75em; padding-right: .75em; }
.bubble.hero::before { content: ""; position: absolute; left: .3em; top: .3em; width: .36em; height: .36em; border-radius: 50%; background: #ffd34d; }
.bubble.notail { margin-bottom: 0; } .bubble.notail::after { display: none; }
body.notags #labels { display: none; }
.tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 7px; padding: 4px 13px 4px 5px; border: 0; border-radius: 999px; font-weight: 900; font-size: 14px; white-space: nowrap; pointer-events: auto; cursor: pointer; will-change: transform;
  transition: opacity .25s, background .2s, color .2s, scale .2s; }
.tag .hex { width: 28px; height: 25px; font-size: 13px; }
.tag small { color: var(--soft); font-weight: 700; font-size: 11.5px; }
.tag.dim { opacity: .62; }
.tag.on { background: var(--c); color: #fff; }
.tag.on .hex { background: #fff; color: var(--c); box-shadow: none; }
.tag.on small { color: rgba(255, 255, 255, .9); }
.tag.hover, .tag:hover { scale: 1.1; opacity: 1; z-index: 2; box-shadow: 0 0 0 3px var(--c), var(--shadow); }
.tag.off { visibility: hidden; }
.tag.blocked, .pin.blocked { opacity: 0 !important; pointer-events: none; }

/* ---------- 3D 熱點圖釘 ---------- */
.pin { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; pointer-events: auto; cursor: pointer; will-change: transform; }
.pin.off { visibility: hidden; }
.pin.on, .pin.hl, .pin:hover { z-index: 3; }
.pin .head { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 900; font-size: 15px; border: 3px solid #fff;
  box-shadow: 0 5px 12px rgba(35, 48, 45, .28), inset 0 -3px 0 rgba(0, 0, 0, .14); transition: transform .2s; animation: bob 2.6s ease-in-out infinite; animation-delay: var(--bd, 0s); }
.pin .head::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--c); opacity: 0; }
.pin .stem { width: 3px; height: 24px; border-radius: 2px; background: linear-gradient(#fff, rgba(255, 255, 255, .55)); box-shadow: 0 0 2px rgba(35, 48, 45, .25); }
.pin .foot { width: 12px; height: 6px; margin-top: -3px; border-radius: 50%; background: rgba(35, 48, 45, .32); }
.pin .lab { position: absolute; left: calc(50% + 24px); top: 3px; padding: 5px 12px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 900; white-space: nowrap; box-shadow: var(--shadow-s);
  opacity: 0; transform: translateX(-6px); transition: opacity .18s, transform .18s; pointer-events: none; }
.pin.flip .lab { left: auto; right: calc(50% + 24px); transform: translateX(6px); }
.pin:hover .lab, .pin.on .lab, .pin.hl .lab { opacity: 1; transform: none; }
.pin:hover .head, .pin.on .head, .pin.hl .head { transform: scale(1.14); }
.pin.on .head::after { opacity: .5; animation: ring 1.4s ease-out infinite; }
.pin.jump .head { animation: jump .62s cubic-bezier(.3, .7, .4, 1) 3; }
.pin.pop .head { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d, 0s); }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@keyframes jump { 0%, 100% { translate: 0 0; scale: 1 1; } 15% { scale: 1.12 .86; } 45% { translate: 0 -20px; scale: .94 1.08; } 75% { translate: 0 0; scale: 1.1 .9; } }
@keyframes pop { from { scale: 0; } }
@keyframes ring { from { transform: scale(.7); opacity: .7; } to { transform: scale(1.35); opacity: 0; } }

/* ---------- 探長字幕 ---------- */
.caption { position: absolute; z-index: 22; bottom: 46px; left: var(--cap-x, 50%); display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100% - 32px)); padding: 7px 20px 7px 7px; border-radius: 999px;
  transform: translate(-50%, 14px); opacity: 0; transition: opacity .3s, transform .35s cubic-bezier(.2, .9, .3, 1.2); pointer-events: none; }
.caption.show { opacity: 1; transform: translate(-50%, 0); }
.caption .ava { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: #fff4c4; box-shadow: inset 0 -3px 0 rgba(232, 165, 34, .35); }
.caption .ava svg { width: 34px; height: 34px; }
.caption .txt { display: grid; gap: 1px; font-size: 16px; font-weight: 900; line-height: 1.35; }
.caption .txt b { white-space: nowrap; color: color-mix(in srgb, var(--c, #23302d) 80%, var(--ink)); }
.caption .txt small { font-size: 13px; font-weight: 700; color: var(--soft); text-wrap: balance; }

/* ---------- 底部授權說明 ---------- */
.credit { position: absolute; z-index: 19; left: 16px; bottom: 10px; max-width: calc(100% - 360px); margin: 0; padding: 5px 14px; border-radius: 999px; color: rgba(35, 48, 45, .72); font-size: 11px; line-height: 1.45; font-weight: 500;
  background: rgba(255, 253, 248, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 2px 8px rgba(48, 78, 70, .08); }
.credit a { color: var(--green, #0f6c58); font-weight: 900; text-decoration: none; white-space: nowrap; border-bottom: 2px solid rgba(15, 108, 88, .3); }
.credit a::after { content: " ↗"; }
.credit a:hover { border-bottom-color: currentColor; }
body[data-time="night"] .credit { color: rgba(255, 255, 255, .82); background: rgba(24, 40, 82, .45); }
body[data-time="night"] .credit a { color: #d9ef73; border-bottom-color: rgba(217, 239, 115, .4); }

/* ---------- 手機的底部按鈕列(桌機不顯示) ---------- */
.dock { display: none; }

/* ---------- 載入畫面 ---------- */
.loader { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 10%, #e8f8fc 0%, #d4f0f7 45%, #fff6e2 100%); transition: opacity .7s ease, visibility .7s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader-box { display: grid; justify-items: center; gap: 10px; width: min(320px, 80vw); }
.loader-logo { width: auto; height: 88px; animation: float 2.2s ease-in-out infinite; filter: drop-shadow(0 10px 12px rgba(48, 78, 70, .18)); }
.loader-title { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: 3px; }
.loader-dots { display: flex; gap: 10px; margin: 2px 0 4px; }
.loader-dots i { width: 22px; height: 20px; clip-path: var(--hex); background: #e6dcc6; transition: background .3s, transform .3s; }
.loader[data-step="1"] .loader-dots i:nth-child(-n+1), .loader[data-step="2"] .loader-dots i:nth-child(-n+2),
.loader[data-step="3"] .loader-dots i:nth-child(-n+3), .loader[data-step="4"] .loader-dots i { background: var(--c); transform: translateY(-3px); }
.bar { width: 100%; height: 14px; padding: 3px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-s), inset 0 1px 2px rgba(0, 0, 0, .06); }
.bar { overflow: hidden; }
/* 用 transform 而不是 width:蓋島時主執行緒很忙,寬度動畫會卡住、看起來像沒在動 */
.bar span { display: block; height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, #f4b63f, #4a97dd 40%, #3fae7a 70%, #f07848); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform .2s ease-out; }
.loader-text { margin: 0; color: var(--soft); font-size: 13.5px; font-weight: 700; }
.loader-text b { color: var(--ink); font-variant-numeric: tabular-nums; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }

/* ---------- 第一次進來的導覽卡 ---------- */
.intro { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(255, 248, 230, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn .4s ease; }
.intro-card { width: min(400px, 100%); padding: 22px 24px 22px; border-radius: 32px; text-align: center; animation: cardUp .5s cubic-bezier(.2, .9, .3, 1.2); }
.intro-art { width: 100%; max-width: 280px; height: auto; margin: 0 auto 4px; display: block; }
.intro h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: 1px; }
.intro-lead { margin: 6px 0 14px; color: var(--soft); font-size: 14.5px; font-weight: 700; }
.tips { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; text-align: left; }
.tips li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 18px; background: #faf5e9; font-size: 14.5px; font-weight: 500; line-height: 1.5; }
.tips li b { font-weight: 900; }
.tips [data-icon] { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #e58a2b; box-shadow: var(--shadow-s); }
.tips [data-icon] svg.ava { width: 32px; height: 32px; }
.intro .go { width: 100%; height: 52px; border: 0; border-radius: 999px; background: var(--yellow); font-size: 18px; font-weight: 900; letter-spacing: 2px; cursor: pointer;
  box-shadow: inset 0 -5px 0 var(--yellow-d), inset 0 3px 0 rgba(255, 255, 255, .55), 0 6px 14px rgba(232, 165, 34, .35); transition: transform .12s, background .2s; }
.intro .go:hover { background: #ffdb6b; }
.intro .go:active { transform: translateY(2px); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes cardUp { from { opacity: 0; transform: translateY(24px) scale(.96); } }

.nojs { position: absolute; inset: 40% 16px auto; text-align: center; font-weight: 700; }

/* 選了島:索引變成細欄 */
body.has-card .index { display: none; }
body.has-card .rail { display: flex; }

/* ---------- 中等寬度:工具列只留圖示 ---------- */
@media (max-width: 1240px) {
  .time button span, .acts button span { display: none; }
  .seg button { padding: 0 10px; }
  .index { width: 276px; }
  .isl-list button { grid-template-columns: 46px 1fr; gap: 10px; }
  .isl-list .hex { width: 46px; height: 41px; font-size: 19px; }
  .isl-list button > [data-icon] { display: none; }
  .isl-list .hero-here::after { left: 32px; }
  .credit { max-width: calc(100% - 330px); }
}
@media (max-width: 1060px) and (min-width: 761px) {
  .title span { display: none; }
  .card { width: 330px; }
  .follow span { display: none; }
  .follow { padding: 0 6px; }
  .index, .rail { top: 80px; }
  .index { max-height: calc(100% - 96px); }
}

/* ---------- 手機(與直式平板) ---------- */
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  .brand { top: 10px; left: 10px; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 18px; }
  /* 毛玻璃要把後面一直在動的 3D 畫面每格重新模糊,手機上很吃效能,改成不透明一點的底色 */
  .brand, .toolbar, .index, .rail, .dock .chips { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 253, 248, .94); }
  .logo img { width: auto; height: 34px; }
  .word { display: none; }
  .title { padding-left: 0; border: 0; }
  .title em { font-size: 18px; }
  .title span { font-size: 10.5px; }
  .toolbar { top: 10px; left: auto; right: 10px; transform: none; gap: 4px; padding: 5px; }
  .toolbar .seg.time, .toolbar > .follow { display: none; }
  .time-cycle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--ink); background: var(--track); }
  .seg.acts { padding: 0; background: none; box-shadow: none; gap: 4px; }
  .seg.acts button { width: 40px; height: 40px; padding: 0; justify-content: center; background: var(--track); color: var(--ink); }
  .seg.acts button[aria-pressed="true"] { background: #fff; }
  .acts #btn-tags[aria-pressed="false"] { color: var(--faint); }
  .index, .rail, body.has-card .rail { display: none; }

  .dock { position: absolute; z-index: 20; left: max(10px, calc(50% - 280px)); right: max(10px, calc(50% - 280px)); bottom: calc(30px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; }
  .dock .follow { height: 46px; font-size: 15.5px; }
  .dock .chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%; padding: 5px; border-radius: 22px; }
  .chips button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border: 2px solid transparent; border-radius: 17px; background: none; font-size: 13.5px; font-weight: 900; cursor: pointer; }
  .chips button:active { background: color-mix(in srgb, var(--c) 14%, #fff); }
  .chips .hex { width: 32px; height: 28px; font-size: 15px; }
  body.has-card .dock { display: none; }

  .card { top: auto; left: max(0px, calc(50% - 340px)); right: max(0px, calc(50% - 340px)); bottom: 0; width: auto; max-height: min(58%, 520px); padding: 0 16px calc(36px + var(--safe-b)); border-radius: 28px 28px 0 0; background: var(--white);
    box-shadow: 0 -10px 30px rgba(48, 78, 70, .18), var(--clay); animation: sheetIn .4s cubic-bezier(.2, .9, .3, 1.05); }
  @keyframes sheetIn { from { transform: translateY(40%); opacity: .3; } }
  .card .grab { position: absolute; z-index: 3; top: 0; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 90px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
  .card .grab i { width: 42px; height: 5px; border-radius: 3px; background: rgba(35, 48, 45, .22); }
  .card .close { top: 14px; right: 12px; width: 34px; height: 34px; }
  .card-head { margin: 0 -16px; padding: 22px 54px 10px 16px; gap: 12px; border-radius: 28px 28px 0 0; }
  .card-head .hex { width: 50px; height: 44px; font-size: 22px; }
  .card-head h2 { font-size: 23px; }
  .card-head .eyebrow { font-size: 11px; }
  .journey { display: none; }
  .card .desc { font-size: 14px; line-height: 1.7; margin: 4px 0 12px; }
  .items { gap: 6px; }
  .items button { min-height: 46px; padding: 7px 10px 7px 8px; font-size: 14px; border-radius: 15px; grid-template-columns: 28px 1fr 20px; gap: 9px; }
  .items .n { width: 26px; height: 26px; font-size: 13px; }
  .card-nav { margin-top: 12px; padding-top: 10px; }
  .card.min { max-height: none; overflow: hidden; }
  .card.min .desc, .card.min .card-nav, .card.min h3, .card.min .items { display: none; }
  .card.min .card-head { cursor: pointer; padding-bottom: 4px; }
  .card.min .more { display: flex; }

  .caption { top: 66px; bottom: auto; left: 50%; max-width: calc(100% - 20px); padding: 5px 14px 5px 5px; transform: translate(-50%, -10px); }
  .caption.show { transform: translate(-50%, 0); }
  .caption .ava { width: 36px; height: 36px; } .caption .ava svg { width: 30px; height: 30px; }
  .caption .txt { font-size: 14px; } .caption .txt small { font-size: 12px; }

  .credit { z-index: 23; left: 50%; right: auto; width: max-content; transform: translateX(-50%); bottom: calc(5px + var(--safe-b)); max-width: min(680px, calc(100% - 20px)); padding: 3px 10px; border-radius: 10px; text-align: center; font-size: 9.5px; line-height: 1.35; }
  body.has-card .credit { color: rgba(35, 48, 45, .55); text-shadow: none; }

  .tag { font-size: 12.5px; padding: 3px 10px 3px 4px; gap: 5px; }
  .tag .hex { width: 24px; height: 21px; font-size: 12px; }
  .tag small { display: none; }
  .pin .head { width: 30px; height: 30px; font-size: 14px; }
  .pin .stem { height: 18px; }
  .pin .lab { font-size: 12px; padding: 4px 10px; }
  .intro-card { padding: 18px 18px 18px; border-radius: 28px; }
  .intro h2 { font-size: 23px; }
  .tips li { font-size: 13.5px; padding: 8px 10px; }
}
@media (max-width: 360px) {
  .title span { display: none; }
  .chips button { font-size: 12px; }
}

/* 截圖模式與減少動態:不要轉場與動畫(截圖要穩定) */
body.snap *, body.snap *::before, body.snap *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
