:root {
    --bg: #ffffff;
    --bg-secondary: #f9f9f9;
    --bg-tertiary: #f5f5f5;
    --text: #000000;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 导航 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    height: 64px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
}

.points { color: var(--text-secondary); }
.points strong { color: var(--text); font-weight: 600; }

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.nav-link:hover { opacity: 0.6; }

/* 主体 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.page-header {
    text-align: center;
    margin-bottom: 48px;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* 网格布局 */
.write-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

/* 卡片 */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

/* 模板标签 */
.template-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.tab-btn.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

/* 表单 */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

textarea, select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.6;
}

textarea:focus, select:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

select {
    height: 48px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* 按钮 */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 输出区 */
.output-card {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.output-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

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

.btn-icon {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-icon:hover {
    border-color: var(--text);
    color: var(--text);
}

.output-content {
    flex: 1;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    overflow-y: auto;
    max-height: 600px;
}

.output-content h2, .output-content h3 {
    margin: 20px 0 12px;
    font-weight: 600;
}

.output-content p { margin-bottom: 12px; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 打字机光标 */
.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    color: var(--text);
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid var(--border-light);
    color: var(--text-tertiary);
    font-size: 13px;
}

/* 响应式 */
@media (max-width: 968px) {
    .write-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 20px; }
    .main-container { padding: 32px 16px 60px; }
    .page-header h1 { font-size: 28px; }
}
