/*
 * WebTools design system.
 * Loaded last on every page: defines tokens, base, shared components, and
 * normalises the legacy tool-page styles onto the same palette.
 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

/* ---------- tokens ---------- */
:root,
[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e7eaef;
    --line: #e2e5ea;
    --line-strong: #cdd2da;
    --ink: #121722;
    --ink-soft: #545d6c;
    --ink-faint: #858d9b;
    --accent: #4f46e5;
    --accent-ink: #ffffff;
    --accent-soft: #eceafd;
    --calc: #0e9f6e;
    --calc-soft: #e3f6ee;
    --sec: #6157f0;
    --sec-soft: #ecebfe;
    --dev: #d97706;
    --dev-soft: #fdf1e1;
    --danger: #dc2626;
    --ok: #0e9f6e;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 14px -4px rgba(16, 24, 40, .10);
    --shadow-lg: 0 18px 40px -16px rgba(16, 24, 40, .22);
    --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --page-max: 1200px;
    --gutter: clamp(16px, 4vw, 32px);
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    /* legacy token names used by existing tool pages */
    --color-bg: var(--bg);
    --color-surface: var(--surface);
    --color-surface-alt: var(--surface-2);
    --color-border: var(--line);
    --color-text: var(--ink);
    --color-text-soft: var(--ink-soft);
    --color-accent: var(--accent);
    --color-accent-alt: var(--accent);
    --color-accent-soft: var(--accent-soft);
    --color-focus: var(--accent);
    --color-page-line: transparent;
    --color-page-wash: transparent;
    --color-danger: var(--danger);
    --color-ok: var(--ok);
    --font-family: var(--sans);
    --font-mono: var(--mono);
    --font-base: 15px;
    --font-xs: 12px;
    --font-sm: 13px;
    --font-md: 15px;
    --font-lg: 17px;
    --font-xl: 21px;
    --radius-xs: 4px;
    --radius-sm: var(--r-sm);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
    --radius-control: var(--r-md);
    --container-max: var(--page-max);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1d2129;
    --surface-3: #262b35;
    --line: #272c36;
    --line-strong: #363c48;
    --ink: #eef0f4;
    --ink-soft: #a6aebb;
    --ink-faint: #737b88;
    --accent: #8b85ff;
    --accent-ink: #0e1015;
    --accent-soft: rgba(139, 133, 255, .14);
    --calc: #34d399;
    --calc-soft: rgba(52, 211, 153, .12);
    --sec: #8b85ff;
    --sec-soft: rgba(139, 133, 255, .14);
    --dev: #fbbf24;
    --dev-soft: rgba(251, 191, 36, .12);
    --danger: #f87171;
    --ok: #34d399;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 44px -18px rgba(0, 0, 0, .7);
}

/* ---------- base ---------- */
/* every page measures widths the same way (legacy tool CSS did this; home/docs did not) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 76px;
}

html body {
    margin: 0;
    background: var(--bg);
    background-image: none;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: -.005em;
    -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
    display: none !important;
}

h1, h2, h3, h4 {
    color: var(--ink);
    letter-spacing: -.02em;
    line-height: 1.3;
}

a {
    color: var(--accent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: var(--accent-soft);
}

.container {
    width: auto;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    animation: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    padding: 8px 14px;
    border-radius: var(--r-md);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.material-symbols-rounded {
    font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}

.btn:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    transform: none;
}

.btn.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.btn.primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn.ghost {
    border-color: transparent;
    background: transparent;
    color: var(--ink-soft);
}

.btn.ghost:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn .material-symbols-rounded {
    font-size: 18px;
}

/* ---------- page head (all tool pages) ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 28px 0 20px;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin: 0 0 4px;
    color: var(--ink-faint);
    font-size: 13px;
}

.crumbs a {
    color: var(--ink-soft);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--ink);
}

.crumbs .sep {
    color: var(--line-strong);
}

.page-head-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.page-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--dev-soft);
    color: var(--dev);
    font-size: 26px;
}

.page-icon.is-calc { background: var(--calc-soft); color: var(--calc); }
.page-icon.is-sec { background: var(--sec-soft); color: var(--sec); }

.page-title {
    margin: 0;
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 800;
}

.page-desc {
    margin: 2px 0 0;
    color: var(--ink-soft);
    font-size: 15px;
}

/* ---------- legacy tool page normalisation ---------- */
.tool-page {
    padding-bottom: 8px;
}

/* old marketing hero (kept only on pages not yet converted) */
.tool-hero .hero-actions,
.tool-hero .hero-panel,
.tool-hero .hero-list {
    display: none !important;
}

/* flatten "card inside card": the workspace section is just a region now */
.tools-section.tool-workspace,
.suite-workspace,
.tool-workspace {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

.tool-workspace > .section-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.tool-workspace::before,
.tool-workspace::after,
.tool-hero::before,
.tool-hero::after {
    display: none !important;
}

.suite-card,
.workspace-panel,
.panel,
.tool-panel {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: none;
}

[data-theme="dark"] .suite-card {
    background: var(--surface);
}

.suite-card h3 {
    font-size: 15px;
    font-weight: 700;
}

.suite-field {
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

.suite-field input,
.suite-field select,
.suite-field textarea,
.suite-editor,
.suite-output {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
}

[data-theme="dark"] .suite-field input,
[data-theme="dark"] .suite-field select,
[data-theme="dark"] .suite-field textarea,
[data-theme="dark"] .suite-output {
    background: var(--surface-2);
}

.suite-field input,
.suite-field select {
    min-height: 40px;
}

.suite-editor,
textarea.suite-editor {
    font-family: var(--mono);
    font-size: 13px;
}

.suite-example {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}

.suite-example:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.suite-stat {
    border: 1px solid var(--line);
    background: var(--surface-2);
}

/* card header: title on the left, that card's actions on the right */
.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-height: 34px;
}

.card-head h3 {
    margin: 0;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.card-actions .btn {
    min-height: 32px;
    padding: 0 11px;
    font-size: 13px;
}

.card-actions .btn:not(.primary) {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink-soft);
}

.card-actions .btn:not(.primary):hover {
    background: var(--surface-2);
    color: var(--ink);
}

/* example chips get a visible label */
.suite-example-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
}

.suite-example-grid::before {
    content: "예시";
    margin-right: 4px;
    color: var(--ink-faint);
    font-size: 13px;
    font-weight: 700;
}

.suite-example {
    min-height: 32px;
    padding: 0 12px;
}

.suite-example .material-symbols-rounded {
    font-size: 17px;
}

.suite-card {
    padding: 18px;
}

/* cards in a two-column grid stretch to the taller one; keep content at the top */
.suite-stack {
    align-content: start;
}

/* JSON formatter keeps its own token set; point it at the shared palette */
html[data-theme] body .json-formatter-page,
html body .json-formatter-page {
    --jf-primary: var(--accent);
    --jf-primary-hover: color-mix(in srgb, var(--accent) 85%, var(--ink));
    --jf-primary-soft: var(--accent-soft);
    --jf-bg-surface: var(--surface);
    --jf-bg-surface-2: var(--surface-2);
    --jf-border: var(--line);
    --jf-text-main: var(--ink);
    --jf-text-muted: var(--ink-soft);
    --jf-shadow: none;
    --jf-radius: var(--r-lg);
}

/* per-tool sticky action bars share one look */
html[data-theme] body .json-sticky,
html[data-theme] body .csv-sticky,
html[data-theme] body .uuid-sticky,
html[data-theme] body .normalizer-sticky {
    top: 68px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

html[data-theme] body .json-formatter-page .io-card textarea:focus {
    background: var(--surface);
}

/* ---------- command palette (main.js) ---------- */
.command-palette[hidden] {
    display: none;
}

.command-palette {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    justify-items: center;
    align-items: start;
    padding: 12vh 16px 16px;
}

.command-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 15, .45);
    backdrop-filter: blur(2px);
}

.command-palette-panel {
    position: relative;
    width: min(620px, 100%);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.command-palette-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
}

.command-palette-search .material-symbols-rounded {
    color: var(--ink-faint);
}

.command-palette-search input {
    flex: 1;
    min-height: 0;
    height: 54px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    outline: none;
    box-shadow: none;
}

.command-palette-hint {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    color: var(--ink-faint);
    font-size: 12px;
}

.command-palette-hint strong {
    color: var(--ink-soft);
    font-weight: 600;
}

.command-palette-list {
    overflow: auto;
    padding: 4px 8px 10px;
}

.command-item-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--r-md);
    background: none;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.command-item[aria-current="true"],
.command-item:hover {
    background: var(--surface-2);
}

.command-item-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 20px;
}

.command-item[aria-current="true"] .command-item-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.command-item strong {
    display: block;
    font-size: 14px;
}

.command-item small {
    display: block;
    overflow: hidden;
    color: var(--ink-faint);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-star {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--ink-faint);
    font-size: 16px;
    cursor: pointer;
}

.command-star.is-active {
    color: #f59e0b;
}

.command-palette .no-results {
    margin: 16px;
    color: var(--ink-faint);
    font-size: 14px;
}

/* ---------- documentation layout (docs, about, license) ---------- */
.doc-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
    padding-top: 8px;
}

.doc-toc {
    position: sticky;
    top: 84px;
    display: grid;
    gap: 2px;
}

.doc-toc p {
    margin: 0 0 6px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

.doc-toc a {
    padding: 6px 10px;
    border-left: 2px solid var(--line);
    color: var(--ink-soft);
    font-size: 14px;
    text-decoration: none;
}

.doc-toc a:hover {
    border-left-color: var(--accent);
    color: var(--ink);
}

.doc-body {
    max-width: 820px;
}

.doc-body section + section {
    margin-top: 48px;
}

.doc-body h2 {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 800;
}

.doc-body p,
.doc-body li {
    color: var(--ink-soft);
    line-height: 1.75;
}

.doc-lead {
    margin: -6px 0 18px;
}

.doc-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.doc-cards div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.doc-cards strong {
    font-size: 15px;
}

.doc-cards p {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.65;
}

.doc-group + .doc-group {
    margin-top: 24px;
}

.doc-group h3 {
    margin: 0 0 6px;
    color: var(--ink-faint);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

.doc-group ul {
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    list-style: none;
}

.doc-group li {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 16px;
    padding: 11px 16px;
    font-size: 14px;
    line-height: 1.6;
}

.doc-group li + li {
    border-top: 1px solid var(--line);
}

.doc-group a {
    font-weight: 700;
    text-decoration: none;
}

.doc-group a:hover {
    text-decoration: underline;
}

.doc-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
}

.doc-list strong {
    color: var(--ink);
}

.doc-keys {
    display: grid;
    gap: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.doc-keys div {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
}

.doc-keys div + div {
    border-top: 1px solid var(--line);
}

.doc-keys dd {
    margin: 0;
    color: var(--ink-soft);
    font-size: 14px;
}

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

.doc-faq {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.doc-faq summary {
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}

.doc-faq p {
    margin: 8px 0 0;
}

.doc-roadmap {
    display: grid;
    gap: 0;
    margin: 0 0 20px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    list-style: none;
}

.doc-roadmap li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
}

.doc-roadmap li + li {
    border-top: 1px solid var(--line);
}

.doc-roadmap strong {
    color: var(--ink);
    font-size: 15px;
}

.doc-roadmap p {
    margin: 2px 0 0;
    font-size: 14px;
}

.tag-soon {
    flex: none;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.tag-soon.is-calc { background: var(--calc-soft); color: var(--calc); }
.tag-soon.is-sec { background: var(--sec-soft); color: var(--sec); }

/* version timeline */
.timeline {
    max-width: 860px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 24px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

.timeline-meta {
    display: grid;
    align-content: start;
    gap: 2px;
}

.timeline-ver {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
}

.timeline-meta time {
    color: var(--ink-faint);
    font-size: 13px;
}

.timeline-body h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}

.timeline-latest {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.timeline-body ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 18px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.7;
}

@media (max-width: 640px) {
    .timeline-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .timeline-meta {
        display: flex;
        gap: 10px;
        align-items: baseline;
    }
}

@media (max-width: 860px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .doc-toc {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .doc-toc p {
        display: none;
    }

    .doc-toc a {
        padding: 5px 11px;
        border: 1px solid var(--line);
        border-radius: 999px;
        font-size: 13px;
    }

    .doc-cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-group li,
    .doc-keys div {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }
}

/* ---------- misc ---------- */
#toTop {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 640px) {
    .page-head {
        padding: 20px 0 14px;
    }

    .page-head-main {
        align-items: flex-start;
    }

    .page-icon {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}

/* ---------- status pages (404, offline) ---------- */
.status-page {
    display: grid;
    justify-items: start;
    gap: 12px;
    max-width: 640px;
    padding-top: 12vh;
    padding-bottom: 8vh;
}

.status-page h1 {
    margin: 8px 0 0;
    font-size: clamp(1.6rem, 3.6vw, 2.2rem);
    font-weight: 800;
}

.status-page p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1.7;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- related tools (main.js) ---------- */
.related {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.related h2 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 800;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.related-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

.related-item:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.related-item .material-symbols-rounded {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 20px;
}

.related-item > span:last-child {
    display: grid;
    min-width: 0;
}

.related-item strong {
    font-size: 14px;
}

.related-item small {
    overflow: hidden;
    color: var(--ink-faint);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suite-stat-grid {
    width: 100%;
}

/* ---------- concept articles ---------- */
html body.concept-page,
html body.concept-page :is(p, li, dd, dt, td, th, h2, h3, .eyebrow, .chip, .btn, .concept-toc) {
    font-family: var(--sans);
}

.concept-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 20px;
}

.concept-bar .concept-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.concept-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* =====================================================================
   Tool layout kit
   Applies one structure to every tool: [action bar] → [input | output]
   with neutral pane headers and footers.
   ===================================================================== */

/* hidden must always win over component display rules */
[hidden] {
    display: none !important;
}

/* --- action bars of custom tools: drop the duplicated title/description --- */
html[data-theme] body .tool-page :is(.json-sticky, .csv-sticky, .uuid-sticky, .normalizer-sticky) {
    position: sticky;
    top: 68px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

html body .tool-page :is(.json-status, .csv-status, .uuid-status, .normalizer-sticky .status-text) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
}

.tool-page :is(.json-status, .csv-status, .uuid-status)::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
}

html body .tool-page :is(.json-sticky-actions, .csv-sticky-actions, .uuid-sticky-actions, .normalizer-sticky-actions) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

html body .tool-page :is(.json-sticky, .csv-sticky, .uuid-sticky, .normalizer-sticky) .btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

/* one spacing rhythm between bar, options and panes */
html body .tool-page .tool-workspace {
    gap: 14px;
}

/* the normalizer workspace is a flex column that already spaces its children */
html[data-theme] body .tool-page .normalizer-workspace .normalizer-sticky {
    margin-bottom: 0;
}

/* --- pane cards: neutral header / footer bands --- */
html body .tool-page .io-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: none;
}

html body .tool-page .io-card .io-header,
html body .tool-page .preview-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

html body .tool-page .io-card :is(.io-title, .io-header h3, .io-header h2) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

html body .tool-page .io-card .io-title .material-symbols-rounded {
    color: var(--ink-faint);
    font-size: 19px;
}

html body .tool-page .io-card .io-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

html body .tool-page .io-card .io-actions .btn {
    min-height: 30px;
    padding: 0 10px;
    border-color: transparent;
    background: transparent;
    color: var(--ink-soft);
    font-size: 13px;
}

html body .tool-page .io-card .io-actions .btn:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--ink);
}

html body .tool-page .io-card .io-actions .btn.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

html body .tool-page .io-card textarea {
    flex: 1;
    min-height: 340px;
    margin: 0;
    padding: 14px;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    box-shadow: none;
    resize: vertical;
}

html body .tool-page .io-card textarea:focus {
    outline: none;
    background: var(--surface);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

html body .tool-page .io-card :is(.io-metrics, .io-footer) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin: 0;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-faint);
    font-size: 12px;
}

html body .tool-page .io-card .io-footer .io-metrics {
    padding: 0;
    border: 0;
    background: none;
}

/* metric chips inside footers */
html body .tool-page :is(.io-metrics, .suite-metrics) :is(span, .metric) {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-faint);
    font-size: 12px;
}

/* --- two-pane grid used by custom tools --- */
html body .tool-page .workspace-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

/* --- text normalizer: options strip on top, input | output below --- */
html body .tool-page .normalizer-workspace .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
        "options options"
        "input output";
}

html body .tool-page .normalizer-options {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: none;
}

html body .tool-page .normalizer-options .option-header {
    margin-bottom: 10px;
}

html body .tool-page .normalizer-options .option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

html body .tool-page .normalizer-options .option-chip {
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    transform: none;
}

html body .tool-page .normalizer-options .option-chip:has(input:checked) {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: var(--accent-soft);
}

html body .tool-page .normalizer-options .option-chip input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* --- PDF toolbox: mode selector now sits at the top of the files card --- */
html body .tool-page .task-options-top {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

/* --- QR: calmer preview stage --- */
html body .tool-page .qr-preview {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: none;
    overflow: hidden;
}

html body .tool-page .preview-stage {
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0 / 20px 20px,
        linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 10px 10px / 20px 20px,
        var(--surface);
}

html body .tool-page .preview-stage::before {
    display: none;
}

html body .tool-page .qr-accordion {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: none;
}

/* --- warnings and notices share one look --- */
html body .tool-page :is(.warning-box, .qr-warning, .notice-warning) {
    border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--line));
    border-radius: var(--r-md);
    background: color-mix(in srgb, #f59e0b 10%, var(--surface));
    color: var(--ink);
}

@media (max-width: 900px) {
    html body .tool-page .workspace-grid,
    html body .tool-page .normalizer-workspace .workspace-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "options" "input" "output";
    }

    html body .tool-page .io-card textarea {
        min-height: 220px;
    }
}

/* --- empty previews explain what will appear --- */
html body .tool-page :is(.pdf-preview, .suite-preview):empty {
    display: grid;
    place-items: center;
    min-height: 260px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

html body .tool-page .pdf-preview:empty::before {
    content: "PDF를 선택하면 페이지 미리보기가 여기에 표시됩니다.";
    color: var(--ink-faint);
    font-size: 14px;
}

html body .tool-page .suite-preview:empty::before {
    content: "결과가 여기에 표시됩니다.";
    color: var(--ink-faint);
    font-size: 14px;
}

/* --- native file inputs match the button style --- */
html body .tool-page input[type="file"] {
    min-height: 0;
    padding: 6px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
}

html body .tool-page input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* --- status lines are quiet text, not boxes --- */
html body .tool-page .suite-status {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-faint);
    font-size: 13px;
}

html body .tool-page .suite-status:empty {
    display: none;
}

/* =====================================================================
   Tool controls
   One rule set for every field, toggle and segmented group inside tools.
   Rhythm: 40px controls · 6px label gap · 12px between fields · 16px blocks
   ===================================================================== */

/* --- field containers: label above control --- */
html body .tool-page :is(.suite-field, .option-field) {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -.005em;
}

html body .tool-page .content-panel > label:not(.option-toggle) {
    display: block;
    margin: 12px 0 6px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

html body .tool-page .content-panel > label:not(.option-toggle):first-child {
    margin-top: 0;
}

/* --- text inputs and selects --- */
html body .tool-page :is(.suite-field, .option-field, .content-panel, .csv-options-grid, .uuid-options-grid, .option-row, .split-options, .option-panel) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select) {
    width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background-color: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

html body .tool-page select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23858d9b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

html body .tool-page :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea):hover {
    border-color: var(--line-strong);
}

html body .tool-page :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea):focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

html body .tool-page input::placeholder,
html body .tool-page textarea::placeholder {
    color: var(--ink-faint);
    opacity: 1;
}

html body .tool-page input[type="range"] {
    accent-color: var(--accent);
}

html body .tool-page input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
}

/* --- rows of fields line up on a shared grid --- */
html body .tool-page .suite-row:has(> .suite-field),
html body .tool-page :is(.csv-options-grid, .uuid-options-grid, .option-row) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 14px;
    align-items: end;
}

html body .tool-page .suite-row:has(> .suite-field) > .suite-field[style] {
    flex: initial !important;
    width: auto !important;
}

/* --- checkboxes: one custom box everywhere --- */
html body .tool-page input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface) center / 12px no-repeat;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

html body .tool-page input[type="checkbox"]::before,
html body .tool-page input[type="checkbox"]::after {
    display: none !important;
}

html body .tool-page input[type="checkbox"]:checked {
    border-color: var(--accent);
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 10 17 19 7.5'/%3E%3C/svg%3E");
}

html body .tool-page input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- toggle tiles (label + checkbox) --- */
html body .tool-page :is(.option-chip, .option-toggle, .pay-checks label, .suite-row > label:has(> input[type="checkbox"])):not(:is(.option-chips, .split-options, .pay-mode) > *) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    transform: none;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background-color .15s;
}

html body .tool-page :is(.option-chip, .option-toggle, .pay-checks label, .suite-row > label:has(> input[type="checkbox"])):not(:is(.option-chips, .split-options, .pay-mode) > *):hover {
    border-color: var(--line-strong);
}

html body .tool-page :is(.option-chip, .option-toggle, .pay-checks label, .suite-row > label:has(> input[type="checkbox"])):not(:is(.option-chips, .split-options, .pay-mode) > *):has(input:checked) {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    background: var(--accent-soft);
}

html body .tool-page .pay-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

/* --- segmented controls: radio groups and tab/preset button rows --- */
html body .tool-page :is(.option-chips, .split-options, .pay-mode, .qr-type-tabs, .preset-chips) {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
}

html body .tool-page .pay-mode legend {
    float: left;
    width: auto;
    margin: 0 8px 0 6px;
    color: var(--ink-soft);
    font-size: 13px;
}

html body .tool-page :is(.option-chips, .split-options, .pay-mode) > label,
html body .tool-page :is(.qr-type-tabs, .preset-chips) > button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .15s, color .15s, box-shadow .15s;
}

html body .tool-page :is(.option-chips, .split-options, .pay-mode) > label:hover,
html body .tool-page :is(.qr-type-tabs, .preset-chips) > button:hover {
    color: var(--ink);
}

html body .tool-page :is(.option-chips, .split-options, .pay-mode) > label:has(input:checked),
html body .tool-page :is(.qr-type-tabs, .preset-chips) > button.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

/* radios stay in the accessibility tree but are drawn by the segment */
html body .tool-page :is(.option-chips, .split-options, .pay-mode) input[type="radio"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

html body .tool-page :is(.option-chips, .split-options, .pay-mode) > label:has(input:focus-visible) {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- section labels inside cards --- */
html body .tool-page :is(.option-header h3, .option-title, .accordion-body > h4, .option-label, .task-options-top > p:first-child, .option-group-title) {
    margin: 0 0 8px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
}

/* --- QR accordions: tidy headers --- */
html body .tool-page .qr-accordion > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

html body .tool-page .qr-accordion > summary::-webkit-details-marker {
    display: none;
}

html body .tool-page .qr-accordion .accordion-body {
    display: grid;
    gap: 12px;
    padding: 2px 14px 14px;
}

html body .tool-page .qr-sidebar {
    display: grid;
    align-content: start;
    gap: 10px;
}

/* --- suite cards: consistent inner rhythm --- */
html body .tool-page .suite-card.suite-stack {
    gap: 16px;
}

/* QR: only the active code-type panel is shown (its own CSS forced both visible) */
html body .tool-page .option-panel[data-panel]:not(.is-active) {
    display: none;
}

/* segmented groups hug their content instead of stretching */
html body .tool-page :is(.option-chips, .split-options, .qr-type-tabs, .preset-chips) {
    justify-self: start;
    width: fit-content;
    max-width: 100%;
}

/* toggle tiles keep their label on one line; option grids give them room */
html body .tool-page :is(.csv-options-grid, .uuid-options-grid) {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

html body .tool-page :is(.csv-options-grid, .uuid-options-grid, .option-row) :is(.option-toggle, .option-chip) {
    white-space: nowrap;
}

/* =====================================================================
   Motion
   Short, calm, and never hides content: entrance starts at 40% opacity.
   ===================================================================== */
:root {
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
}

/* --- cross-page transitions (Chrome 126+, Safari 18.2+; others just navigate) --- */
@view-transition {
    navigation: auto;
}

header.header {
    view-transition-name: site-header;
}

::view-transition-group(site-header) {
    animation: none;
}

::view-transition-old(root) {
    animation: vt-out 140ms ease-in both;
}

::view-transition-new(root) {
    animation: vt-in 240ms var(--ease-out) both;
}

@keyframes vt-out {
    to { opacity: 0; transform: translateY(-4px); }
}

@keyframes vt-in {
    from { opacity: 0; transform: translateY(6px); }
}

/* --- theme switch: circular reveal from the toggle --- */
html.theme-vt header.header {
    view-transition-name: none;
}

html.theme-vt::view-transition-old(root) {
    animation: none;
}

html.theme-vt::view-transition-new(root) {
    animation: theme-reveal 480ms var(--ease-out) both;
}

@keyframes theme-reveal {
    from { clip-path: circle(0 at var(--vt-x, 90%) var(--vt-y, 30px)); }
    to { clip-path: circle(150vmax at var(--vt-x, 90%) var(--vt-y, 30px)); }
}

/* --- entrance: staggered, short, starts partly visible --- */
@keyframes rise-in {
    from { opacity: .4; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

:is(.page-head, .calc-basis, .home-hero > *, .doc-layout, .timeline, .status-page > *),
.tool-page > :is(section, .wb-tabs, .wb-panel, div:not(.page-head)),
.tool-workspace > :is(.workspace-grid, .suite-grid, [class$="-sticky"], .suite-example-grid) {
    animation: rise-in 360ms var(--ease-out) backwards;
}

.page-head { animation-delay: 0ms; }
.calc-basis, .tool-page > section:nth-of-type(1), .home-hero > :nth-child(2) { animation-delay: 60ms; }
.tool-workspace > :nth-child(2), .home-hero > :nth-child(3) { animation-delay: 90ms; }
.tool-workspace > :nth-child(3) { animation-delay: 120ms; }
.tool-workspace > :nth-child(4) { animation-delay: 150ms; }

/* --- header shadow after scrolling --- */
header.header {
    transition: box-shadow .2s, background-color .2s;
}

html.is-scrolled header.header {
    box-shadow: 0 6px 20px -14px rgba(16, 24, 40, .35);
}

/* --- micro-interactions --- */
.btn,
.icon-btn,
.chip,
.wb-chip,
.hero-quick a,
.suite-example {
    transition: background-color .15s, border-color .15s, color .15s, transform .12s var(--ease-out), box-shadow .15s;
}

.btn:active:not(:disabled),
.icon-btn:active,
.chip:active,
.suite-example:active,
.hero-quick a:active {
    transform: translateY(1px) scale(.98);
}

:is(.tile, .related-item, a.calc-card, .sec-recipes a, .wb-recipe-card, .doc-group li) {
    transition: border-color .18s, box-shadow .18s, transform .18s var(--ease-out), background-color .18s;
}

:is(.tile, .related-item, a.calc-card, .wb-recipe-card):hover {
    transform: translateY(-2px);
}

:is(.tile, .related-item, a.calc-card):hover .material-symbols-rounded {
    transition: transform .25s var(--ease-spring);
    transform: scale(1.08);
}

/* icons inside cards ease back too */
:is(.tile, .related-item, a.calc-card) .material-symbols-rounded {
    transition: transform .25s var(--ease-out), background-color .18s, color .18s;
}

.calc-card-go,
.hero-card-cta .material-symbols-rounded {
    transition: transform .2s var(--ease-out);
}

a.calc-card:hover .calc-card-go,
.hero-card:hover .hero-card-cta .material-symbols-rounded {
    transform: translateX(3px);
}

/* --- overlays: palette, feedback panel, mobile menu --- */
.command-palette:not([hidden]) .command-palette-backdrop {
    animation: fade-in 160ms ease-out both;
}

.command-palette:not([hidden]) .command-palette-panel {
    animation: pop-in 200ms var(--ease-out) both;
}

.report-panel:not([hidden]) {
    animation: pop-in 180ms var(--ease-out) both;
    transform-origin: top right;
}

@media (max-width: 900px) {
    .header-actions.is-open {
        animation: drop-in 200ms var(--ease-out) both;
    }
}

@keyframes fade-in {
    from { opacity: 0; }
}

@keyframes pop-in {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
}

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

/* --- segmented and toggle state changes glide --- */
html body .tool-page :is(.option-chips, .split-options, .pay-mode) > label,
html body .tool-page :is(.qr-type-tabs, .preset-chips) > button,
.wb-tab {
    transition: background-color .18s, color .18s, box-shadow .18s, border-color .18s;
}

/* --- results that update briefly highlight --- */
@keyframes flash-ok {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
    100% { box-shadow: 0 0 0 8px transparent; }
}

.is-flash {
    animation: flash-ok 600ms ease-out;
}

/* --- reduced motion: no transitions, no view transitions --- */
@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* =====================================================================
   Option groups: every setting is "label above, control below, left-aligned"
   ===================================================================== */

/* a titled row (title + segmented control) stacks instead of splitting into columns */
html body .tool-page .option-row:has(> .option-title) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 8px;
}

html body .tool-page .option-row > .option-title {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -.005em;
}

/* a row holding only one toggle should not stretch it across the card */
html body .tool-page .option-row:has(> .option-toggle:only-child) {
    display: flex;
}

/* accordion body: one vertical rhythm, a hairline between groups */
html body .tool-page .qr-accordion .accordion-body {
    gap: 18px;
}

html body .tool-page .qr-accordion .accordion-body > * + * {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

html body .tool-page .qr-accordion .accordion-body > [hidden] + *,
html body .tool-page .qr-accordion .accordion-body > .option-panel:not(.is-active)[data-panel] + * {
    padding-top: 0;
    border-top: 0;
}

/* option panels inside cards use the same two-column field grid */
html body .tool-page .option-panel {
    gap: 14px;
}

/* --- number input + range slider + scale read as one control --- */
html body .tool-page .option-field:has(> input[type="range"]) {
    gap: 6px;
}

html body .tool-page .option-field > input[type="range"] {
    width: 100%;
    height: 20px;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
    background: none;
}

html body .tool-page .range-labels {
    display: flex;
    justify-content: space-between;
    margin: -4px 2px 0;
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

/* --- color inputs become a full-bleed swatch field --- */
html body .tool-page input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

html body .tool-page input[type="color"]:hover {
    border-color: var(--line-strong);
}

html body .tool-page input[type="color"]:focus-visible {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

html body .tool-page input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

html body .tool-page input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 7px;
    box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25);
}

html body .tool-page input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 7px;
}

/* fieldset wrapping a segmented control: legend sits above like any other label */
html body .tool-page .pay-mode-field {
    display: grid;
    justify-items: start;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

html body .tool-page .pay-mode-field > legend {
    float: left;
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- ad slots (filled by main.js only when a slot id is configured) ---------- */
.ad-slot:not(.is-filled) {
    display: none;
}

.ad-slot.is-filled {
    position: relative;
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
    min-height: 120px;
}

.ad-slot.is-filled::before {
    content: "광고";
    position: absolute;
    top: 2px;
    left: 0;
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 600;
}
