/* 主题编辑页 */
.theme-page-root {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #f0f2f5;
}

.theme-page-root.active {
    display: flex;
}

.theme-page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    flex-shrink: 0;
}

.theme-page-header .back-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.theme-page-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.theme-page-header-spacer {
    position: absolute;
    right: 16px;
    width: 36px;
    height: 1px;
}

.theme-page-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 12px 100px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.theme-page-body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.theme-section-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.theme-section-head {
    margin-bottom: 12px;
}

.theme-section-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.theme-section-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

.theme-section-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.theme-thumb-wrap {
    width: 88px;
    height: 88px;
    border-radius: 10px;
    border: 1px dashed #ccc;
    background: #fafafa;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-thumb-wrap.has-image {
    border-style: solid;
    border-color: #e0e0e0;
}

.theme-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.theme-thumb-placeholder {
    font-size: 12px;
    color: #aaa;
    padding: 8px;
    text-align: center;
}

.theme-section-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.theme-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
}

.theme-btn-secondary {
    background: #07c160;
    color: #fff;
}

.theme-btn-secondary:active {
    opacity: 0.9;
}

.theme-btn-ghost {
    background: #f5f5f5;
    color: #555;
}

.theme-icons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.theme-icon-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.theme-icon-preview {
    width: 100%;
    aspect-ratio: 1;
    max-width: 64px;
    padding: 0;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.theme-icon-label {
    font-size: 11px;
    color: #444;
}

.theme-mini-link {
    border: none;
    background: none;
    color: #576b95;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 0;
}

.theme-font-preview-block {
    border: 1px solid #e8edf2;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fa 100%);
    padding: 14px;
}

.theme-font-sample {
    color: #33404d;
    line-height: 1.65;
    font-size: 20px;
    word-break: break-word;
}

.theme-font-sample-title {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
}

.theme-font-sample-line + .theme-font-sample-line {
    margin-top: 6px;
}

.theme-font-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.theme-text-input {
    width: 100%;
    border: 1px solid #dbe3ea;
    border-radius: 10px;
    background: #fff;
    padding: 11px 12px;
    font-size: 13px;
    color: #2f3b47;
    outline: none;
    box-sizing: border-box;
}

.theme-text-input:focus {
    border-color: #8ea4b8;
    box-shadow: 0 0 0 3px rgba(142, 164, 184, 0.14);
}

.theme-font-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.theme-font-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-font-slider-label {
    flex-shrink: 0;
    font-size: 13px;
    color: #4a5968;
}

.theme-font-size-range {
    flex: 1;
    accent-color: #7f97ab;
}

.theme-font-size-value {
    min-width: 42px;
    text-align: right;
    font-size: 12px;
    color: #708395;
}

.theme-page-footer {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-footer-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    cursor: pointer;
}

.theme-footer-cancel {
    background: #f0f0f0;
    color: #333;
}

.theme-footer-save {
    background: #07c160;
    color: #fff;
}
