/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", Arial, sans-serif;
    color: var(--text);
    background: #f9fafb;
    line-height: 1.7;
    font-size: 15px;
}

/* ========== 顶部工具栏 ========== */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.toolbar-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.tool-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #f3f4f6;
}

.tool-btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tool-btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
}

.tool-btn[hidden] {
    display: none;
}

/* ========== 简历主容器 ========== */
.resume {
    max-width: 760px;
    margin: 24px auto 40px;
    background: #fff;
    padding: 48px 56px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* ========== 头部 ========== */
.header {
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 32px;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 1px;
}

.title {
    color: var(--primary);
    font-size: 16px;
    margin: 6px 0 16px;
}

.contact {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.contact li {
    display: inline-block;
}

/* ========== 各区块 ========== */
section {
    margin-bottom: 32px;
}

h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: 10px;
    margin-bottom: 14px;
}

section p {
    color: var(--text);
    margin-bottom: 8px;
}

/* ========== 经历/项目条目 ========== */
.item {
    margin-bottom: 18px;
    padding-left: 2px;
}

.item:last-child {
    margin-bottom: 0;
}

.item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.item-head strong {
    font-size: 15px;
    font-weight: 600;
}

.item-head span {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

.item ul {
    list-style: none;
    padding-left: 0;
}

.item ul li {
    position: relative;
    padding-left: 14px;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 4px;
}

.item ul li::before {
    content: '·';
    position: absolute;
    left: 4px;
    color: var(--primary);
    font-weight: bold;
}

.tags {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 4px;
}

/* ========== 技能 ========== */
.skills {
    list-style: none;
}

.skills li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}

.skills li:last-child {
    border-bottom: none;
}

.skills li span:last-child {
    color: var(--primary);
    font-weight: 600;
}

/* ========== 编辑模式提示 ========== */
body.editing .resume {
    outline: 2px dashed var(--primary);
    outline-offset: 6px;
}

body.editing [contenteditable="true"]:hover {
    background: #eff6ff;
    outline: 1px dashed var(--primary);
    cursor: text;
}

body.editing [contenteditable="true"]:focus {
    background: #eff6ff;
    outline: 1px solid var(--primary);
}

.edit-banner {
    display: none;
    max-width: 760px;
    margin: 16px auto 0;
    padding: 8px 16px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

body.editing .edit-banner {
    display: block;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .resume {
        margin: 0 0 24px;
        padding: 32px 24px;
        border-radius: 0;
    }

    .header h1 {
        font-size: 26px;
    }

    .contact {
        flex-direction: column;
        gap: 6px;
    }

    .item-head {
        flex-direction: column;
        gap: 2px;
    }

    .toolbar-inner {
        padding: 10px 16px;
    }

    .tool-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ========== 打印优化 ========== */
@media print {
    body {
        background: #fff;
    }

    .toolbar,
    .edit-banner {
        display: none !important;
    }

    .resume {
        box-shadow: none;
        margin: 0;
        max-width: 100%;
        padding: 0;
        outline: none !important;
    }

    [contenteditable] {
        background: none !important;
        outline: none !important;
    }
}
