/* 魷魚大師的島 · npplus 深色＋金色 */
:root {
  --bg: #0d0b07; --card: #1c1710; --line: #3a3020;
  --text: #f5f0e6; --sub: #d8cbb0; --dim: #8a7d63;
  --gold: #f4d09c; --gold-deep: #d4a574;
  --glass: rgba(18, 15, 10, 0.78);
  --list-w: 320px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; font-size: 16px; line-height: 1.6; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

#stage { position: fixed; inset: 0 0 0 var(--list-w); }
#c { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* 名牌 */
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .35s; will-change: transform; }
.lbl.on { opacity: 1; pointer-events: auto; }
.lbl-group { font-size: 17px; font-weight: 700; color: var(--bg); background: linear-gradient(180deg, var(--gold), var(--gold-deep)); padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 18px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.25) inset; }
.lbl-group .e { margin-right: 6px; }
.lbl-start { font-size: 17px; font-weight: 800; color: #1a140b; background: linear-gradient(180deg, #ffe7b8, var(--gold)); padding: 7px 16px; border-radius: 999px; cursor: pointer; box-shadow: 0 0 0 0 rgba(244,208,156,.7), 0 6px 20px rgba(0,0,0,.45); }
.lbl-start.on { animation: startPulse 1.8s ease-out infinite; }
.lbl-start .e { margin-right: 6px; }
@keyframes startPulse { 0% { box-shadow: 0 0 0 0 rgba(244,208,156,.75), 0 6px 20px rgba(0,0,0,.45); } 70% { box-shadow: 0 0 0 16px rgba(244,208,156,0), 0 6px 20px rgba(0,0,0,.45); } 100% { box-shadow: 0 0 0 0 rgba(244,208,156,0), 0 6px 20px rgba(0,0,0,.45); } }
.lbl-island { font-size: 15px; font-weight: 600; color: var(--gold); background: var(--glass); padding: 4px 11px; border-radius: 999px; border: 1px solid rgba(244,208,156,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lbl-island::after, .lbl-bld::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 1px; height: 6px; background: rgba(244,208,156,.6); }
.lbl-bld { font-size: 14px; color: var(--text); background: rgba(13,11,7,.72); padding: 2px 9px; border-radius: 6px; border: 1px solid rgba(244,208,156,.3); }
.lbl-bld[data-href]:not([data-href=""]) { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(244,208,156,.4); }
.lbl:hover { filter: brightness(1.15); }

/* 頂部 */
#top { position: fixed; top: 0; left: var(--list-w); right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; pointer-events: none; background: linear-gradient(180deg, rgba(5,6,12,.6), rgba(5,6,12,0)); }
#top > * { pointer-events: auto; }
h1 { font-size: 20px; font-weight: 800; color: var(--gold); letter-spacing: .06em; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.ctrl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lt { display: flex; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 3px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lt button { min-width: 40px; height: 36px; border-radius: 999px; font-size: 15px; color: var(--sub); }
.lt button.on { background: var(--gold); color: var(--bg); font-weight: 700; }
.day-btn, .home-btn { height: 42px; padding: 0 16px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(244,208,156,.5); color: var(--gold); font-size: 15px; font-weight: 700; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.home-btn { width: 42px; padding: 0; font-size: 18px; }
body.day-playing .day-btn { background: var(--gold); color: var(--bg); }

/* 一天的字幕 */
#day-cap { position: fixed; left: calc(var(--list-w) + 50% - var(--list-w) / 2); bottom: 28px; transform: translate(-50%, 20px); opacity: 0; transition: .5s; pointer-events: none; background: var(--glass); border: 1px solid rgba(244,208,156,.5); border-radius: 16px; padding: 12px 22px 14px; text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); min-width: 240px; }
#day-cap.show { opacity: 1; transform: translate(-50%, 0); }
#day-cap b { display: block; color: var(--gold); font-size: 15px; letter-spacing: .1em; }
#day-cap span { font-size: 20px; font-weight: 700; }
#day-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
#day-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
#day-dots i.on { background: var(--gold); }

/* 卡片 */
#card { position: fixed; top: 76px; right: 18px; width: 340px; max-height: calc(100% - 100px); overflow: auto; background: rgba(28,23,16,.94); border: 1px solid rgba(244,208,156,.4); border-radius: 18px; padding: 20px 20px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.55); transform: translateX(30px); opacity: 0; pointer-events: none; transition: .35s cubic-bezier(.2,.8,.2,1); }
#card.show { transform: none; opacity: 1; pointer-events: auto; }
.card-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; font-size: 24px; color: var(--dim); border-radius: 50%; }
.card-grp { font-size: 14px; color: var(--gold-deep); margin-bottom: 4px; }
#card h2 { font-size: 22px; color: var(--gold); margin-bottom: 8px; padding-right: 30px; line-height: 1.35; }
#card p { font-size: 16px; color: var(--text); }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 10px; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--bg); font-size: 15px; font-weight: 700; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }

/* 文字清單 */
#list { position: fixed; left: 0; top: 0; bottom: 0; width: var(--list-w); background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 5; }
#list-toggle { display: none; }
#list-body { overflow-y: auto; padding: 18px 16px 30px; -webkit-overflow-scrolling: touch; }
#list-body::before { content: "全部島嶼清單"; display: block; font-size: 14px; color: var(--dim); letter-spacing: .1em; margin-bottom: 8px; }
.lg { margin-bottom: 18px; }
.lg h3 { margin-bottom: 6px; }
.lg-name { font-size: 17px; font-weight: 800; color: var(--gold); text-align: left; padding: 4px 0; }
.li { padding: 10px 0 10px 12px; border-left: 2px solid var(--line); }
.li-name { font-size: 16px; font-weight: 700; color: var(--text); text-align: left; padding: 2px 0; }
.li-name:hover, .lg-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.li p { font-size: 14px; color: var(--sub); }
.li-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.lnk { font-size: 14px; color: var(--gold); text-decoration: none; padding: 3px 0; }
.lnk:hover { text-decoration: underline; }

/* ───── 手機 ───── */
@media (max-width: 760px) {
  :root { --list-w: 0px; }
  #stage { inset: 0; }
  #top { left: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; flex-direction: column; align-items: stretch; gap: 8px; }
  h1 { font-size: 18px; text-align: center; }
  .ctrl { justify-content: space-between; flex-wrap: nowrap; gap: 6px; }
  .lt button { min-width: 38px; height: 38px; }
  .day-btn { padding: 0 12px; font-size: 14px; flex: 1; white-space: nowrap; }
  .home-btn { flex: none; }
  .lbl-group { font-size: 15px; padding: 5px 11px; }
  .lbl-island { font-size: 14px; }

  #list { top: auto; left: 0; right: 0; width: auto; height: 72vh; border-right: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; transform: translateY(calc(72vh - 56px - env(safe-area-inset-bottom))); transition: transform .35s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -10px 30px rgba(0,0,0,.4); }
  body.drawer-open #list { transform: none; }
  #list-toggle { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; height: 56px; flex: none; padding-top: 8px; font-size: 15px; font-weight: 700; color: var(--gold); }
  .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--dim); }
  #list-body { padding-top: 4px; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  #list-body::before { display: none; }

  #card { top: auto; right: 10px; left: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; max-height: 46vh; transform: translateY(30px); padding: 16px 16px 14px; }
  #card h2 { font-size: 20px; }
  #day-cap { left: 50%; bottom: calc(70px + env(safe-area-inset-bottom)); min-width: 0; width: calc(100% - 40px); }
  body.drawer-open #card, body.drawer-open #day-cap { opacity: 0; pointer-events: none; }
}

/* 不支援 WebGL：只顯示文字清單 */
body.no-webgl #stage, body.no-webgl #top .ctrl, body.no-webgl #card, body.no-webgl #day-cap { display: none; }
body.no-webgl { overflow: auto; }
body.no-webgl #top { position: static; left: 0; padding: 22px 18px 6px; background: none; }
body.no-webgl #list { position: static; width: auto; max-width: 720px; margin: 0 auto; height: auto; transform: none; border: 0; background: none; box-shadow: none; }
body.no-webgl #list-toggle { display: none; }
body.no-webgl html, html:has(body.no-webgl) { overflow: auto; }

/* 第二版：一格多個議題 */
.topic { padding: 12px 0; border-top: 1px solid var(--line); }
.topic:first-of-type { border-top: 0; padding-top: 4px; }
#card .topic h3 { font-size: 17px; color: var(--gold); margin-bottom: 2px; }
#card .topic .card-links { margin-top: 8px; }
.li-topics .topic { padding: 6px 0; border-top: 0; }
.li-topics h4 { font-size: 15px; color: var(--sub); font-weight: 700; }
.lbl-island.lbl-green { background: rgba(28, 46, 30, .82); border-color: rgba(244,208,156,.6); }
