/* 第一次使用：互動導覽（聚光燈＋說明泡泡）與示範白板的「清空」小卡。顏色都讀主題的外框變數（--ch-*、--acc、--hi）。 */

.ob-root { position: fixed; inset: 0; z-index: 6800; pointer-events: none; animation: ob-fade 0.2s ease-out; }
.ob-root.ob-leaving { animation: ob-fade-out 0.18s ease-in forwards; }

/* 暗幕：clip-path 挖一個洞，洞外擋住點擊、洞裡點得到底下的東西 */
.ob-dim { position: absolute; inset: 0; pointer-events: auto; background: rgba(14, 14, 16, 0.58); }
body[data-theme="dark"] .ob-dim { background: rgba(4, 6, 14, 0.7); }
body[data-theme="chalk"] .ob-dim { background: rgba(10, 18, 14, 0.62); }

/* 點亮起來的那個東西：點了就是下一步。第一步可以真的拖、拉角，所以讓點擊穿過去 */
.ob-catch { position: absolute; pointer-events: auto; cursor: pointer; }
.ob-interactive .ob-catch { pointer-events: none; }

.ob-ring { position: absolute; pointer-events: none; box-shadow: 0 0 0 3px var(--ob-ring, var(--acc)), 0 0 0 7px color-mix(in srgb, var(--ob-ring, var(--acc)) 30%, transparent); }
body[data-theme="sketch"] .ob-ring { --ob-ring: var(--hi); box-shadow: 0 0 0 3px #161616, 0 0 0 7px var(--hi), 0 0 0 9px #161616; }
body[data-theme="blocks"] .ob-ring { --ob-ring: var(--acc); }
body[data-theme="chalk"] .ob-ring { --ob-ring: #f4e9a8; }
body[data-theme="dark"] .ob-ring { --ob-ring: var(--acc); box-shadow: 0 0 0 2px var(--acc), 0 0 26px 4px color-mix(in srgb, var(--acc) 55%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .ob-ring { animation: ob-pulse 1.8s ease-in-out infinite; }
}

/* 說明泡泡 */
.ob-bubble { position: absolute; left: 0; top: 0; width: min(24rem, calc(100vw - 24px)); pointer-events: auto; padding: 16px 18px 14px; background: var(--ch-bg); color: var(--ch-ink); border: var(--ch-border); border-radius: calc(var(--ch-radius) + 2px); box-shadow: var(--ch-shadow), 0 26px 60px -24px rgba(0, 0, 0, 0.6); backdrop-filter: var(--ch-blur); -webkit-backdrop-filter: var(--ch-blur); }
body[data-theme="dark"] .ob-bubble { background: #1c2240; }
.ob-bubble.ob-enter { animation: ob-bubble-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }

/* 指向目標的小三角 */
.ob-bubble::before { content: ""; position: absolute; width: 14px; height: 14px; background: inherit; border: inherit; border-width: 0; transform: rotate(45deg); display: none; }
.ob-bubble[data-side="below"]::before { display: block; top: -7px; left: calc(var(--ob-ax) - 7px); border-top: var(--ch-border); border-left: var(--ch-border); }
.ob-bubble[data-side="above"]::before { display: block; bottom: -7px; left: calc(var(--ob-ax) - 7px); border-bottom: var(--ch-border); border-right: var(--ch-border); }
.ob-bubble[data-side="right"]::before { display: block; left: -7px; top: calc(var(--ob-ay) - 7px); border-bottom: var(--ch-border); border-left: var(--ch-border); }
.ob-bubble[data-side="left"]::before { display: block; right: -7px; top: calc(var(--ob-ay) - 7px); border-top: var(--ch-border); border-right: var(--ch-border); }

.ob-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--ch-sub); font-size: 0.8125rem; font-weight: 700; }
.ob-label { display: inline-flex; align-items: center; gap: 6px; text-transform: none; }
.ob-label .ic { color: var(--acc); }
body[data-theme="sketch"] .ob-label .ic { color: #161616; background: var(--hi); border-radius: 50%; padding: 2px; }
.ob-count { font-variant-numeric: tabular-nums; }
.ob-title { margin: 0 0 6px; font-size: 1.25rem; font-weight: 850; line-height: 1.25; font-family: var(--font-display); letter-spacing: -0.01em; }
.ob-text { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--ch-ink); }

.ob-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.ob-foot .btn { white-space: nowrap; }
.ob-grow { flex: 1 1 auto; }
.ob-foot .btn { min-height: 44px; }
.ob-next { min-width: 6.5rem; }
.ob-skip { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--ch-sub); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ob-skip:hover { color: var(--ch-ink); }
.ob-dots { display: inline-flex; align-items: center; gap: 5px; }
.ob-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ch-line); transition: background-color 0.2s, width 0.2s; }
.ob-dots i.on { width: 18px; border-radius: 4px; background: var(--acc); }
body[data-theme="sketch"] .ob-dots i { background: rgba(22, 22, 22, 0.22); }
body[data-theme="sketch"] .ob-dots i.on { background: #161616; }

/* 窄螢幕：點點收起來，按鈕排一行 */
@media (max-width: 420px) {
  .ob-bubble { padding: 14px 14px 12px; }
}

/* 導覽中工具列的捲動、hover 名稱列不要跳出來搶畫面 */
body.ob-touring .toast { z-index: 1; }

/* 示範白板：左下角的小卡（上課模式、試玩框不顯示） */
.ob-demo { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 96px); z-index: 4900; display: flex; align-items: center; gap: 10px; max-width: min(30rem, calc(100vw - 28px)); padding: 8px 6px 8px 14px; animation: pop-in-up 0.22s ease-out; }
.ob-demo-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.875rem; line-height: 1.3; }
.ob-demo-text b { font-weight: 800; }
.ob-demo-text span { color: var(--ch-sub); }
.ob-demo-clear { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.ob-demo-hide { flex: none; color: var(--ch-sub); }
body.present .ob-demo, body.embed .ob-demo, body.solo .ob-demo, body.blanked .ob-demo { display: none; }
@media (max-width: 560px) {
  .ob-demo-text span { display: none; }
}

@keyframes ob-fade { from { opacity: 0; } }
@keyframes ob-fade-out { to { opacity: 0; } }
@keyframes ob-bubble-in { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
@keyframes ob-pulse { 50% { box-shadow: 0 0 0 3px var(--ob-ring, var(--acc)), 0 0 0 12px color-mix(in srgb, var(--ob-ring, var(--acc)) 0%, transparent); } }
body[data-theme="sketch"] .ob-ring { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .ob-root, .ob-root.ob-leaving, .ob-bubble.ob-enter, .ob-demo { animation: none; }
  .ob-dots i { transition: none; }
}
