* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #0b2030; }
body { font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; color: #3a2f24; }

:root {
  --warm-cream: #fdf6e8;
  --warm-sand: #f0dfae;
  --warm-terracotta: #c97a4e;
  --warm-orange: #e2823f;
  --warm-sage: #7fa872;
  --warm-teal: #2f8f93;
  --ink: #3a2f24;
  --ink-soft: #6b5c48;
  --panel-bg: rgba(253, 246, 232, 0.96);
  --panel-border: rgba(201, 122, 78, 0.28);
}

#app { position: relative; width: 100vw; height: 100vh; }
#gl { position: absolute; inset: 0; display: block; outline: none; }

#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.label {
  position: absolute; top: 0; left: 0;
  pointer-events: auto; white-space: nowrap; cursor: pointer;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: opacity .15s ease;
  user-select: none;
}
.label.island-label {
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: #3a2f24;
  background: #fdf6e8; padding: 5px 14px 5px 10px; border-radius: 999px;
  border: 1px solid rgba(201,122,78,.35); box-shadow: 0 3px 10px rgba(60,30,10,.25);
  text-shadow: none;
}
.label.island-label .pill-num {
  display: inline-block; background: var(--warm-orange); color: #fff; font-weight: 800;
  border-radius: 999px; width: 18px; height: 18px; line-height: 18px; text-align: center;
  font-size: 10.5px; margin-right: 6px;
}
.label.district-label {
  font-size: 11.5px; color: #3a2f24; background: rgba(253,246,232,.92); padding: 2px 9px;
  border-radius: 10px; border: 1px solid rgba(201,122,78,.3); text-shadow: none; font-weight: 600;
}
.label.district-label.missing { color: #a8402c; border-color: rgba(168,64,44,.4); }
/* H4b: Defect/Profile sub-island labels -- smaller/lighter than both
   .island-label (parent 缺陷群島/輪廓群島 pill) and .district-label, so the
   parent stays visually dominant. */
.label.subisland-label {
  font-size: 10.5px; color: #4a3420; background: rgba(253,246,232,.82); padding: 1px 7px;
  border-radius: 8px; border: 1px solid rgba(201,122,78,.25); text-shadow: none; font-weight: 600;
  opacity: .92;
}
.label.hidden-by-collision { opacity: 0; pointer-events: none; }
.label.bridge-label {
  font-size: 10px; color: #4a3420; background: rgba(253,246,232,.9); padding: 1px 7px;
  border-radius: 8px; border: 1px solid rgba(201,122,78,.35); text-shadow: none; font-weight: 600;
}

/* numbered orange pins (B4) */
.label.pin { text-shadow: none; }
.pin-dot {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--warm-orange); border: 2px solid #fff6e4; box-shadow: 0 2px 6px rgba(60,20,0,.4);
}
.pin-num { transform: rotate(45deg); color: #fff; font-size: 10.5px; font-weight: 800; }
.pin.pin-missing .pin-dot { background: #a8402c; }
.pin.pin-user .pin-dot { background: #ff8a3d; box-shadow: 0 0 8px rgba(255,138,61,.7); }

.hidden { display: none !important; }

/* 名牌 toolbar toggle (C6): island pills always stay (B1 panorama rule),
   district/bridge/item-pin labels hide when turned off. */
body.nametags-off .label.district-label,
body.nametags-off .label.subisland-label,
body.nametags-off .label.bridge-label,
body.nametags-off .label.pin { display: none !important; }

/* ------------------------------------------------------------ brand bar */
#brandbar {
  position: absolute; top: 14px; left: 18px; z-index: 20; pointer-events: none;
}
#title-block h1 { font-size: 16px; margin: 0; letter-spacing: .03em; color: #fdf6e8; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
#title-block .subtitle { font-size: 10.5px; margin: 2px 0 0; color: #e8d9b8; text-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* ------------------------------------------------------------ pill toolbar (C6) */
#toolbar-wrap { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20; }
.pillbar {
  display: flex; align-items: center; gap: 14px;
  background: rgba(253,246,232,.92); border: 1px solid var(--panel-border); border-radius: 999px;
  padding: 7px 12px; box-shadow: 0 6px 20px rgba(40,20,0,.25);
}
.pill-group { display: flex; align-items: center; gap: 4px; }
.pill-group + .pill-group { padding-left: 12px; border-left: 1px solid rgba(201,122,78,.25); }
.pill-btn {
  background: transparent; border: none; color: var(--ink); font-size: 12px; font-weight: 600;
  padding: 7px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.pill-btn:hover { background: rgba(201,122,78,.14); }
.pill-btn[data-tod].on, .pill-btn.toggle.on {
  background: var(--warm-orange); color: #fff;
}
#tod-group .pill-btn { font-size: 15px; padding: 6px 8px; }
.pill-btn.toggle { font-size: 14px; padding: 7px 8px; }
.pill-btn.toggle .pl { display: none; font-size: 11px; margin-left: 4px; }

/* -------------------------------------------------------- top-right buttons */
#topbar-actions { position: absolute; top: 12px; right: 18px; z-index: 20; display: flex; gap: 8px; }
.topbar-btn {
  background: rgba(253,246,232,.92); border: 1px solid var(--panel-border); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 3px 10px rgba(40,20,0,.18);
}
.topbar-btn:hover { background: #fff; border-color: var(--warm-orange); }
.topbar-btn.round { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; }

/* --------------------------------------------------------------- float panel */
.floatpanel {
  position: absolute; top: 58px; right: 18px; z-index: 24; width: 230px;
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 10px 28px rgba(40,20,0,.28); font-size: 12.5px; color: var(--ink);
}
.floatpanel-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 8px; }
.floatpanel-head button { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--ink-soft); }
.char-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.char-row label { width: 40px; font-size: 11.5px; color: var(--ink-soft); }
.swatches { display: flex; gap: 6px; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.sw.sel { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.char-hat-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 8px 0 4px; }
.char-hint { font-size: 11px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }

/* -------------------------------------------------------------- right index (B2) */
#indexbar {
  position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 18;
  background: var(--panel-bg); border-left: 1px solid var(--panel-border);
  padding: 58px 16px 16px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(40,20,0,.12);
}
.ib-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.ib-tab {
  flex: 1; background: rgba(201,122,78,.08); border: 1px solid transparent; color: var(--ink-soft);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 8px 6px; border-radius: 8px; cursor: pointer;
}
.ib-tab.on { background: var(--ink); color: #fff; }
.ib-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ib-counts { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 10px; }
.ib-counts strong { color: var(--warm-orange); font-size: 15px; }
.ib-actions-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ib-actions-row button {
  background: rgba(255,138,61,.14); border: 1px solid rgba(255,138,61,.35); color: #a85414;
  padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 12px; font-weight: 700; text-align: left;
}
.ib-actions-row button:hover { background: rgba(255,138,61,.26); }
#btn-quiz { background: rgba(127,168,114,.16) !important; border-color: rgba(127,168,114,.4) !important; color: #4a6a3a !important; }
#btn-quiz:hover { background: rgba(127,168,114,.28) !important; }

#search-input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(201,122,78,.3);
  background: #fff; color: var(--ink); font-size: 12.5px; outline: none; margin-bottom: 8px;
}
#search-input:focus { border-color: var(--warm-orange); }
#search-results {
  position: relative; max-height: 260px; overflow-y: auto; margin-bottom: 8px;
  background: #fff; border: 1px solid rgba(201,122,78,.25); border-radius: 10px;
}
#search-results .result-item { padding: 8px 12px; font-size: 12px; border-bottom: 1px solid rgba(201,122,78,.12); cursor: pointer; }
#search-results .result-item:hover { background: rgba(201,122,78,.1); }
#search-results .result-item .ri-title { color: var(--ink); }
#search-results .result-item .ri-meta { color: var(--warm-teal); opacity: .8; font-size: 11px; margin-top: 2px; }
#search-results .result-empty { padding: 10px 12px; font-size: 12px; color: var(--ink-soft); }

.ib-subtabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.ib-subtab {
  background: none; border: 1px solid rgba(201,122,78,.25); color: var(--ink-soft);
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.ib-subtab.on { background: var(--warm-sage); border-color: var(--warm-sage); color: #fff; }
.ib-sub { flex: 1; min-height: 0; overflow-y: auto; }
.ib-topic {
  display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 8px; cursor: pointer;
  margin-bottom: 3px;
}
.ib-topic:hover { background: rgba(201,122,78,.1); }
.ib-topic-num { background: var(--ink); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.ib-topic-name { flex: 1; font-size: 12.5px; font-weight: 600; }
.ib-topic-count { font-size: 11px; color: var(--ink-soft); }
.ib-collab-row { padding: 9px 8px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; border: 1px solid rgba(201,122,78,.15); }
.ib-collab-row:hover { background: rgba(201,122,78,.1); }
.ib-collab-pair { font-size: 12px; font-weight: 700; }
.ib-collab-meta { font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }
.ib-collab-empty { font-size: 12px; color: var(--ink-soft); padding: 10px; }

/* -------------------------------------------------------------------- log */
.log-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; margin-bottom: 8px; color: var(--ink-soft); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #d94b3a; box-shadow: 0 0 6px #d94b3a; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
#log-filter { flex: 1; font-size: 11px; border-radius: 8px; border: 1px solid rgba(201,122,78,.3); padding: 4px 6px; background: #fff; }
.log-count-wrap { white-space: nowrap; }
#log-list { flex: 1; overflow-y: auto; }
.log-row { display: flex; gap: 6px; padding: 7px 4px; border-bottom: 1px solid rgba(201,122,78,.12); font-size: 11px; align-items: flex-start; }
.log-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.log-icon { flex-shrink: 0; }
.log-body { flex: 1; line-height: 1.5; }
.log-role { font-weight: 700; color: var(--warm-teal); margin-right: 4px; }
.log-text { color: var(--ink); }
.log-sim { display: inline-block; margin-left: 5px; font-size: 9px; background: rgba(201,122,78,.18); color: var(--warm-terracotta); border-radius: 6px; padding: 1px 5px; vertical-align: middle; }
.log-empty { font-size: 12px; color: var(--ink-soft); padding: 14px; text-align: center; }

/* ----------------------------------------------------------------- notice */
#patent-notice { position: absolute; bottom: 18px; left: 18px; z-index: 20; max-width: 360px; }
.notice-toggle {
  display: block; background: rgba(168,64,44,.92); border: 1px solid rgba(255,180,160,.5); border-radius: 999px;
  padding: 7px 16px; font-size: 12.5px; font-weight: 700; color: #fff; cursor: pointer;
}
.notice-toggle:hover { background: rgba(190,74,50,.95); }
.notice-body {
  position: relative; margin-top: 8px;
  background: rgba(253,246,232,.97); border: 1px solid rgba(168,64,44,.3); border-radius: 10px;
  padding: 12px 14px; font-size: 12px; line-height: 1.6; color: var(--ink);
}
.notice-close { display: block; margin-top: 10px; background: none; border: none; color: #a8402c; cursor: pointer; font-size: 11.5px; padding: 0; }

/* ------------------------------------------------------------- side panels */
#sidepanel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 380px; z-index: 25;
  background: var(--panel-bg); border-right: 1px solid var(--panel-border);
  padding: 50px 20px 20px; overflow-y: auto; box-shadow: 10px 0 30px rgba(40,20,0,.18);
  color: var(--ink);
}
#btn-panel-close, #btn-list-close {
  position: absolute; top: 14px; right: 16px; background: rgba(201,122,78,.12); border: none; color: var(--ink);
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px;
}
#sidepanel h2 { font-size: 16px; line-height: 1.4; margin: 0 0 6px; color: var(--ink); }
#sidepanel .meta-row { font-size: 12px; color: var(--ink-soft); margin: 2px 0; }
#sidepanel .badge {
  display: inline-block; font-size: 10.5px; padding: 2px 9px; border-radius: 10px; margin-right: 6px; margin-bottom: 4px;
  background: rgba(47,143,147,.14); color: #1d6a6d; border: 1px solid rgba(47,143,147,.3);
}
#sidepanel .badge.user-added { background: rgba(255,138,61,.16); color: #b5560f; border-color: rgba(255,138,61,.4); }
#sidepanel .abstract { font-size: 12.5px; line-height: 1.7; color: #4a3d2c; margin: 12px 0; white-space: pre-wrap; }
#sidepanel a.doi-link { display: inline-block; margin: 6px 0 14px; color: var(--warm-teal); font-size: 12.5px; text-decoration: none; border-bottom: 1px dotted var(--warm-teal); }
#sidepanel a.doi-link:hover { color: var(--ink); }
#sidepanel .section-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--warm-sage); margin: 18px 0 8px; font-weight: 700; }
#sidepanel .link-item { font-size: 12px; padding: 7px 9px; border-radius: 6px; margin-bottom: 5px; background: rgba(201,122,78,.07); cursor: pointer; border-left: 3px solid var(--warm-orange); }
#sidepanel .link-item.dashed { border-left-style: dashed; border-left-color: var(--warm-teal); }
#sidepanel .link-item:hover { background: rgba(201,122,78,.16); }
#sidepanel .link-item .basis { color: var(--ink-soft); }
#sidepanel .link-item .li-title { color: var(--ink); margin-top: 2px; }
#sidepanel .missing-box { background: rgba(168,64,44,.08); border: 1px solid rgba(168,64,44,.25); border-radius: 8px; padding: 12px; font-size: 12px; line-height: 1.6; color: #7a3220; margin-top: 10px; }

.breadcrumb { font-size: 11px; color: var(--ink-soft); margin-bottom: 10px; }
.breadcrumb span[data-fly-island], .breadcrumb span[data-fly-district] { cursor: pointer; color: var(--warm-teal); }
.breadcrumb span[data-fly-island]:hover, .breadcrumb span[data-fly-district]:hover { text-decoration: underline; }
.breadcrumb .bc-sep { margin: 0 4px; color: rgba(0,0,0,.25); }
.breadcrumb .bc-current { color: var(--ink); font-weight: 600; }

.keypoints { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: #4a3d2c; }
.keypoints li { margin-bottom: 6px; }

.timeline { display: flex; align-items: flex-end; gap: 6px; padding: 6px 2px 2px; }
.tl-seg { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.tl-bar { width: 100%; max-width: 20px; background: rgba(201,122,78,.35); border-radius: 3px 3px 0 0; }
.tl-seg.active .tl-bar { background: var(--warm-orange); }
.tl-label { font-size: 9px; color: var(--ink-soft); white-space: nowrap; }
.tl-seg.active .tl-label { color: var(--warm-orange); font-weight: 700; }

/* island card (B3) */
.island-card { color: var(--ink); }
.island-num {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  background: var(--ink); color: #fff; font-weight: 800; border-radius: 50%; font-size: 14px; margin-bottom: 8px;
}
.island-card h2 { margin: 2px 0 8px; font-size: 19px; }
.island-summary { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; margin: 0 0 10px; }
.island-quote {
  margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--warm-teal);
  background: rgba(47,143,147,.07); font-size: 12px; line-height: 1.6; color: #2a4a4c; font-style: italic;
}
.island-quote cite { display: block; margin-top: 4px; font-size: 10.5px; color: var(--ink-soft); font-style: normal; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.tag { background: rgba(201,122,78,.12); color: var(--warm-terracotta); font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.ip-district-list { display: flex; flex-direction: column; gap: 4px; }
.ip-district { display: flex; justify-content: space-between; padding: 8px 9px; border-radius: 7px; background: rgba(201,122,78,.06); cursor: pointer; font-size: 12.5px; }
.ip-district:hover { background: rgba(201,122,78,.15); }
.ip-district-count { color: var(--ink-soft); }
.jump-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.jump-chip {
  background: var(--warm-sage); color: #fff; border: none; border-radius: 999px; padding: 7px 12px;
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.jump-chip:hover { background: #6a9a5c; }
.src-badge { display: inline-block; font-size: 10px; padding: 2px 9px; border-radius: 999px; background: rgba(47,143,147,.14); color: #1d6a6d; border: 1px solid rgba(47,143,147,.3); }

#listview {
  position: absolute; top: 0; left: 0; bottom: 0; width: 340px; z-index: 25;
  background: var(--panel-bg); border-right: 1px solid var(--panel-border);
  padding: 50px 16px 16px; overflow-y: auto; color: var(--ink);
}
.listview-head h2 { font-size: 15px; margin: 0; position: absolute; top: 16px; left: 18px; }
.lv-island { margin-bottom: 14px; }
.lv-island-head { font-size: 13.5px; font-weight: 700; padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; }
.lv-island-head:hover { background: rgba(201,122,78,.1); }
.lv-district { margin: 3px 0 3px 10px; }
.lv-district-head { font-size: 12px; color: var(--ink-soft); padding: 4px 8px; cursor: pointer; display: flex; justify-content: space-between; border-radius: 5px; }
.lv-district-head:hover { background: rgba(201,122,78,.1); }
.lv-item { font-size: 11.5px; color: #4a3d2c; padding: 4px 8px 4px 16px; cursor: pointer; border-radius: 5px; }
.lv-item:hover { background: rgba(201,122,78,.15); color: var(--ink); }
.lv-item.missing { color: #a8402c; font-style: italic; }
.lv-item.user-added { color: #b5560f; }
.lv-count { color: var(--warm-sage); font-weight: 400; }

#addpanel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 380px; z-index: 26;
  background: var(--panel-bg); border-right: 1px solid rgba(255,138,61,.3);
  padding: 50px 18px 18px; overflow-y: auto; box-shadow: 10px 0 30px rgba(40,20,0,.18); color: var(--ink);
}
#btn-add-close { position: absolute; top: 14px; right: 16px; background: rgba(201,122,78,.12); border: none; color: var(--ink); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.add-label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.add-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
#add-input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(201,122,78,.3); background: #fff; color: var(--ink); font-size: 12.5px; outline: none; }
#add-input:focus { border-color: var(--warm-orange); }
#btn-add-fetch, #btn-add-confirm, #btn-add-cancel, #btn-export, #btn-import-trigger {
  background: rgba(255,138,61,.16); border: 1px solid rgba(255,138,61,.4); color: #a85414;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 12.5px; white-space: nowrap;
}
#btn-add-fetch:hover, #btn-add-confirm:hover, #btn-export:hover, #btn-import-trigger:hover { background: rgba(255,138,61,.3); }
#btn-add-cancel { background: rgba(201,122,78,.08); border-color: rgba(201,122,78,.25); color: var(--ink-soft); }
.add-status { font-size: 12px; line-height: 1.6; margin: 6px 0; color: var(--ink-soft); }
.add-status.error { color: #a8402c; }
.add-status.success { color: #2f7f55; }
.add-preview { margin: 10px 0; padding: 10px 12px; background: rgba(201,122,78,.06); border-radius: 8px; }
.add-preview-title { font-size: 14px; line-height: 1.4; margin: 4px 0; color: var(--ink); }
.add-preview-abstract { font-size: 12px; line-height: 1.6; color: #4a3d2c; margin: 8px 0; }
.src-badge2 { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 8px; background: rgba(47,143,147,.14); color: #1d6a6d; border: 1px solid rgba(47,143,147,.3); }
.add-reason { margin: 10px 0; padding: 10px 12px; background: rgba(255,138,61,.07); border: 1px solid rgba(255,138,61,.2); border-radius: 8px; font-size: 12px; }
.classify-top { color: #a85414; margin-bottom: 4px; }
.classify-top-terms { color: var(--ink-soft); line-height: 1.7; }
.classify-warn { color: #a8402c; margin-bottom: 6px; }
.candidate-row { margin: 8px 0; padding-top: 8px; border-top: 1px solid rgba(201,122,78,.15); }
.candidate-name { color: var(--ink-soft); font-weight: 600; }
.candidate-score { color: var(--warm-sage); margin-left: 6px; }
.candidate-terms { margin-top: 3px; line-height: 1.7; }
.match-term { display: inline-block; background: rgba(201,122,78,.1); border-radius: 6px; padding: 1px 6px; margin: 2px 2px 0 0; color: #4a3d2c; font-size: 11px; }
.match-empty { color: var(--warm-sage); font-size: 11px; }
.add-override { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--ink-soft); }
.add-override select { background: #fff; color: var(--ink); border: 1px solid rgba(201,122,78,.3); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.add-actions { display: flex; gap: 8px; margin: 10px 0; }
#addpanel hr { border: none; border-top: 1px solid rgba(201,122,78,.2); margin: 14px 0; }
.add-io-row { display: flex; gap: 8px; }

#tooltip {
  position: absolute; z-index: 30; pointer-events: none; background: rgba(253,246,232,.96);
  border: 1px solid var(--panel-border); border-radius: 8px; padding: 6px 10px; font-size: 12px;
  max-width: 260px; line-height: 1.4; color: var(--ink); box-shadow: 0 4px 14px rgba(40,20,0,.2);
}
#tooltip .tt-title { color: var(--ink); font-weight: 700; }
#tooltip .tt-meta { color: var(--ink-soft); font-size: 11px; margin-top: 2px; }
#tooltip .tt-sim { color: var(--warm-terracotta); font-size: 10px; margin-top: 2px; font-weight: 700; }

#hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 15;
  font-size: 11px; color: #fdf6e8; background: rgba(40,20,0,.35); padding: 5px 12px; border-radius: 12px;
  pointer-events: none;
}

/* ---------------------------------------------------------- onboarding/quiz */
.onboarding {
  position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(20,10,0,.45);
}
.ob-card {
  width: 420px; max-width: 90vw; background: var(--panel-bg); border-radius: 16px; padding: 26px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4); color: var(--ink);
}
.ob-step { font-size: 11px; font-weight: 700; color: var(--warm-orange); letter-spacing: .06em; margin-bottom: 6px; }
.ob-card h3 { margin: 0 0 10px; font-size: 19px; }
.ob-card p { font-size: 13px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 16px; }
.ob-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(201,122,78,.25); }
.ob-dot.on { background: var(--warm-orange); }
.ob-actions { display: flex; justify-content: space-between; align-items: center; }
.ob-skip { background: none; border: none; color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.ob-nav { display: flex; gap: 8px; }
.ob-prev { background: rgba(201,122,78,.1); border: 1px solid rgba(201,122,78,.25); color: var(--ink); padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 12.5px; }
.ob-next { background: var(--warm-orange); border: none; color: #fff; padding: 8px 18px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 700; }
.quiz-card .quiz-q { font-size: 14px; color: var(--ink); font-weight: 600; margin-bottom: 14px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.quiz-opt { text-align: left; background: rgba(201,122,78,.07); border: 1px solid rgba(201,122,78,.2); color: var(--ink); padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.quiz-opt:hover { background: rgba(255,138,61,.16); border-color: var(--warm-orange); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(201,122,78,.3); border-radius: 4px; }

/* ------------------------------------------------ H4d-3 mobile (<=768px) */
#drawer-handle { display: none; }
@media (max-width: 768px) {
  #brandbar, #hint { display: none; }

  /* compact top toolbar: icon-only, one row, scrolls sideways if needed */
  #toolbar-wrap { top: 6px; left: 6px; right: 6px; transform: none; max-width: none; }
  #toolbar { gap: 4px; padding: 3px 6px; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  #toolbar::-webkit-scrollbar { display: none; }
  .pill-group { gap: 0; }
  .pill-group + .pill-group { padding-left: 4px; }
  #toolbar .pill-btn, #tod-group .pill-btn, .pill-btn.toggle { min-width: 40px; height: 40px; padding: 0 6px; font-size: 15px; }
  #topbar-actions { top: 56px; right: 6px; gap: 6px; }
  .topbar-btn { min-height: 40px; padding: 0 12px; font-size: 12px; }
  .topbar-btn.round { width: 40px; height: 40px; }
  .floatpanel { top: 104px; right: 6px; }

  /* island index -> collapsible bottom drawer */
  #indexbar {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 60vh; z-index: 22;
    border-left: none; border-top: 1px solid var(--panel-border); border-radius: 16px 16px 0 0;
    padding: 56px 14px 14px; overflow-y: auto; box-shadow: 0 -8px 24px rgba(40,20,0,.18);
    transform: translateY(calc(100% - 48px)); transition: transform .25s ease;
  }
  body.drawer-open #indexbar { transform: translateY(0); }
  #drawer-handle {
    display: block; position: absolute; top: 0; left: 0; right: 0; height: 48px; width: 100%;
    background: transparent; border: none; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer;
  }
  #drawer-handle::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 2px; background: rgba(58,47,36,.25);
  }
  body.drawer-open #drawer-handle .dh-caret { display: inline-block; transform: rotate(180deg); }

  /* island/item detail, list, add-paper -> bottom sheets over the drawer */
  #sidepanel, #listview, #addpanel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 60vh; z-index: 26;
    border-right: none; border-top: 1px solid var(--panel-border); border-radius: 16px 16px 0 0;
    padding: 48px 16px 16px; overflow-y: auto; box-shadow: 0 -10px 30px rgba(40,20,0,.2);
  }
  #btn-panel-close, #btn-list-close, #btn-add-close { width: 40px; height: 40px; top: 6px; right: 8px; }
}
