body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* 固定导航与吸顶内容之间的留白也需要遮住下方滚动的卡片。 */
body::before {
    position: fixed;
    top: 64px;
    right: 0;
    left: 0;
    height: 24px;
    z-index: 50;
    background: #f2f3f4;
    content: '';
    pointer-events: none;
}
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 30px;
    padding: 24px 0 60px;
    align-items: start;
    width: min(1200px, calc(100% - 32px));
}
.main-content.is-searching { grid-template-columns: minmax(0, 1fr); }
.template-sidebar {
    position: sticky;
    top: 88px;
    padding: 16px 10px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    z-index: 3;
}
.template-sidebar::-webkit-scrollbar {
    width: 0;
}
.template-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.template-sidebar::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: #d0d0d0;
}
.template-sidebar:hover::-webkit-scrollbar {
    width: 4px;
}
.template-sidebar button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #666;
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.template-sidebar button:hover { color: #266fff; }
.template-sidebar button.active { color: #266fff; background: #edf4ff; }
.template-menu-caption { padding: 12px 10px 5px; color: #999; font-size: 12px; }
.template-menu-icon {
    display: inline-block;
    flex: 0 0 18px;
    height: 18px;
    margin-right: 6px;
    background-color: currentColor;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
}
.template-main { min-width: 0; }
.template-section { margin-bottom: 52px; scroll-margin-top: 164px; }
.template-empty-category { margin: 0; padding: 24px 0; color: #aaa; font-size: 13px; }

/* 顶部工具栏 */
.toolbar {
    position: sticky;
    top: 88px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 12px 0;
    background: #f2f3f4;
}
.toolbar-title {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-box {
    width: 260px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    background: #fff;
}
.search-box input {
    border: none;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #999;
    outline: none;
}
.search-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: #999;
    margin-left: 6px;
}
/* 分类标题 */
.section-title {
    font-size: 18px;
    color: #333;
    font-weight: bold;
    margin-bottom: 20px;
}

/* 卡片网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 26px 20px;
}

/* 模板卡片 */
.template-card {
    min-width: 0;
    background: transparent;
    transition: .2s;
}
.template-card:hover {
    transform: translateY(-5px);
}
.template-card-name { padding-top: 8px; color: #222; font-size: 14px; font-weight: 600; text-align: center; }

/* 手机外壳 */
.phone-mockup {
    width: 100%;
    aspect-ratio: 400 / 660;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.phone-status-right {
    display: flex;
    align-items: center;
    gap: 3px;
}
.phone-status-icon {
    width: 12px;
    height: 8px;
    background: #333;
    border-radius: 1px;
}
.phone-status-battery {
    width: 14px;
    height: 7px;
    border: 1px solid #333;
    border-radius: 2px;
    position: relative;
}
.phone-status-battery::after {
    content: "";
    position: absolute;
    right: -2px;
    top: 1px;
    width: 1px;
    height: 3px;
    background: #333;
    border-radius: 0 1px 1px 0;
}
.phone-nav-bar {
    height: 40px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid #f0f0f0;
}
.phone-nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #333;
    font-size: 14px;
}
.phone-nav-title {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.phone-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-dot {
    width: 3px;
    height: 3px;
    background: #333;
    border-radius: 50%;
}

/* 小程序内容 */
.mini-content {
    background: #fff;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.mini-page-preview img { width: 100%; height: auto; display: block; }
.mini-page-preview--empty { display: flex; align-items: center; justify-content: center; height: 100%; background: #e9ebef; color: #8d949e; font-size: 13px; text-align: center; }
.mini-page-title { margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.mini-page-blocks { color: #888; font-size: 11px; line-height: 1.5; }
.template-card-hover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.32); opacity: 0; transition: opacity .2s; }
.template-card:hover .template-card-hover, .template-card:focus-within .template-card-hover { opacity: 1; }
.template-card-hover button { border: 0; border-radius: 18px; padding: 7px 20px; background: #266fff; color: #fff; font-size: 13px; cursor: pointer; }
.mini-form-title {
    text-align: center;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
}
.mini-form-field {
    margin-bottom: 8px;
}
.mini-field-label {
    font-size: 9px;
    color: #666;
    margin-bottom: 3px;
}
.mini-field-input {
    height: 18px;
    background: #f5f7fa;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    font-size: 8px;
    color: #bbb;
    padding: 0 4px;
    display: flex;
    align-items: center;
}
.mini-form-btn {
    margin-top: 10px;
    height: 22px;
    background: #266FFF;
    border-radius: 4px;
    color: #fff;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}
