:root {
    --bg: #f3ede2;
    --bg-accent: #ead8b8;
    --panel: rgba(255, 250, 240, 0.88);
    --panel-strong: #fffdf7;
    --text: #1f1c17;
    --muted: #6f655a;
    --line: rgba(31, 28, 23, 0.12);
    --brand: #ba4a00;
    --brand-deep: #7e2a00;
    --ok: #1f7a45;
    --error: #aa2e1a;
    --shadow: 0 20px 60px rgba(69, 43, 9, 0.12);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 32%),
        linear-gradient(135deg, var(--bg), var(--bg-accent));
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    width: 34vw;
    height: 34vw;
    border-radius: 50%;
    background: rgba(186, 74, 0, 0.08);
    filter: blur(6px);
    pointer-events: none;
}

body::before {
    top: -12vw;
    right: -10vw;
}

body::after {
    bottom: -14vw;
    left: -10vw;
}

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

.hero,
.panel,
.grid {
    animation: rise 480ms ease both;
}

.hero {
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--brand-deep);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 12px;
}

.hero h1,
.panel h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
}

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 0.95;
    max-width: 10ch;
}

.lede {
    margin: 18px 0 0;
    max-width: 52rem;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.panel {
    position: relative;
    margin-bottom: 20px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 6px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, var(--brand), #efb24b, #f8d58b);
}

.parser-form {
    display: grid;
    gap: 14px;
}

.field-label {
    font-size: 0.95rem;
    color: var(--muted);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.field-row input,
.field-row button {
    border-radius: 16px;
    border: 1px solid var(--line);
    font: inherit;
}

.field-row input {
    min-width: 0;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
}

.field-row input:focus {
    outline: 2px solid rgba(186, 74, 0, 0.2);
    border-color: rgba(186, 74, 0, 0.35);
}

.field-row button,
.action-link,
.action-button {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff8f2;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
    box-shadow: 0 12px 24px rgba(126, 42, 0, 0.22);
}

.field-row button {
    cursor: pointer;
}

.field-row button:hover,
.action-link:hover,
.action-button:hover {
    transform: translateY(-1px);
}

.field-row button:disabled {
    cursor: wait;
    opacity: 0.74;
}

.hint,
.result-message,
.meta-list,
.note p {
    color: var(--muted);
    line-height: 1.65;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.status {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 122, 69, 0.12);
    color: var(--ok);
    font-size: 0.9rem;
}

.status.error {
    background: rgba(170, 46, 26, 0.12);
    color: var(--error);
}

.result-content {
    display: grid;
    gap: 18px;
}

.result-card {
    display: grid;
    grid-template-columns: minmax(0, 260px) 1fr;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel-strong);
}

.preview {
    min-height: 220px;
    border-radius: 16px;
    overflow: hidden;
    background: #ddd0bb;
}

.preview img,
.preview video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-main h3 {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
}

.meta-list {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.meta-list li + li {
    margin-top: 8px;
}

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

.ghost-link,
.ghost-button {
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.72);
}

.action-button,
.ghost-button {
    font: inherit;
    cursor: pointer;
}

.action-button {
    border: 0;
}

.history-panel {
    margin-top: 12px;
}

.history-list {
    display: grid;
    gap: 14px;
}

.history-item {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
}

.history-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.history-item h3 {
    margin: 0;
    font-size: 1.05rem;
    font-family: Georgia, "Times New Roman", serif;
}

.history-url {
    word-break: break-all;
    color: var(--muted);
    font-size: 0.95rem;
}

.history-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

.note pre {
    margin: 0;
    padding: 16px;
    overflow: auto;
    border-radius: 16px;
    background: #1f1c17;
    color: #f8e8d5;
}

code,
pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 980px);
        padding-top: 32px;
    }

    .field-row,
    .result-card,
    .grid {
        grid-template-columns: 1fr;
    }

    .field-row button,
    .action-link,
    .ghost-link,
    .action-button,
    .ghost-button {
        width: 100%;
        text-align: center;
    }

    .history-item-head {
        flex-direction: column;
    }
}
