:root {
    --bg: #0b1220;
    --bg-grad-1: #0c1526;
    --bg-grad-2: #0a0f1b;
    --surface: #131c2e;
    --surface-2: #18233a;
    --border: #243149;
    --border-strong: #34466a;
    --text: #e8edf6;
    --text-dim: #9aa7bd;
    --text-faint: #6b7890;
    --accent: #3ea6ff;
    --accent-2: #2bd9b4;
    --accent-ink: #04101f;
    --danger-bg: #2a1620;
    --danger-border: #6b2741;
    --danger-text: #ffb3c4;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 40px -24px rgba(0, 0, 0, .8);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(1100px 600px at 80% -10%, rgba(62, 166, 255, .10), transparent 60%),
        radial-gradient(900px 500px at 0% 0%, rgba(43, 217, 180, .07), transparent 55%),
        linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- shell ---------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 18, 32, .72);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-topbar__inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 24px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.app-brand__mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.25rem;
    color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px -8px rgba(62, 166, 255, .7);
}

.app-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand__title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .2px;
}

.app-brand__sub {
    font-size: .76rem;
    color: var(--text-faint);
}

.app-main {
    flex: 1;
    width: 100%;
}

.app-footer {
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: .8rem;
    text-align: center;
    padding: 18px 24px;
}

/* ---------- page ---------- */
.page {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 24px 64px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.hero {
    text-align: center;
}

.hero__title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 10px;
    letter-spacing: -.4px;
}

.hero__lead {
    margin: 0 auto;
    max-width: 620px;
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1.6;
}

.hero__lead strong {
    color: var(--text);
    font-weight: 600;
}

/* ---------- upload ---------- */
.upload-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dropzone {
    position: relative;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    padding: 44px 24px;
    text-align: center;
    transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}

.dropzone:hover {
    border-color: var(--accent);
    background: linear-gradient(180deg, #16213650, #1a273f);
}

.dropzone.is-busy {
    border-style: solid;
    border-color: var(--accent);
}

.dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone__input:disabled {
    cursor: progress;
}

.dropzone__content {
    position: relative;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dropzone__icon {
    font-size: 2.6rem;
    color: var(--accent);
}

.dropzone__spinner {
    color: var(--accent);
    width: 2.2rem;
    height: 2.2rem;
}

.dropzone__title {
    font-weight: 600;
    font-size: 1.02rem;
}

.dropzone__hint {
    font-size: .82rem;
    color: var(--text-faint);
}

.upload-name {
    align-self: center;
    color: var(--text-dim);
    font-size: .88rem;
}

.upload-name .bi {
    color: var(--accent-2);
}

.app-alert {
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    margin: 0;
}

/* ---------- results ---------- */
.results-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.results-head {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.results-count {
    font-size: .95rem;
    color: var(--text-dim);
}

.results-count strong {
    color: var(--text);
    font-size: 1.1rem;
}

.mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mode-toggle__label {
    font-size: .82rem;
    color: var(--text-faint);
    margin-right: 2px;
}

.mode-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: .86rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.mode-btn:hover {
    color: var(--text);
    border-color: #3a4d72;
}

.mode-btn.is-active {
    color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    box-shadow: 0 8px 18px -10px rgba(62, 166, 255, .8);
}

.defter-list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.defter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 12px;
    transition: background .18s var(--ease);
}

.defter-row:hover {
    background: rgba(62, 166, 255, .06);
}

.defter-row + .defter-row {
    border-top: 1px solid var(--border);
}

.defter-row__info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.defter-row__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 10px;
    font-size: 1.15rem;
    color: var(--accent);
    background: rgba(62, 166, 255, .12);
}

.defter-row__text {
    min-width: 0;
}

.defter-row__title {
    font-weight: 600;
    font-size: .98rem;
}

.defter-row__meta {
    font-size: .82rem;
    color: var(--text-dim);
    margin-top: 1px;
}

.defter-row__file {
    font-size: .74rem;
    color: var(--text-faint);
    font-family: "Cascadia Code", "Consolas", monospace;
    margin-top: 2px;
    word-break: break-all;
}

.defter-row__actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid transparent;
    transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
    white-space: nowrap;
}

.btn-action--primary {
    color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 18px -10px rgba(62, 166, 255, .85);
}

.btn-action--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px -10px rgba(62, 166, 255, .95);
}

.btn-action--ghost {
    color: var(--text-dim);
    background: transparent;
    border-color: var(--border);
}

.btn-action--ghost:hover {
    color: var(--text);
    border-color: #3a4d72;
    background: var(--surface-2);
}

@media (max-width: 560px) {
    .hero__title {
        font-size: 1.6rem;
    }

    .results-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .defter-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .defter-row__actions {
        width: 100%;
    }

    .btn-action {
        flex: 1;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
