/* 覆盖 header.php 的 main padding */
main { padding: 0 !important; }

.lib-page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lib-page-inner {
    max-width: var(--site-content-max-width, none);
    margin: 0 auto;
    padding: 1.5rem max(var(--site-gutter), env(safe-area-inset-left)) 2.5rem max(var(--site-gutter), env(safe-area-inset-right));
}

.lib-category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.lib-category-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: transparent;
    color: #6b7280;
    font-size: var(--site-meta-font-size, 12px);
    line-height: var(--site-meta-line-height, 1.5);
    font-weight: 500;
    cursor: pointer;
}
.dark .lib-category-pill {
    border-color: #333;
    color: #9ca3af;
}
.lib-category-pill.active {
    background: #111;
    border-color: #111;
    color: #fff;
}
.dark .lib-category-pill.active {
    background: #f5f5f5;
    border-color: #f5f5f5;
    color: #111;
}

.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.lib-card.lib-card-create {
    border: none;
}

.lib-card-create-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
}
.dark .lib-card-create-cover {
    background: #111;
    border-color: #333;
}
.lib-card-create-plus {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    color: #6b7280;
}
.dark .lib-card-create-plus {
    color: #9ca3af;
}
.lib-card-menu--placeholder {
    visibility: hidden;
    pointer-events: none;
}

.lib-card.lib-card-goal {
    background: #fff;
}
.dark .lib-card.lib-card-goal {
    background: #0a0a0a;
}
.lib-card-goal .lib-card-footer {
    background: #fff;
}
.dark .lib-card-goal .lib-card-footer {
    background: #0a0a0a;
}
.lib-goal-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.lib-card-goal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    justify-content: center;
    align-items: stretch;
    padding: 0.25rem 0.75rem 0.5rem;
}
.lib-card-goal-body.is-static {
    cursor: default;
}
.lib-goal-label {
    margin: 0 0 0.375rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.02em;
}
.dark .lib-goal-label { color: #9ca3af; }
.lib-goal-arc-wrap {
    position: relative;
    width: 100%;
    max-width: 12rem;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    --lib-goal-ring-color: #0071e3;
    --lib-goal-ring-track: rgba(0, 113, 227, 0.12);
}
.dark .lib-goal-arc-wrap {
    --lib-goal-ring-track: rgba(0, 113, 227, 0.18);
}
.lib-goal-arc {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.lib-goal-arc-track {
    fill: none;
    stroke: var(--lib-goal-ring-track);
    stroke-width: 20;
    stroke-linecap: round;
}
.lib-goal-arc-progress {
    fill: none;
    stroke: var(--lib-goal-ring-color);
    stroke-width: 20;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.35s ease;
}
.lib-goal-tip-dot {
    fill: var(--lib-goal-ring-color);
}
.lib-goal-tip-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
}
.lib-goal-tip-arrow i {
    font-size: 11px;
    line-height: 1;
}
.lib-goal-arc-wrap.is-no-progress .lib-goal-tip-arrow i {
    font-size: 12px;
}
.lib-goal-ring-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.125rem;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.lib-goal-ring-done {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #111827;
}
.dark .lib-goal-ring-done {
    color: #f5f5f7;
}
.lib-goal-ring-sep,
.lib-goal-ring-target {
    font-size: 0.875rem;
    font-weight: 500;
    color: #9ca3af;
}
.lib-goal-arc-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 56%;
    text-align: center;
    pointer-events: none;
}
.lib-goal-arc-kicker {
    margin: 0 0 0.45rem;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.15;
    color: #1d1d1f;
    letter-spacing: -0.01em;
    font-family: "New York", Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
}
.dark .lib-goal-arc-kicker { color: #f5f5f7; }
.lib-goal-arc-value {
    margin: 0 0 0.35rem;
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    color: #1d1d1f;
    font-variant-numeric: tabular-nums;
    font-family: "New York", Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
    letter-spacing: -0.03em;
}
.dark .lib-goal-arc-value { color: #f5f5f7; }
.lib-goal-arc-sub {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0.8125rem;
    line-height: 1.3;
    font-weight: 400;
    color: #636366;
    font-variant-numeric: tabular-nums;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.15s ease;
}
.lib-goal-arc-sub:hover {
    color: #1d1d1f;
}
.dark .lib-goal-arc-sub { color: #98989d; }
.dark .lib-goal-arc-sub:hover {
    color: #f5f5f7;
}
.lib-goal-arc-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.15rem;
    font-size: 0.875rem;
    line-height: 1;
    color: #aeaeb2;
    font-weight: 400;
}
.lib-goal-arc-chevron i {
    font-size: 0.875rem;
    line-height: 1;
}
.dark .lib-goal-arc-chevron { color: #636366; }
.lib-goal-settings-panel {
    width: 100%;
    margin-top: 0.625rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.04);
}
.dark .lib-goal-settings-panel {
    background: rgba(255, 255, 255, 0.06);
}
.lib-goal-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.lib-goal-settings-hint {
    margin: 0 0 0.625rem;
    font-size: 0.6875rem;
    line-height: 1.4;
    color: #9ca3af;
}

.dark .lib-goal-settings-hint {
    color: #71717a;
}
.lib-goal-settings-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
}
.dark .lib-goal-settings-label {
    color: #e5e7eb;
}
.lib-goal-settings-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}
.dark .lib-goal-settings-value {
    color: #f3f4f6;
}
.lib-goal-settings-slider {
    width: 100%;
}

/* Layui 风格进度条（不依赖 layui） */
.vk-progress {
    position: relative;
    height: 6px;
    margin-bottom: 1.125rem;
    border-radius: 20px;
    background-color: #eee;
}
.vk-progress-ticks {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 6px;
    pointer-events: none;
    z-index: 2;
}
.vk-progress-tick {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}
.vk-progress-tick.is-end {
    transform: translateX(-100%);
}
.vk-progress-tick-mark {
    display: block;
    width: 1px;
    height: 10px;
    margin-top: -2px;
    background: rgba(0, 0, 0, 0.16);
}
.vk-progress-tick-label {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5625rem;
    font-style: normal;
    font-weight: 500;
    line-height: 1;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.vk-progress-tick.is-end .vk-progress-tick-label {
    left: auto;
    right: 0;
    transform: none;
}
.vk-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--vk-progress, 0%);
    max-width: 100%;
    height: 100%;
    border-radius: 20px;
    background-color: var(--vk-progress-fill, #16b777);
    transition: width 0.3s ease;
    pointer-events: none;
}
.vk-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    margin-right: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--vk-progress-fill, #16b777);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.vk-progress-range,
.vk-progress .goal-slider {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    z-index: 1;
}
.vk-progress-range::-webkit-slider-runnable-track,
.vk-progress .goal-slider::-webkit-slider-runnable-track {
    height: 24px;
    background: transparent;
    border: none;
}
.vk-progress-range::-webkit-slider-thumb,
.vk-progress .goal-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.vk-progress-range::-moz-range-track,
.vk-progress .goal-slider::-moz-range-track {
    height: 24px;
    background: transparent;
    border: none;
}
.vk-progress-range::-moz-range-thumb,
.vk-progress .goal-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.goal-progress {
    --vk-progress-fill: #0071e3;
    margin-top: 0.375rem;
    margin-bottom: 1.25rem;
}
.dark .vk-progress {
    background-color: rgba(255, 255, 255, 0.12);
}
.dark .vk-progress-tick-mark {
    background: rgba(255, 255, 255, 0.22);
}
.dark .vk-progress-tick-label {
    color: #71717a;
}
.dark .vk-progress-bar::after {
    background: #1f1f23;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.lib-goal-meta {
    margin: 0.625rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #6b7280;
}
.dark .lib-goal-meta { color: #9ca3af; }
.lib-goal-stats {
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: var(--site-meta-font-size, 12px);
    line-height: 1.4;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}
.lib-goal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.875rem 0.875rem 0;
    flex-shrink: 0;
}
.lib-goal-head .lib-goal-label {
    margin: 0;
    text-align: left;
}
.lib-goal-library-name {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}
.dark .lib-goal-library-name {
    color: #f3f4f6;
}
.lib-goal-library-name.is-empty {
    font-weight: 500;
    color: #9ca3af;
}
.dark .lib-goal-library-name.is-empty {
    color: #71717a;
}
.lib-card-footer--goal {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 0.375rem;
}
.lib-goal-select-wrap {
    position: relative;
    display: inline-flex;
    max-width: 100%;
}
.lib-goal-select-wrap::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 1.5px solid #9ca3af;
    border-bottom: 1.5px solid #9ca3af;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
.lib-goal-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.4375rem 2rem 0.4375rem 0.875rem;
    border: none;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.06);
    color: #111;
    font-size: var(--site-meta-font-size, 12px);
    line-height: var(--site-meta-line-height, 1.5);
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    text-overflow: ellipsis;
}
.lib-goal-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 103, 30, 0.35);
}
.dark .lib-goal-select-wrap::after {
    border-color: #9ca3af;
}
.dark .lib-goal-select {
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f5;
}

.lib-card {
    display: flex;
    flex-direction: column;
    aspect-ratio: 9 / 16;
    border: none;
    border-radius: 0;
    background: #fff;
    overflow: hidden;
}
.dark .lib-card {
    background: #0a0a0a;
}

.lib-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    justify-content: flex-start;
    padding: 0;
    text-decoration: none;
    color: inherit;
}
.lib-card-link.has-cover {
    padding: 0;
    justify-content: flex-start;
}
.lib-card-cover {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.lib-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lib-card-link:not(.has-cover):not(.is-user-lib) {
    justify-content: center;
    padding: 1.125rem 1.25rem;
}

.lib-card-user .lib-card-link {
    justify-content: center;
    align-items: center;
    padding: 1.125rem 1.25rem;
    background: #f3f4f6;
}
.dark .lib-card-user .lib-card-link {
    background: #1f1f1f;
}
.lib-card-user .lib-card-title {
    color: #f9671e;
}

.lib-card-title {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    margin: 0;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dark .lib-card-title { color: #f5f5f5; }

.lib-card-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.5rem 0.625rem;
    background: #fff;
}
.dark .lib-card-footer {
    background: #0a0a0a;
}
.lib-card-pct {
    font-size: var(--site-meta-font-size, 12px);
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #374151;
}
.dark .lib-card-pct { color: #d1d5db; }

.lib-card-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
}
.lib-card-menu i {
    font-size: 1.125rem;
    line-height: 1;
}
.dark .lib-card-menu { color: #9ca3af; }

.lib-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: #9ca3af;
    font-size: 0.9375rem;
}

@media (min-width: 768px) {
    .lib-page-inner { padding-top: 2rem; padding-bottom: 3rem; }
    .lib-grid { gap: 1.5rem; }
    .lib-card-title { font-size: 1.125rem; }
}
