:root,
[data-theme="dark"] {
    color-scheme: dark;
    --bg-deep: #080b10;
    --bg-panel: #111820;
    --bg-surface: #161e2a;
    --bg-elevated: #1c2636;
    --bg-input: #0d1219;
    --bg-tool: #1a2433;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #eef2f7;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --code-text: #c8d4e4;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-deep: #14b8a6;
    --accent-glow: rgba(45, 212, 191, 0.2);
    --header-accent: #f43f5e;
    --payload-accent: #c084fc;
    --signature-accent: #38bdf8;
    --page-glow-1: rgba(45, 212, 191, 0.08);
    --page-glow-2: rgba(192, 132, 252, 0.06);
    --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    --shadow-tool: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-strong);
}

[data-theme="light"] {
    color-scheme: light;
    --bg-deep: #e2e8f0;
    --bg-panel: #ffffff;
    --bg-surface: #f8fafc;
    --bg-elevated: #f1f5f9;
    --bg-input: #f1f5f9;
    --bg-tool: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.12);
    --text: #0f172a;
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --code-text: #334155;
    --accent: #0d9488;
    --accent-hover: #14b8a6;
    --accent-deep: #0f766e;
    --accent-glow: rgba(13, 148, 136, 0.15);
    --header-accent: #e11d48;
    --payload-accent: #7c3aed;
    --signature-accent: #0284c7;
    --page-glow-1: rgba(13, 148, 136, 0.1);
    --page-glow-2: rgba(124, 58, 237, 0.06);
    --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-tool: 0 20px 40px rgba(15, 23, 42, 0.1), 0 0 0 1px var(--border);
}

:root {
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font-sans: "Plus Jakarta Sans", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", Consolas, monospace;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 60% 45% at 15% 0%, var(--page-glow-1), transparent 55%),
        radial-gradient(ellipse 50% 40% at 85% 20%, var(--page-glow-2), transparent 50%),
        var(--bg-deep);
}

.page-shell {
    width: min(1720px, 98vw);
    max-width: none;
    margin: 0 auto;
    padding: 16px 12px 20px;
}

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

.site-eyebrow {
    margin: 0 0 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.site-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.site-lead {
    margin: 0 0 14px;
    max-width: 520px;
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feature-pills li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-panel);
}

.pill-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.mode-toggle {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-faint);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.mode-btn svg {
    width: 15px;
    height: 15px;
}

.mode-btn:hover {
    color: var(--text-muted);
}

.mode-btn[aria-pressed="true"] {
    color: var(--text);
    background: var(--bg-elevated);
}

.ad-slot {
    flex: 0 0 auto;
    display: flex;
    position: relative;
    flex-direction: column;
    align-items: stretch;
    width: 300px;
    min-height: 278px;
    padding: 6px 8px;
    background: var(--bg-panel);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    overflow: visible;
}

.ad-label {
    margin: 0 0 4px;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    text-align: center;
    flex-shrink: 0;
}

.col-ads {
    position: sticky;
    top: 16px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
}

.ads-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    width: 100%;
    min-height: auto;
}

.ad-slot ins.adsbygoogle {
    display: inline-block;
    flex: 1 1 auto;
    width: 300px;
    height: 250px;
    min-width: 0;
    min-height: 250px;
    max-height: none;
    margin: 0 auto;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.ad-slot.ad-unfilled:not(.is-filled) ins.adsbygoogle {
    background: var(--bg-input);
    border-radius: 8px;
    opacity: 0;
}

.ad-slot.is-filled ins.adsbygoogle {
    opacity: 1;
}

[data-ads-dev="true"] .ad-slot.ad-unfilled:not(.is-filled),
.ad-slot.ad-unfilled:not(.is-filled) {
    align-items: stretch;
    justify-content: flex-start;
}

[data-ads-dev="true"] .ad-slot.ad-unfilled::after,
.ad-slot.ad-unfilled:not(.is-filled)::after {
    content: "Ad space 300 x 250";
    position: absolute;
    top: 34px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-faint);
    opacity: 0.45;
    pointer-events: none;
}

.ad-slot.is-filled .ad-label {
    display: none;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(320px, 1fr) minmax(0, 220px) minmax(300px, 320px);
    gap: 12px;
    align-items: stretch;
    min-height: calc(100vh - 150px);
}

.col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.col-center {
    min-width: 0;
}

.col-left .panel:last-child,
.col-right .panel:last-child {
    flex: 1;
}

.panel {
    padding: 12px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel);
}

.panel--accent {
    border-color: rgba(45, 212, 191, 0.35);
    background: var(--bg-elevated);
}

[data-theme="light"] .panel--accent {
    border-color: rgba(13, 148, 136, 0.35);
}

.panel-title {
    margin: 0 0 12px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
}

.panel-note,
.panel-foot {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: var(--text-faint);
    line-height: 1.45;
}

.panel-foot kbd {
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.steps-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.steps-list li:last-child {
    margin-bottom: 0;
}

.steps-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(45, 212, 191, 0.12);
    border-radius: 50%;
}

.steps-list li span {
    font-weight: 700;
    color: var(--text);
}

.steps-list code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--payload-accent);
}

.algo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.algo-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.algo-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.algo-desc {
    font-size: 0.68rem;
    color: var(--text-faint);
    line-height: 1.35;
}

.token-parts {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
}

.token-sep {
    display: none;
}

.token-part {
    padding: 6px 10px;
    border-radius: 5px;
    text-align: center;
    width: 100%;
}

.token-part--header {
    background: rgba(244, 63, 94, 0.15);
    color: var(--header-accent);
}

.token-part--payload {
    background: rgba(192, 132, 252, 0.15);
    color: var(--payload-accent);
}

.token-part--sig {
    background: rgba(56, 189, 248, 0.12);
    color: var(--signature-accent);
}

.token-sep {
    color: var(--text-faint);
}

.tool-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--bg-tool);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-tool);
    padding: 18px 20px 20px;
}

.tool-card-top {
    margin-bottom: 14px;
    flex-shrink: 0;
}

.input-panel {
    flex-shrink: 0;
}

.tool-badge {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.tool-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.input-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.input-label-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.text-btn {
    padding: 0;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-btn:hover {
    color: var(--accent-hover);
}

textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
}

textarea::placeholder {
    color: var(--text-faint);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #042f2e;
}

[data-theme="light"] .btn-primary {
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    flex: 1;
    min-height: 0;
    animation: fadeUp 0.3s ease;
}

@media (min-width: 1100px) {
    .results {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: auto 1fr;
        align-content: stretch;
    }

    .results-toolbar {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }

    .result-card {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    .result-card .code-block {
        flex: 1;
        max-height: none;
        min-height: 140px;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.results-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.result-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.result-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.result-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.result-card--header .result-dot {
    background: var(--header-accent);
}

.result-card--payload .result-dot {
    background: var(--payload-accent);
}

.result-card--signature .result-dot {
    background: var(--signature-accent);
}

.result-card h3 {
    margin: 0;
    flex: 1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.result-badge {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-faint);
}

.code-block {
    margin: 0;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--code-text);
    background: var(--bg-input);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 140px;
    overflow-y: auto;
}

.code-block--mono {
    color: var(--signature-accent);
}

.code-block.is-error {
    color: #f87171;
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    min-height: 140px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
}

.empty-state-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
}

.empty-icon {
    width: 32px;
    height: 32px;
    color: var(--text-faint);
    opacity: 0.7;
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-faint);
    max-width: 300px;
}

.empty-state[hidden],
.results[hidden] {
    display: none;
}

.claim-hints {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.claim-hints-placeholder {
    margin: 0;
}

.claim-hints code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
}

.claim-hint-row {
    display: block;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.claim-hint-row:last-child {
    border-bottom: none;
}

.claim-hint-row strong {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
}

.panel-accordion {
    padding: 0;
    overflow: hidden;
}

.panel-accordion__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    cursor: pointer;
    list-style: none;
}

.panel-accordion__summary::-webkit-details-marker {
    display: none;
}

.panel-accordion__summary::after {
    content: "+";
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-faint);
}

.panel-accordion[open] .panel-accordion__summary::after {
    content: "−";
}

.claims-inner {
    margin: 0;
    padding: 0 14px 12px;
    list-style: none;
    border-top: 1px solid var(--border);
}

.claims-inner li {
    padding: 8px 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    border-bottom: 1px solid var(--border);
}

.claims-inner li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.claims-inner code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--payload-accent);
    margin-right: 6px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    overflow: hidden;
}

.faq-item summary {
    padding: 10px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    float: right;
    color: var(--text-faint);
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-item p {
    margin: 0;
    padding: 0 12px 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.faq-item code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
}

.tips-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.tips-list li {
    margin-bottom: 8px;
}

.tips-list li:last-child {
    margin-bottom: 0;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #042f2e;
    background: var(--accent);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 100;
    pointer-events: none;
}

[data-theme="light"] .toast {
    color: #fff;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 1200px) {
    .dashboard {
        grid-template-columns: minmax(0, 200px) minmax(0, 1fr) minmax(0, 200px) minmax(280px, 300px);
    }
}

@media (max-width: 1024px) {
    .dashboard {
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
    }

    .col-center {
        order: 1;
    }

    .col-left {
        order: 2;
    }

    .col-right {
        order: 3;
    }

    .col-ads {
        order: 4;
        position: static;
        align-self: stretch;
        height: auto;
    }

    .col {
        max-height: none;
        overflow: visible;
    }

    .tool-card {
        min-height: auto;
    }

    .col-left .panel:last-child,
    .col-right .panel:last-child {
        flex: none;
    }

    .ads-rail {
        min-height: auto;
        height: auto;
    }

    .ad-slot {
        flex: none;
        width: 100%;
        min-height: 180px;
    }

    .ad-slot ins.adsbygoogle {
        min-width: 0;
        width: 100%;
        height: auto;
        min-height: 180px;
    }
}

@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
    }

    .mode-toggle {
        align-self: flex-start;
    }

    .col-ads {
        position: static;
    }

    .ads-rail {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        min-height: 200px;
        height: auto;
    }

    .ads-rail .ad-slot {
        flex: none;
        min-height: 120px;
    }

    .ads-rail .ad-slot ins.adsbygoogle {
        min-width: 0;
        width: 100%;
        height: auto;
        min-height: 120px;
    }

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

@media (max-width: 480px) {
    .page-shell {
        padding: 16px 12px 28px;
    }

    .mode-label {
        display: none;
    }

    .input-actions {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
    }

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