* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 移动端文字渲染优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 移动端专用样式重置 */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0c1445 0%, #1e3c72 50%, #2a5298 100%);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    /* 移动端优化 */
    -webkit-overflow-scrolling: touch;
    -webkit-user-select: none;
    user-select: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.section {
    display: none;
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}

.section.active {
    display: block;
}

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

/* 输入界面样式 */
.title {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 40px;
}

.avatar-upload {
    margin-bottom: 30px;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.avatar-circle:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.upload-hint {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    white-space: nowrap;
}

.input-group {
    margin-bottom: 30px;
}

.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.gender-group {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.gender-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.gender-option:hover {
    color: #fff;
    transform: scale(1.05);
}

.gender-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.gender-option input[type="radio"]:checked + .radio-custom {
    border-color: #fff;
    background: linear-gradient(45deg, #ff6b9d, #c44569);
}

.gender-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.start-btn, .restart-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(45deg, #ff6b9d, #c44569);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
}

.start-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.6);
}

/* 新增：模式选择按钮样式 */
.mode-selection {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.mode-btn {
    width: 100%;
    padding: 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.mode-btn:hover::before {
    left: 100%;
}

.scumbag-mode {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.scumbag-mode:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.foodie-mode {
    background: linear-gradient(45deg, #f093fb, #f5576c, #ff9a9e);
    color: #fff;
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
}

.foodie-mode:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(245, 87, 108, 0.6);
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.mode-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.mode-desc {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

/* 扫描界面样式 */
.scan-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

.scan-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 40px;
    animation: pulse 2s infinite;
}

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

.scan-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 40px;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.scan-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    animation: scanMove 2s linear infinite;
}

.scan-line:nth-child(1) {
    animation-delay: 0s;
}

.scan-line:nth-child(2) {
    animation-delay: 0.7s;
}

.scan-line:nth-child(3) {
    animation-delay: 1.4s;
}

@keyframes scanMove {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.scan-progress {
    width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    border-radius: 2px;
    animation: progressFill 3s ease-in-out;
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

.scan-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    animation: pulse 2s infinite;
    margin-bottom: 30px;
}

/* 新增：伪造后台日志终端样式 */
#scan-log-container {
    width: 90%;
    max-width: 500px;
    height: 200px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #00ff88;
    border-radius: 8px;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.log-header {
    background: rgba(0, 255, 136, 0.1);
    padding: 8px 15px;
    border-bottom: 1px solid #00ff88;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-title {
    color: #00ff88;
    font-size: 0.8rem;
    font-weight: bold;
}

.log-status {
    color: #00ff88;
    font-size: 0.7rem;
    animation: blink 1.5s infinite;
}

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

.log-content {
    height: calc(100% - 40px);
    padding: 10px 15px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.log-content::-webkit-scrollbar {
    display: none;
}

.log-line {
    color: #00ff88;
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 3px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
    opacity: 0;
    animation: typeIn 0.5s ease-out forwards;
}

@keyframes typeIn {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-line.error {
    color: #ff4444;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

.log-line.warning {
    color: #ffaa00;
    text-shadow: 0 0 5px rgba(255, 170, 0, 0.5);
}

.log-line.success {
    color: #44ff44;
    text-shadow: 0 0 5px rgba(68, 255, 68, 0.5);
}

/* 结果界面样式 */
.result-container {
    width: 100%;
    text-align: center;
}

.result-title {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.result-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-name {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 30px;
}

.result-quote {
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    color: #ffffff !important;
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    /* 移动端强化 */
    -webkit-font-smoothing: antialiased;
}

/* 新增：属性进度条样式 */
#attributes-container {
    width: 100%;
    margin-bottom: 25px;
}

/* 移动端兼容性修复 - 确保文字在所有设备上可见 */
@supports (-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px)) {
    .result-quote,
    .ultimate-judgment {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* 移动端Safari兼容性 */
@supports not (backdrop-filter: blur(10px)) {
    .result-quote {
        background: rgba(0, 0, 0, 0.8) !important;
    }
    
    .ultimate-judgment {
        background: rgba(0, 0, 0, 0.8) !important;
    }
    
    .attribute-bar {
        background: rgba(0, 0, 0, 0.6) !important;
    }
}

/* 强制移动端文字颜色 */
@media screen and (max-width: 768px) {
    .attribute-label,
    .attribute-value,
    .result-quote,
    .judgment-content,
    .judgment-title,
    .result-name,
    .result-title {
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    }
    
    .elite-value {
        color: #00f2fe !important;
        text-shadow: 0 0 10px rgba(0, 242, 254, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    }
    
    .scumbag-value {
        color: #f093fb !important;
        text-shadow: 0 0 10px rgba(240, 147, 251, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    }
    
    /* 移动端背景强化 */
    .result-quote {
        background: rgba(0, 0, 0, 0.85) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    .ultimate-judgment {
        background: rgba(0, 0, 0, 0.85) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    .attribute-bar {
        background: rgba(0, 0, 0, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
}

.attribute-item {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.attribute-label {
    color: #fff !important;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 120px;
    text-align: right;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.attribute-bar {
    flex: 1;
    height: 14px;
    background: rgba(0, 0, 0, 0.7) !important;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.attribute-fill {
    height: 100%;
    width: 0%;
    border-radius: 7px;
    position: relative;
    transition: width 2s ease-out;
    animation: glow 2s ease-in-out infinite alternate;
}

/* 精英浓度样式 - 青色/金色 */
.elite-fill {
    background: linear-gradient(90deg, #00f2fe, #4facfe, #00f2fe);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
}

.elite-fill:hover {
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.9), 0 0 35px rgba(79, 172, 254, 0.4);
}

.elite-value {
    color: #00f2fe !important;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.8);
}

/* 海王/干饭浓度样式 - 粉色/紫色 */
.scumbag-fill {
    background: linear-gradient(90deg, #f093fb, #f5576c, #f093fb);
    box-shadow: 0 0 15px rgba(240, 147, 251, 0.6);
}

.scumbag-fill:hover {
    box-shadow: 0 0 25px rgba(240, 147, 251, 0.9), 0 0 35px rgba(245, 87, 108, 0.4);
}

.scumbag-value {
    color: #f093fb !important;
    text-shadow: 0 0 10px rgba(240, 147, 251, 0.8);
}

@keyframes glow {
    0% {
        filter: brightness(1);
    }
    100% {
        filter: brightness(1.2);
    }
}

.attribute-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.attribute-value {
    font-size: 0.9rem;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
    font-family: 'Courier New', monospace;
    color: #fff; /* 确保基础颜色为白色 */
}

/* 新增：终极鉴定样式 */
.ultimate-judgment {
    width: 100%;
    margin: 25px 0;
    padding: 25px;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 5px 15px rgba(255, 255, 255, 0.1);
}

.ultimate-judgment.show {
    opacity: 1;
    transform: translateY(0);
}

.judgment-title {
    color: #ffffff !important;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    /* 移除可能导致文字不可见的渐变文字效果 */
}

.judgment-content {
    color: #ffffff !important;
    font-size: 1rem;
    line-height: 1.6;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}



/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .avatar-circle {
        width: 100px;
        height: 100px;
    }
    
    .gender-group {
        gap: 30px;
    }
    
    .scan-avatar {
        width: 120px;
        height: 120px;
    }
    
    .result-quote {
        padding: 20px;
        font-size: 0.9rem;
    }
    
    .mode-selection {
        gap: 15px;
    }
    
    .mode-btn {
        padding: 15px;
    }
    
    .mode-icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .mode-title {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    .mode-desc {
        font-size: 0.8rem;
    }
    
    #scan-log-container {
        width: 95%;
        height: 150px;
    }
    
    .log-line {
        font-size: 0.7rem;
    }
    
    .attribute-label {
        min-width: 100px;
        font-size: 0.8rem;
    }
    
    .attribute-item {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .ultimate-judgment {
        margin: 20px 0;
        padding: 20px;
    }
    
    .judgment-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .judgment-content {
        font-size: 0.8rem;
    }
}

/* 移动端强制文字可见性 - 最高优先级 */
@media screen and (max-device-width: 768px), 
       screen and (-webkit-min-device-pixel-ratio: 2) {
    
    /* 强制所有文字为白色，最高优先级 */
    .attribute-label,
    .result-name,
    .result-title,
    .scan-title,
    .title,
    .subtitle,
    .judgment-title,
    .judgment-content,
    .result-quote,
    .mode-title,
    .mode-desc {
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
        -webkit-text-fill-color: #ffffff !important;
        -webkit-font-smoothing: antialiased !important;
    }
    
    /* 属性值保持特定颜色但增强对比度 */
    .elite-value {
        color: #00f2fe !important;
        text-shadow: 0 0 10px rgba(0, 242, 254, 1), 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
        -webkit-text-fill-color: #00f2fe !important;
    }
    
    .scumbag-value {
        color: #f093fb !important;
        text-shadow: 0 0 10px rgba(240, 147, 251, 1), 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
        -webkit-text-fill-color: #f093fb !important;
    }
    
    /* 强化背景对比度 */
    .result-quote,
    .ultimate-judgment {
        background: rgba(0, 0, 0, 0.9) !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .attribute-bar {
        background: rgba(0, 0, 0, 0.8) !important;
        border: 1px solid rgba(255, 255, 255, 0.5) !important;
    }
    
    /* 移动端输入框样式强化 */
    .input-group input {
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
        background: rgba(0, 0, 0, 0.6) !important;
    }
    
    .input-group input::placeholder {
        color: rgba(255, 255, 255, 0.7) !important;
        -webkit-text-fill-color: rgba(255, 255, 255, 0.7) !important;
    }
}

@media (max-height: 600px) {
    .title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .subtitle {
        margin-bottom: 25px;
    }
    
    .avatar-circle {
        width: 80px;
        height: 80px;
    }
    
    .input-group, .gender-group {
        margin-bottom: 20px;
    }
    
    .scan-container {
        padding: 10px;
    }
    
    .scan-avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }
    
    #scan-log-container {
        height: 120px;
    }
    
    .scan-text {
        margin-bottom: 15px;
    }
}

/* WebKit浏览器专用修复 */
@supports (-webkit-appearance: none) {
    .attribute-label,
    .attribute-value,
    .result-quote,
    .judgment-content,
    .judgment-title {
        -webkit-text-fill-color: inherit !important;
        -webkit-background-clip: border-box !important;
        background-clip: border-box !important;
    }
    
    .elite-value {
        -webkit-text-fill-color: #00f2fe !important;
    }
    
    .scumbag-value {
        -webkit-text-fill-color: #f093fb !important;
    }
}

/* Safari专用修复 */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        .result-quote,
        .ultimate-judgment {
            background: #000000 !important;
            opacity: 0.9;
        }
        
        .attribute-bar {
            background: #000000 !important;
            opacity: 0.8;
        }
    }
}

/* 最终保障 - 移动端文字强制可见 */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-text-fill-color: unset !important;
    }
    
    .attribute-label,
    .result-quote,
    .judgment-content,
    .judgment-title,
    .result-name,
    .result-title {
        color: #ffffff !important;
        text-shadow: 2px 2px 4px #000000 !important;
    }
    
    .elite-value {
        color: #00f2fe !important;
        text-shadow: 0 0 10px rgba(0, 242, 254, 1), 2px 2px 4px #000000 !important;
    }
    
    .scumbag-value {
        color: #f093fb !important;
        text-shadow: 0 0 10px rgba(240, 147, 251, 1), 2px 2px 4px #000000 !important;
    }
}