:root {
    color-scheme: light;
    --ink: #0f172a;
    --subtle: #475569;
    --line: rgba(148, 163, 184, 0.24);
    --panel: rgba(255, 255, 255, 0.78);
    --panel-strong: rgba(255, 255, 255, 0.92);
    --accent: #0ea5e9;
    --accent-dark: #0369a1;
    --good: #15803d;
    --warn: #b45309;
    --bad: #b91c1c;
    --radius: 22px;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

html { scroll-behavior: smooth; }
body.site-body {
    min-height: 100vh;
    margin: 0;
    font-family: Aptos, "Segoe UI", Tahoma, system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, rgba(14, 165, 233, 0.18), transparent 28rem),
        radial-gradient(circle at 90% 0%, rgba(249, 115, 22, 0.12), transparent 24rem),
        linear-gradient(180deg, #f8fbff 0%, #eff6ff 45%, #f8fafc 100%);
}
.background-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}
.background-orb-a { width: 18rem; height: 18rem; top: 8rem; right: -4rem; background: rgba(56, 189, 248, 0.22); }
.background-orb-b { width: 20rem; height: 20rem; bottom: 2rem; left: -5rem; background: rgba(59, 130, 246, 0.12); }
.site-header, .site-main, .site-footer { position: relative; z-index: 1; }
.site-header { padding-top: 1rem; }
.nav-shell, .hero-shell, .tool-panel, .tool-action-panel, .category-section, .footer-shell {
    backdrop-filter: blur(18px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: calc(var(--radius) - 4px);
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    font-family: "Trebuchet MS", Aptos, "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--ink);
}
.brand-mark::before {
    content: "";
    width: .85rem;
    height: .85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #fb7185);
    box-shadow: 0 0 0 .28rem rgba(14, 165, 233, 0.14);
}
.nav-menu { display: flex; flex-wrap: wrap; gap: .45rem; }
.nav-link, .nav-toggle {
    text-decoration: none;
    color: var(--subtle);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .55rem .9rem;
    font-size: .95rem;
    transition: .2s ease;
}
.nav-link:hover, .nav-toggle:hover { color: var(--ink); border-color: rgba(14, 165, 233, .18); background: rgba(255, 255, 255, .65); }
.nav-toggle { display: none; background: rgba(255, 255, 255, .72); }
.site-main { padding-bottom: 2rem; }
.hero-shell, .category-section {
    border-radius: var(--radius);
    padding: 1.5rem;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr);
    gap: 1.4rem;
    align-items: start;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .85rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-dark);
}
.hero-title, .section-title, .panel-title, .tool-card-title {
    margin: 0;
    font-family: "Trebuchet MS", Aptos, "Segoe UI", system-ui, sans-serif;
    letter-spacing: -.02em;
}
.hero-title { font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; }
.hero-copy, .panel-copy, .section-copy, .tool-card-copy, .tool-card-meta, .footer-copy, .tool-hint-copy { color: var(--subtle); line-height: 1.7; }
.hero-search { margin-top: 1.2rem; max-width: 38rem; }
.hero-badges, .action-stack { display: flex; flex-wrap: wrap; gap: .7rem; }
.hero-badges { margin-top: 1rem; }
.hero-badge, .card-badge, .section-count, .badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .75rem;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(14, 165, 233, .16);
}
.hero-side-note, .tool-hint {
    padding: 1.1rem 1.15rem;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.65));
    border: 1px solid rgba(148, 163, 184, .18);
}
.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 13rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.tool-panel, .tool-action-panel {
    border-radius: var(--radius);
    padding: 1.2rem;
}
.panel-header { margin-bottom: 1rem; }
.panel-kicker {
    margin: 0 0 .4rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 700;
    color: var(--accent-dark);
}
.panel-title { font-size: 1.35rem; }
.field-block { display: grid; gap: .45rem; margin-bottom: 1rem; }
.field-label { font-weight: 600; color: var(--ink); }
.field-help { margin: 0; font-size: .86rem; color: var(--subtle); }
.field-checkbox { display: inline-flex; align-items: center; gap: .7rem; font-weight: 600; }
.field-checkbox input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.tool-input, .tool-select, .tool-textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: var(--panel-strong);
    color: var(--ink);
    padding: .95rem 1rem;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.tool-input:focus, .tool-select:focus, .tool-textarea:focus { border-color: rgba(14, 165, 233, .45); box-shadow: 0 0 0 .28rem rgba(14, 165, 233, .12); }
.tool-textarea { min-height: 10rem; resize: vertical; }
.tool-output-textarea { background: rgba(248, 250, 252, .95); }
.tool-html-output, .tool-preview-output, .tool-svg-output, .tool-code-output {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, .2);
    background: rgba(248, 250, 252, .95);
    min-height: 11rem;
    padding: 1rem;
    overflow: auto;
}
.tool-code-output { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, monospace; }
.tool-svg-output svg { width: 100%; height: auto; display: block; }
.tool-preview-output img, .tool-preview-output canvas { margin: 0 auto; display: block; }
.action-stack { flex-direction: column; }
.action-button {
    width: 100%;
    border-radius: 16px;
    border: 1px solid transparent;
    padding: .88rem 1rem;
    font-weight: 700;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.action-button:hover { transform: translateY(-1px); }
.action-button-primary { background: linear-gradient(135deg, var(--accent), #2563eb); color: #fff; box-shadow: 0 12px 30px rgba(37, 99, 235, .25); }
.action-button-secondary { background: rgba(255,255,255,.84); color: var(--ink); border-color: rgba(148, 163, 184, .25); }
.action-button-ghost { background: transparent; color: var(--subtle); border-color: rgba(148, 163, 184, .18); }
.tool-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}
.section-head, .tool-card-top, .footer-shell { display: flex; justify-content: space-between; gap: 1rem; }
.section-head { align-items: end; margin-bottom: 1rem; }
.tool-card {
    display: grid;
    gap: .8rem;
    border-radius: 20px;
    padding: 1.1rem;
    background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.64));
    border: 1px solid rgba(148, 163, 184, .18);
    text-decoration: none;
    color: inherit;
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(14, 165, 233, .28); box-shadow: 0 20px 40px rgba(15, 23, 42, .10); }
.card-link { font-weight: 700; color: var(--accent-dark); }
.tool-card-meta { font-size: .92rem; }
.footer-shell { align-items: center; border-radius: var(--radius); padding: 1.4rem; }
.footer-title { margin: 0 0 .35rem; font-family: "Trebuchet MS", Aptos, "Segoe UI", system-ui, sans-serif; font-size: 1.2rem; font-weight: 700; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .75rem; margin-bottom: .9rem; }
.metric-card { padding: .85rem; border-radius: 16px; border: 1px solid rgba(148, 163, 184, .16); background: rgba(255,255,255,.86); }
.metric-card span { display: block; color: var(--subtle); font-size: .82rem; margin-bottom: .25rem; }
.metric-card strong { font-size: 1rem; }
.callout { border-radius: 16px; padding: .9rem 1rem; border: 1px solid transparent; margin-top: .8rem; }
.callout-good { background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .18); }
.callout-warn { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .2); }
.callout-bad { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .18); }
.callout-neutral { background: rgba(14, 165, 233, .08); border-color: rgba(14, 165, 233, .18); }
.badge-good { color: var(--good); }
.badge-warn { color: var(--warn); }
.badge-bad { color: var(--bad); }
.tool-highlight { white-space: pre-wrap; line-height: 1.7; }
.tool-highlight mark { background: rgba(250, 204, 21, .35); padding: 0 .12rem; border-radius: .18rem; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { font-family: "Trebuchet MS", Aptos, "Segoe UI", system-ui, sans-serif; margin-top: 1.2rem; }
.markdown-preview :first-child { margin-top: 0; }
.tool-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tool-table th, .tool-table td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid rgba(148, 163, 184, .14); }
.tool-table th { font-size: .8rem; text-transform: uppercase; color: var(--subtle); letter-spacing: .08em; }
.contrast-sample { margin-top: 1rem; border-radius: 18px; padding: 1rem; font-weight: 600; }

@media (max-width: 1080px) {
    .tool-layout { grid-template-columns: 1fr; }
    .tool-action-panel { order: 2; }
}
@media (max-width: 840px) {
    .hero-grid { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    .nav-menu { display: none; width: 100%; padding-top: .6rem; border-top: 1px solid rgba(148, 163, 184, .18); }
    .nav-menu[data-open="true"] { display: flex; }
    .nav-shell { flex-wrap: wrap; }
    .section-head, .footer-shell { flex-direction: column; align-items: flex-start; }
}