:root {
    --bg: #07111f;
    --bg-soft: rgba(7, 17, 31, 0.72);
    --panel: rgba(9, 18, 36, 0.78);
    --panel-edge: rgba(255, 255, 255, 0.09);
    --text: #f3f6fb;
    --muted: #9baaca;
    --accent: #6ee7b7;
    --accent-strong: #22c55e;
    --danger: #fb7185;
    --warning: #facc15;
    --info: #60a5fa;
    --idle: #7dd3fc;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-main: "Bahnschrift", "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), transparent 34%),
        radial-gradient(circle at right center, rgba(56, 189, 248, 0.18), transparent 28%),
        linear-gradient(145deg, #08101d 0%, #0a1324 52%, #050a14 100%);
}

button,
input,
textarea {
    font: inherit;
}

.scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.54;
    animation: drift 12s ease-in-out infinite alternate;
}

.orb-a {
    width: 320px;
    height: 320px;
    background: rgba(34, 197, 94, 0.14);
    top: -80px;
    left: -60px;
}

.orb-b {
    width: 280px;
    height: 280px;
    background: rgba(59, 130, 246, 0.14);
    right: -40px;
    bottom: -20px;
    animation-duration: 14s;
}

.grid-glow {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 90%);
    opacity: 0.35;
}

.shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.panel {
    position: relative;
    width: min(100%, 960px);
    min-height: min(720px, calc(100dvh - 40px));
    padding: clamp(18px, 3vw, 28px);
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 18px;
    background: linear-gradient(180deg, rgba(14, 27, 51, 0.94), rgba(8, 15, 31, 0.9));
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    animation: rise 0.7s ease-out;
}

.panel::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: calc(var(--radius-xl) - 1px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.panel__head h1 {
    margin: 8px 0 8px;
    font-size: clamp(1.75rem, 4vw, 3.2rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

.panel__head p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(0.96rem, 2vw, 1.06rem);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    color: #dffcf0;
    background: rgba(110, 231, 183, 0.08);
    border: 1px solid rgba(110, 231, 183, 0.16);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
}

.badge {
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 999px;
    color: #c8d6f2;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.16);
    font-size: 0.85rem;
}

.mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-switch__item {
    height: 52px;
    border: 0;
    border-radius: 16px;
    padding: 0 16px;
    color: #d8e3f9;
    background: transparent;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mode-switch__item:hover {
    transform: translateY(-1px);
}

.mode-switch__item.is-active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.84));
    color: #04110b;
    box-shadow: 0 16px 36px rgba(16, 185, 129, 0.24);
}

.workspace {
    position: relative;
    display: grid;
}

.pane {
    display: none;
    min-height: 0;
}

.pane.is-active {
    display: block;
    animation: pane-in 0.35s ease;
}

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

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

.field {
    display: grid;
    gap: 8px;
}

.field__label {
    font-size: 0.88rem;
    color: #dce6fb;
    letter-spacing: 0.04em;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    outline: none;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.field input:focus,
.field textarea:focus {
    border-color: rgba(96, 165, 250, 0.6);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.field input::placeholder,
.field textarea::placeholder {
    color: rgba(203, 213, 225, 0.42);
}

.field textarea {
    min-height: 128px;
    resize: none;
}

.primary-button {
    height: 54px;
    border: 0;
    border-radius: 18px;
    color: #08111c;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #f8fafc, #c7d2fe 52%, #86efac 100%);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 18px 36px rgba(134, 239, 172, 0.18);
}

.primary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.result-zone {
    display: flex;
    align-items: flex-end;
}

.result-card {
    width: 100%;
    min-height: 116px;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 16px;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.result-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.result-card p {
    margin: 0;
    color: #e2e8f0;
    line-height: 1.45;
}

.result-card__body {
    min-width: 0;
}

.result-card__meta {
    margin-top: 10px;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.9rem;
}

.result-card__icon {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.result-card__icon::before,
.result-card__icon::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
}

.result-card--idle {
    border-color: rgba(125, 211, 252, 0.22);
    background: rgba(125, 211, 252, 0.08);
}

.result-card--idle .result-card__icon {
    background: rgba(125, 211, 252, 0.18);
}

.result-card--idle .result-card__icon::before {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 3px solid rgba(7, 17, 31, 0.3);
    background: var(--idle);
}

.result-card--available {
    border-color: rgba(110, 231, 183, 0.28);
    background: rgba(34, 197, 94, 0.11);
}

.result-card--available .result-card__icon,
.result-card--completed .result-card__icon {
    background: rgba(34, 197, 94, 0.18);
}

.result-card--available .result-card__icon::before,
.result-card--completed .result-card__icon::before {
    width: 22px;
    height: 11px;
    border-left: 4px solid #d9f99d;
    border-bottom: 4px solid #d9f99d;
    transform: rotate(-45deg);
    top: -6px;
}

.result-card--completed {
    border-color: rgba(110, 231, 183, 0.28);
    background: rgba(16, 185, 129, 0.12);
}

.result-card--processing {
    border-color: rgba(96, 165, 250, 0.28);
    background: rgba(59, 130, 246, 0.1);
}

.result-card--processing .result-card__icon {
    background: rgba(59, 130, 246, 0.18);
}

.result-card--processing .result-card__icon::before {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 3px solid rgba(147, 197, 253, 0.26);
    border-top-color: #bfdbfe;
    animation: spin 0.85s linear infinite;
}

.result-card--used,
.result-card--invalid,
.result-card--invalid_json,
.result-card--error {
    border-color: rgba(251, 113, 133, 0.28);
    background: rgba(244, 63, 94, 0.1);
}

.result-card--used .result-card__icon,
.result-card--invalid .result-card__icon,
.result-card--invalid_json .result-card__icon,
.result-card--error .result-card__icon {
    background: rgba(251, 113, 133, 0.16);
}

.result-card--used .result-card__icon::before,
.result-card--invalid .result-card__icon::before,
.result-card--invalid_json .result-card__icon::before,
.result-card--error .result-card__icon::before {
    width: 22px;
    height: 4px;
    background: #fecdd3;
    border-radius: 999px;
    transform: rotate(45deg);
}

.result-card--used .result-card__icon::after,
.result-card--invalid .result-card__icon::after,
.result-card--invalid_json .result-card__icon::after,
.result-card--error .result-card__icon::after {
    width: 22px;
    height: 4px;
    background: #fecdd3;
    border-radius: 999px;
    transform: rotate(-45deg);
}

.result-card--warning {
    border-color: rgba(250, 204, 21, 0.3);
    background: rgba(234, 179, 8, 0.12);
}

.result-card--warning .result-card__icon {
    background: rgba(250, 204, 21, 0.16);
}

.result-card--warning .result-card__icon::before {
    width: 6px;
    height: 18px;
    top: -6px;
    border-radius: 999px;
    background: #fef08a;
}

.result-card--warning .result-card__icon::after {
    width: 6px;
    height: 6px;
    bottom: 12px;
    border-radius: 999px;
    background: #fef08a;
}

code.inline-code {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    color: #dffcf0;
    background: rgba(255, 255, 255, 0.08);
}

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

@keyframes pane-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(24px, 18px, 0) scale(1.08);
    }
}

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

@media (max-width: 780px) {
    .shell {
        padding: 14px;
    }

    .panel {
        min-height: calc(100dvh - 28px);
        gap: 14px;
    }

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

    .badge {
        font-size: 0.78rem;
    }

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

    .field textarea {
        min-height: 108px;
    }
}

@media (max-width: 560px) {
    .panel {
        padding: 16px;
        border-radius: 24px;
    }

    .panel__head h1 {
        font-size: clamp(1.45rem, 9vw, 2.25rem);
    }

    .mode-switch__item {
        height: 48px;
        font-size: 0.82rem;
    }

    .field input,
    .field textarea,
    .primary-button {
        padding-top: 13px;
        padding-bottom: 13px;
    }

    .result-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 12px;
        min-height: 110px;
        padding: 16px;
    }

    .result-card__icon {
        width: 46px;
        height: 46px;
        border-radius: 15px;
    }
}

@media (max-height: 760px) {
    .panel {
        min-height: calc(100dvh - 24px);
        gap: 12px;
    }

    .panel__head h1 {
        margin: 6px 0;
    }

    .field textarea {
        min-height: 88px;
    }

    .result-card {
        min-height: 98px;
        padding: 15px;
    }
}
