.tool-guide-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(8, 12, 19, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tool-guide-overlay.visible { animation: toolGuideFadeIn 180ms ease-out; }

.tool-guide-dialog {
    --tool-guide-accent: #5b6ee1;
    --tool-guide-soft: #eef1ff;
    --tool-guide-accent-text: #4052c7;
    width: min(900px, 100%);
    max-height: min(880px, calc(100vh - 48px));
    overflow: hidden auto;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    background: #f8fafc;
    box-shadow: 0 28px 80px rgba(8, 15, 30, 0.34);
    color: #111827;
    animation: toolGuideRiseIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.ui-theme-vector-trace .tool-guide-dialog {
    --tool-guide-accent: #2563eb;
    --tool-guide-soft: #eff6ff;
    --tool-guide-accent-text: #1d4ed8;
    width: min(980px, 100%);
}

body.ui-theme-image-cutout .tool-guide-dialog {
    --tool-guide-accent: #0f766e;
    --tool-guide-soft: #ecfdf5;
    --tool-guide-accent-text: #0f766e;
}

body.ui-theme-image-upscale .tool-guide-dialog {
    --tool-guide-accent: #4f46e5;
    --tool-guide-soft: #eef2ff;
    --tool-guide-accent-text: #4338ca;
}

.tool-guide-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 28px 23px;
    background: #151b25;
    color: #f8fafc;
}

.tool-guide-heading {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 14px;
}

.tool-guide-heading-icon,
.tool-guide-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--tool-guide-accent);
}

.tool-guide-heading-icon {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.tool-guide-heading-icon svg,
.tool-guide-card-icon svg,
.tool-guide-action svg { width: 20px; height: 20px; }

.tool-guide-kicker {
    margin: 0 0 5px;
    color: #aeb8c8;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
}

.tool-guide-title {
    margin: 0;
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 720;
    line-height: 1.3;
    letter-spacing: 0;
}

.tool-guide-subtitle {
    max-width: 700px;
    margin: 7px 0 0;
    color: #b9c3d2;
    font-size: 0.9rem;
    line-height: 1.65;
}

.tool-guide-close {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: #cbd5e1;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.tool-guide-close:hover,
.tool-guide-close:focus-visible {
    border-color: rgba(255, 255, 255, 0.28);
    outline: none;
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
}

.tool-guide-close svg { width: 18px; height: 18px; }

.tool-guide-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px 22px 14px;
    background: #f8fafc;
}

.tool-guide-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 238px;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    overflow: hidden;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

.tool-guide-card:hover:not(:disabled),
.tool-guide-card:focus-visible:not(:disabled) {
    z-index: 1;
    transform: translateY(-2px);
    border-color: #7180e7;
    outline: none;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.tool-guide-card:focus-visible:not(:disabled) {
    box-shadow: 0 0 0 3px rgba(91, 110, 225, 0.16), 0 14px 30px rgba(15, 23, 42, 0.1);
}

.tool-guide-card:disabled { opacity: 0.56; cursor: wait; }

.tool-guide-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tool-guide-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--tool-guide-soft);
    color: var(--tool-guide-accent-text);
}

.tool-guide-tag {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--tool-guide-soft);
    color: var(--tool-guide-accent-text);
    font-size: 0.73rem;
    font-weight: 720;
    line-height: 1.2;
}

.tool-guide-card.secondary .tool-guide-card-icon,
.tool-guide-card.secondary .tool-guide-tag {
    background: #fff7ed;
    color: #b45309;
}

body.ui-theme-image-cutout .tool-guide-card.secondary .tool-guide-card-icon,
body.ui-theme-image-cutout .tool-guide-card.secondary .tool-guide-tag {
    background: #eff6ff;
    color: #1d4ed8;
}

body.ui-theme-image-upscale .tool-guide-card:first-child .tool-guide-card-icon,
body.ui-theme-image-upscale .tool-guide-card:first-child .tool-guide-tag {
    background: #fff7ed;
    color: #b45309;
}

.tool-guide-card-title {
    margin: 16px 0 0;
    color: #111827;
    font-size: 1.14rem;
    font-weight: 740;
    line-height: 1.4;
}

.tool-guide-card-copy {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.7;
}

.tool-guide-examples {
    margin: 11px 0 0;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.6;
}

.tool-guide-examples strong { color: #334155; font-weight: 700; }

.tool-guide-media {
    height: 156px;
    margin: -20px -20px 17px;
    overflow: hidden;
    border-bottom: 1px solid #e5eaf1;
    background: #eef2f7;
}

.tool-guide-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    color-scheme: light;
}

body.ui-theme-vector-trace .trace-guide-choice {
    min-height: 298px;
}

.trace-guide-choice-lead {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: stretch;
    gap: 16px;
}

.trace-guide-choice-heading {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.trace-guide-choice .trace-guide-choice-media {
    width: 112px;
    height: 108px;
    margin: 0;
    padding: 7px;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #f3f6fa;
}

.trace-guide-choice .trace-guide-choice-media img {
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.trace-guide-choice .tool-guide-card-title {
    margin-top: 13px;
}

.tool-guide-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 17px;
    color: var(--tool-guide-accent-text);
    font-size: 0.83rem;
    font-weight: 740;
}

.tool-guide-card.secondary .tool-guide-action { color: #b45309; }
body.ui-theme-image-cutout .tool-guide-card.secondary .tool-guide-action { color: #1d4ed8; }
body.ui-theme-image-upscale .tool-guide-card:first-child .tool-guide-action { color: #b45309; }

.tool-guide-action svg { transition: transform 170ms ease; }

.tool-guide-card:hover:not(:disabled) .tool-guide-action svg,
.tool-guide-card:focus-visible:not(:disabled) .tool-guide-action svg { transform: translateX(3px); }

.tool-guide-note {
    margin: 0 22px 16px;
    padding: 11px 13px;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #f1f5f9;
    color: #526174;
    font-size: 0.8rem;
    line-height: 1.6;
}

.tool-guide-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 22px 18px;
    border-top: 1px solid #e5eaf1;
    background: #fff;
}

.tool-guide-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.tool-guide-remember input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--tool-guide-accent);
}

.tool-guide-confirm {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--tool-guide-accent);
    border-radius: 8px;
    background: var(--tool-guide-accent);
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 720;
    cursor: pointer;
    box-shadow: none;
    transition: filter 160ms ease, transform 160ms ease;
}

.tool-guide-confirm:hover,
.tool-guide-confirm:focus-visible {
    outline: none;
    filter: brightness(0.94);
    transform: translateY(-1px);
}

.tool-info-dialog {
    width: min(680px, 100%);
    border-radius: 16px;
    background: #f8fafc;
}

.tool-info-dialog .popup-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid #e5eaf1;
    background: #fff;
}

.tool-info-dialog .popup-header-title { color: #111827; font-size: 1.08rem; }

.tool-info-dialog .popup-close-icon {
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #f8fafc;
}

.tool-info-dialog .popup-body { padding: 18px 24px; }
.tool-info-dialog .popup-card { border-radius: 8px; background: #fff; }
.tool-info-dialog .popup-footer { padding: 0 24px 22px; }

html[data-ui-theme="dark"] .tool-guide-dialog,
html[data-ui-theme="dark"] .tool-info-dialog {
    color: #e5e7eb;
    border-color: #313947;
    background: #181e28;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

html[data-ui-theme="dark"] .tool-guide-header { background: #11161f; }
html[data-ui-theme="dark"] .tool-guide-options { background: #181e28; }

html[data-ui-theme="dark"] .tool-guide-card {
    border-color: #343e4d;
    background: #202733;
    color: #edf2f7;
    box-shadow: none;
}

html[data-ui-theme="dark"] .tool-guide-card:hover:not(:disabled),
html[data-ui-theme="dark"] .tool-guide-card:focus-visible:not(:disabled) {
    border-color: #6678d8;
    background: #252e3b;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

html[data-ui-theme="dark"] .tool-guide-card-title { color: #f1f5f9; }
html[data-ui-theme="dark"] .tool-guide-card-copy { color: #aab5c4; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .tool-guide-heading-icon,
html[data-ui-theme="dark"] body.ui-theme-vector-trace .tool-guide-action { color: #93c5fd; }

html[data-ui-theme="dark"] body.ui-theme-svg-processing .tool-guide-heading-icon,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .tool-guide-action,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .tool-guide-heading-icon,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .tool-guide-action { color: #a5b4fc; }

html[data-ui-theme="dark"] body.ui-theme-vector-trace .tool-guide-card.secondary .tool-guide-action,
html[data-ui-theme="dark"] body.ui-theme-svg-processing .tool-guide-card.secondary .tool-guide-action,
html[data-ui-theme="dark"] body.ui-theme-image-upscale .tool-guide-card:first-child .tool-guide-action { color: #fdba74; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .tool-guide-heading-icon,
html[data-ui-theme="dark"] body.ui-theme-image-cutout .tool-guide-action { color: #5eead4; }

html[data-ui-theme="dark"] body.ui-theme-image-cutout .tool-guide-card.secondary .tool-guide-action { color: #93c5fd; }

html[data-ui-theme="dark"] .tool-guide-examples,
html[data-ui-theme="dark"] .tool-guide-remember { color: #a8b3c2; }

html[data-ui-theme="dark"] .tool-guide-examples strong { color: #dbe4f0; }

html[data-ui-theme="dark"] .tool-guide-media {
    border-color: #343e4d;
    background: #111720;
}

html[data-ui-theme="dark"] .trace-guide-choice .trace-guide-choice-media {
    border-color: #343e4d;
    background: #151b24;
}

html[data-ui-theme="dark"] .tool-guide-note {
    color: #bac5d4;
    border-color: #343e4d;
    background: #141a23;
}

html[data-ui-theme="dark"] .tool-guide-footer {
    border-color: #313947;
    background: #181e28;
}

html[data-ui-theme="dark"] .tool-info-dialog .popup-header {
    border-color: #313947;
    background: #1d2430;
}

html[data-ui-theme="dark"] .tool-info-dialog .popup-header-title,
html[data-ui-theme="dark"] .tool-info-dialog .popup-card-title { color: #f1f5f9; }

html[data-ui-theme="dark"] .tool-info-dialog .popup-close-icon,
html[data-ui-theme="dark"] .tool-info-dialog .popup-card {
    color: #cbd5e1;
    border-color: #343e4d;
    background: #202733;
}

@keyframes toolGuideFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 720px) {
    .tool-guide-overlay {
        align-items: flex-start;
        padding: 12px;
    }

    .tool-guide-dialog {
        max-height: calc(100vh - 24px);
        border-radius: 12px;
    }

    .tool-guide-header { padding: 21px 18px 18px; }
    .tool-guide-heading-icon { width: 38px; height: 38px; }
    .tool-guide-title { font-size: 1.26rem; }

    .tool-guide-options {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .tool-guide-card { min-height: 0; padding: 17px; }

    .tool-guide-media {
        height: 150px;
        margin: -17px -17px 15px;
    }

    body.ui-theme-vector-trace .trace-guide-choice { min-height: 0; }

    .trace-guide-choice-lead {
        grid-template-columns: 94px minmax(0, 1fr);
        gap: 13px;
    }

    .trace-guide-choice .trace-guide-choice-media {
        width: 94px;
        height: 102px;
        margin: 0;
        padding: 6px;
    }

    .trace-guide-choice .tool-guide-card-title {
        margin-top: 11px;
        font-size: 1.02rem;
    }

    .tool-guide-note { margin: 0 14px 14px; }

    .tool-guide-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px 18px;
    }

    .tool-guide-confirm { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .tool-guide-overlay.visible,
    .tool-guide-dialog { animation-duration: 1ms; }

    .tool-guide-card,
    .tool-guide-action svg,
    .tool-guide-confirm { transition-duration: 1ms; }
}
