:root {
  --paper: #F4EFE3;
  --paper-2: #EAE2CF;
  --ink: #1D2B26;
  --ink-soft: #55635C;
  --line: rgba(29, 43, 38, .14);
  --panel: rgba(250, 247, 239, .92);
  --accent: #1F6F5C;
  --gold: #E3B23C;
  --shadow: 0 10px 30px rgba(20, 35, 30, .14);
  --radius: 14px;
  --font: "Noto Sans TC", system-ui, sans-serif;
  --display: "Space Grotesk", "Noto Sans TC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12201B; --paper-2: #1A2B25; --ink: #EEF2EC; --ink-soft: #A9B8B0;
    --line: rgba(238, 242, 236, .14); --panel: rgba(20, 34, 29, .9);
    --shadow: 0 10px 30px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12201B; --paper-2: #1A2B25; --ink: #EEF2EC; --ink-soft: #A9B8B0;
  --line: rgba(238, 242, 236, .14); --panel: rgba(20, 34, 29, .9);
  --shadow: 0 10px 30px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

/* brand */
.brand { position: fixed; top: 22px; left: 24px; z-index: 8; cursor: pointer; line-height: 1; border-radius: 12px; outline-offset: 6px; }
.brand:hover .brand-title { color: var(--accent); }
.brand-title { transition: color .2s; }
.brand-kicker { font-family: var(--display); font-weight: 700; letter-spacing: .32em; font-size: 13px; color: var(--accent);
  display: inline-block; padding: 5px 9px; border: 2px solid var(--accent); border-radius: 999px; }
.brand-title { margin: 10px 0 4px; font-size: clamp(34px, 5vw, 56px); font-weight: 900; letter-spacing: .04em; }
.brand-sub { font-size: clamp(18px, 2.2vw, 24px); font-weight: 700; letter-spacing: .5em; color: var(--ink-soft); }

/* toolbar */
.toolbar { position: fixed; top: 22px; right: 24px; z-index: 6; display: flex; gap: 4px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.toolbar button { border: 0; background: transparent; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.toolbar button.on { background: var(--ink); color: var(--paper); }
.toolbar button:hover:not(.on) { background: var(--paper-2); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

/* index */
.index { position: fixed; left: 24px; top: 170px; bottom: 64px; width: 300px; z-index: 5; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(8px); overflow: hidden; }
.index-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.eyebrow { font-family: var(--display); font-size: 11px; letter-spacing: .24em; color: var(--ink-soft); font-weight: 700; }
.index-lead { margin: 6px 0 10px; font-size: 15px; font-weight: 700; line-height: 1.5; }
.stats { display: flex; gap: 14px; font-size: 12px; color: var(--ink-soft); }
.stats b { font-family: var(--display); font-size: 20px; color: var(--ink); margin-right: 3px; }
.index-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.index-list li button { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 10px 10px;
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.index-list li button:hover, .index-list li button.on { background: var(--paper-2); }
.index-list .num { font-family: var(--display); font-weight: 700; font-size: 14px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; color: #fff; }
.index-list .nm { font-weight: 700; font-size: 15px; }
.index-list .tg { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; margin-top: 2px; }
.index-list .ct { font-size: 11px; color: var(--ink-soft); text-align: right; line-height: 1.5; white-space: nowrap; }
.core-badge { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 2px; }

/* detail */
.detail { position: fixed; right: 24px; top: 80px; bottom: 64px; width: 380px; z-index: 5; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(8px); padding: 22px 22px 18px; }
.detail-close { position: sticky; top: 0; float: right; border: 0; background: var(--paper-2); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; }
.d-eyebrow { font-family: var(--display); font-size: 12px; letter-spacing: .2em; font-weight: 700; }
.d-title { margin: 6px 0 4px; font-size: 30px; font-weight: 900; }
.d-tag { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; }
.d-section { font-size: 12px; letter-spacing: .14em; color: var(--ink-soft); font-weight: 700; margin: 18px 0 8px; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.items li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: background .2s, border-color .2s; }
.items li.hit { border-color: var(--hl, var(--accent)); background: color-mix(in srgb, var(--hl, var(--accent)) 12%, transparent); }
.items .in { font-weight: 700; font-size: 15px; }
.items .id { font-size: 13.5px; color: var(--ink-soft); margin: 4px 0 6px; line-height: 1.55; }
.items .src { font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.items .src a { text-decoration: none; border-bottom: 1px dotted currentColor; }
.flows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flows li { font-size: 13.5px; line-height: 1.55; padding: 9px 12px; border-radius: 10px; background: var(--paper-2); }
.flows .ft { font-weight: 700; display: block; margin-bottom: 2px; }
.flows button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; }

/* list view */
.listview { position: fixed; inset: 0; z-index: 4; background: var(--paper); overflow-y: auto; padding: 170px 24px 80px; }
.listview-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.lv-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; border-top: 6px solid var(--c); }
.lv-card h2 { margin: 0 0 2px; font-size: 22px; font-weight: 900; }
.lv-card p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }
.lv-card ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; }
.lv-card ol span { color: var(--ink-soft); font-size: 12.5px; display: block; }

/* labels & tip */
.island-label { pointer-events: auto; cursor: pointer; padding: 5px 11px 5px 6px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-family: var(--font); font-weight: 700; font-size: 14px; color: var(--ink);
  display: flex; align-items: center; gap: 7px; white-space: nowrap; transition: opacity .3s; user-select: none; }
.island-label i { font-style: normal; font-family: var(--display); color: #fff; font-size: 11px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.island-label.dim { opacity: .35; }
.hub-label { pointer-events: none; font-family: var(--display); font-weight: 700; letter-spacing: .3em; font-size: 12px; color: var(--accent);
  background: var(--panel); border: 2px solid var(--accent); border-radius: 999px; padding: 4px 10px; }
.labels-off .island-label, .labels-off .hub-label { opacity: 0 !important; pointer-events: none; }
.tip { position: fixed; z-index: 8; pointer-events: none; max-width: 260px; background: var(--ink); color: var(--paper);
  padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow); }
.tip b { display: block; font-size: 14px; }
.tip small { opacity: .75; }

.note { position: fixed; left: 24px; right: 24px; bottom: 16px; z-index: 5; font-size: 11.5px; color: var(--ink-soft); text-align: center; pointer-events: none; }
.noscript { padding: 2rem; }

.lv-note { max-width: 1180px; margin: 20px auto 0; font-size: 12px; color: var(--ink-soft); text-align: center; }
.toolbar button { white-space: nowrap; }

@media (max-width: 860px) {
  .brand { top: 14px; left: 16px; }
  .brand-title { margin: 6px 0 2px; }
  .toolbar { top: auto; bottom: 48px; right: 50%; transform: translateX(50%); }
  .toolbar button { padding: 6px 10px; font-size: 13px; }
  .index { left: 16px; right: 16px; top: auto; bottom: 100px; width: auto; max-height: 24vh; }
  .index-list li button { padding: 6px 8px; }
  .index-list .tg { display: none; }
  .index-head { display: none; }
  .detail { left: 16px; right: 16px; width: auto; top: 120px; bottom: 96px; }
  .listview { padding: 130px 16px 110px; }
  .listview-inner { grid-template-columns: 1fr; }
  .note { left: 16px; right: 16px; bottom: 10px; font-size: 10.5px; }
}

/* SAY YES hall */
.hub-label { pointer-events: auto; cursor: pointer; }
.hub-label small { font-family: var(--font); letter-spacing: .05em; font-weight: 700; margin-left: 4px; opacity: .8; }
.hall-back { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 7; display: none;
  border: 0; background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.fade { position: fixed; inset: 0; z-index: 20; background: var(--paper); opacity: 0; pointer-events: none; transition: opacity .38s ease; }
.fade.on { opacity: 1; }
.hall-tag { pointer-events: none; text-align: center; background: var(--panel); border: 2px solid var(--gold); border-radius: 14px;
  padding: 6px 14px; box-shadow: var(--shadow); font-family: var(--font); color: var(--ink); min-width: 150px; }
.hall-tag b { display: block; font-size: 17px; font-weight: 900; letter-spacing: .1em; }
.hall-tag span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.hall-fine { font-size: 11.5px; color: var(--ink-soft); margin-top: 16px; }
body.in-hall .index, body.in-hall .toolbar, body.in-hall .note { display: none; }
body.in-hall .hall-back { display: block; }
.in-hall .island-label:not(.hall-label), .in-hall .hub-label { display: none !important; }
#stage:not(.in-hall) .hall-label { display: none !important; }
@media (max-width: 860px) { .hall-back { bottom: 20px; } }
