:root {
    --bg: #f5f6f8;
    --fg: #1a1a1a;
    --muted: #6b7280;
    --border: #e4e6eb;
    --card: #ffffff;
    --accent: #111827;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding: 64px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

main {
    width: 100%;
    max-width: 720px;
}

.view {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 56px;
    line-height: 1;
    letter-spacing: -0.5px;
    color: var(--fg);
}

.lead {
    color: var(--fg);
    font-size: 17px;
    max-width: 620px;
}

.lead strong, .about-card strong, .hint strong {
    font-weight: 600;
}

.hint {
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.upload-card {
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.05s ease;
    position: relative;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-card:hover {
    border-color: #c8ccd3;
}

.upload-card.dragover {
    border-color: var(--accent);
    border-style: dashed;
}

.upload-card.has-preview .upload-inner {
    display: none;
}

.upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.upload-icon {
    font-size: 28px;
    color: var(--muted);
}

.upload-text {
    font-weight: 600;
    font-size: 16px;
}

.upload-sub {
    color: var(--muted);
    font-size: 14px;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.05s ease;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    transform: translateY(1px);
}

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

#preview {
    display: none;
    max-width: 100%;
    max-height: 360px;
    border-radius: 10px;
    object-fit: contain;
}

.upload-card.has-preview #preview {
    display: block;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 20, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.modal.open {
    display: flex;
}

.modal-card {
    background: var(--card);
    border-radius: 18px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    position: relative;
    animation: pop 0.18s ease-out;
}

@keyframes pop {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.modal-close:hover {
    color: var(--fg);
}

.modal-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.modal-label {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 1.1;
    margin-bottom: 4px;
    word-break: break-word;
}

.modal-confidence {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 18px;
}

.top3 {
    list-style: none;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top3 li {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--fg);
}

.top3 li span:last-child {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.loading {
    pointer-events: none;
    opacity: 0.6;
}
