:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --accent: #00CEC9;
    --accent-dark: #00B5B0;
    --bg: #0F0F1A;
    --bg-card: #1A1A2E;
    --bg-card-hover: #222240;
    --text: #E8E8F0;
    --text-muted: #9090A8;
    --border: #2A2A45;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;
    --gradient: linear-gradient(135deg, var(--primary), var(--accent));
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    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;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header {
    text-align: center;
    padding: 2.5rem 0 1.5rem;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.15) 0%, transparent 100%);
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-accent {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.25rem;
}

main {
    padding: 1.5rem 0 3rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.upload-section {
    text-align: center;
}

.theme-input {
    text-align: left;
    margin-bottom: 1.5rem;
}

.theme-input label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.theme-input input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.theme-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.theme-input input::placeholder {
    color: var(--text-muted);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-card);
    margin-bottom: 1.5rem;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.upload-icon {
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-remove {
    background: rgba(225, 112, 85, 0.15);
    color: var(--danger);
    border: 1px solid rgba(225, 112, 85, 0.3);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
}

.btn-remove:hover {
    background: rgba(225, 112, 85, 0.25);
}

.btn-correction {
    background: var(--accent);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    margin-top: 0.5rem;
}

.btn-correction:hover:not(:disabled) {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 206, 201, 0.4);
}

.preview-container {
    margin: 1.5rem auto;
    max-width: 100%;
}

.preview-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
    background: #000;
    aspect-ratio: 3 / 4;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(225, 112, 85, 0.9);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.preview-remove:hover {
    background: var(--danger);
}

.result-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.result-section h2 {
    text-align: center;
    margin-bottom: 1rem;
}

.disclaimer {
    background: rgba(253, 203, 110, 0.12);
    border: 1px solid rgba(253, 203, 110, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--warning);
    text-align: center;
    line-height: 1.5;
}

.disclaimer strong {
    color: var(--warning);
}

.result-markdown {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    line-height: 1.8;
}

.result-markdown h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    color: var(--text);
}

.result-markdown h3:first-child {
    margin-top: 0;
}

.result-markdown h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary-light);
}

.result-markdown ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.result-markdown li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text);
}

.result-markdown li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.result-markdown strong {
    color: var(--text);
    font-weight: 700;
}

.result-markdown em {
    color: var(--text-muted);
    font-style: italic;
}

.result-markdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.result-markdown .checklist-item {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text-muted);
}

.result-markdown .checklist-item::before {
    content: '☐';
    position: absolute;
    left: 0;
    color: var(--warning);
    font-size: 1.1rem;
}

.result-markdown .checklist-item.checked {
    color: var(--success);
}

.result-markdown .checklist-item.checked::before {
    content: '☑';
    color: var(--success);
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.score-box {
    text-align: center;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.18), rgba(0, 206, 201, 0.12));
    border-color: var(--primary);
    padding: 1.75rem;
}

.score-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-value small {
    font-size: 1.3rem;
    -webkit-text-fill-color: var(--text-muted);
    color: var(--text-muted);
    margin-left: 0.15rem;
}

.comp-box {
    border-left: 4px solid var(--primary);
}

.comp-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.comp-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.comp-score {
    background: var(--gradient);
    color: #fff;
    padding: 0.3rem 0.9rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.strengths-box {
    border-left: 4px solid var(--success);
}

.strengths-box .box-title {
    color: var(--success);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.priorities-box {
    border-left: 4px solid var(--warning);
}

.priorities-box .box-title {
    color: var(--warning);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.box-body p {
    margin-bottom: 0.5rem;
}

.box-body ul {
    margin: 0.25rem 0;
}

@media (max-width: 600px) {
    .score-value {
        font-size: 2.4rem;
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: var(--text);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 0.8s linear infinite;
}

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

.loading-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .logo {
        font-size: 2rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
    }

    .result-markdown {
        padding: 1.25rem;
    }

    .result-markdown h3 {
        font-size: 1.1rem;
    }
}
