:root { 
    --bg: #fafafa; 
    --surface: #fff; 
    --text: #111; 
    --text-sub: #666; 
    --border: #e5e5e5; 
    --border-hover: #a3a3a3; 
}

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    display: flex; 
    justify-content: center; 
    padding: 12px 16px; 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased; 
}

.container { 
    width: 100%; 
    max-width: 600px; 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
}

.header { 
    font-size: 18px; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    margin-bottom: 4px;
}

.header-left { display: flex; align-items: center; gap: 8px; }
.header-left svg { width: 20px; height: 20px; stroke: currentColor; }
.header-right { 
    font-size: 12px; 
    color: var(--text-sub); 
    font-weight: 500; 
    background: #f0f0f0; 
    padding: 2px 8px; 
    border-radius: 10px; 
}

input[type="file"] { display: none; }

.image-box { 
    width: 100%; 
    min-height: 280px; 
    border: 1px dashed var(--border); 
    border-radius: 8px; 
    background: var(--surface); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer; 
    overflow: hidden; 
    position: relative; 
    padding: 10px; 
    transition: border-color 0.2s; 
}
.image-box:hover { border-color: var(--border-hover); }

.placeholder { display: flex; flex-direction: column; align-items: center; color: var(--text-sub); gap: 8px; pointer-events: none; }
.placeholder svg { width: 36px; height: 36px; stroke: #c0c0c0; }
.placeholder p { font-size: 14px; font-weight: 500; }

canvas { display: none; max-width: 100%; max-height: 60vh; object-fit: contain; }
#videoPreview { display: none; max-width: 100%; max-height: 60vh; background: #000; border-radius: 4px; }

.controls { display: flex; flex-direction: column; gap: 12px; }
.status-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-sub); padding: 0 4px; gap: 8px; }
.status-bar span { font-weight: 600; color: var(--text); }

.btn-group { display: flex; flex-wrap: wrap; gap: 10px; }
button { 
    flex: 1 1 45%; 
    padding: 10px 16px; 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    background: var(--surface); 
    color: var(--text); 
    font-size: 14px; 
    font-weight: 500; 
    cursor: pointer; 
    transition: background 0.15s, border-color 0.15s; 
}
button:hover:not(:disabled) { background: #f5f5f5; border-color: #d4d4d4; }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
button.primary:hover:not(:disabled) { background: #333; border-color: #333; }

.section-title { 
    text-align: center; 
    font-size: 12px; 
    color: #999; 
    margin-top: 10px; 
    margin-bottom: -6px; 
    letter-spacing: 1px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
}
.section-title::before, .section-title::after { content: ""; height: 1px; width: 30px; background: var(--border); }

.info-panel { 
    background: #f3f4f6; 
    border-radius: 8px; 
    padding: 16px; 
    font-size: 13px; 
    color: var(--text-sub); 
    line-height: 1.6; 
}
.info-panel p { margin-bottom: 8px; }
.info-panel p:last-child { margin-bottom: 0; }
.info-panel b { color: var(--text); }
.info-panel ul { list-style: none; padding-left: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.info-panel li { position: relative; padding-left: 14px; }
.info-panel li::before { content: "•"; position: absolute; left: 0; top: 0; color: var(--text-sub); }

.loading { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.9); display: none; justify-content: center; align-items: center; flex-direction: column; gap: 12px; z-index: 10; }
.spinner { width: 24px; height: 24px; border: 2px solid #eee; border-top-color: var(--text); border-radius: 50%; animation: spin 0.6s linear infinite; }
.loading-text { font-size: 13px; color: var(--text-sub); }

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