docs/.vitepress/theme/components/HomeFeatures.vue

5f20afcddd9bf446affeb450596a58cc0fe7e4ca
wotaku/docs/.vitepress/theme/components/HomeFeatures.vue history · blame · raw

1003 lines · 25393 bytes

   1<script setup lang="ts">
   2import { computed, onMounted, ref, watch } from 'vue'
   3import type { HomeCard } from '../../configs/constants'
   4
   5const props = defineProps<{ cards: HomeCard[] }>()
   6
   7const STORAGE_KEY = 'wotaku-home-cards-v2'
   8const PREFS_KEY = 'wotaku-home-prefs-v1'
   9
  10interface CardState {
  11  homepage: string[]
  12}
  13
  14function defaultState(): CardState {
  15  return {
  16    homepage: props.cards.filter((c) => c.featured).map((c) => c.id)
  17  }
  18}
  19
  20function loadState(): CardState {
  21  if (typeof window === 'undefined') return defaultState()
  22  try {
  23    const raw = localStorage.getItem(STORAGE_KEY)
  24    if (!raw) return defaultState()
  25    const parsed: CardState = JSON.parse(raw)
  26    const allIds = new Set(props.cards.map((c) => c.id))
  27    return { homepage: (parsed.homepage ?? []).filter((id) => allIds.has(id)) }
  28  } catch { return defaultState() }
  29}
  30
  31const mounted = ref(false)
  32const state = ref<CardState>(defaultState())
  33
  34onMounted(() => {
  35  state.value = loadState()
  36  const prefs = loadPrefs()
  37  columnMode.value = prefs.columnMode
  38  viewMode.value = prefs.viewMode
  39  mounted.value = true
  40})
  41
  42function save() {
  43  localStorage.setItem(STORAGE_KEY, JSON.stringify(state.value))
  44}
  45
  46const cardMap = computed(() => new Map(props.cards.map((c) => [c.id, c])))
  47
  48const homepageSet = computed(() => new Set(state.value.homepage))
  49
  50const visibleCards = computed(() =>
  51  state.value.homepage.map((id) => cardMap.value.get(id)!).filter(Boolean)
  52)
  53
  54const grid = computed(() => {
  55  const n = visibleCards.value.length
  56  if (n === 0) return undefined
  57  if (columnMode.value === 'max') return 'grid-max'
  58  if (n === 2) return 'grid-2'
  59  if (n === 3) return 'grid-3'
  60  if (n % 3 === 0) return 'grid-6'
  61  if (n > 3) return 'grid-4'
  62  return undefined
  63})
  64
  65const panelGrid = computed(() => {
  66  if (columnMode.value === 'max') return 'grid-max'
  67  const n = props.cards.length
  68  if (n === 2) return 'grid-2'
  69  if (n === 3) return 'grid-3'
  70  if (n % 3 === 0) return 'grid-6'
  71  if (n > 3) return 'grid-4'
  72  return undefined
  73})
  74
  75const KNOWN_PREFIXES = /^(lucide|mdi|ic|mingcute|material-symbols|simple-icons|uil|octicon|logos|akar-icons|map|bi|streamline-logos|streamline-ultimate|streamline-sharp|iconoir)-/
  76
  77function cardIcon(card: HomeCard) {
  78  return card.icon.replace(/:([A-Za-z0-9_+-]+):/g, (_, markup) => {
  79    const cls = KNOWN_PREFIXES.test(markup) ? markup : `twemoji-${markup}`
  80    return `<span class="i-${cls}"></span>`
  81  })
  82}
  83
  84/* ── Manager panel ── */
  85const panelOpen = ref(false)
  86const dropdownOpen = ref(false)
  87
  88watch(panelOpen, (open) => {
  89  if (typeof document !== 'undefined')
  90    document.body.style.overflow = open ? 'hidden' : ''
  91})
  92
  93function loadPrefs() {
  94  if (typeof window === 'undefined') return { columnMode: 'default' as const, viewMode: 'default' as const }
  95  try {
  96    const p = JSON.parse(localStorage.getItem(PREFS_KEY) ?? '{}')
  97    return {
  98      columnMode: p.columnMode === 'max' ? 'max' as const : 'default' as const,
  99      viewMode: p.viewMode === 'mini' ? 'mini' as const : 'default' as const
 100    }
 101  } catch { return { columnMode: 'default' as const, viewMode: 'default' as const } }
 102}
 103
 104const columnMode = ref<'default' | 'max'>('default')
 105const viewMode = ref<'default' | 'mini'>('default')
 106
 107watch([columnMode, viewMode], () => {
 108  localStorage.setItem(PREFS_KEY, JSON.stringify({
 109    columnMode: columnMode.value,
 110    viewMode: viewMode.value
 111  }))
 112})
 113
 114const homepageSectionCards = computed(() =>
 115  state.value.homepage.map((id) => cardMap.value.get(id)!).filter(Boolean)
 116)
 117
 118const otherSections = computed(() => {
 119  const sectionMap = new Map<string, HomeCard[]>()
 120  for (const card of props.cards) {
 121    const s = card.section ?? 'Pages'
 122    if (!sectionMap.has(s)) sectionMap.set(s, [])
 123    if (!homepageSet.value.has(card.id)) sectionMap.get(s)!.push(card)
 124  }
 125  return Array.from(sectionMap.entries()).map(([label, cards]) => ({ label, cards }))
 126})
 127
 128function toggleCard(id: string) {
 129  if (homepageSet.value.has(id)) {
 130    state.value.homepage = state.value.homepage.filter((hid) => hid !== id)
 131  } else {
 132    state.value.homepage.push(id)
 133  }
 134  save()
 135}
 136
 137function showAll() {
 138  const current = new Set(state.value.homepage)
 139  const toAdd = props.cards.filter((c) => !current.has(c.id)).map((c) => c.id)
 140  state.value.homepage = [...state.value.homepage, ...toAdd]
 141  save()
 142}
 143
 144function hideAll() {
 145  state.value.homepage = []
 146  save()
 147}
 148
 149function resetDefaults() {
 150  state.value = defaultState()
 151  columnMode.value = 'default'
 152  viewMode.value = 'default'
 153  save()
 154}
 155
 156const cardTooltip = ref<{ text: string; x: number; y: number } | null>(null)
 157
 158function showCardTooltip(e: MouseEvent, title: string) {
 159  if (!window.matchMedia('(hover: hover)').matches) return
 160  const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
 161  cardTooltip.value = { text: title, x: rect.left + rect.width / 2, y: rect.top }
 162}
 163
 164function hideCardTooltip() {
 165  cardTooltip.value = null
 166}
 167
 168/* ── Drag-to-reorder (homepage only, pointer events) ── */
 169const dragging = ref<string | null>(null)
 170const dragTarget = ref<string | null>(null)
 171const cardListEl = ref<HTMLElement | null>(null)
 172const ghostPos = ref<{ x: number; y: number } | null>(null)
 173
 174function onHandlePointerDown(e: PointerEvent, id: string) {
 175  e.preventDefault()
 176  dragging.value = id
 177  dragTarget.value = null
 178  ghostPos.value = { x: e.clientX, y: e.clientY }
 179  ;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
 180}
 181
 182function onHandlePointerMove(e: PointerEvent) {
 183  if (!dragging.value) return
 184  ghostPos.value = { x: e.clientX, y: e.clientY }
 185  const items = cardListEl.value?.querySelectorAll<HTMLElement>('[data-card-id]')
 186  if (!items) return
 187  for (const item of items) {
 188    const rect = item.getBoundingClientRect()
 189    if (
 190      e.clientX >= rect.left && e.clientX <= rect.right &&
 191      e.clientY >= rect.top && e.clientY <= rect.bottom
 192    ) {
 193      const id = item.dataset.cardId!
 194      if (id !== dragging.value) dragTarget.value = id
 195      break
 196    }
 197  }
 198}
 199
 200function onHandlePointerUp() {
 201  if (dragging.value && dragTarget.value) {
 202    const order = [...state.value.homepage]
 203    const from = order.indexOf(dragging.value)
 204    const to = order.indexOf(dragTarget.value)
 205    if (from !== -1 && to !== -1) {
 206      order.splice(from, 1)
 207      order.splice(to, 0, dragging.value)
 208      state.value.homepage = order
 209      save()
 210    }
 211  }
 212  dragging.value = null
 213  dragTarget.value = null
 214  ghostPos.value = null
 215}
 216</script>
 217
 218<template>
 219  <!-- ── Feature Grid ── -->
 220  <div class="home-features" :class="{ 'is-mounted': mounted }">
 221    <div class="container">
 222      <div class="card-toolbar">
 223        <button class="gear-btn" aria-label="Customize cards" @click="panelOpen = true">
 224          <span class="i-lucide-ellipsis" />
 225        </button>
 226      </div>
 227      <div class="items" :class="{ 'view-mini': viewMode === 'mini' }">
 228        <div
 229          v-for="card in visibleCards"
 230          :key="card.id"
 231          class="item"
 232          :class="grid"
 233        >
 234          <a class="card" :href="card.link">
 235            <article class="box">
 236              <div class="icon" v-html="cardIcon(card)" />
 237              <h2 class="title">{{ card.title }}</h2>
 238              <p class="details">{{ card.details }}</p>
 239            </article>
 240          </a>
 241        </div>
 242      </div>
 243    </div>
 244  </div>
 245
 246  <!-- ── Manager Panel ── -->
 247  <Teleport to="body">
 248    <Transition name="fade">
 249      <div v-if="panelOpen" class="backdrop" @click.self="panelOpen = false">
 250        <Transition name="slide-up" appear>
 251          <div v-if="panelOpen" class="panel" role="dialog" aria-modal="true" aria-label="Customize cards">
 252            <div class="panel-head">
 253              <span class="panel-title">Customize Cards</span>
 254              <button class="close-btn" aria-label="Close" @click="panelOpen = false">
 255                <span class="i-lucide-x" />
 256              </button>
 257            </div>
 258
 259            <div class="card-sections">
 260              <!-- Homepage section (draggable) -->
 261              <div class="section-label">Homepage</div>
 262              <ul ref="cardListEl" class="card-list" :class="panelGrid">
 263                <li v-if="homepageSectionCards.length === 0" class="empty-box">
 264                  <span class="empty-hint">No cards have been selected</span>
 265                </li>
 266                <li
 267                  v-for="card in homepageSectionCards"
 268                  :key="card.id"
 269                  :data-card-id="card.id"
 270                  class="card-row"
 271                  @mouseenter="showCardTooltip($event, card.title)"
 272                  @mouseleave="hideCardTooltip"
 273                  :class="{
 274                    'is-dragging': dragging === card.id,
 275                    'is-over': dragTarget === card.id && dragging !== card.id
 276                  }"
 277                >
 278                  <span
 279                    class="row-handle"
 280                    aria-hidden="true"
 281                    @pointerdown="onHandlePointerDown($event, card.id)"
 282                    @pointermove="onHandlePointerMove"
 283                    @pointerup="onHandlePointerUp"
 284                  >
 285                    <span class="i-lucide-grip-vertical" />
 286                  </span>
 287                  <span class="row-icon" v-html="cardIcon(card)" />
 288                  <span class="row-name">{{ card.title }}</span>
 289                  <button
 290                    class="row-toggle active"
 291                    aria-label="Remove from homepage"
 292                    @click="toggleCard(card.id)"
 293                  >
 294                    <span class="i-lucide-eye" />
 295                  </button>
 296                </li>
 297              </ul>
 298
 299              <!-- Other sections (Pages, Extensions, Other…) -->
 300              <template v-for="section in otherSections" :key="section.label">
 301                <div class="section-label">{{ section.label }}</div>
 302                <ul class="card-list" :class="panelGrid">
 303                  <li v-if="section.cards.length === 0" class="empty-box">
 304                    <span class="empty-hint">All cards from this section have been selected</span>
 305                  </li>
 306                  <li
 307                    v-for="card in section.cards"
 308                    :key="card.id"
 309                    class="card-row card-row-unselected"
 310                    @mouseenter="showCardTooltip($event, card.title)"
 311                    @mouseleave="hideCardTooltip"
 312                  >
 313                    <span class="row-handle-spacer" aria-hidden="true" />
 314                    <span class="row-icon" v-html="cardIcon(card)" />
 315                    <span class="row-name">{{ card.title }}</span>
 316                    <button
 317                      class="row-toggle"
 318                      aria-label="Add to homepage"
 319                      @click="toggleCard(card.id)"
 320                    >
 321                      <span class="i-lucide-eye-off" />
 322                    </button>
 323                  </li>
 324                </ul>
 325              </template>
 326            </div>
 327
 328            <div class="panel-foot">
 329              <div class="foot-group">
 330                <button class="tool-btn" aria-label="Show all" @click="showAll">
 331                  <span class="i-lucide-eye" />
 332                </button>
 333                <button class="tool-btn" aria-label="Hide all" @click="hideAll">
 334                  <span class="i-lucide-eye-off" />
 335                </button>
 336              </div>
 337              <div class="foot-group">
 338                <div class="settings-wrap">
 339                  <div v-if="dropdownOpen" class="dropdown-overlay" @click="dropdownOpen = false" />
 340                  <div v-if="dropdownOpen" class="settings-dropdown">
 341                    <div class="dropdown-section">
 342                      <span class="dropdown-label">View</span>
 343                      <div class="dropdown-group">
 344                        <button class="tool-btn" :class="{ 'is-active': viewMode === 'default' }" @click="viewMode = 'default'">Default</button>
 345                        <button class="tool-btn" :class="{ 'is-active': viewMode === 'mini' }" @click="viewMode = 'mini'">Mini</button>
 346                      </div>
 347                    </div>
 348                    <div class="dropdown-section">
 349                      <span class="dropdown-label">Columns</span>
 350                      <div class="dropdown-group">
 351                        <button class="tool-btn" :class="{ 'is-active': columnMode === 'default' }" @click="columnMode = 'default'">Default</button>
 352                        <button class="tool-btn" :class="{ 'is-active': columnMode === 'max' }" @click="columnMode = 'max'">Max</button>
 353                      </div>
 354                    </div>
 355                  </div>
 356                  <button
 357                    class="tool-btn"
 358                    :class="{ 'is-active': dropdownOpen }"
 359                    aria-label="Display settings"
 360                    @click.stop="dropdownOpen = !dropdownOpen"
 361                  >
 362                    <span class="i-lucide-settings-2" />
 363                  </button>
 364                </div>
 365                <button class="tool-btn" aria-label="Reset to default" @click="resetDefaults">
 366                  <span class="i-lucide-refresh-ccw" />
 367                </button>
 368              </div>
 369            </div>
 370          </div>
 371        </Transition>
 372      </div>
 373    </Transition>
 374
 375    <div
 376      v-if="cardTooltip"
 377      class="card-tooltip"
 378      :style="{ left: cardTooltip.x + 'px', top: cardTooltip.y + 'px' }"
 379    >{{ cardTooltip.text }}</div>
 380
 381    <Transition name="ghost-fade">
 382      <div
 383        v-if="dragging && ghostPos"
 384        class="drag-ghost"
 385        :style="{ left: ghostPos.x + 'px', top: ghostPos.y + 'px' }"
 386      >
 387        <span class="row-icon" v-html="cardIcon(cardMap.get(dragging)!)" />
 388        <span class="drag-ghost-name">{{ cardMap.get(dragging)?.title }}</span>
 389      </div>
 390    </Transition>
 391  </Teleport>
 392</template>
 393
 394<style scoped>
 395/* ── Grid ── */
 396.home-features {
 397  position: relative;
 398  padding: 0 24px;
 399}
 400
 401.home-features .container {
 402  opacity: 0;
 403  transition: opacity 0.15s ease;
 404}
 405
 406.home-features.is-mounted .container {
 407  opacity: 1;
 408}
 409
 410@media (min-width: 640px) {
 411  .home-features { padding: 0 48px; }
 412}
 413
 414@media (min-width: 960px) {
 415  .home-features { padding: 0 64px; }
 416}
 417
 418.container {
 419  position: relative;
 420  margin: 0 auto;
 421  max-width: 1152px;
 422}
 423
 424.items {
 425  display: flex;
 426  flex-wrap: wrap;
 427  margin: -8px;
 428}
 429
 430.item {
 431  padding: 8px;
 432  width: 100%;
 433}
 434
 435@media (min-width: 640px) {
 436  .item.grid-2,
 437  .item.grid-4,
 438  .item.grid-6 { width: calc(100% / 2); }
 439}
 440
 441@media (min-width: 768px) {
 442  .item.grid-2,
 443  .item.grid-4 { width: calc(100% / 2); }
 444  .item.grid-3,
 445  .item.grid-6 { width: calc(100% / 3); }
 446}
 447
 448@media (min-width: 960px) {
 449  .item.grid-4 { width: calc(100% / 4); }
 450}
 451
 452@media (min-width: 640px) {
 453  .item.grid-max { width: calc(100% / 2); }
 454}
 455
 456@media (min-width: 768px) {
 457  .item.grid-max { width: calc(100% / 3); }
 458}
 459
 460@media (min-width: 960px) {
 461  .item.grid-max { width: calc(100% / 4); }
 462}
 463
 464/* ── Card ── */
 465.card {
 466  display: block;
 467  border: 2px solid #3d3d3d;
 468  border-radius: 12px;
 469  height: 100%;
 470  background-color: var(--vp-c-bg-soft);
 471  transition: border-color 0.25s, background-color 0.25s;
 472  text-decoration: none;
 473  color: inherit;
 474}
 475
 476.card:hover {
 477  border-color: var(--vp-c-brand-1);
 478}
 479
 480.card:active {
 481  transform: none;
 482}
 483
 484.box {
 485  display: flex;
 486  flex-direction: column;
 487  padding: 24px;
 488  height: 100%;
 489}
 490
 491.icon {
 492  display: flex;
 493  justify-content: center;
 494  align-items: center;
 495  margin-bottom: 20px;
 496  border-radius: 6px;
 497  background-color: var(--vp-c-default-soft);
 498  width: 48px;
 499  height: 48px;
 500  font-size: 27px;
 501  transition: background-color 0.25s;
 502}
 503
 504.title {
 505  line-height: 24px;
 506  font-size: 16px;
 507  font-weight: 600;
 508}
 509
 510.details {
 511  flex-grow: 1;
 512  padding-top: 8px;
 513  line-height: 24px;
 514  font-size: 14px;
 515  font-weight: 500;
 516  color: var(--vp-c-text-2);
 517}
 518
 519/* ── Mini View ── */
 520.view-mini .box {
 521  flex-direction: row;
 522  align-items: center;
 523  padding: 12px 16px;
 524  gap: 12px;
 525}
 526
 527.view-mini .icon {
 528  width: 32px;
 529  height: 32px;
 530  font-size: 18px;
 531  margin-bottom: 0;
 532  flex-shrink: 0;
 533}
 534
 535.view-mini .title {
 536  font-size: 14px;
 537  line-height: 1.3;
 538}
 539
 540.view-mini .details {
 541  display: none;
 542}
 543
 544/* ── Gear Button ── */
 545.card-toolbar {
 546  display: flex;
 547  justify-content: flex-end;
 548  margin-bottom: 4px;
 549}
 550
 551.gear-btn {
 552  background: none;
 553  border: none;
 554  padding: 4px;
 555  color: var(--vp-c-text-3, var(--vp-c-text-2));
 556  font-size: 18px;
 557  cursor: pointer;
 558  transition: color 0.2s;
 559  display: flex;
 560  align-items: center;
 561}
 562
 563.gear-btn:hover {
 564  color: var(--vp-c-brand-1);
 565}
 566
 567/* ── Backdrop ── */
 568.backdrop {
 569  position: fixed;
 570  inset: 0;
 571  z-index: 100;
 572  display: flex;
 573  align-items: center;
 574  justify-content: center;
 575  background: rgba(0, 0, 0, 0.5);
 576  backdrop-filter: blur(4px);
 577  overscroll-behavior: none;
 578  touch-action: none;
 579}
 580
 581/* ── Panel ── */
 582.panel {
 583  width: min(520px, calc(100vw - 32px));
 584  max-height: 85vh;
 585  display: flex;
 586  flex-direction: column;
 587  border-radius: 16px;
 588  border: 2px solid #3d3d3d;
 589  background: var(--vp-c-bg);
 590}
 591
 592@media (min-width: 768px) {
 593  .panel { width: min(720px, calc(100vw - 32px)); }
 594}
 595
 596@media (min-width: 960px) {
 597  .panel { width: min(940px, calc(100vw - 32px)); }
 598}
 599
 600.panel-head {
 601  display: flex;
 602  align-items: center;
 603  justify-content: space-between;
 604  padding: 10px 16px;
 605  border-bottom: 1px solid var(--vp-c-divider);
 606  flex-shrink: 0;
 607}
 608
 609.panel-title {
 610  font-size: 15px;
 611  font-weight: 600;
 612  color: var(--vp-c-text-1);
 613}
 614
 615.close-btn {
 616  position: relative;
 617  display: flex;
 618  align-items: center;
 619  justify-content: center;
 620  width: 28px;
 621  height: 28px;
 622  border-radius: 6px;
 623  border: none;
 624  background: transparent;
 625  color: var(--vp-c-text-2);
 626  font-size: 16px;
 627  cursor: pointer;
 628  transition: background 0.15s, color 0.15s;
 629}
 630
 631.close-btn:hover {
 632  background: var(--vp-c-bg-soft);
 633  color: var(--vp-c-text-1);
 634}
 635
 636.close-btn::after {
 637  content: attr(aria-label);
 638  position: absolute;
 639  top: calc(100% + 6px);
 640  right: 0;
 641  background: var(--vp-c-bg-soft);
 642  color: var(--vp-c-text-1);
 643  border: 1px solid var(--vp-c-divider);
 644  border-radius: 5px;
 645  padding: 3px 8px;
 646  font-size: 11px;
 647  white-space: nowrap;
 648  pointer-events: none;
 649  opacity: 0;
 650  transition: opacity 0.15s;
 651  z-index: 10;
 652}
 653
 654@media (hover: hover) {
 655  .close-btn:hover::after {
 656    opacity: 1;
 657  }
 658}
 659
 660/* ── Card List ── */
 661.card-sections {
 662  overflow-y: auto;
 663  min-height: 0;
 664  padding: 8px;
 665  display: flex;
 666  flex-direction: column;
 667  gap: 2px;
 668  touch-action: pan-y;
 669  overscroll-behavior: contain;
 670}
 671
 672.section-label {
 673  font-size: 11px;
 674  font-weight: 600;
 675  text-transform: uppercase;
 676  letter-spacing: 0.06em;
 677  color: var(--vp-c-text-3, var(--vp-c-text-2));
 678  padding: 8px 10px 2px;
 679}
 680
 681.section-label:first-child {
 682  padding-top: 2px;
 683}
 684
 685.card-list {
 686  list-style: none;
 687  margin: 0;
 688  padding: 0;
 689  display: grid;
 690  grid-template-columns: 1fr;
 691  gap: 2px;
 692}
 693
 694@media (min-width: 640px) {
 695  .card-list.grid-2,
 696  .card-list.grid-4,
 697  .card-list.grid-6,
 698  .card-list.grid-max { grid-template-columns: 1fr 1fr; }
 699}
 700
 701@media (min-width: 768px) {
 702  .card-list.grid-3,
 703  .card-list.grid-6,
 704  .card-list.grid-max { grid-template-columns: 1fr 1fr 1fr; }
 705}
 706
 707@media (min-width: 960px) {
 708  .card-list.grid-4,
 709  .card-list.grid-max { grid-template-columns: 1fr 1fr 1fr 1fr; }
 710}
 711
 712.card-row {
 713  display: flex;
 714  align-items: center;
 715  gap: 8px;
 716  padding: 7px 10px;
 717  border-radius: 8px;
 718  transition: background 0.15s, opacity 0.15s;
 719  user-select: none;
 720  min-width: 0;
 721}
 722
 723.card-row:hover {
 724  background: var(--vp-c-bg-soft);
 725}
 726
 727.card-row-unselected {
 728  opacity: 0.45;
 729}
 730
 731.card-row-unselected:hover {
 732  opacity: 1;
 733}
 734
 735.empty-box {
 736  grid-column: 1 / -1;
 737  list-style: none;
 738  border-radius: 8px;
 739  padding: 14px 16px;
 740  display: flex;
 741  align-items: center;
 742  justify-content: center;
 743  background-image:
 744    linear-gradient(90deg, var(--vp-c-divider) 6px, transparent 6px),
 745    linear-gradient(90deg, var(--vp-c-divider) 6px, transparent 6px),
 746    linear-gradient(0deg,  var(--vp-c-divider) 6px, transparent 6px),
 747    linear-gradient(0deg,  var(--vp-c-divider) 6px, transparent 6px);
 748  background-size: 10px 1px, 10px 1px, 1px 10px, 1px 10px;
 749  background-position: top left, bottom left, top left, top right;
 750  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
 751}
 752
 753.empty-hint {
 754  font-size: 13px;
 755  color: var(--vp-c-text-3, var(--vp-c-text-2));
 756  font-style: italic;
 757}
 758
 759.card-tooltip {
 760  position: fixed;
 761  z-index: 9999;
 762  transform: translate(-50%, calc(-100% - 6px));
 763  background: var(--vp-c-bg-soft);
 764  color: var(--vp-c-text-1);
 765  border: 1px solid var(--vp-c-divider);
 766  border-radius: 5px;
 767  padding: 3px 8px;
 768  font-size: 11px;
 769  white-space: nowrap;
 770  pointer-events: none;
 771}
 772
 773.card-row.is-dragging {
 774  opacity: 0.25;
 775  cursor: grabbing;
 776}
 777
 778.card-row.is-over {
 779  background: var(--vp-c-brand-soft);
 780  outline: 2px solid var(--vp-c-brand-1);
 781  outline-offset: -2px;
 782}
 783
 784.row-handle {
 785  color: var(--vp-c-text-3, var(--vp-c-text-2));
 786  font-size: 16px;
 787  flex-shrink: 0;
 788  display: flex;
 789  align-items: center;
 790  cursor: grab;
 791  touch-action: none;
 792}
 793
 794.row-handle:active {
 795  cursor: grabbing;
 796}
 797
 798.row-handle-spacer {
 799  width: 16px;
 800  flex-shrink: 0;
 801}
 802
 803.row-icon {
 804  font-size: 18px;
 805  flex-shrink: 0;
 806  display: flex;
 807  align-items: center;
 808  width: 20px;
 809}
 810
 811.row-name {
 812  flex: 1;
 813  font-size: 14px;
 814  font-weight: 500;
 815  color: var(--vp-c-text-1);
 816  overflow: hidden;
 817  white-space: nowrap;
 818  text-overflow: ellipsis;
 819  min-width: 0;
 820}
 821
 822.row-toggle {
 823  display: flex;
 824  align-items: center;
 825  justify-content: center;
 826  width: 30px;
 827  height: 30px;
 828  border-radius: 6px;
 829  border: none;
 830  background: transparent;
 831  color: var(--vp-c-text-2);
 832  font-size: 16px;
 833  cursor: pointer;
 834  flex-shrink: 0;
 835  transition: background 0.15s, color 0.15s;
 836}
 837
 838.row-toggle:hover {
 839  background: var(--vp-c-bg-alt);
 840  color: var(--vp-c-text-1);
 841}
 842
 843.row-toggle.active {
 844  color: var(--vp-c-brand-1);
 845}
 846
 847/* ── Panel Footer ── */
 848.panel-foot {
 849  display: flex;
 850  align-items: center;
 851  justify-content: space-between;
 852  padding: 5px 8px;
 853  border-top: 1px solid var(--vp-c-divider);
 854  flex-shrink: 0;
 855  gap: 8px;
 856}
 857
 858.foot-group {
 859  display: flex;
 860  align-items: center;
 861  gap: 4px;
 862}
 863
 864.tool-btn {
 865  position: relative;
 866  display: flex;
 867  align-items: center;
 868  gap: 5px;
 869  font-size: 14px;
 870  font-weight: 500;
 871  color: var(--vp-c-text-2);
 872  background: transparent;
 873  border: none;
 874  border-radius: 5px;
 875  padding: 5px 6px;
 876  cursor: pointer;
 877  transition: color 0.15s, background 0.15s;
 878}
 879
 880.tool-btn[aria-label]::after {
 881  content: attr(aria-label);
 882  position: absolute;
 883  bottom: calc(100% + 6px);
 884  left: 50%;
 885  transform: translateX(-50%);
 886  background: var(--vp-c-bg-soft);
 887  color: var(--vp-c-text-1);
 888  border: 1px solid var(--vp-c-divider);
 889  border-radius: 5px;
 890  padding: 3px 8px;
 891  font-size: 11px;
 892  white-space: nowrap;
 893  pointer-events: none;
 894  opacity: 0;
 895  transition: opacity 0.15s;
 896  z-index: 10;
 897}
 898
 899@media (hover: hover) {
 900  .tool-btn[aria-label]:hover::after {
 901    opacity: 1;
 902  }
 903}
 904
 905.tool-btn:hover {
 906  color: var(--vp-c-text-1);
 907  background: var(--vp-c-bg-soft);
 908}
 909
 910.tool-btn.is-active {
 911  color: var(--vp-c-brand-1);
 912  background: var(--vp-c-brand-soft);
 913}
 914
 915/* ── Settings Dropdown ── */
 916.settings-wrap {
 917  position: relative;
 918}
 919
 920.dropdown-overlay {
 921  position: fixed;
 922  inset: 0;
 923  z-index: 1;
 924}
 925
 926.settings-dropdown {
 927  position: absolute;
 928  bottom: calc(100% + 8px);
 929  right: 0;
 930  z-index: 2;
 931  min-width: 196px;
 932  background: var(--vp-c-bg);
 933  border: 1px solid var(--vp-c-divider);
 934  border-radius: 10px;
 935  padding: 10px;
 936  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
 937}
 938
 939.dropdown-section + .dropdown-section {
 940  border-top: 1px solid var(--vp-c-divider);
 941  margin-top: 8px;
 942  padding-top: 8px;
 943}
 944
 945.dropdown-label {
 946  display: block;
 947  font-size: 11px;
 948  font-weight: 600;
 949  text-transform: uppercase;
 950  letter-spacing: 0.06em;
 951  color: var(--vp-c-text-3, var(--vp-c-text-2));
 952  margin-bottom: 6px;
 953}
 954
 955.dropdown-group {
 956  display: flex;
 957  gap: 4px;
 958}
 959
 960/* ── Drag Ghost ── */
 961.drag-ghost {
 962  position: fixed;
 963  pointer-events: none;
 964  z-index: 9999;
 965  display: flex;
 966  align-items: center;
 967  gap: 8px;
 968  padding: 6px 12px 6px 10px;
 969  background: var(--vp-c-bg);
 970  border: 1px solid var(--vp-c-brand-1);
 971  border-radius: 8px;
 972  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
 973  opacity: 0.88;
 974  font-size: 14px;
 975  font-weight: 500;
 976  color: var(--vp-c-text-1);
 977  white-space: nowrap;
 978  user-select: none;
 979  transform: translate(12px, -50%);
 980}
 981
 982.drag-ghost-name {
 983  font-size: 14px;
 984  font-weight: 500;
 985  color: var(--vp-c-text-1);
 986}
 987
 988.ghost-fade-enter-active,
 989.ghost-fade-leave-active { transition: opacity 0.1s ease; }
 990.ghost-fade-enter-from,
 991.ghost-fade-leave-to { opacity: 0; }
 992
 993/* ── Transitions ── */
 994.fade-enter-active,
 995.fade-leave-active { transition: opacity 0.2s ease; }
 996.fade-enter-from,
 997.fade-leave-to { opacity: 0; }
 998
 999.slide-up-enter-active { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease; }
1000.slide-up-leave-active { transition: transform 0.2s ease, opacity 0.15s ease; }
1001.slide-up-enter-from { transform: translateY(20px); opacity: 0; }
1002.slide-up-leave-to { transform: translateY(10px); opacity: 0; }
1003</style>