:root {
    --bg-dark: #1a1a1d;
    --bg-card: rgba(30, 30, 35, 0.85);
    --primary-cyan: #c5a065; /* Gold */
    --primary-purple: #8e9aaf; /* Muted Blue */
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --border-glow: 0 0 10px rgba(197, 160, 101, 0.3);
    --font-display: 'Bodoni Moda', serif;
    --font-body: 'Cormorant Garamond', serif;
}

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

html, body {
    overflow-x: hidden; /* 禁止横向滚动 */
    width: 100%;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(197, 160, 101, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(142, 154, 175, 0.1) 0%, transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
}

/* 背景网格动画 - 改为更柔和的纹理 */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100px 100px;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 50px;
    padding-top: 30px;
}

.logo h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 8vw, 64px); /* 响应式字体大小 */
    font-weight: 100; /* 更细的字体 */
    letter-spacing: 2px;
    margin: 10px 0;
    text-shadow: 0 0 20px rgba(197, 160, 101, 0.3);
}

.logo-icon {
    font-size: 40px;
}

.logo-svg {
    width: 50px;
    height: 50px;
    color: var(--primary-cyan);
    filter: drop-shadow(0 0 10px rgba(197, 160, 101, 0.4));
}

.magic-star {
    transform-box: fill-box;
    transform-origin: center;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.highlight {
    color: var(--primary-cyan);
}

.tagline {
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sub-tag {
    color: var(--primary-purple);
    font-weight: bold;
}

/* 玻璃拟态卡片 */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-cyan));
}

/* 标题样式 */
.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.card-header.sm {
    margin-top: 30px;
    margin-bottom: 15px;
}

.step-badge {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-cyan));
    color: #fff;
    font-weight: bold;
    font-family: var(--font-display);
    padding: 2px 10px;
    border-radius: 4px;
    margin-right: 15px;
    font-size: 14px;
}

h2, h3 {
    font-family: var(--font-display);
    font-weight: normal;
    letter-spacing: 1px;
    color: var(--text-main);
}

h2 { font-size: clamp(18px, 5vw, 24px); }
h3 { font-size: 18px; color: var(--text-muted); }

/* 上传区域 */
.upload-area {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    width: 100%;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-cyan);
    background: rgba(197, 160, 101, 0.05);
    box-shadow: inset 0 0 20px rgba(197, 160, 101, 0.05);
}

.icon-box {
    font-size: 48px;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.upload-area:hover .icon-box {
    transform: scale(1.1);
}

.upload-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--primary-cyan);
    opacity: 0;
    box-shadow: 0 0 10px var(--primary-cyan);
    pointer-events: none;
}

.upload-area:hover .scan-line {
    opacity: 0.6;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { top: 100%; opacity: 0; }
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    object-fit: contain;
}

.reupload-btn {
    margin-top: 15px;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.reupload-btn:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

/* 输入框样式 */
.textarea-wrapper {
    position: relative;
    padding: 2px;
}

textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 15px;
    font-family: var(--font-body);
    font-size: 16px;
    border-radius: 4px;
    resize: vertical;
    transition: all 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-cyan);
    background: rgba(197, 160, 101, 0.02);
    box-shadow: 0 0 15px rgba(197, 160, 101, 0.1);
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    margin-top: 40px;
    padding: 20px;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-cyan));
    border: none;
    border-radius: 8px;
    color: white;
    font-family: var(--font-display);
    font-size: clamp(16px, 4vw, 20px);
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-transform: uppercase;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(197, 160, 101, 0.4);
}

.generate-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* 加载状态 */
.loading-card {
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.scanner-container {
    position: relative;
    width: 80px;
    height: 50px;
    margin-bottom: 20px;
}

.scanner-car {
    font-size: 50px;
    filter: drop-shadow(0 0 10px var(--primary-cyan));
}

.scanner-beam {
    position: absolute;
    top: 0;
    left: -20%;
    width: 140%;
    height: 4px;
    background: var(--primary-cyan);
    box-shadow: 0 0 15px var(--primary-cyan);
    animation: scanning 2s ease-in-out infinite alternate;
}

@keyframes scanning {
    0% { top: 0; opacity: 0.5; }
    100% { top: 100%; opacity: 1; }
}

.terminal-output {
    font-family: 'Courier New', monospace;
    color: var(--primary-cyan);
    text-align: left;
    width: 90%;
    max-width: 400px;
    height: 80px;
    margin: 20px 0;
    overflow: hidden;
    font-size: 14px;
}

.loading-progress-container {
    width: 90%;
    max-width: 400px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-cyan);
    width: 0%;
    box-shadow: 0 0 10px var(--primary-cyan);
    transition: width 0.3s ease;
}

/* 结果展示容器 */
.result-display-container {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    min-height: 200px;
    background: #000;
}

.result-img {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.result-img:hover {
    opacity: 0.9;
}

.result-img:active {
    transform: scale(0.98);
}

.image-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
    opacity: 0.7;
}

/* 图片预览弹窗 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-preview-modal .preview-full-image {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    z-index: 2001;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    /* 移动端：图片撑满宽度 */
    padding: 10px;
    box-sizing: border-box;
}

.image-preview-modal.active .preview-full-image {
    transform: scale(1);
}

/* 移动端优化 */
@media (max-width: 600px) {
    .preview-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    
    .image-preview-modal .preview-full-image {
        padding: 5px;
    }
    
    .image-hint {
        font-size: 11px;
    }
}

/* 按钮组 */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.action-btn {
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-family: var(--font-display);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.action-btn .icon {
    margin-right: 8px;
    font-size: 18px;
}

.download-btn:hover {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: #000;
}

.restart-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 页脚 */
.footer {
    height: 50px;
    margin-top: 50px;
    position: relative;
}

.footer-decor {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-cyan), transparent);
    width: 50%;
    margin: 0 auto;
    opacity: 0.3;
}

/* 装饰角标 */
.corner-decor {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--primary-cyan);
    opacity: 0.5;
    pointer-events: none;
}

.top-left { top: 0; left: 0; border-right: none; border-bottom: none; }
.top-right { top: 0; right: 0; border-left: none; border-bottom: none; }
.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; }
.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; }

/* 密码弹窗 */
.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--bg-dark);
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    border: 1px solid var(--primary-cyan);
    box-shadow: 0 0 30px rgba(197, 160, 101, 0.2);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(197, 160, 101, 0.1);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-cyan);
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
}

.modal-hint {
    margin-bottom: 20px;
    color: var(--text-main);
}

.password-input {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 20px;
    text-align: center;
    letter-spacing: 5px;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}

.password-input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(197, 160, 101, 0.2);
}

.modal-wechat {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.wechat-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.wechat-id {
    font-size: 18px;
    color: var(--primary-cyan);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.wechat-note {
    font-size: 12px;
    color: #ff6b6b;
}

.modal-error {
    color: #ff6b6b;
    margin-top: 15px;
    font-size: 14px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.confirm-btn {
    background: var(--primary-cyan);
    color: #000;
    font-weight: bold;
}

.confirm-btn:hover {
    background: #d4b075;
}

/* 响应式适配 */
@media (max-width: 600px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        margin-bottom: 30px;
    }
    
    .glass-card {
        padding: 20px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}
