/* Base Reset & Styling */
* { box-sizing: border-box; margin: 0; padding: 0; }
body, html {
    height: 100%; width: 100%; overflow: hidden; background-color: #f4f4f5;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* -------------------------
    CANVAS & BOARD
-------------------------- */
#viewport {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: radial-gradient(#d1d1d1 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 1;
    overflow: hidden;
}

#board {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    transform-origin: 0 0;
}

#html-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
}

/* -------------------------
    UI TOOLBARS
-------------------------- */
.toolbar {
    position: fixed; background: #ffffff; border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); display: flex; align-items: center; z-index: 10;
}
.top-left { top: 20px; left: 20px; padding: 8px 16px; gap: 8px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; color: #050038; }
.divider { width: 1px; height: 20px; background: #e0e0e0; }
.board-title { font-size: 14px; font-weight: 600; }

/* -------------------------
    ACCESSIBILITY MENU
-------------------------- */
.a11y-menu-trigger {
    width: 44px; height: 44px; border-radius: 8px; border: none;
    background: #ffffff; cursor: pointer; padding: 2px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: 4px; transition: background 0.15s, outline-color 0.15s;
    color: #050038;
}
.a11y-menu-trigger img { width: 36px; height: 36px; display: block; }
.a11y-menu-trigger:hover { background: #e5e7ff; color: #4262ff; }
.a11y-menu-trigger:focus-visible {
    background: #e5e7ff; color: #4262ff;
    outline: 2px solid #4262ff; outline-offset: 2px;
}
.a11y-menu-trigger[aria-expanded="true"] {
    background: #e5e7ff; color: #4262ff;
    outline: 2px solid #4262ff;
}

.kebab-btn {
    width: 40px; height: 40px; border-radius: 8px; border: none;
    background: transparent; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; line-height: 1; color: #050038;
    transition: background 0.15s;
}
.kebab-btn:hover { background: #f0f0f0; }
.kebab-btn:focus-visible { outline: 2px solid #4262ff; outline-offset: 2px; }

.a11y-menu,
.a11y-submenu {
    position: fixed;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    padding: 6px 0;
    min-width: 280px;
    z-index: 30;
    font-family: 'DM Sans', sans-serif;
}
.a11y-submenu { min-width: 240px; }

.a11y-menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    background: none; border: none; cursor: pointer;
    padding: 10px 14px;
    font-size: 14px; font-weight: 500;
    color: #050038; text-align: left;
    font-family: 'DM Sans', sans-serif;
    box-sizing: border-box;
    outline: none;
}
.a11y-menu-item:hover,
.a11y-menu-item.is-active,
.a11y-menu-item:focus-visible {
    background: #eef1ff;
}
.a11y-menu-label { flex: 1; }
.a11y-menu-chevron { margin-left: auto; font-size: 16px; color: #050038; }

.a11y-menu-icon { width: 26px; height: 26px; flex-shrink: 0; }

.a11y-menu-divider {
    height: 1px; background: #e5e5e5; margin: 6px 8px;
}

/* Pill toggle */
.a11y-menu-switch {
    position: relative;
    width: 36px; height: 20px;
    background: #d4d4d8;
    border-radius: 999px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.a11y-menu-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.15s;
}
.a11y-toggle-row[aria-checked="true"] .a11y-menu-switch { background: #4262ff; }
.a11y-toggle-row[aria-checked="true"] .a11y-menu-switch::after { transform: translateX(16px); }

/* Radio rows in toolbar submenu */
.a11y-radio-row {
    cursor: pointer;
}
.a11y-radio-dot {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #c4c4c8;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s;
}
.a11y-radio-row[aria-checked="true"] .a11y-radio-dot {
    border-color: #4262ff;
}
.a11y-radio-row[aria-checked="true"] .a11y-radio-dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #4262ff;
}
.left-vertical {
    top: 50%; left: 20px; transform: translateY(-50%); flex-direction: column; padding: 6px 4px; gap: 4px;
}
.icon-btn {
    background: none; border: none; cursor: pointer; border-radius: 6px;
    font-size: 22px; color: #050038; width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center; transition: background 0.1s;
    padding: 4px;
}
.icon-btn img { width: 32px; height: 32px; display: block; }
.icon-btn:hover { background-color: #f0f0f0; }
.icon-btn.active { background: #e5e7ff; color: #4262ff; outline: 2px solid #4262ff; }
.icon-btn:focus-visible { outline: 2px solid #4262ff; outline-offset: 2px; }
.hidden { display: none !important; }

/* -------------------------
    BOARD OBJECTS 
-------------------------- */
.board-object {
    position: absolute;
    display: flex; align-items: center; justify-content: center;
    user-select: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Focus ring for keyboard navigation — applied when object is focused via Tab */
.board-object:focus {
    outline: 3px solid #4262ff;
    outline-offset: 2px;
}

.board-object.active-obj { outline: 3px solid #4262ff; z-index: 100; }

/* Generic textarea for non-sticky objects */
.board-object:not(.sticky-note) textarea {
    width: 100%; height: 100%; border: none; background: transparent;
    resize: none; outline: none; text-align: center; font-size: 14px;
    font-family: 'DM Sans', sans-serif;
}

/* ─────────────────────────────────────────────────────
   STICKY NOTE — fixed 200×200 square, never resizes
───────────────────────────────────────────────────── */
.sticky-note {
    width: 200px;
    height: 200px;
    min-height: unset;
    background: #ffeb3b;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    box-shadow: 2px 6px 16px rgba(0,0,0,0.13);
    z-index: 10;
    overflow: visible;
    position: relative;
    cursor: default;
}

/* Inner wrapper fills the square */
.sticky-note .text-container-wrapper {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
}

.sticky-note textarea {
    width: 100%;
    height: 100%;
    overflow: hidden;
    text-align: center;
    font-size: 18px;
    line-height: 1.4;
    resize: none;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    color: #1a1a2e;
    /* Pointer events OFF by default — only on during edit */
    cursor: default;
    pointer-events: none;
    display: block;
}

/* Textarea becomes interactive while editing */
.sticky-note textarea.editing-textarea {
    pointer-events: auto;
    cursor: text;
}

/* ─────────────────────────────────────────────────────
   STICKY CONTAINER
   Holds format bar (above) + sticky note (below)
   so the bar never gets clipped by the note's overflow
───────────────────────────────────────────────────── */
.sticky-container {
    position: absolute;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    user-select: none;
    z-index: 10;
}

/* ─────────────────────────────────────────────────────
   FORMAT BAR
   Hidden by default. Only visible when the container
   has .editing-container (i.e. textarea is focused).
───────────────────────────────────────────────────── */
.sticky-format-bar {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(5, 0, 56, 0.14), 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    white-space: nowrap;
    border: 1px solid rgba(0,0,0,0.07);
    order: -1; /* always renders above the sticky */

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Shown ONLY when actively editing text */
.sticky-container.editing-container .sticky-format-bar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Selection outline on the sticky itself */
.sticky-container.active-container .sticky-note {
    outline: 3px solid #4262ff;
}

/* ─────────────────────────────────────────────────────
   FORMAT BAR BUTTONS
───────────────────────────────────────────────────── */
.fmt-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.1s, color 0.1s;
    flex-shrink: 0;
}
.fmt-btn:hover { background: #f0f0f4; color: #050038; }
.fmt-btn.fmt-active { background: #eef1ff; color: #4262ff; }
.fmt-btn:focus-visible { outline: 2px solid #4262ff; outline-offset: 1px; border-radius: 4px; }

.fmt-divider {
    width: 1px;
    height: 18px;
    background: #e8e8ec;
    margin: 0 3px;
    flex-shrink: 0;
}

/* Color swatch dot in the format bar */
.fmt-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s;
}
.fmt-color-dot:hover { transform: scale(1.2); }
.fmt-color-dot:focus-visible { outline: 2px solid #4262ff; outline-offset: 2px; border-radius: 50%; }

/* ─────────────────────────────────────────────────────
   OTHER OBJECT TYPES
───────────────────────────────────────────────────── */
.shape-rect { width: 160px; height: 100px; background: #e3f2fd; border: 2px solid #2196f3; border-radius: 8px; padding: 10px; }
.text-box { width: 200px; height: auto; background: transparent; box-shadow: none; padding: 5px; }
.text-box textarea { text-align: left; font-size: 18px; color: #050038; overflow: hidden; height: 40px; }
.frame-box { width: 400px; height: 300px; background: rgba(255,255,255,0.4); border: 2px dashed #9e9e9e; align-items: flex-start; justify-content: flex-start; z-index: 1 !important; }
.frame-box.active-obj { z-index: 1 !important; outline: 3px solid #4262ff; }
.frame-title { position: absolute; top: -25px; left: 0; font-size: 14px; font-weight: bold; color: #555; pointer-events: none; }

/* ─────────────────────────────────────────────────────
   CONNECTION HANDLES
───────────────────────────────────────────────────── */
.conn-handle { position: absolute; width: 12px; height: 12px; background: #ffffff; border: 2px solid #4262ff; border-radius: 50%; cursor: crosshair; z-index: 10; opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease; }
.board-object:hover .conn-handle, .board-object.active-obj .conn-handle { opacity: 1; }
.conn-handle:hover { transform: scale(1.3); background: #4262ff; }
.conn-handle.top    { top: -6px; left: calc(50% - 6px); }
.conn-handle.right  { right: -6px; top: calc(50% - 6px); }
.conn-handle.bottom { bottom: -6px; left: calc(50% - 6px); }
.conn-handle.left   { left: -6px; top: calc(50% - 6px); }

/* ─────────────────────────────────────────────────────
   KEYBOARD SHORTCUTS BUTTON
───────────────────────────────────────────────────── */
#shortcuts-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px 8px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #050038;
    font-family: 'DM Sans', sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
#shortcuts-toggle-btn:hover {
    border-color: #4262ff;
    box-shadow: 0 4px 14px rgba(66, 98, 255, 0.15);
    background: #f5f7ff;
}
#shortcuts-toggle-btn:focus-visible {
    outline: 2px solid #4262ff;
    outline-offset: 2px;
}
#shortcuts-toggle-btn span:first-child {
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    background: #050038; color: #fff;
    border-radius: 50%;
    font-size: 13px; font-weight: 700;
    line-height: 1;
}
.shortcuts-btn-label { letter-spacing: 0.01em; }

/* ─────────────────────────────────────────────────────
   KEYBOARD SHORTCUTS PANEL
───────────────────────────────────────────────────── */
#shortcuts-panel {
    position: fixed;
    bottom: 72px;
    right: 24px;
    width: 400px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(5, 0, 56, 0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 200;
    border: 1px solid rgba(0,0,0,0.06);
    animation: panelSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shortcuts-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f0f0f2;
    position: sticky; top: 0; background: #fff;
    border-radius: 12px 12px 0 0;
    z-index: 1;
}
.shortcuts-panel-header h2 { font-size: 16px; font-weight: 700; color: #050038; letter-spacing: -0.2px; }
#shortcuts-close-btn {
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: #888; width: 28px; height: 28px;
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
    transition: background 0.1s, color 0.1s;
}
#shortcuts-close-btn:hover { background: #f0f0f2; color: #050038; }
#shortcuts-close-btn:focus-visible { outline: 2px solid #4262ff; outline-offset: 1px; }

.shortcuts-section { padding: 16px 20px; border-bottom: 1px solid #f0f0f2; }
.shortcuts-section:last-child { border-bottom: none; }
.shortcuts-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #888; margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.section-icon { font-size: 14px; }
.new-badge {
    background: #4262ff; color: #fff; font-size: 10px; font-weight: 700;
    letter-spacing: 0.04em; padding: 2px 6px; border-radius: 20px;
    text-transform: uppercase; margin-left: 4px;
}
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table tr { border-radius: 6px; transition: background 0.1s; }
.shortcuts-table tbody tr:hover td { background: #f7f8ff; }
.shortcuts-table tbody tr:hover td:first-child { border-radius: 6px 0 0 6px; }
.shortcuts-table tbody tr:hover td:last-child { border-radius: 0 6px 6px 0; }
.shortcuts-table td { padding: 7px 8px; font-size: 13px; color: #333; vertical-align: middle; }
.shortcuts-table td:first-child { color: #050038; font-weight: 500; width: 55%; }
.shortcuts-table td:last-child { text-align: right; white-space: nowrap; }
.shortcuts-table th { padding: 7px 8px; font-size: 12px; color: #050038; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; text-align: left; border-bottom: 1px solid #e0e0e0; }
.shortcuts-table th:last-child { text-align: right; }

kbd {
    display: inline-flex; align-items: center; justify-content: center;
    background: #f4f4f6; border: 1px solid #ddd; border-bottom: 2px solid #ccc;
    border-radius: 5px; padding: 2px 6px; font-size: 11px;
    font-family: 'DM Mono', 'Fira Mono', monospace; font-weight: 500;
    color: #333; line-height: 1.4; white-space: nowrap;
}
kbd.inline-kbd { font-size: 11px; padding: 1px 5px; }

.accessibility-section { background: #fafbff; }
.accessibility-section .shortcuts-section-title { color: #4262ff; }
.shortcuts-note { margin-top: 10px; font-size: 12px; color: #888; line-height: 1.5; }
.shortcuts-note strong { color: #050038; }

/* ─────────────────────────────────────────────────────
   ONBOARDING MODAL
───────────────────────────────────────────────────── */
#onboarding-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(244, 244, 245, 0.85);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; transition: opacity 0.3s ease;
}
#onboarding-overlay.hidden { display: none !important; opacity: 0; }

.onboarding-modal {
    background: #ffffff; padding: 40px; border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.1); width: 1000px; max-width: 95%;
    max-height: 92vh; overflow-y: auto;
    font-family: 'DM Sans', sans-serif;
}
.modal-header { text-align: center; margin-bottom: 40px; }
.modal-logo { font-size: 32px; font-weight: 800; color: #050038; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.modal-logo span { background: #ffeb3b; padding: 4px 8px; border-radius: 4px; font-size: 24px; letter-spacing: -2px; }
.modal-header h2 { font-size: 28px; color: #000; margin-bottom: 8px; font-weight: 700; }
.modal-header p { font-size: 16px; color: #555; }
.step-title { font-size: 22px; color: #000; margin-bottom: 28px; font-weight: 700; }

.toolbar-options { display: flex; align-items: stretch; gap: 40px; margin-bottom: 28px; }
.option-col { flex: 1; display: flex; flex-direction: column; }
.middle-col { border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0; padding: 0 40px; margin: 0 -20px; }
.option-col h4 { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 16px; color: #000; }
.preview-box {
    border: 1px solid #000; border-radius: 8px; padding: 12px; min-height: 100px;
    display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; margin-bottom: 16px;
}
.custom-preview { justify-content: center; align-items: center; gap: 14px; }
.preview-box span { font-size: 20px; width: 32px; height: 32px; text-align: center; color: #000; display: inline-flex; align-items: center; justify-content: center; }
.preview-box .preview-tool-icon { width: 32px; height: 32px; padding: 0; }
.preview-box .preview-tool-icon img { width: 30px; height: 30px; display: block; }
.preview-box .add-btn { background: #000; color: #fff; border-radius: 4px; font-size: 16px; font-weight: bold; line-height: 24px; height: 24px; width: 24px; cursor: default; }

.desc { font-size: 14px; color: #555; line-height: 1.5; margin-bottom: 10px; flex-grow: 1; }
.link { font-size: 14px; color: #000; text-decoration: underline; margin-bottom: 16px; display: inline-block; cursor: pointer; }
button.link, .link.link-button { background: none; border: none; padding: 0; font-family: inherit; text-align: left; }
button.link:focus-visible, .link.link-button:focus-visible { outline: 2px solid #4262ff; outline-offset: 2px; border-radius: 2px; }

.select-tool-btn {
    background: #000; color: #fff; border: 2px solid #000; padding: 12px;
    font-size: 14px; font-weight: 600; border-radius: 6px; cursor: pointer; width: 100%; transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}
.select-tool-btn:hover { background: #333; }
.select-tool-btn.selected { background: #fff; color: #000; }
.select-tool-btn:focus-visible { outline: 2px solid #4262ff; outline-offset: 2px; }

.modal-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.modal-footer.right-align { justify-content: flex-end; }
.modal-footer.space-between { justify-content: space-between; align-items: center; margin-top: 32px; }
.modal-footer .link { margin-bottom: 0; }

#continue-btn {
    background: #4262ff; color: #fff; border: none; padding: 12px 32px;
    font-size: 16px; font-weight: 600; border-radius: 6px; cursor: pointer;
    transition: background 0.2s; font-family: 'DM Sans', sans-serif;
}
#continue-btn:hover:not(:disabled) { background: #2b42c4; }
#continue-btn:disabled { background: #a6b5ff; cursor: not-allowed; }
#continue-btn:focus-visible { outline: 2px solid #050038; outline-offset: 2px; }

#done-btn {
    background: #4262ff; color: #fff; border: none; padding: 12px 32px;
    font-size: 16px; font-weight: 600; border-radius: 6px; cursor: pointer;
    transition: background 0.2s; font-family: 'DM Sans', sans-serif;
}
#done-btn:hover { background: #2b42c4; }
#done-btn:focus-visible { outline: 2px solid #050038; outline-offset: 2px; }

.gray-back-btn {
    background: #e5e5e8;
    color: #050038;
    border: none;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'DM Sans', sans-serif;
}
.gray-back-btn:hover { background: #d4d4d8; }

.settings-learn-link {
    display: inline-block;
    margin-top: 14px;
    margin-bottom: 8px;
}

/* -------------------------
    CUSTOM TOOLBAR NAME STEP
-------------------------- */
#step-custom-name {
    display: flex; flex-direction: column; min-height: 420px; justify-content: space-between;
}
.custom-name-body {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; flex: 1; padding: 56px 0 40px; text-align: center;
}
.custom-name-icon { margin-bottom: 24px; line-height: 1; }
.custom-name-title { font-size: 24px; font-weight: 700; color: #050038; margin-bottom: 40px; }
.custom-name-field { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 320px; }
.custom-name-label { font-size: 14px; color: #888; font-weight: 400; font-family: 'DM Sans', sans-serif; }
.toolbar-name-input {
    width: 100%; border: none; border-bottom: 1.5px solid #050038; outline: none;
    font-size: 16px; font-family: 'DM Sans', sans-serif;
    padding: 6px 0; text-align: center; color: #050038; background: transparent; box-sizing: border-box;
}
.toolbar-name-input:focus { border-bottom-color: #4262ff; }
.cancel-link {
    background: none; border: none; font-size: 14px; font-family: 'DM Sans', sans-serif;
    color: #050038; text-decoration: underline; cursor: pointer; padding: 0; font-weight: 500;
}
.cancel-link:hover { color: #333; }
.continue-custom-btn {
    background: #4262ff; color: #fff; border: none; padding: 12px 32px;
    font-size: 16px; font-weight: 600; border-radius: 6px; cursor: pointer;
    transition: background 0.2s; font-family: 'DM Sans', sans-serif;
}
.continue-custom-btn:hover { background: #2b42c4; }

/* -------------------------
    TOOLBAR CUSTOMIZATION STEP
-------------------------- */
#step-customize-creation {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.customize-subtitle {
    font-size: 14px;
    color: #555;
    margin: -16px 0 4px;
}

.customize-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    align-items: start;
}

.customize-tools-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 56vh;
    overflow-y: auto;
    padding: 2px;
}

.tool-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d8d8db;
    border-radius: 8px;
    cursor: grab;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-row:focus-visible {
    border-color: #4262ff;
    box-shadow: 0 0 0 2px rgba(66, 98, 255, 0.35);
}

.tool-row:focus-visible .tool-toggle-btn {
    outline: 2px solid #4262ff;
    outline-offset: 2px;
}

.tool-row.dragging { opacity: 0.4; }
.tool-row.drag-over-top { border-top: 2px solid #4262ff; }
.tool-row.drag-over-bottom { border-bottom: 2px solid #4262ff; }

.tool-toggle-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1.5px solid #c9c9d1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    background: #fff;
    color: #4262ff;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tool-toggle-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

.tool-toggle-btn:hover { border-color: #4262ff; }

.tool-toggle-btn.is-enabled { border-color: #4262ff; }
.tool-toggle-btn.is-enabled svg { visibility: visible; }
.tool-toggle-btn.is-disabled svg { visibility: hidden; }

.tool-row-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tool-row-icon img {
    width: 28px;
    height: 28px;
}

.tool-row-label {
    flex: 1;
    font-size: 14px;
    color: #050038;
    font-weight: 500;
}

.tool-drag-handle {
    background: none;
    border: none;
    cursor: grab;
    color: #888;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    flex-shrink: 0;
}
.tool-drag-handle:hover { color: #050038; }
.tool-drag-handle:active { cursor: grabbing; }

.customize-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-card {
    background: #f4f4f5;
    border: 1px solid #e5e5e7;
    border-radius: 10px;
    padding: 14px 16px;
}

.info-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #050038;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-card h4 img { width: 18px; height: 18px; }
.info-card p { font-size: 13px; color: #333; margin: 0; line-height: 1.4; }

.kbd-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #333;
    padding: 4px 0;
    gap: 8px;
}
.kbd-row span:first-child { flex: 1; }
.kbd-pair { display: inline-flex; gap: 4px; }

.customize-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* Focus ring on the listbox container so sighted keyboard users see when it's the focus target */
#customize-tools-list:focus-visible {
    outline: 2px solid #4262ff;
    outline-offset: 2px;
    border-radius: 8px;
}

.customize-footer-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Tab-order vs. visual-order overrides (DOM order is the tab order; flex order keeps the visuals unchanged) */
/* Step "Name your toolbar" footer: DOM is Continue, Cancel — visually keep Cancel on the left */
#step-custom-name .modal-footer #cancel-custom-name-btn { order: 1; }
#step-custom-name .modal-footer #continue-custom-name-btn { order: 2; }
/* Customize-creation footer: DOM is actions(Save,Reset) then Back — visually keep Back on the left, Reset then Save on the right */
.customize-footer .customize-footer-actions { order: 2; }
.customize-footer #customize-back-btn { order: 1; }
.customize-footer-actions #reset-default-btn { order: 1; }
.customize-footer-actions #save-customize-btn { order: 2; }
/* Step-2 footer: DOM is Done, Back — visually keep Back on the left */
#step-2 .modal-footer #settings-back-btn { order: 1; }
#step-2 .modal-footer #done-btn { order: 2; }

.reset-btn {
    background: #ff8585;
    color: #fff;
    border: none;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.2s;
}
.reset-btn:hover { background: #ee6e6e; }

#customize-back-btn {
    font-size: 14px;
    color: #050038;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

/* Saved-state Custom column in Step 1 */
.custom-select-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.custom-select-row .select-tool-btn { flex: 1; }

.edit-custom-btn {
    width: 44px;
    background: #fff;
    color: #050038;
    border: 2px solid #000;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s;
    font-family: 'DM Sans', sans-serif;
}
.edit-custom-btn:hover { background: #f0f0f0; }
.edit-custom-btn.hidden { display: none; }

/* -------------------------
    CUSTOM TOOL PICKER
-------------------------- */
#custom-tool-picker {
    background: #f9f9fb; border: 1px solid #e0e0e0; border-radius: 10px;
    padding: 20px 24px; margin-bottom: 20px;
    animation: pickerReveal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pickerReveal {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.picker-header { margin-bottom: 16px; }
.picker-header h4 { font-size: 15px; font-weight: 700; color: #050038; margin-bottom: 4px; }
.picker-subtitle { font-size: 13px; color: #888; }
.picker-categories { display: flex; gap: 24px; margin-bottom: 16px; }
.picker-category { flex: 1; }
.picker-category h5 {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: #aaa; margin-bottom: 10px;
}
.picker-tools-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-tool-chip {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    background: #fff; border: 1.5px solid #e0e0e0; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: #333; font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s, background 0.15s, color 0.15s; user-select: none;
}
.picker-tool-chip .chip-icon { font-size: 15px; line-height: 1; }
.picker-tool-chip .chip-label { font-size: 12px; }
.picker-tool-chip:hover { border-color: #4262ff; background: #f5f7ff; color: #4262ff; }
.picker-tool-chip.chip-selected { border-color: #4262ff; background: #eef1ff; color: #4262ff; }
.picker-tool-chip:focus-visible { outline: 2px solid #4262ff; outline-offset: 1px; }

.picker-preview-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; min-height: 52px;
}
.picker-preview-label {
    font-size: 12px; font-weight: 600; color: #aaa; white-space: nowrap;
    text-transform: uppercase; letter-spacing: 0.05em;
}
#picker-live-preview {
    display: flex; gap: 6px; align-items: center; flex: 1; flex-wrap: wrap;
}
.preview-chip {
    background: #f0f0f2; border-radius: 5px; width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; border: 1px solid #e0e0e0;
}
.picker-count { font-size: 12px; font-weight: 600; color: #aaa; white-space: nowrap; min-width: 70px; text-align: right; }
.picker-count.at-max { color: #4262ff; }

/* ─────────────────────────────────────────────────────
   STEP 2: SETTINGS CARDS
───────────────────────────────────────────────────── */
.settings-list { display: flex; flex-direction: column; gap: 14px; }
.setting-card {
    display: flex; align-items: center; justify-content: space-between;
    border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px 24px;
    background: #fff; gap: 16px;
}
.setting-icon { font-size: 22px; width: 36px; display: flex; justify-content: center; flex-shrink: 0; }
.setting-text { flex-grow: 1; }
.setting-text h4 { font-size: 15px; font-weight: 700; color: #000; margin-bottom: 6px; }
.setting-text p { font-size: 13px; color: #555; line-height: 1.6; margin: 0; }

.toggle-switch {
    position: relative; display: inline-block;
    width: 50px; height: 28px; flex-shrink: 0;
    /* Reset native <button> styling */
    background: transparent; border: none; padding: 0; margin: 0;
    cursor: pointer; font: inherit; color: inherit;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: #4262ff; }
input:checked + .slider:before { transform: translateX(22px); }
/* role=checkbox button variant — key the slider visuals off aria-checked */
.toggle-switch[role="checkbox"][aria-checked="true"] .slider { background-color: #4262ff; }
.toggle-switch[role="checkbox"][aria-checked="true"] .slider:before { transform: translateX(22px); }
.setting-card:has(:focus-visible) { border: 2px solid #4262ff; }
.toggle-switch input:focus-visible + .slider { outline: 2px solid #4262ff; outline-offset: 2px; }
.toggle-switch[role="checkbox"]:focus-visible .slider { outline: 2px solid #4262ff; outline-offset: 2px; }
.toggle-switch[role="checkbox"]:focus { outline: none; }

/* ─────────────────────────────────────────────────────
   SIDEBAR Z-INDEX
───────────────────────────────────────────────────── */
#sidebar { z-index: 1001; transition: all 0.3s ease; }

/* ─────────────────────────────────────────────────────
   STICKY COLOR PANEL
───────────────────────────────────────────────────── */
#sticky-color-panel {
    position: fixed; top: 50%; left: 72px; transform: translateY(-50%);
    background: #ffffff; border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08); padding: 12px;
    display: flex; flex-direction: column; gap: 10px; z-index: 1001;
}
.color-grid { display: grid; grid-template-columns: repeat(2, 44px); gap: 10px; }
.sticky-color-swatch {
    width: 44px; height: 44px; border-radius: 4px; cursor: pointer;
    border: 1px solid rgba(0,0,0,0.08); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.05);
    transition: transform 0.15s, border-color 0.15s;
}
.sticky-color-swatch:hover { transform: scale(1.05); }
.sticky-color-swatch.selected-color { outline: 2px solid #4262ff; outline-offset: 2px; }
.sticky-color-swatch:focus-visible { outline: 3px solid #4262ff; outline-offset: 2px; }

.panel-action-btn {
    background: #f1f3f5; border: none; color: #050038; font-size: 13px; font-weight: 600;
    padding: 8px 12px; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
    transition: background 0.1s; font-family: 'DM Sans', sans-serif;
}
.panel-action-btn:hover { background: #e2e6ea; }
.panel-action-btn .btn-icon { font-size: 14px; }

/* ─────────────────────────────────────────────────────
   SCREEN READER & LIVE REGIONS
───────────────────────────────────────────────────── */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─────────────────────────────────────────────────────
   TOAST — brief visual confirmation for sighted users
───────────────────────────────────────────────────── */
.a11y-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #050038;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
    max-width: 380px;
    text-align: center;
}
.a11y-toast.fade-out { opacity: 0; }