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

/* 变量定义 */
:root {
    --bg-primary: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F2F2F7;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-color: #E5E5EA;
    --accent-blue: #007AFF;
    --accent-green: #34C759;
    --accent-red: #FF3B30;
    --shadow-light: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.08);
    --shadow-elevated: 0 8px 28px rgba(0, 0, 0, 0.12);
    --border-radius: 16px;
    --border-radius-small: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

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

header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* 代码区域容器 */
.code-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 卡片样式 */
.card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 32px;
    margin-bottom: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 28px;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: -0.022em;
    line-height: 1.3;
}

/* 统计行样式 */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 36px;
    padding: 0;
}

.stat-item {
    text-align: center;
    flex: 1;
    max-width: 180px;
    transition: var(--transition);
    padding: 20px 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(245, 245, 247, 0.6) 100%);
    border-radius: var(--border-radius-small);
    border: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.stat-item:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(245, 245, 247, 0.8) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: -0.012em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
    transition: var(--transition);
    background: linear-gradient(135deg, #1D1D1F 0%, #86868B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 添加统计数据变化动画 */
.stat-value.updating {
    animation: gentlePulse 0.6s ease-in-out;
    transform: scale(1.05);
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0056CC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 按钮样式 */
.btn {
    position: relative;
    padding: 16px 40px;
    border: none;
    border-radius: 32px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    min-width: 200px;
    display: block;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0056CC 100%);
    color: white;
    min-height: 52px;
    line-height: 1.5;
    letter-spacing: -0.022em;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.1);
}

.btn:hover {
    background: linear-gradient(135deg, #0056CC 0%, #003A99 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.18);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.12);
}

.btn:focus {
    outline: 3px solid rgba(0, 122, 255, 0.3);
    outline-offset: 4px;
}

.btn:disabled {
    background: linear-gradient(135deg, #C7C7CC 0%, #AEAEB2 100%);
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: not-allowed;
    opacity: 0.8;
}

/* 提取按钮特定样式 */
.extract-btn {
    font-size: 19px;
    padding: 18px 48px;
    min-height: 56px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0056CC 100%);
}

.extract-btn:hover {
    background: linear-gradient(135deg, #0056CC 0%, #003A99 100%);
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.18);
}

.extract-btn:active {
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.15);
}

/* 状态消息 */
.status-message {
    margin-top: 16px;
    font-size: 14px;
    min-height: 40px;
    text-align: center;
    padding: 8px 0;
    line-height: 1.5;
}

.status-message.success {
    color: #34C759;
}

.status-message.error {
    color: var(--accent-red);
}

/* 代码显示样式 */
.code-display {
    padding: 16px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    margin-top: 16px;
}

.code-display .label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 8px;
}

.code-value {
    font-family: 'SF Mono', Menlo, monospace;
    font-weight: 600;
    color: var(--accent-blue);
    word-break: break-all;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 24px;
        max-width: 100%;
    }
    
    .card {
        padding: 28px 24px;
        margin-bottom: 24px;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-light);
    }
    
    .card h2 {
        font-size: 22px;
        margin-bottom: 28px;
        letter-spacing: -0.022em;
    }
    
    .stats-row {
        gap: 20px;
        margin-bottom: 32px;
        padding: 0;
    }
    
    .stat-item {
        padding: 16px 12px;
        max-width: none;
    }
    
    .stat-label {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .btn {
        width: 100%;
        max-width: 360px;
        padding: 18px 32px;
        font-size: 18px;
        min-height: 56px;
    }
    
    .extract-btn {
        font-size: 18px;
        padding: 18px 40px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .code-sections {
        gap: 16px;
    }
    
    .card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .card h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .stats-row {
        flex-direction: row;
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .stat-item {
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 16px 12px;
        background-color: var(--bg-primary);
        border-radius: 10px;
        max-width: none;
        flex: 1;
    }
    
    .stat-label {
        font-size: 13px;
        margin-bottom: 4px;
        color: var(--text-secondary);
    }
    
    .stat-value {
        font-size: 22px;
        font-weight: 600;
    }
    
    .btn {
        padding: 15px 24px;
        font-size: 17px;
        max-width: none;
    }
}

/* 针对平板横屏的优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .container {
        max-width: 900px;
        padding: 24px 32px;
    }
    
    .code-sections {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .card {
        padding: 20px;
    }
    
    .card h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

@keyframes gentlePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.02);
    }
}

.card {
    animation: fadeIn 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-value.updating {
    animation: gentlePulse 0.6s ease-in-out;
}

/* 状态消息动画 */
.status-message {
    animation: fadeInUp 0.4s ease-out;
}

.status-message.fading {
    animation: fadeOutDown 0.3s ease-in;
}

/* 按钮点击波纹效果 */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    opacity: 0;
    pointer-events: none;
    transform-origin: center;
}

.btn:active::after {
    width: 150px;
    height: 150px;
    opacity: 1;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.8) 100%);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    padding: 40px 32px;
    max-width: 90%;
    width: 520px;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-content {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 19px;
    font-weight: 600;
    color: var(--accent-green);
    text-align: center;
    padding: 28px 20px;
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.08) 0%, rgba(52, 199, 89, 0.03) 100%);
    border-radius: var(--border-radius-small);
    margin-bottom: 24px;
    word-break: break-all;
    line-height: 1.7;
    letter-spacing: -0.022em;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(52, 199, 89, 0.2);
    box-shadow: inset 0 1px 2px rgba(52, 199, 89, 0.08);
}

.modal-status {
    margin-bottom: 32px;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
    color: var(--text-secondary);
    padding: 0 24px;
    line-height: 1.6;
    letter-spacing: -0.012em;
}

.modal-status.success {
    color: var(--accent-green);
    font-weight: 500;
}

.modal-status.error {
    color: var(--accent-red);
    font-weight: 500;
}

.modal-close-btn {
    width: 100%;
    max-width: none;
    padding: 18px 32px;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.022em;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0056CC 100%);
}

/* 响应式弹窗设计 */
@media (max-width: 768px) {
    .modal-container {
        padding: 28px 24px;
        margin: 0 20px;
        border-radius: 18px;
    }
    
    .modal-content {
        font-size: 17px;
        padding: 20px 16px;
        min-height: 70px;
    }
    
    .modal-close-btn {
        padding: 16px 24px;
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        padding: 24px 20px;
        margin: 0 16px;
        border-radius: 16px;
    }
    
    .modal-content {
        font-size: 16px;
        padding: 18px 12px;
        min-height: 60px;
        line-height: 1.5;
    }
    
    .modal-status {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .modal-close-btn {
        padding: 15px 20px;
        font-size: 16px;
    }
}