/* style.css */
:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --scan-frame-color: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 扫描区域 */
.scanner-area {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 比例 */
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* 扫描框样式 */
.scan-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    z-index: 1;
}

.scan-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--scan-frame-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    animation: scan 2s infinite linear;
    filter: drop-shadow(0 0 4px var(--primary-color));
}

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

/* 控制区域 */
.controls {
    padding: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.02);
}

.scan-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.scan-button:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.scan-button:active {
    transform: translateY(0);
}

.hint {
    color: #666;
    font-size: 14px;
    margin-top: 12px;
}

/* 结果区域 */
.result-area {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-header {
    padding: 16px;
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    border-radius: 12px 12px 0 0;
}

.result-content {
    padding: 20px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .container {
        grid-template-columns: 1fr 1fr;
        padding: 30px;
    }
    
    .scan-overlay {
        width: 60%;
        height: 60%;
    }
}

/* 辅助样式 */
.resolution-display {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 2;
}

.error {
    color: var(--error-color);
    padding: 12px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 6px;
    margin: 10px 0;
}

.scan-success {
    outline: 3px solid rgba(76, 175, 80, 0.5);
    transition: outline 0.3s ease;
}

a {
    color: var(--primary-color);
    word-break: break-all;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
}