* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "SUIT", "Space Grotesk", sans-serif;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 193, 122, 0.35), transparent 55%),
        radial-gradient(circle at 90% 20%, rgba(121, 106, 255, 0.25), transparent 55%),
        #fff7f1;
    color: #1d152b;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 3rem 1.5rem 5rem;
}

.container {
    width: min(1040px, 100%);
    display: grid;
    gap: 2rem;
}

.toolbar {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(219, 204, 255, 0.7);
    box-shadow: 0 12px 24px rgba(39, 24, 85, 0.08);
}

.nav-link {
    background-color: transparent;
    color: #1d152b;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.5rem 1.2rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.nav-link:hover {
    background-color: #ffffff;
    border-color: #e5d6ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(27, 17, 41, 0.12);
}

.hero {
    text-align: left;
}

.back-link {
    display: inline-flex;
    margin-bottom: 1rem;
    color: #3a2d5c;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

.eyebrow {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #5a4a78;
    margin-bottom: 0.8rem;
}

h1 {
    font-size: clamp(2.6rem, 5vw, 4.5rem);
    margin: 0 0 1rem;
}

.hero-subtitle {
    max-width: 520px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #3a3156;
}

.panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(229, 217, 255, 0.8);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(14px);
    box-shadow: 0 30px 60px rgba(64, 40, 120, 0.1);
}

.panel-left h2 {
    margin: 0 0 0.6rem;
    font-size: 1.6rem;
}

.panel-note {
    margin: 0 0 1.5rem;
    color: #625a7f;
}

.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-button,
#camera-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.3rem;
    border-radius: 999px;
    background: #191326;
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-button input {
    display: none;
}

#camera-toggle {
    background: #ffe56d;
    color: #1c1305;
}

.file-button:hover,
#camera-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(27, 17, 41, 0.2);
}

.status {
    margin-top: 1.2rem;
    font-weight: 600;
    color: #5a4a78;
}

.panel-right {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.preview {
    position: relative;
    background: #f7f5ff;
    border: 1px dashed #c9b8ff;
    border-radius: 18px;
    height: 320px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

#webcam,
#snapshot,
#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

#analyze {
    padding: 0.9rem 1.5rem;
    border-radius: 14px;
    border: none;
    background: #7b4dff;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#analyze:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#analyze:not(:disabled):hover {
    transform: translateY(-2px);
}

.result {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #efe6ff;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(73, 52, 120, 0.08);
}

.result-primary {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.result-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    background: #f6f2ff;
    font-weight: 600;
}

.bar {
    height: 8px;
    border-radius: 999px;
    background: #d9ccff;
    margin-top: 0.4rem;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7b4dff, #ff5d8f);
}

.disclaimer {
    text-align: center;
    color: #6c6292;
}

@media (max-width: 680px) {
    body {
        padding: 2rem 1.2rem 3rem;
    }

    .panel {
        padding: 1.5rem;
    }

    .preview {
        height: 260px;
    }
}
