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

:root {
    --primary-color: #fe2c55;
    --primary-dark: #e62548;
    --secondary-color: #24d3d3;
    --bg-color: #0f1419;
    --card-bg: #1a1f2e;
    --card-bg-hover: #252b3d;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: #2d3748;
    --input-bg: #0f1419;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 输入区域 */
.input-section {
    margin-bottom: 40px;
}

.input-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.input-card label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#video-url {
    width: 100%;
    padding: 16px 48px 16px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

#video-url:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
}

#video-url::placeholder {
    color: #4a5568;
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.input-tip {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #4a5568;
}

/* 详细程度选择器 */
.level-selector {
    margin-bottom: 24px;
}

.selector-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.level-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.level-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.level-btn:hover {
    background: var(--card-bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.level-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(254, 44, 85, 0.1) 0%, rgba(36, 211, 211, 0.05) 100%);
}

.level-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.level-name {
    font-size: 1rem;
    font-weight: 600;
}

.level-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(254, 44, 85, 0.4);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 结果区域 */
.result-section {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.result-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-level {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.result-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--card-bg-hover);
    border-color: var(--primary-color);
}

.result-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    min-height: 200px;
}

/* Markdown 样式 */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.markdown-body h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.markdown-body h2 {
    font-size: 1.4rem;
    border-left: 4px solid var(--secondary-color);
    padding-left: 12px;
}

.markdown-body h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 8px;
}

.markdown-body li::marker {
    color: var(--primary-color);
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body code {
    background: rgba(254, 44, 85, 0.1);
    color: var(--secondary-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-body pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
}

.markdown-body strong {
    color: var(--primary-color);
    font-weight: 600;
}

.markdown-body a {
    color: var(--secondary-color);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-color);
    font-weight: 600;
}

.markdown-body hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

/* 示例说明 */
.examples-section {
    margin-top: 60px;
}

.examples-section h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.example-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.example-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.example-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.example-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 12px;
}

.example-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 页脚 */
.footer {
    margin-top: 60px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

/* AdSense 广告容器 */
.ad-container {
    margin: 32px 0;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-container ins {
    display: block !important;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 14px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .level-buttons {
        grid-template-columns: 1fr;
    }

    .example-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-content {
        padding: 20px;
    }

    .markdown-body h1 {
        font-size: 1.4rem;
    }

    .markdown-body h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .example-cards {
        grid-template-columns: 1fr;
    }

    .result-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
