:root {
    --bg: #0f172a;
    --panel: #111c33;
    --panel-soft: #16243f;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: rgba(255, 255, 255, 0.12);
    --brand: #7dd3fc;
    --brand-strong: #38bdf8;
    --danger: #fecaca;
    --danger-bg: rgba(127, 29, 29, 0.45);
    --success: #86efac;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.16), transparent 34rem),
        var(--bg);
}

button,
input,
textarea {
    font: inherit;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.hero {
    display: flex;
    gap: 24px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.05;
}

h1 {
    font-size: clamp(3rem, 7vw, 5.8rem);
    letter-spacing: -0.08em;
}

h2 {
    font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.lead {
    max-width: 720px;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-card,
.panel,
.info-card,
.alert {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero-card {
    display: inline-flex;
    min-width: max-content;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 999px;
    color: var(--muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 18px var(--success);
}

.panel,
.alert {
    border-radius: 28px;
}

.upload-panel {
    padding: 22px;
}

.dropzone {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 34px;
    border: 2px dashed rgba(125, 211, 252, 0.45);
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.52);
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.dragover {
    transform: translateY(-2px);
    border-color: var(--brand);
    background: rgba(14, 165, 233, 0.08);
}

.dropzone input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-icon {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    margin-bottom: 18px;
    border-radius: 22px;
    color: #082f49;
    background: linear-gradient(135deg, #bae6fd, #38bdf8);
    font-weight: 900;
    letter-spacing: -0.06em;
}

.drop-title {
    display: block;
    color: #f8fafc;
    font-size: 1.2rem;
    font-weight: 800;
}

.drop-help,
.hint,
.muted {
    color: var(--muted);
}

.drop-help {
    display: block;
    margin-top: 10px;
    max-width: 760px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    text-decoration: none;
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.11);
}

.button.primary {
    border-color: rgba(125, 211, 252, 0.2);
    color: #04111f;
    background: linear-gradient(135deg, #bae6fd, var(--brand-strong));
    font-weight: 850;
}

.button[disabled] {
    opacity: 0.65;
    cursor: progress;
}

.alert {
    margin-bottom: 18px;
    padding: 18px 22px;
}

.alert p {
    margin: 8px 0 0;
}

.alert-error {
    border-color: rgba(248, 113, 113, 0.5);
    color: var(--danger);
    background: var(--danger-bg);
}

.result-panel {
    margin-top: 22px;
    padding: 22px;
}

.result-header {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

#markdownOutput {
    width: 100%;
    min-height: 440px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: #dbeafe;
    background: rgba(2, 6, 23, 0.72);
    line-height: 1.55;
    resize: vertical;
    outline: none;
    white-space: pre;
}

#markdownOutput:focus {
    border-color: rgba(125, 211, 252, 0.65);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.13);
}

.grid-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 22px;
}

.info-card {
    padding: 20px;
    border-radius: 24px;
}

.info-card h2 {
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: min(420px, calc(100% - 40px));
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 22px, 1120px);
        padding: 28px 0;
    }

    .hero,
    .result-header {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-card {
        width: fit-content;
    }

    .dropzone {
        min-height: 220px;
        padding: 24px;
    }

    .form-actions,
    .result-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .grid-info {
        grid-template-columns: 1fr;
    }
}

/* Sección explicativa: propósito y ahorro de tokens */
.hero-side {
    display: grid;
    gap: 12px;
    justify-items: end;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    max-width: 360px;
}

.hero-badges span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid rgba(134, 239, 172, 0.2);
    border-radius: 999px;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    font-size: 0.84rem;
    font-weight: 800;
}

.purpose-panel {
    display: grid;
    gap: 26px;
    margin-bottom: 22px;
    padding: 26px;
}

.purpose-header {
    max-width: 930px;
}

.purpose-header h2 {
    margin: 6px 0 12px;
    font-size: clamp(1.45rem, 3vw, 2.1rem);
    letter-spacing: -0.03em;
}

.purpose-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
    font-size: 1rem;
}

.purpose-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.purpose-card {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.44);
}

.purpose-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: 14px;
    color: #082f49;
    background: linear-gradient(135deg, #bae6fd, var(--brand-strong));
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.purpose-card h3 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 1.05rem;
}

.purpose-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
    font-size: 0.95rem;
}

.workflow-box {
    display: grid;
    grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.4fr);
    gap: 22px;
    padding: 22px;
    border: 1px solid rgba(125, 211, 252, 0.16);
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 20rem),
        linear-gradient(135deg, rgba(2, 6, 23, 0.72), rgba(15, 23, 42, 0.78));
}

.workflow-box .eyebrow {
    color: var(--success);
}

.workflow-box h3 {
    margin: 6px 0 0;
    color: #ffffff;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.workflow-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: workflow;
}

.workflow-list li {
    position: relative;
    display: grid;
    gap: 3px;
    padding-left: 42px;
    counter-increment: workflow;
}

.workflow-list li::before {
    content: counter(workflow);
    position: absolute;
    top: 2px;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #042f2e;
    background: var(--success);
    font-size: 0.85rem;
    font-weight: 900;
}

.workflow-list strong {
    color: #ffffff;
    font-size: 0.98rem;
}

.workflow-list span {
    color: rgba(229, 231, 235, 0.72);
    line-height: 1.5;
    font-size: 0.93rem;
}

.token-note {
    padding: 18px 20px;
    border: 1px solid rgba(134, 239, 172, 0.22);
    border-radius: 18px;
    color: #d1fae5;
    background: rgba(34, 197, 94, 0.1);
    line-height: 1.65;
}

.token-note strong {
    color: var(--success);
}

@media (max-width: 900px) {
    .purpose-grid {
        grid-template-columns: 1fr;
    }

    .workflow-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .hero-side {
        justify-items: start;
    }

    .hero-badges {
        justify-content: flex-start;
    }

    .purpose-panel {
        padding: 20px;
    }
}
