/* -- Reset & Base ---------------------------------------------------------- */

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

:root {
    /* Deep navy base — not pure black */
    --bg:            #080c14;
    --bg-subtle:     #0d1220;
    --surface:       #111827;
    --surface-hover: #1a2235;
    --surface-glow:  #1e293b;
    --border:        rgba(148, 163, 184, 0.08);
    --border-light:  rgba(148, 163, 184, 0.14);

    /* Text — warm, not harsh */
    --text:          #e2e8f0;
    --text-muted:    #64748b;
    --text-faint:    #475569;

    /* Accent gradient (teal → blue → violet) */
    --accent-1:      #06b6d4;
    --accent-2:      #3b82f6;
    --accent-3:      #8b5cf6;
    --accent-glow:   rgba(59, 130, 246, 0.25);
    --gradient:      linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));

    /* Functional */
    --success:       #34d399;
    --error:         #f87171;

    /* Shape */
    --radius:        14px;
    --radius-sm:     10px;
    --radius-xs:     6px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient glow behind the page */
body {
    min-height: 100%;
    display: flex;
    justify-content: center;
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(6, 182, 212, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 70%),
        var(--bg);
}

#app {
    width: 100%;
    max-width: 500px;
    padding: 0 20px;
}

/* -- App Layout ----------------------------------------------------------- */

.app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 56px 0 48px;
}

.header {
    text-align: center;
    margin-bottom: 44px;
}

.header__logo {
    height: auto;
    max-width: min(100%, 600px);
}

.header__subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
    margin-top: 6px;
}

.main {
    flex: 1;
}

/* -- Upload Zone ---------------------------------------------------------- */

.upload-zone {
    position: relative;
    border: 1.5px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 56px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    background: var(--surface);
    transition: all 0.25s ease;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

/* Ambient glow behind upload zone on hover */
.upload-zone::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.upload-zone:hover,
.upload-zone--over {
    border-color: transparent;
    background: var(--surface-hover);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.08), 0 0 80px rgba(139, 92, 246, 0.04);
}

.upload-zone:hover::before,
.upload-zone--over::before {
    opacity: 0.12;
}

.upload-zone--disabled {
    pointer-events: none;
    opacity: 0.6;
}

.upload-zone--cooldown {
    cursor: default;
    border-color: var(--border);
    background: var(--bg-subtle);
}

.upload-zone--cooldown::before { opacity: 0 !important; }
.upload-zone--cooldown:hover { box-shadow: none; }

/* Countdown ring */

.cooldown-ring {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cooldown-ring__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.cooldown-ring__track {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 3;
}

.cooldown-ring__fill {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 163.36;
    transition: stroke-dashoffset 1s linear;
}

.cooldown-ring__number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.upload-zone__icon {
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.upload-zone:hover .upload-zone__icon {
    color: var(--accent-2);
}

.upload-zone__text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

.upload-zone__hint {
    color: var(--text-faint);
    font-size: 0.8125rem;
}

/* -- Spinner -------------------------------------------------------------- */

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* -- Result --------------------------------------------------------------- */

.result {
    animation: fadeIn 0.35s ease;
}

.result--queued {
    text-align: center;
    padding: 56px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.result__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 16px;
}

.result__subtitle {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 0.9375rem;
}

.queued-icon {
    font-size: 2.25rem;
}

.result__image-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.result__image {
    display: block;
    width: 100%;
    height: auto;
}

.result__actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* -- Buttons -------------------------------------------------------------- */

.btn {
    flex: 1;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn--primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover:not(:disabled) {
    box-shadow: 0 6px 28px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn--primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-light);
}

.btn--ghost:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: rgba(148, 163, 184, 0.2);
}

/* -- Info Sections (How It Works / FAQ) ----------------------------------- */

.info-section {
    margin-top: 56px;
}

.info-section__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    color: var(--text-faint);
}

/* Steps */

.steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}

.step:hover {
    border-color: var(--border-light);
}

.step__number {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
}

.step__text {
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.55;
    padding-top: 4px;
}


/* -- Footer --------------------------------------------------------------- */

.footer {
    margin-top: 48px;
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer__link {
    color: var(--text-faint);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.15s;
}

.footer__link:hover {
    color: var(--text-muted);
}

/* -- Prose (Terms page) --------------------------------------------------- */

.prose h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.prose h1:first-child {
    margin-top: 0;
}

.prose h2 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text);
}

.prose p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.prose ul, .prose ol {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 12px;
    padding-left: 24px;
}

.prose li {
    margin-bottom: 4px;
}

.prose blockquote {
    border-left: 3px solid var(--accent-2);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--surface);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text);
    font-style: italic;
    font-size: 0.9375rem;
    line-height: 1.7;
}

.prose a {
    color: var(--accent-2);
    text-decoration: none;
}

.prose a:hover {
    text-decoration: underline;
}

.prose strong {
    color: var(--text);
}

.prose em {
    color: var(--text-faint);
}

/* Notice box */

.notice-box {
    background: var(--surface);
    border: 1px solid var(--accent-2);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.06);
}

.notice-box__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-1);
    margin-bottom: 12px;
}

.notice-box ul {
    list-style: none;
    padding: 0;
}

.notice-box li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text);
}

.notice-box li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-2);
}

.notice-box li:last-child {
    margin-bottom: 0;
}

/* Header back link */

.header__back {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.legal-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.8125rem;
}

/* -- Toasts --------------------------------------------------------------- */

.toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    z-index: 100;
}

.toast {
    pointer-events: auto;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    font-size: 0.875rem;
    max-width: 380px;
    cursor: pointer;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error   { border-left: 3px solid var(--error); }
.toast--info    { border-left: 3px solid var(--accent-2); }

/* -- Animations ----------------------------------------------------------- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* -- Responsive ----------------------------------------------------------- */

@media (max-width: 480px) {
    .app { padding-top: 36px; }
    .header { margin-bottom: 32px; }
    .header__logo { max-width: 80%; }
    .upload-zone { padding: 40px 16px; }
    .result__actions { flex-direction: column; }
    .info-section { margin-top: 40px; }
}
