:root {
    --bg: #0a0a1a; --bg2: #12122a; --card: #1a1a3e;
    --card-hover: #222250; --border: #2a2a5a;
    --text: #f0f0ff; --text2: #8888bb; --text3: #555588;
    --a1: #f093fb; --a2: #f5576c; --a3: #4facfe; --a4: #00f2fe;
    --grad: linear-gradient(135deg, #f093fb, #f5576c);
    --rad: 8px; --rad2: 16px; --rad3: 24px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; overflow-x: hidden; line-height: 1.6;
}
.bg-blur {
    position: fixed; top: -100px; right: -100px; width: 400px; height: 400px;
    border-radius: 50%; background: var(--a1); filter: blur(100px); opacity: 0.08;
    animation: float 20s ease-in-out infinite; pointer-events: none; z-index: 0;
}
.bg-blur2 {
    position: fixed; bottom: -100px; left: -100px; width: 400px; height: 400px;
    border-radius: 50%; background: var(--a3); filter: blur(100px); opacity: 0.08;
    animation: float 25s ease-in-out infinite reverse; pointer-events: none; z-index: 0;
}
@keyframes float {
    0%,100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(50px,-50px) scale(1.1); }
    66% { transform: translate(-30px,30px) scale(0.9); }
}
.container { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 20px 24px 40px; }

.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0; margin-bottom: 32px; border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 12px;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo text { font-weight: 700; }
.logo-text h1 { font-size: 24px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-sub { font-size: 12px; color: var(--text2); display: block; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-1 { background: rgba(79,172,254,0.15); color: #4facfe; border: 1px solid rgba(79,172,254,0.3); }
.badge-2 { background: rgba(240,147,251,0.15); color: #f093fb; border: 1px solid rgba(240,147,251,0.3); }

.upload-section { margin-bottom: 32px; }
.upload-zone {
    background: var(--card); border: 2px dashed var(--border);
    border-radius: var(--rad3); padding: 60px 40px; text-align: center;
    cursor: pointer; transition: all 0.4s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--a1); background: var(--card-hover); box-shadow: 0 0 40px rgba(240,147,251,0.08); }
.upload-zone.dragover { border-color: var(--a2); transform: scale(1.01); }
.u-icon { color: var(--text3); margin-bottom: 16px; transition: all 0.4s; }
.upload-zone:hover .u-icon { color: var(--a1); transform: translateY(-4px); }
.u-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.u-desc { color: var(--text2); font-size: 14px; }
.u-link { color: var(--a1); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.u-hint { display: block; margin-top: 12px; font-size: 12px; color: var(--text3); }

.preview-wrap { position: relative; display: inline-block; }
.preview-wrap img { max-width: 280px; max-height: 320px; border-radius: var(--rad2); object-fit: cover; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.btn-sm {
    position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7);
    color: white; border: 1px solid rgba(255,255,255,0.2); padding: 6px 12px;
    border-radius: 20px; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; gap: 4px;
}
.btn-sm:hover { background: rgba(0,0,0,0.9); }

.u-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px;
    border-radius: 50px; font-size: 15px; font-weight: 600; cursor: pointer;
    border: none; transition: all 0.3s; font-family: inherit;
}
.btn-primary { background: var(--grad); color: white; box-shadow: 0 4px 20px rgba(240,147,251,0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(240,147,251,0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--text2); }

.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10,10,26,0.85); backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.loading-card {
    background: var(--card); border-radius: var(--rad3); padding: 48px 60px;
    text-align: center; border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3); max-width: 400px; width: 90%;
}
.loading-card h3 { font-size: 22px; font-weight: 600; margin: 24px 0 20px; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.spinner { position: relative; width: 64px; height: 64px; margin: 0 auto; }
.ring {
    position: absolute; width: 100%; height: 100%; border-radius: 50%;
    border: 3px solid transparent; animation: spin 1.5s cubic-bezier(0.4,0,0.2,1) infinite;
}
.ring:nth-child(1) { border-top-color: #f093fb; }
.ring:nth-child(2) { border-right-color: #4facfe; width: 80%; height: 80%; top: 10%; left: 10%; animation-delay: 0.3s; }
.ring:nth-child(3) { border-bottom-color: #f5576c; width: 60%; height: 60%; top: 20%; left: 20%; animation-delay: 0.6s; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text3); opacity: 0.4; transition: all 0.4s; }
.step.active { opacity: 1; color: var(--text); }
.step.done { opacity: 0.7; color: var(--a4); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.result-section { animation: fadeUp 0.6s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.score-hero {
    display: flex; align-items: center; gap: 40px;
    background: var(--card); border-radius: var(--rad3); padding: 40px;
    border: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; justify-content: center;
}
.ring-wrap { position: relative; flex-shrink: 0; }
.ring-svg { display: block; }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }
.ring-fill { fill: none; stroke: url(#sg); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 110px 110px; transition: stroke-dashoffset 2s cubic-bezier(0.4,0,0.2,1); }
.score-num { font-size: 52px; font-weight: 800; fill: var(--text); font-family: Inter, sans-serif; }
.score-lbl { font-size: 13px; fill: var(--text2); font-family: Inter, sans-serif; }
.level-badge {
    position: absolute; top: -8px; right: -8px; width: 44px; height: 44px;
    border-radius: 50%; background: var(--grad);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; color: white;
    box-shadow: 0 4px 15px rgba(240,147,251,0.4);
    animation: pulse 2s ease infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.score-info h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.score-info p { color: var(--text2); font-size: 14px; }

.card { background: var(--card); border-radius: var(--rad3); padding: 28px 32px; border: 1px solid var(--border); margin-bottom: 20px; }
.card-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.card-header h3 { font-size: 18px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text3); }
.chart-wrap { display: flex; justify-content: center; }
.chart-wrap svg { max-width: 480px; width: 100%; }

.dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-bottom: 20px; }
.dim-item { background: var(--card); border-radius: var(--rad2); padding: 18px 20px; border: 1px solid var(--border); }
.dim-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dim-name { font-size: 14px; font-weight: 600; color: var(--text2); }
.dim-score { font-size: 18px; font-weight: 700; }
.dim-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 3px; transition: width 1.5s cubic-bezier(0.4,0,0.2,1); }

.tips-wrap { display: grid; gap: 12px; }
.tip { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,0.03); border-radius: var(--rad); }
.tip-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.tip-text { font-size: 14px; color: var(--text2); line-height: 1.5; }

.re-bar { text-align: center; margin-top: 24px; margin-bottom: 32px; }

.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(10px); z-index: 2000;
    align-items: center; justify-content: center;
}
.modal.show { display: flex; }
.modal-content { background: var(--card); border-radius: var(--rad3); padding: 24px; max-width: 520px; width: 90%; border: 1px solid var(--border); }
.modal-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-hdr h3 { font-size: 18px; font-weight: 600; }
.btn-x { background: none; border: none; color: var(--text2); font-size: 24px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.btn-x:hover { background: rgba(255,255,255,0.1); }
.cam-box { width: 100%; aspect-ratio: 4/3; background: black; border-radius: var(--rad); overflow: hidden; margin-bottom: 16px; }
.cam-box video, .cam-box canvas { width: 100%; height: 100%; object-fit: cover; }
.cam-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.footer { text-align: center; padding: 24px 0; border-top: 1px solid var(--border); }
.footer p { font-size: 13px; color: var(--text3); }
.footer a { color: var(--a3); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.model-status {
    text-align: center; padding: 12px; margin-bottom: 16px;
    border-radius: var(--rad); font-size: 13px;
}
.model-status.loading { background: rgba(79,172,254,0.1); color: #4facfe; border: 1px solid rgba(79,172,254,0.2); }
.model-status.loaded { background: rgba(0,242,254,0.1); color: #00f2fe; border: 1px solid rgba(0,242,254,0.2); }
.model-status.error { background: rgba(245,87,108,0.1); color: #f5576c; border: 1px solid rgba(245,87,108,0.2); }

@media (max-width: 640px) {
    .container { padding: 12px 16px; }
    .header { flex-direction: column; align-items: flex-start; }
    .score-hero { flex-direction: column; gap: 20px; padding: 24px; }
    .upload-zone { padding: 40px 20px; }
    .card { padding: 20px; }
    .dim-grid { grid-template-columns: 1fr; }
    .score-num { font-size: 40px; }
    .loading-card { padding: 32px 24px; }
}
