.tools-page { max-width: 1100px; margin: 0 auto; padding: 16px 8px 40px; }
.tools-page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 8px 4px 14px; }
.tools-page-title { font-size: 1.5rem; font-weight: 800; margin: 0; color: var(--bs-body-color, #1f2937); }
.tools-page-tip { font-size: .8rem; color: var(--theme-text-weak, #9ca3af); }

.tools-grid { display: flex; flex-wrap: wrap; gap: 18px 14px; align-items: stretch; }
.tool-wrap { width: 158px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tool-wrap.sortable-ghost { opacity: .35; }
.tool-wrap.sortable-chosen { transform: scale(1.04); }
.tool-wrap.size-large { width: 330px; }
.tool-wrap.size-large .tool-card { width: 100%; }
.tool-name { font-size: .82rem; color: var(--theme-text-secondary, #4b5563); user-select: none; }

.tool-card { position: relative; width: 158px; height: 122px; border-radius: 14px; padding: 10px 12px; overflow: hidden; box-shadow: 0 4px 14px -6px rgba(0,0,0,.18); cursor: grab; user-select: none; touch-action: pan-y; }
.tool-card:active { cursor: grabbing; }
.tool-card[data-open] { cursor: pointer; }

.tool-gear { position: absolute; top: 6px; right: 6px; border: none; background: rgba(0,0,0,.06); color: #6b7280; width: 22px; height: 22px; line-height: 1; border-radius: 50%; font-size: .72rem; display: none; align-items: center; justify-content: center; padding: 0; z-index: 2; }
.tool-gear-light { background: rgba(255,255,255,.25); color: #fff; }
.tool-wrap:hover .tool-gear { display: inline-flex; }

.tc-calendar { background: #fff; color: #1f2937; padding: 0; }
.cal-head { background: #e4393c; color: #fff; font-size: .78rem; font-weight: 600; text-align: center; padding: 6px 0; border-radius: 14px 14px 0 0; }
.cal-day { font-size: 2.6rem; font-weight: 800; line-height: 1.1; text-align: center; margin-top: 2px; }
.cal-meta { font-size: .66rem; color: #9ca3af; text-align: center; }
.cal-lunar { font-size: .74rem; color: #374151; text-align: center; }

.tc-holiday { background: linear-gradient(150deg, #0f9d8f, #12b5a2); color: #fff; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.holiday-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; }
.holiday-name { font-weight: 700; min-width: 44px; }
.holiday-date { font-size: .64rem; opacity: .8; }
.holiday-days { margin-left: auto; background: rgba(255,255,255,.22); border-radius: 8px; padding: 1px 7px; font-size: .7rem; font-weight: 700; }
.holiday-loading { font-size: .78rem; opacity: .8; text-align: center; }

.tc-eat { background: #fff7ed; color: #374151; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.eat-title { font-size: .92rem; font-weight: 800; color: #c2410c; }
.eat-result { min-height: 1.2em; font-size: .82rem; font-weight: 700; color: #ea580c; }
.eat-result.done { font-size: .92rem; }
.eat-roll { border: none; background: linear-gradient(135deg, #f97316, #fb923c); color: #fff; font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 5px 16px; box-shadow: 0 3px 8px -3px rgba(249,115,22,.6); }
.eat-roll:disabled { opacity: .6; }

.tc-memory { background: linear-gradient(150deg, #fbbf24, #fcd34d); color: #78350f; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.mem-label { font-size: .74rem; opacity: .85; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-days { font-size: 1.7rem; font-weight: 800; color: #92400e; }
.mem-date { font-size: .72rem; opacity: .8; }

.tc-offwork { background: #fff; color: #1f2937; }
.off-label { font-size: .72rem; color: #6b7280; }
.off-time { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.off-slack { font-size: .7rem; color: #6b7280; }
.off-slack span { color: #e4393c; font-weight: 700; }
.off-week { font-size: .68rem; color: #9ca3af; }
.off-cat { position: absolute; right: 6px; bottom: 4px; font-size: 1.5rem; opacity: .9; pointer-events: none; }

.tc-countdown { background: linear-gradient(150deg, #7c3aed, #a78bfa); color: #fff; display: flex; flex-direction: column; justify-content: center; }
.cd-title { font-size: .7rem; opacity: .85; }
.cd-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.cd-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: rgba(255,255,255,.2); border-radius: 7px; padding: 3px 7px; font-size: .72rem; }
.cd-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cd-empty { font-size: .7rem; opacity: .85; }

.tc-pet { background: linear-gradient(150deg, #f472b6, #fbcfe8); color: #831843; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.pet-bubble { position: absolute; top: 4px; left: 7px; background: #fff; color: #be123c; font-size: .6rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; box-shadow: 0 2px 6px -2px rgba(0,0,0,.3); }
.pet-stage { font-size: 1.8rem; line-height: 1.25; }
.pet-stage.bounce { animation: wbwPetBounce 1.8s ease-in-out infinite; }
.pet-name { font-size: .8rem; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-status { font-size: .65rem; opacity: .85; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-stat { font-size: .6rem; opacity: .75; }
.pet-online { font-size: .58rem; opacity: .8; font-variant-numeric: tabular-nums; }
@keyframes wbwPetBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.wbw-modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 3000; display: none; align-items: center; justify-content: center; padding: 16px; }
.wbw-modal-mask.show { display: flex; }
.wbw-modal { background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #1f2937); border-radius: 14px; width: 100%; max-width: 460px; max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px -12px rgba(0,0,0,.4); }
.wbw-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--bs-border-color, #e5e7eb); font-weight: 700; }
.wbw-modal-close { border: none; background: transparent; color: inherit; font-size: .9rem; padding: 2px 6px; }
.wbw-modal-body { padding: 14px 16px; overflow-y: auto; font-size: .88rem; }
.wbw-field { margin-bottom: 12px; }
.wbw-field label { display: block; font-size: .78rem; color: var(--theme-text-secondary, #6b7280); margin-bottom: 4px; }
.wbw-field input, .wbw-field select { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--bs-border-color, #d1d5db); background: var(--bs-body-bg, #fff); color: inherit; font-size: .85rem; }
.wbw-btn { border: none; border-radius: 8px; padding: 7px 16px; font-size: .85rem; font-weight: 600; background: var(--theme-nav-primary, #1e73be); color: #fff; white-space: nowrap; }
.wbw-btn.ghost { background: var(--bs-secondary-bg, #f3f4f6); color: var(--bs-body-color, #1f2937); }
.wbw-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.wbw-cat-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.wbw-cat-tab { border: 1px solid var(--bs-border-color, #d1d5db); background: transparent; color: inherit; border-radius: 999px; padding: 3px 12px; font-size: .78rem; }
.wbw-cat-tab.active { background: var(--theme-nav-primary, #1e73be); border-color: var(--theme-nav-primary, #1e73be); color: #fff; }
.wbw-item-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; margin-bottom: 12px; }
.wbw-item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; background: var(--bs-tertiary-bg, #f9fafb); font-size: .84rem; }
.wbw-item span:first-child { flex: 1; }
.wbw-item .wbw-cat-tag { font-size: .68rem; color: var(--theme-text-weak, #9ca3af); }
.wbw-item-del { border: none; background: transparent; color: #e4393c; font-size: .8rem; padding: 0 2px; }
.wbw-add-row { display: flex; align-items: center; gap: 8px; }
.wbw-field .wbw-add-row select { flex: 0 0 96px; width: 96px; padding: 7px 6px; }
.wbw-field .wbw-add-row input { flex: 1; width: auto; min-width: 0; }
.wbw-field .wbw-add-row .wbw-btn { flex: 0 0 auto; padding: 7px 14px; }
.wbw-empty { font-size: .8rem; color: var(--theme-text-weak, #9ca3af); text-align: center; padding: 12px 0; }

.wbw-cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.wbw-cal-title { font-weight: 700; }
.wbw-cal-nav { border: 1px solid var(--bs-border-color, #d1d5db); background: var(--bs-body-bg, #fff); color: inherit; border-radius: 8px; padding: 4px 12px; font-size: .8rem; }
.wbw-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wbw-cal-week { text-align: center; font-size: .72rem; color: var(--theme-text-weak, #9ca3af); padding: 2px 0; }
.wbw-cal-cell { min-height: 38px; border: 1px solid transparent; background: var(--bs-tertiary-bg, #f9fafb); color: inherit; border-radius: 8px; font-size: .8rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; }
.wbw-cal-cell.empty { background: transparent; }
.wbw-cal-cell.today { border-color: var(--theme-nav-primary, #1e73be); }
.wbw-cal-cell.selected { background: var(--theme-nav-primary, #1e73be); color: #fff; }
.wbw-cal-fest { font-size: .56rem; color: #e4393c; line-height: 1; }
.wbw-cal-cell.selected .wbw-cal-fest { color: #fff; }
.wbw-cal-detail { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bs-tertiary-bg, #f9fafb); font-size: .84rem; line-height: 1.8; }
.wbw-cal-detail strong { color: var(--theme-nav-primary, #1e73be); }

.wbw-holiday-more { max-height: 320px; overflow-y: auto; }
.wbw-holiday-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--bs-border-color, #e5e7eb); font-size: .84rem; }
.wbw-holiday-row:last-child { border-bottom: none; }
.wbw-holiday-row span:last-child { font-weight: 700; color: var(--theme-nav-primary, #1e73be); white-space: nowrap; }

.wbw-cd-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.wbw-cd-item { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; background: var(--bs-tertiary-bg, #f9fafb); }
.wbw-drag { cursor: grab; color: var(--theme-text-weak, #9ca3af); user-select: none; padding: 0 2px; }
.wbw-cd-item .wbw-grow { flex: 1; min-width: 0; }
.wbw-cd-item .wbw-grow input { width: 100%; margin-bottom: 4px; }
.wbw-cd-item .wbw-grow small { display: block; font-size: .7rem; color: var(--theme-text-weak, #9ca3af); }
.wbw-mini { border: 1px solid var(--bs-border-color, #d1d5db); background: var(--bs-body-bg, #fff); color: inherit; border-radius: 6px; padding: 3px 7px; font-size: .72rem; white-space: nowrap; }
.wbw-mini.danger { color: #e4393c; }
.wbw-cd-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.wbw-cd-form .wbw-field { flex: 1; min-width: 120px; margin-bottom: 0; }

.pet-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: var(--bs-tertiary-bg, #f9fafb); margin-bottom: 8px; }
.pet-face { font-size: 1.4rem; }
.pet-info { flex: 1; min-width: 0; }
.pet-info b { display: block; font-size: .86rem; }
.pet-info small { display: block; font-size: .72rem; color: var(--theme-text-weak, #9ca3af); }
.pet-ops { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.pet-rename-input { width: 100%; margin-bottom: 6px; }
.wbw-store { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.wbw-store button { border: 1px solid var(--bs-border-color, #d1d5db); background: var(--bs-body-bg, #fff); color: inherit; border-radius: 10px; padding: 10px 8px; font-size: .8rem; font-weight: 600; }
.wbw-pet-stats { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; border-radius: 10px; background: var(--bs-tertiary-bg, #f9fafb); font-size: .8rem; }
.pet-progress { padding: 9px 10px; margin-bottom: 10px; border-radius: 10px; background: var(--bs-tertiary-bg, #f9fafb); }
.pet-progress-head { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; margin-bottom: 6px; }
.pet-progress-head span:last-child { color: var(--theme-text-weak, #9ca3af); font-variant-numeric: tabular-nums; }
.pet-progress-track { height: 7px; border-radius: 999px; background: var(--bs-secondary-bg, #e5e7eb); overflow: hidden; }
.pet-progress-fill { height: 100%; background: var(--theme-nav-primary, #1e73be); border-radius: 999px; }
.pet-progress-marks { margin-top: 5px; font-size: .66rem; color: var(--theme-text-weak, #9ca3af); }
.pet-tasks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pet-task { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--bs-tertiary-bg, #f9fafb); font-size: .78rem; }
.pet-task span:last-child { color: var(--theme-nav-primary, #1e73be); font-weight: 600; }
.pet-task.done { opacity: .55; text-decoration: line-through; }

@media (max-width: 575.98px) {
    .tools-grid { gap: 14px 10px; }
    .tool-wrap { width: calc(33.333% - 8px); }
    .tool-wrap.size-large { width: calc(66.666% - 3.34px); }
    .tool-card { width: 100%; }
    .wbw-store { grid-template-columns: 1fr; }
    .wbw-cd-form .wbw-field { min-width: 100%; }
}
