/* Scheme editor — full-screen app shell, desktop left toolbar, mobile bottom toolbar */

.scheme-editor {
    flex: 1 1 auto;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    height: 100vh;
    overflow: hidden;
    background: #f6f7f9;
}

/* Topbar */
.scheme-editor__topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 5;
}

.scheme-editor__name {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 320px;
    border: 1px solid #e5e7eb;
    font-weight: 500;
}
.scheme-editor__name:focus {
    border-color: #4f8ff7;
    box-shadow: 0 0 0 0.15rem rgba(79, 143, 247, 0.18);
}

.scheme-editor__bg-button {
    flex-shrink: 0;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Background picker overlay */
.scheme-bg-picker {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.scheme-bg-picker[hidden] { display: none; }

.scheme-bg-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.scheme-bg-picker__dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: min(880px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scheme-bg-picker__header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
}
.scheme-bg-picker__title {
    font-weight: 600;
}
.scheme-bg-picker__close {
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.scheme-bg-picker__close:hover { background: #f3f4f6; color: #111827; }

.scheme-bg-picker__tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}
.scheme-bg-tab {
    border: none;
    background: transparent;
    padding: 0.55rem 1rem;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.scheme-bg-tab:hover { color: #111827; background: #f9fafb; }
.scheme-bg-tab.is-active {
    color: #1d4ed8;
    border-bottom-color: #4f8ff7;
}

.scheme-bg-picker__grid {
    padding: 1rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.scheme-bg-card {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.scheme-bg-card:hover {
    border-color: #4f8ff7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 143, 247, 0.15);
}
.scheme-bg-card.is-active {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(79, 143, 247, 0.2);
}

.scheme-bg-card__thumb {
    width: 100%;
    height: 130px;
    background: #f3f4f6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.scheme-bg-card__thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.scheme-bg-card__name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #111827;
}
.scheme-bg-card__meta {
    font-size: 0.75rem;
    color: #9ca3af;
}

.scheme-bg-picker__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
    font-size: 0.9rem;
}

.scheme-editor__topbar-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: nowrap;
    align-items: center;
}

.scheme-zoom-display {
    min-width: 56px;
    font-variant-numeric: tabular-nums;
}

/* Body — toolbar + canvas */
.scheme-editor__body {
    display: grid;
    grid-template-columns: 64px 1fr;
    min-height: 0;
}

.scheme-editor__toolbar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 0.5rem 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    overflow-y: auto;
}

.scheme-tool-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.scheme-toolbar__sep {
    width: 32px;
    height: 1px;
    background: #e5e7eb;
    margin: 0.35rem 0;
}

.scheme-tool {
    width: 46px;
    height: 46px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.scheme-tool:hover { background: #f3f4f6; color: #111827; }
.scheme-tool.is-active {
    background: #e8f0fe;
    border-color: #4f8ff7;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px #4f8ff7;
}

.scheme-marker {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.4);
}
.scheme-marker--red    { background: #e53935; }
.scheme-marker--blue   { background: #1e88e5; }
.scheme-marker--white  { background: #ffffff; }
.scheme-marker--yellow { background: #fdd835; }
/* Step-number tool icon — "123" reads as ordering, matching the plain-digit canvas objects */
.scheme-number-icon {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.5px;
}

/* Custom toolbar icons (inline SVG via mask) */
.scheme-icon-double-arrow,
.scheme-icon-dashed-arrow {
    display: inline-block;
    width: 22px;
    height: 22px;
    background-color: currentColor;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-size: contain;
            mask-size: contain;
}
.scheme-icon-double-arrow {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 8h11v-3l7 4-7 4v-3h-11zM3 14h11v-2h-11z'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 8h11v-3l7 4-7 4v-3h-11zM3 14h11v-2h-11z'/></svg>");
}
.scheme-icon-dashed-arrow {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 11h3v2h-3zM7 11h3v2h-3zM11 11h3v2h-3zM15 11h3v-3l5 4-5 4v-3h-3z'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 11h3v2h-3zM7 11h3v2h-3zM11 11h3v2h-3zM15 11h3v-3l5 4-5 4v-3h-3z'/></svg>");
}

/* Left toolbar tooltips (data-tip + ::after — no JS library). Shown to the
   right of the icon on hover/keyboard focus. `aria-label` on the buttons
   covers screen readers independently of this purely-visual tooltip. */
.scheme-tool[data-tip] {
    position: relative;
}
.scheme-tool[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #111827;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 20;
}
.scheme-tool[data-tip]:hover::after,
.scheme-tool[data-tip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Canvas */
.scheme-editor__canvas-wrap {
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-width: 0;
    min-height: 0;
}

.scheme-editor__canvas-frame {
    background: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    border-radius: 4px;
    position: relative;
}

/* Fabric.js wraps the canvas in a container we cannot directly style, so target it generically. */
.scheme-editor__canvas-frame .canvas-container {
    max-width: 100%;
    max-height: 100%;
}

/* Onboarding hint — dismissible corner card for a brand-new, empty scheme. */
.scheme-editor__hint {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 6;
    max-width: 240px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 0.85rem 1rem 0.85rem 0.9rem;
}
.scheme-editor__hint[hidden] { display: none; }

.scheme-editor__hint-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
}
.scheme-editor__hint-close:hover { background: #f3f4f6; color: #111827; }

.scheme-editor__hint-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.8rem;
    color: #374151;
    line-height: 1.5;
}
.scheme-editor__hint-list li + li { margin-top: 0.15rem; }

@media (max-width: 768px) {
    .scheme-editor__hint {
        right: 0.5rem;
        bottom: 0.5rem;
        max-width: 200px;
        padding: 0.7rem 0.85rem 0.7rem 0.75rem;
    }
}

/* Toast */
.scheme-editor__toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    z-index: 50;
    font-size: 0.9rem;
}

/* Mobile: toolbar moves to bottom, topbar wraps */
@media (max-width: 768px) {
    .scheme-editor__topbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .scheme-editor__name {
        flex: 1 1 60%;
        max-width: none;
    }
    .scheme-editor__bg-button {
        flex: 0 0 auto;
        max-width: 40%;
    }
    .scheme-editor__topbar-actions {
        flex: 1 1 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .scheme-editor__body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    .scheme-editor__toolbar {
        flex-direction: row;
        border-right: 0;
        border-top: 1px solid #e5e7eb;
        padding: 0.35rem 0.5rem;
        gap: 0.25rem;
        overflow-x: auto;
        overflow-y: hidden;
        order: 2;
    }
    .scheme-tool-group {
        flex-direction: row;
        padding: 0 0.25rem;
    }
    .scheme-toolbar__sep {
        width: 1px;
        height: 32px;
        margin: 0 0.25rem;
    }
    .scheme-editor__canvas-wrap {
        order: 1;
        padding: 0.5rem;
    }
}

/* Options bar (per-tool / per-selection context).
   Fixed height, no wrapping — always reserves the same vertical space (even
   when empty) so switching tools never shifts the canvas below it. Overflow
   scrolls horizontally instead of growing taller. */
.scheme-editor__options-bar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fafbfc;
    border-bottom: 1px solid #e5e7eb;
    height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 4;
}

.scheme-options__label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-right: 0.15rem;
    white-space: nowrap;
}

.scheme-options__group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.scheme-options__sep {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 0.35rem;
}

/* Color swatch (circle) */
.scheme-options__swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}
.scheme-options__swatch:hover { transform: scale(1.08); }
.scheme-options__swatch.is-active {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(79,143,247,0.35);
}

/* Quick-pick number chip */
.scheme-options__chip {
    min-width: 28px;
    height: 28px;
    padding: 0 0.4rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.1s, background 0.1s;
}
.scheme-options__chip:hover { border-color: #9ca3af; }
.scheme-options__chip.is-active {
    border-color: #1d4ed8;
    background: rgba(79,143,247,0.1);
    color: #1d4ed8;
}

/* Tool-style/icon button (line types, equipment) */
.scheme-options__icon-btn {
    min-width: 34px;
    height: 34px;
    padding: 4px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.1s, background 0.1s;
}
.scheme-options__icon-btn:hover { border-color: #9ca3af; background: #f9fafb; }
.scheme-options__icon-btn.is-active {
    border-color: #1d4ed8;
    background: rgba(79,143,247,0.1);
    box-shadow: 0 0 0 1px rgba(79,143,247,0.35);
}
.scheme-options__icon-btn img,
.scheme-options__icon-btn svg {
    max-width: 24px;
    max-height: 24px;
    pointer-events: none;
}

/* Width selector (line thickness preview) */
.scheme-options__width {
    min-width: 36px;
    height: 28px;
    padding: 0 0.4rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.scheme-options__width:hover { border-color: #9ca3af; }
.scheme-options__width.is-active {
    border-color: #1d4ed8;
    background: rgba(79,143,247,0.1);
}
.scheme-options__width-bar {
    width: 18px;
    background: #374151;
    border-radius: 2px;
}

/* Text input (custom label) */
.scheme-options__text-input {
    width: 56px;
    height: 28px;
    padding: 0 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.scheme-options__text-input:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(79,143,247,0.2);
}

/* Formation preset dropdown */
.scheme-options__select {
    height: 28px;
    padding: 0 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #374151;
    background: #fff;
    cursor: pointer;
}
.scheme-options__select:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(79,143,247,0.2);
}

/* Toggle (opponent variant) */
.scheme-options__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 0.5rem;
    height: 28px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #374151;
}
.scheme-options__toggle.is-active {
    border-color: #1d4ed8;
    background: rgba(79,143,247,0.1);
    color: #1d4ed8;
}

/* Direct children never shrink — overflow scrolls horizontally instead of
   squeezing buttons/labels, on both desktop and mobile. */
.scheme-editor__options-bar > * { flex-shrink: 0; }

@media (max-width: 768px) {
    .scheme-editor__options-bar {
        padding: 0.35rem 0.4rem;
        gap: 0.3rem;
        height: 44px;
    }
    .scheme-options__sep { display: none; }
    .scheme-options__label { display: none; }
}

/* Animation timeline */
.scheme-editor__timeline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    min-height: 64px;
    z-index: 4;
}

.scheme-timeline__play,
.scheme-timeline__add,
.scheme-timeline__remove {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    color: #374151;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.scheme-timeline__play:hover:not(:disabled),
.scheme-timeline__add:hover:not(:disabled),
.scheme-timeline__remove:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #cbd5e1;
}
.scheme-timeline__play:disabled,
.scheme-timeline__add:disabled,
.scheme-timeline__remove:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.scheme-timeline__play {
    color: #1d4ed8;
}

.scheme-timeline__frames {
    flex: 1 1 auto;
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.scheme-timeline__frame {
    flex: 0 0 auto;
    min-width: 44px;
    height: 44px;
    padding: 0 0.5rem;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    color: #6b7280;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.scheme-timeline__frame:hover {
    border-color: #cbd5e1;
    color: #111827;
}
.scheme-timeline__frame.is-active {
    border-color: #1d4ed8;
    color: #1d4ed8;
    background: rgba(79, 143, 247, 0.08);
    box-shadow: 0 0 0 2px rgba(79, 143, 247, 0.18);
}

/* Disable editing UI while animation is playing */
.scheme-editor.is-playing .scheme-editor__toolbar,
.scheme-editor.is-playing .scheme-editor__topbar,
.scheme-editor.is-playing .scheme-editor__canvas-wrap {
    pointer-events: none;
}
.scheme-editor.is-playing .scheme-editor__toolbar,
.scheme-editor.is-playing .scheme-editor__topbar,
.scheme-editor.is-playing .scheme-editor__options-bar {
    opacity: 0.5;
}
.scheme-editor.is-playing .scheme-editor__options-bar { pointer-events: none; }
.scheme-editor.is-playing .scheme-timeline__frame {
    pointer-events: none;
}

@media (max-width: 768px) {
    .scheme-editor__timeline {
        min-height: 56px;
        padding: 0.4rem 0.5rem;
        gap: 0.35rem;
    }
    .scheme-timeline__play,
    .scheme-timeline__add,
    .scheme-timeline__remove,
    .scheme-timeline__frame {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
}

/* Print */
@media print {
    .scheme-editor__topbar,
    .scheme-editor__toolbar,
    .scheme-editor__timeline,
    .scheme-editor__footer {
        display: none !important;
    }
    .scheme-editor__canvas-wrap {
        padding: 0;
    }
}

/* ---------------------------------------------------------------------------
   Viewer mode (read-only animation player)

   Everything below is scoped under `.scheme-editor--viewer`, added to the root
   only by the viewer route (viewerMode). The normal editor never gets this
   class, so its layout/appearance are completely unaffected. Chrome elements
   stay in the DOM (so editor.js querySelectors keep working) — they are merely
   hidden here. Only a clean canvas + a play/pause button remain visible.
--------------------------------------------------------------------------- */
.scheme-editor--viewer {
    /* Only the body (canvas) row + the slim play control row remain. */
    grid-template-rows: 1fr auto;
    background: #0f172a;
}

.scheme-editor--viewer .scheme-editor__topbar,
.scheme-editor--viewer .scheme-editor__options-bar,
.scheme-editor--viewer .scheme-editor__toolbar {
    display: none !important;
}

/* Canvas fills the whole area, no left toolbar column. */
.scheme-editor--viewer .scheme-editor__body {
    grid-template-columns: 1fr;
}

.scheme-editor--viewer .scheme-editor__canvas-wrap {
    padding: 1rem;
    background: #0f172a;
}

/* Timeline: keep it as the control bar but expose only the play/pause button. */
.scheme-editor--viewer .scheme-editor__timeline {
    justify-content: center;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 56px;
}
.scheme-editor--viewer .scheme-timeline__frames,
.scheme-editor--viewer .scheme-timeline__add,
.scheme-editor--viewer .scheme-timeline__remove {
    display: none !important;
}
.scheme-editor--viewer .scheme-timeline__play {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
    border-radius: 50%;
    color: #fff;
    background: #2563eb;
    border-color: #2563eb;
}
.scheme-editor--viewer .scheme-timeline__play:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

/* The "is-playing" dimming/pointer-events lock is for the editor's chrome;
   in the viewer there is no chrome to dim and the play button must stay
   clickable so the user can pause. */
.scheme-editor--viewer.is-playing .scheme-editor__timeline,
.scheme-editor--viewer.is-playing .scheme-timeline__play {
    pointer-events: auto;
    opacity: 1;
}

/* Login modal (anonymous visitors) */
.scheme-login {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.scheme-login[hidden] { display: none; }

.scheme-login__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.scheme-login__dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: min(420px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.scheme-login__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: #6b7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.scheme-login__close:hover { background: #f3f4f6; color: #111827; }

.scheme-login__title { font-weight: 600; }

.scheme-login__benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
}
.scheme-login__benefits li {
    padding: 0.15rem 0;
}

.scheme-login__divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: #9ca3af;
    font-size: 0.85rem;
}
.scheme-login__divider::before,
.scheme-login__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.scheme-login__social {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.scheme-login__social .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Onboarding guided tour ─────────────────────────────────────────────── */
.scheme-tour { position: fixed; inset: 0; z-index: 100000; }
.scheme-tour[hidden] { display: none; }
.scheme-tour__spot {
    position: fixed;
    z-index: 1;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
    outline: 2px solid #ef761b;
    pointer-events: none;
    transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}
.scheme-tour__card {
    position: fixed;
    z-index: 2;
    max-width: 360px;
    background: #fff;
    color: #1f2733;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    padding: 16px 18px;
}
.scheme-tour__step {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #ef761b;
    margin-bottom: 6px;
}
.scheme-tour__title { font-size: 1.05rem; font-weight: 700; margin: 0 0 6px; }
.scheme-tour__text { font-size: .9rem; line-height: 1.5; margin: 0 0 14px; color: #4e5562; }
.scheme-tour__actions { display: flex; align-items: center; gap: 8px; }
.scheme-tour__spacer { flex: 1; }
.scheme-tour__btn {
    border: 1px solid #d7dbe0;
    background: #fff;
    color: #1f2733;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: .875rem;
    line-height: 1.2;
    cursor: pointer;
}
.scheme-tour__btn:hover { background: #f4f5f7; }
.scheme-tour__btn--ghost { border-color: transparent; color: #6c727f; padding-left: 4px; padding-right: 4px; }
.scheme-tour__btn--ghost:hover { background: transparent; color: #1f2733; }
.scheme-tour__btn--primary { background: #ef761b; border-color: #ef761b; color: #fff; font-weight: 600; }
.scheme-tour__btn--primary:hover { background: #e06810; }
@media (prefers-reduced-motion: reduce) {
    .scheme-tour__spot { transition: none; }
}
