:root {
    color-scheme: light;
    --page-bg:
        radial-gradient(circle at 12% 12%, rgba(188, 151, 86, 0.18), transparent 24%),
        radial-gradient(circle at 88% 12%, rgba(78, 112, 78, 0.14), transparent 28%),
        linear-gradient(180deg, #eef2e8 0%, #e2e8dc 26%, #ebe1cd 58%, #f3eadb 100%);
    --surface: rgba(252, 249, 241, 0.96);
    --surface-strong: #fdf8ee;
    --surface-muted: rgba(242, 236, 222, 0.98);
    --text-main: #183024;
    --text-soft: #4e6152;
    --text-faint: #758173;
    --accent: #2f6840;
    --accent-strong: #1b4127;
    --accent-soft: rgba(47, 104, 64, 0.12);
    --warm: #a86838;
    --warm-soft: rgba(168, 104, 56, 0.14);
    --warning: #8b4a23;
    --border: rgba(47, 104, 64, 0.16);
    --border-strong: rgba(47, 104, 64, 0.24);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text-main);
    font-family: "Trebuchet MS", "Segoe UI Variable", "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

.page-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 14px 0 24px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 16px 18px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(252, 248, 238, 0.99), rgba(226, 235, 223, 0.97));
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.app-brand {
    display: grid;
    gap: 8px;
}

.app-brand__badge {
    display: inline-flex;
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(47, 104, 64, 0.08);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-brand h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 0.98;
}

.app-brand p {
    margin: 2px 0 0;
    max-width: 620px;
    color: var(--text-soft);
    line-height: 1.45;
    font-size: 15px;
}

.app-header__side {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.user-chip {
    max-width: 260px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(47, 104, 64, 0.08);
    color: var(--accent-strong);
    line-height: 1.45;
    text-align: right;
}

.app-shell {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.workspace-card,
.result-card {
    padding: 16px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
}

.workspace-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 104, 64, 0.1), rgba(168, 104, 56, 0.08));
    border: 1px solid rgba(47, 104, 64, 0.12);
}

.workspace-tab,
.help-tab,
.action-button {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.workspace-tab {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.3);
    color: rgba(27, 65, 39, 0.8);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.workspace-tab:hover:not(:disabled),
.help-tab:hover:not(:disabled),
.action-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.workspace-tab.is-active {
    background: linear-gradient(135deg, #2f6840, #3e7b50);
    border-color: rgba(27, 65, 39, 0.18);
    color: white;
}

.workspace-tab:not(.is-active) {
    border-color: rgba(255, 255, 255, 0.18);
}

.workspace-tab:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--accent-strong);
}

.workspace-panel {
    display: grid;
    gap: 14px;
}

.workspace-panel[hidden] {
    display: none;
}

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

.panel-header h2 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1.06;
}

.panel-header p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.45;
}

.panel-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.panel-step {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 14px;
}

.panel-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
}

.upload-zone {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-strong);
    background: linear-gradient(135deg, rgba(253, 249, 242, 0.99), rgba(244, 241, 229, 0.96));
}

.upload-zone--muted {
    opacity: 1;
}

.upload-zone__title {
    font-size: 16px;
    font-weight: 800;
}

.upload-zone__text {
    color: var(--text-soft);
    line-height: 1.55;
}

.upload-zone input {
    color: var(--text-soft);
}

.upload-zone input:disabled {
    opacity: 0.7;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.picker-button {
    appearance: none;
    width: fit-content;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(47, 104, 64, 0.14);
    background: rgba(47, 104, 64, 0.08);
    color: var(--accent-strong);
    font-weight: 800;
    cursor: pointer;
}

.picker-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.picker-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.meta-line,
.hint-line {
    min-height: 22px;
    color: var(--text-faint);
    line-height: 1.5;
}

.progress-line {
    min-height: 22px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(47, 104, 64, 0.09);
    color: var(--accent-strong);
    font-weight: 700;
    line-height: 1.45;
}

.progress-line::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 50%;
    border: 2px solid rgba(47, 104, 64, 0.25);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    vertical-align: -1px;
}

.series-state {
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 104, 64, 0.12), rgba(117, 145, 97, 0.08));
    color: var(--accent-strong);
    font-weight: 700;
    line-height: 1.5;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-button {
    padding: 12px 16px;
    background: rgba(47, 104, 64, 0.08);
    border-color: rgba(47, 104, 64, 0.14);
    color: var(--accent-strong);
    font-weight: 800;
}

.action-button--primary {
    background: linear-gradient(135deg, #467755, var(--accent));
    border-color: transparent;
    color: white;
}

.action-button--ghost {
    background: transparent;
}

.action-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.action-button.is-loading {
    position: relative;
    color: transparent;
}

.action-button.is-loading::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.help-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.help-tab {
    padding: 10px 12px;
    background: rgba(47, 104, 64, 0.08);
    border-color: rgba(47, 104, 64, 0.1);
    color: var(--accent-strong);
    font-weight: 700;
}

.help-tab.is-active {
    background: linear-gradient(135deg, #e6d3a2, #d7bc84);
    border-color: rgba(168, 104, 56, 0.18);
    color: #48311b;
}

.help-preview {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(47, 104, 64, 0.08);
}

.help-preview__title {
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.help-preview__value {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-strong);
}

.result-card__header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.result-card__eyebrow {
    margin: 0 0 6px;
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-card h2 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1.06;
}

.result-card__header p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.4;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-meta__item {
    min-width: 132px;
    padding: 10px 12px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(236, 241, 231, 0.66));
    border: 1px solid rgba(47, 104, 64, 0.1);
}

.result-meta__label {
    display: block;
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.result-meta__value {
    display: block;
    margin-top: 4px;
    color: var(--accent-strong);
    font-weight: 800;
    line-height: 1.35;
}

.result {
    margin-top: 14px;
    min-height: 170px;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(238, 243, 234, 0.68));
    border: 1px solid rgba(255, 255, 255, 0.55);
    line-height: 1.65;
    white-space: pre-line;
}

.result.is-loading {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(244, 239, 228, 0.96), rgba(255, 255, 255, 0.78));
    background-size: 220% 100%;
    animation: shimmer 1.5s linear infinite;
}

.result-card--active {
    outline: 2px solid rgba(168, 104, 56, 0.18);
}

.result p,
.result ul,
.result ol {
    margin: 0 0 14px;
}

.result a {
    color: var(--accent-strong);
}

.prediction-layout {
    display: grid;
    gap: 16px;
}

.prediction-grid {
    display: grid;
    gap: 12px;
}

.prediction-card {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 16px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(235, 241, 230, 0.72));
    border: 1px solid rgba(47, 104, 64, 0.1);
}

.prediction-card--featured {
    background: linear-gradient(135deg, rgba(244, 231, 201, 0.98), rgba(231, 239, 221, 0.96));
    border-color: rgba(168, 104, 56, 0.2);
}

.prediction-card__score {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(47, 104, 64, 0.14), rgba(47, 104, 64, 0.08));
    color: var(--accent-strong);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.prediction-card--featured .prediction-card__score {
    background: linear-gradient(180deg, rgba(168, 104, 56, 0.16), rgba(168, 104, 56, 0.08));
    color: #70401c;
}

.prediction-card__body {
    display: grid;
    gap: 6px;
    align-content: center;
}

.prediction-card__name {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.prediction-card__latin,
.series-section__content,
.prediction-warning {
    color: var(--text-soft);
}

.prediction-card__link a {
    font-weight: 700;
    text-decoration: none;
}

.prediction-card__link a:hover {
    text-decoration: underline;
}

.series-overview {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 104, 64, 0.12), rgba(132, 156, 103, 0.08));
    color: var(--accent-strong);
    font-weight: 700;
}

.series-section {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(238, 242, 233, 0.62));
    border: 1px solid rgba(47, 104, 64, 0.08);
}

.series-section h3 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 18px;
}

.prediction-warning {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(245, 235, 215, 0.98), rgba(239, 224, 201, 0.96));
    border: 1px solid rgba(168, 104, 56, 0.2);
    line-height: 1.65;
}

.tab-summary {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(238, 242, 233, 0.68));
    border: 1px solid rgba(47, 104, 64, 0.08);
}

.tab-summary h3 {
    margin: 0 0 10px;
    color: var(--accent-strong);
    font-size: 20px;
    line-height: 1.15;
}

.tab-summary p {
    margin: 0 0 10px;
    color: var(--text-soft);
    line-height: 1.6;
}

.tab-summary p:last-child {
    margin-bottom: 0;
}

.hidden {
    display: none;
}

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

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -20% 0;
    }
}

@media (max-width: 900px) {
    .app-header,
    .result-card__header,
    .panel-header {
        flex-direction: column;
    }

    .app-header__side {
        justify-items: start;
    }
}

@media (max-width: 768px) {
    .page-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 10px;
    }

    .app-header,
    .workspace-card,
    .result-card {
        padding: 16px;
    }

    .workspace-tabs {
        grid-template-columns: 1fr;
    }

    .panel-actions,
    .help-tabs,
    .panel-steps,
    .result-meta {
        flex-direction: column;
    }

    .workspace-tab,
    .help-tab,
    .action-button {
        width: 100%;
    }

    .prediction-card {
        grid-template-columns: 1fr;
    }

    .prediction-card__score {
        min-height: 56px;
    }
}
