:root {
    --hx-bg: linear-gradient(155deg, #071626, #0f2f2e 45%, #1f2937);
    --hx-shell: rgba(7, 26, 33, 0.86);
    --hx-surface: rgba(15, 30, 39, 0.78);
    --hx-text: #f8fafc;
    --hx-muted: rgba(226, 232, 240, 0.7);
    --hx-border: rgba(148, 163, 184, 0.24);
    --hx-accent: #14b8a6;
    --hx-accent-soft: rgba(20, 184, 166, 0.18);
    --hx-accent-strong: #f59e0b;
    --hx-code-bg: rgba(15, 23, 42, 0.7);
    --hx-code-text: #e2e8f0;
    --hx-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
    --hx-pattern: radial-gradient(circle at 12% 18%, rgba(20, 184, 166, 0.18), transparent 40%),
        radial-gradient(circle at 80% 10%, rgba(245, 158, 11, 0.15), transparent 45%);
    --bg: var(--hx-bg);
    --surface: var(--hx-surface);
    --text: var(--hx-text);
    --text-muted: var(--hx-muted);
    --accent: var(--hx-accent);
    --accent-soft: var(--hx-accent-soft);
}

:root[data-theme="light"] {
    --hx-bg: linear-gradient(155deg, #fef7ed, #f8fafc 45%, #e2f5f1);
    --hx-shell: rgba(255, 255, 255, 0.92);
    --hx-surface: rgba(248, 250, 252, 0.96);
    --hx-text: #0f172a;
    --hx-muted: rgba(30, 41, 59, 0.65);
    --hx-border: rgba(148, 163, 184, 0.35);
    --hx-accent: #0d9488;
    --hx-accent-soft: rgba(13, 148, 136, 0.16);
    --hx-accent-strong: #b45309;
    --hx-code-bg: rgba(226, 232, 240, 0.7);
    --hx-code-text: #1e293b;
    --hx-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
    --hx-pattern: radial-gradient(circle at 18% 20%, rgba(13, 148, 136, 0.16), transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(180, 83, 9, 0.12), transparent 45%);
    --bg: var(--hx-bg);
    --surface: var(--hx-surface);
    --text: var(--hx-text);
    --text-muted: var(--hx-muted);
    --accent: var(--hx-accent);
    --accent-soft: var(--hx-accent-soft);
}

body {
    background: var(--hx-bg);
}

.app-main {
    background: var(--hx-shell);
    border: 1px solid var(--hx-border);
    box-shadow: var(--hx-shadow);
}

:root[data-theme="light"] .app-main {
    background: rgb(0 0 0 / 40%);
}

.helperx {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 2rem;
    animation: helperx-rise 0.6s ease both;
}

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

.helperx__hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem;
    border-radius: 1.5rem;
    background: var(--hx-surface);
    border: 1px solid var(--hx-border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    background-image: var(--hx-pattern);
}

.helperx__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hx-accent);
    margin: 0 0 0.5rem;
}

.helperx__title {
    margin: 0 0 0.4rem;
    font-size: clamp(1.8rem, 2.6vw, 2.6rem);
}

.helperx__subtitle {
    margin: 0;
    color: var(--hx-muted);
    max-width: 36rem;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.25);
    border: 1px solid var(--hx-border);
    color: var(--hx-text);
    font-weight: 600;
}

:root[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.7);
}

.theme-toggle__label {
    font-size: 0.85rem;
}

.theme-toggle input {
    appearance: none;
    width: 2.4rem;
    height: 1.25rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(15, 23, 42, 0.2);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle input::after {
    content: "";
    position: absolute;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 50%;
    background: #ffffff;
    top: 0.12rem;
    left: 0.12rem;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.theme-toggle input:checked {
    background: var(--hx-accent);
    border-color: var(--hx-accent);
}

.theme-toggle input:checked::after {
    transform: translateX(1.05rem);
}

.helperx__controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    align-items: end;
    padding: 1.25rem;
    border-radius: 1.5rem;
    background: var(--hx-surface);
    border: 1px solid var(--hx-border);
}

.helperx__field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--hx-text);
}

.helperx__field select {
    appearance: none;
    border-radius: 0.85rem;
    padding: 0.65rem 0.85rem;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--hx-border);
    color: var(--hx-text);
    font-size: 0.95rem;
}

:root[data-theme="light"] .helperx__field select {
    background: rgba(255, 255, 255, 0.95);
}

.helperx__button {
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    color: #ffffff;
    background: rgb(0 0 0 / 40%);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.helperx__button:hover {
    transform: translateY(-1px);
    background: rgb(0 0 0 / 55%);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}

.helperx__button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.helperx__button--ghost {
    background: transparent;
    color: var(--hx-text);
    border: 1px solid var(--hx-border);
    box-shadow: none;
}

.helperx__button--ghost:hover {
    background: rgba(15, 23, 42, 0.18);
    box-shadow: none;
}

.hx-collapse {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.helperx__options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.helperx__option {
    padding: 1.25rem;
    border-radius: 1.5rem;
    background: var(--hx-surface);
    border: 1px solid var(--hx-border);
}

.helperx__option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.helperx__option-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.helperx__option-title {
    margin: 0;
    font-size: 1.3rem;
}

.helperx__option-meta {
    margin: 0.4rem 0 0;
    color: var(--hx-muted);
}

.helperx__option-tag {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--hx-border);
    color: var(--hx-accent);
    background: rgba(15, 23, 42, 0.2);
}

.helperx__option-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hx-tabs__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: flex-end;
    justify-content: space-between;
}

.hx-search {
    flex: 1;
    min-width: 220px;
}

.helperx__field input[type="search"] {
    appearance: none;
    border-radius: 0.85rem;
    padding: 0.65rem 0.85rem;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--hx-border);
    color: var(--hx-text);
    font-size: 0.95rem;
}

:root[data-theme="light"] .helperx__field input[type="search"] {
    background: rgba(255, 255, 255, 0.95);
}

.helperx__note {
    margin: 0;
    color: var(--hx-muted);
    font-size: 0.9rem;
}

.hx-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hx-tab {
    border: 1px solid var(--hx-border);
    background: rgba(15, 23, 42, 0.25);
    color: var(--hx-text);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.hx-tab.is-active {
    background: var(--hx-accent);
    border-color: var(--hx-accent);
    color: #0f172a;
}

:root[data-theme="light"] .hx-tab.is-active {
    color: #ffffff;
}

.hx-tab__progress {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.hx-tabs__panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hx-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.hx-search-list {
    display: grid;
    gap: 0.6rem;
}

.hx-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid var(--hx-border);
}

:root[data-theme="light"] .hx-search-item {
    background: rgba(255, 255, 255, 0.8);
}

.hx-search-item__info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.hx-search-item__name {
    font-weight: 600;
}

.hx-search-item__phase {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hx-muted);
}

.hx-search-item__load {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.hx-tabs.is-collapsed .hx-tabs__panel {
    display: none;
}

.hx-readme-list {
    display: grid;
    gap: 0.75rem;
}

.hx-readme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid var(--hx-border);
}

:root[data-theme="light"] .hx-readme {
    background: rgba(255, 255, 255, 0.75);
}

.hx-readme.is-done {
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.hx-readme__label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    font-weight: 600;
}

.hx-readme__check {
    width: 1rem;
    height: 1rem;
    accent-color: var(--hx-accent);
}

.hx-readme__status {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hx-muted);
    margin-left: auto;
}

.hx-readme__load {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.helperx__status {
    padding: 0.85rem 1.1rem;
    border-radius: 1rem;
    background: var(--hx-surface);
    border: 1px solid var(--hx-border);
    color: var(--hx-muted);
    font-size: 0.9rem;
    border-left: 4px solid var(--hx-accent);
}

.helperx__status[data-status="error"] {
    border-left-color: #f97316;
    color: #fdba74;
}

.helperx__status[data-status="success"] {
    border-left-color: #22c55e;
    color: #86efac;
}

:root[data-theme="light"] .helperx__status[data-status="error"] {
    color: #c2410c;
}

:root[data-theme="light"] .helperx__status[data-status="success"] {
    color: #15803d;
}

.markdown-output {
    position: relative;
    border-radius: 1.5rem;
    padding: 1.75rem;
    min-height: 280px;
    background: var(--hx-surface);
    border: 1px solid var(--hx-border);
    overflow: hidden;
}

.markdown-output__empty {
    text-align: center;
    color: var(--hx-muted);
    padding: 2rem 1rem;
}

.markdown-output__empty strong {
    display: block;
    font-size: 1.05rem;
    color: var(--hx-text);
    margin-bottom: 0.3rem;
}

.markdown-output__body {
    max-width: 840px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.7;
}

.markdown-output.is-loaded .markdown-output__empty {
    display: none;
}

.markdown-output h1,
.markdown-output h2,
.markdown-output h3,
.markdown-output h4 {
    margin: 1.8rem 0 0.6rem;
    line-height: 1.3;
}

.markdown-output h1 {
    font-size: 2rem;
}

.markdown-output h2 {
    font-size: 1.5rem;
}

.markdown-output h3 {
    font-size: 1.25rem;
}

.markdown-output p {
    margin: 0 0 1rem;
    color: var(--hx-text);
}

.markdown-output ul,
.markdown-output ol {
    padding-left: 1.3rem;
    margin: 0 0 1rem;
}

.markdown-output li {
    margin-bottom: 0.45rem;
}

.markdown-output a {
    color: var(--hx-accent);
    text-decoration: none;
}

.markdown-output a:hover {
    text-decoration: underline;
}

.markdown-output blockquote {
    margin: 1.2rem 0;
    padding: 0.9rem 1.1rem;
    border-left: 4px solid var(--hx-accent);
    background: rgba(15, 23, 42, 0.2);
    color: var(--hx-muted);
    border-radius: 0.8rem;
}

:root[data-theme="light"] .markdown-output blockquote {
    background: rgba(226, 232, 240, 0.6);
}

.markdown-output pre {
    background: var(--hx-code-bg);
    color: var(--hx-code-text);
    padding: 1rem 1.1rem;
    border-radius: 0.9rem;
    overflow-x: auto;
    border: 1px solid var(--hx-border);
}

.markdown-output code {
    font-family: "Cascadia Code", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.92rem;
}

.markdown-output :not(pre) > code {
    background: var(--hx-code-bg);
    padding: 0.15rem 0.35rem;
    border-radius: 0.4rem;
}

.markdown-output img {
    max-width: 100%;
    border-radius: 0.85rem;
    border: 1px solid var(--hx-border);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
}

.markdown-output table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: 0.95rem;
}

.markdown-output th,
.markdown-output td {
    text-align: left;
    padding: 0.6rem;
    border-bottom: 1px solid var(--hx-border);
}

.helperx__noscript {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.8rem;
    border: 1px solid var(--hx-border);
    background: var(--hx-surface);
    color: var(--hx-muted);
}

@media (max-width: 640px) {
    .helperx__hero {
        padding: 1.4rem;
    }

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

    .theme-toggle {
        width: 100%;
        justify-content: space-between;
    }
}
