* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 顶部导航 ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-desc {
    font-size: 13px;
    color: #999;
}

.breadcrumb {
    font-size: 13px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb a {
    color: #2563eb;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========== 首页 ========== */
.home-page .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 20px;
    flex: 1;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.tool-card-placeholder {
    cursor: default;
    opacity: 0.5;
}

.tool-card-placeholder:hover {
    transform: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.tool-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a1a2e;
}

.tool-info p {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.tool-arrow {
    font-size: 18px;
    color: #ccc;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.tool-card:hover .tool-arrow {
    transform: translateX(4px);
    color: #2563eb;
}

/* ========== 工具页 ========== */
.tool-page .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 20px;
}

h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 8px;
    color: #1a1a2e;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 32px;
    font-size: 14px;
}

.main-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
}

/* 配置面板 */
.config-panel {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.form-group label span {
    color: #2563eb;
    font-weight: 400;
}

input[type="text"],
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

input[type="text"]:focus,
select:focus {
    border-color: #2563eb;
}

input[type="range"] {
    width: 100%;
    accent-color: #2563eb;
}

.color-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

.color-input input[type="text"] {
    flex: 1;
}

.radio-group,
.checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 400 !important;
    cursor: pointer;
    font-size: 13px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    width: 100%;
    padding: 10px;
    background: #fff;
    color: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #f0f5ff;
}

/* 预览面板 */
.preview-panel {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.preview-panel h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #444;
}

.preview-area {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    padding: 20px;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
    border-radius: 8px;
}

#previewCanvas {
    max-width: 256px;
    max-height: 256px;
    border-radius: 4px;
}

.size-previews {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.size-item canvas {
    border: 1px solid #e5e7eb;
    image-rendering: pixelated;
}

.size-item span {
    font-size: 11px;
    color: #888;
}

.download-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========== 模式切换 ========== */
.mode-tabs {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.mode-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: #f8f9fa;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab:first-child {
    border-right: 1px solid #ddd;
}

.mode-tab.active {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: #fff;
}

.mode-tab:hover:not(.active) {
    background: #eef2ff;
}

/* ========== 图片上传 ========== */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.upload-area:hover {
    border-color: #2563eb;
    background: #f8faff;
}

.upload-area.dragover {
    border-color: #2563eb;
    background: #eef2ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-placeholder p {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.upload-placeholder span {
    font-size: 12px;
    color: #999;
}

#uploadPreview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

/* ========== 裁剪区域 ========== */
.crop-container {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-container canvas {
    display: block;
    cursor: move;
}

.crop-hint {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 4px;
}

/* ========== 页脚 ========== */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    color: #aaa;
    font-size: 12px;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}
