/* =========================================================
   LIVE CANVAS — CLEAN CSS
   Themes ❌
   Sticky Notes ❌
   Statistics ❌
========================================================= */

/* Global reset and shared custom-cursor baseline for the whiteboard UI. */
* {
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='), none !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.custom-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    color: #9900ff;
    left: -100px;
    top: -100px;
    transition: color 0.2s ease;
}

.cursor-pointer {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.cursor-label {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 2px;
    margin-top: 18px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    color: #ffffff;
    background-color: currentColor;
    font-family: 'Poppins', 'Outfit', sans-serif;
    pointer-events: none;
    user-select: none;
}

.custom-cursor.show-label .cursor-label,
.remote-canvas-cursor .cursor-label {
    opacity: 1;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f7f6f2;
    color: #1e293b;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

/* =========================================================
   HEADER
========================================================= */
#collaborators {
    display: flex;
    align-items: center;
    gap: 8px;
}
.collaborators {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

header {
    width: 100%;
    height: 94px;

    padding: 0 40px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: #ffffff;

    position: sticky;
    top: 0;
    z-index: 999;
    overflow: visible;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.logo h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #1e293b;
}

.header-right {
    display: flex;
    align-items: center;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.auth-section button {
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    background: #2563eb;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: 0.25s ease;
}

.auth-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

#welcomeUser {
    font-weight: 600;
    color: #2563eb;
}

/* User Profile Avatar in Header */
.user-avatar-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    cursor: pointer;
    flex-shrink: 0;
}

.user-avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(#f472b6, #fb923c, #facc15, #34d399, #60a5fa, #a78bfa, #f472b6);
    z-index: 0;
    transition: transform .15s ease;
}

.user-avatar-wrap:hover .user-avatar-ring {
    transform: scale(1.08);
}

.user-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid #ffffff;
    z-index: 1;
    display: block;
    background: #fff;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: 52px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
    width: 230px;
    padding: 8px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    animation: menuFadeIn .18s cubic-bezier(.16, 1, .3, 1);
}

.user-menu-dropdown.show {
    display: flex;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-menu-header {
    padding: 10px 12px 8px;
}

.user-menu-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-email {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background .12s ease, color .12s ease;
}

.user-menu-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.user-menu-logout {
    color: #ef4444 !important;
}

.user-menu-logout:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* The account dropdown is inside .auth-section, whose generic button rule is
   intentionally blue for Login/Signup. Keep the destructive action neutral. */
.auth-section .user-menu-logout {
    background: #ffffff !important;
    color: #ef4444 !important;
}

.auth-section .user-menu-logout:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    transform: none;
    box-shadow: none;
}

/* =========================================================
   MAIN
========================================================= */

main {
    width: 100%;
    height: calc(100vh - 94px);
    min-height: 0;

    display: block;

    margin: 0;
    padding: 0;
}

/* =========================================================
   CANVAS SECTION
========================================================= */

.canvas-section {
    width: 100%;
    height: 100%;
    min-height: 0;

    display: flex;
    flex-direction: column;

    background: #f7f6f2;

    overflow: visible;
    position: relative;
}

/* =========================================================
   TOP CANVAS BAR
========================================================= */

.canvas-topbar {
    height: 74px;

    flex-shrink: 0;

    background: rgba(255, 255, 255, 0.96);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 22px;
    overflow: visible;
    position: relative;
    z-index: 100;
}

.document-info {
    display: flex;
    align-items: center;
}

.document-icon {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f1efff;
    color: #6754d9;

    border-radius: 11px;
}

.document-info input {
    border: none;
    outline: none;

    font-family: 'Poppins', sans-serif;

    font-size: 24px;
    font-weight: 700;

    background: transparent;
    color: #202333;

    min-width: 240px;
    max-width: 520px;
    padding: 5px 12px;
    text-align: center;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.document-info input:hover,
.document-info input:focus {
    background: rgba(0, 0, 0, 0.04);
}

/* =========================================================
   COLLABORATORS
========================================================= */

.collaborators {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible;
    position: absolute;
    right: 22px;
    z-index: 100;
}

.collaborator-list {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible;
    position: relative;
    z-index: 100;
}

.collaborator-list .avatar,
.avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #ffffff;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
    flex-shrink: 0;
    cursor: pointer;
    overflow: visible !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.collaborator-list .avatar:hover,
.avatar:hover {
    transform: translateY(-2px) scale(1.12);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
    z-index: 99999;
}

.avatar img,
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    pointer-events: none;
}

.avatar-tooltip {
    display: none;
}

#avatarGlobalTooltip {
    position: fixed;
    color: #ffffff;
    font-family: 'Poppins', 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    border: 2px solid rgba(255, 255, 255, 0.35);
    z-index: 2147483647;
    letter-spacing: 0.01em;
}

#avatarGlobalTooltip.visible {
    opacity: 1;
    visibility: visible;
}

.avatar.more {
    background: #64748b;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid #ffffff;
}

.share-btn {
    margin-left: 12px;

    border: none;

    background: #6754d9;
    color: white;

    padding: 9px 16px;

    border-radius: 9px;

    font-family: 'Poppins', sans-serif;
    font-weight: 600;

    cursor: pointer;

    transition: 0.25s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(103, 84, 217, 0.25);
}

/* =========================================================
   TOOLBAR
========================================================= */

.canvas-toolbar {
    height: 58px;

    flex-shrink: 0;

    display: flex;
    align-items: center;

    gap: 5px;

    padding: 0 18px;

    background: rgba(255, 255, 255, 0.96);

    border-bottom: 1px solid #e8e8ef;

    box-shadow: 0 2px 10px rgba(20, 20, 50, 0.05);

    backdrop-filter: blur(14px);

    position: relative;
    z-index: 50;
}

.tool {
    width: 38px;
    height: 38px;

    border: none;

    border-radius: 9px;

    background: transparent;

    color: #4b5563;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;

    cursor: pointer;

    transition: 0.18s ease;
}

.tool:hover {
    background: #f1f3f8;
    color: #4f46e5;
}

.tool:active {
    transform: scale(0.92);
}

.tool.active-tool {
    background: #eeeaff;
    color: #4f46e5;
}

.toolbar-divider {
    width: 1px;
    height: 28px;

    background: #e5e7eb;

    margin: 0 7px;
}

.toolbar-spacer {
    flex: 1;
}

/* =========================================================
   COLOR PICKER
========================================================= */

.color-tool {
    width: 38px;
    height: 38px;

    border-radius: 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    background: #f5f6fa;
}

.color-tool input {
    width: 23px;
    height: 23px;

    padding: 0;
    border: none;

    background: transparent;

    cursor: pointer;
}

/* =========================================================
   BRUSH SIZE
========================================================= */

.brush-slider {
    width: 85px;

    accent-color: #4f46e5;

    cursor: pointer;
}

/* =========================================================
   ZOOM
========================================================= */

#zoomValue {
    min-width: 48px;

    text-align: center;

    font-size: 13px;
    font-weight: 500;

    color: #555;
}

/* =========================================================
   NOTEBOOK AREA
========================================================= */

.notebook-area {
    flex: 1;

    /* The Select tool moves the board within this viewport. */
    overflow: hidden;

    padding: 0;

    display: block;

    background: #ffffff;
    position: relative;
}

/* =========================================================
   NOTEBOOK PAGE
========================================================= */

.notebook-page {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    min-height: 0;

    background: #ffffff;

    border-radius: 0;

    box-shadow: none;

    overflow: hidden;

    cursor:none;

    transform-origin: top center;
    will-change: transform;
}

.notebook-page.canvas-pan-ready {
    cursor: grab;
}

.notebook-page.is-panning-canvas {
    cursor: grabbing;
}

/* =========================================================
   COLLABORATIVE CURSORS
========================================================= */

#canvasPointers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: visible;
}

.remote-canvas-cursor {
    position: absolute;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    z-index: 1000;
    transform: translate(0, 0);
    transition: left 0.06s linear, top 0.06s linear, opacity 0.2s ease;
}

.remote-canvas-cursor .cursor-pointer {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.remote-canvas-cursor .cursor-label {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 2px;
    margin-top: 18px;
    white-space: nowrap;
    opacity: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    color: #ffffff;
    background-color: currentColor;
    font-family: 'Poppins', 'Outfit', sans-serif;
    pointer-events: none;
    user-select: none;
}

/* =========================================================
   PAPER
========================================================= */

.paper-background {
    position: absolute;

    inset: 0;

    background-color: #ffffff;

    background-image: none;

    pointer-events: none;

    z-index: 0;
}

/* =========================================================
   DRAWING CANVAS
========================================================= */

#drawingBoard {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: transparent;

    cursor: crosshair;

    touch-action: none;

    z-index: 2;
}

/* =========================================================
   OBJECT LAYER
========================================================= */

.object-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;

    pointer-events: none;

    z-index: 3;
    transform-origin: 0 0;
    overflow: visible;
}

/* =========================================================
   PAGE CONTROLS
========================================================= */

.page-controls {
    margin-top: 20px;

    display: flex;
    align-items: center;

    gap: 12px;

    background: white;

    border: 1px solid #e4e4e8;

    border-radius: 10px;

    padding: 5px 8px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.page-btn {
    width: 32px;
    height: 32px;

    border: none;

    background: transparent;

    border-radius: 7px;

    cursor: pointer;

    transition: 0.2s;
}

.page-btn:hover {
    background: #f1effb;
}

#pageNumber {
    font-size: 12px;
    color: #555;
}

/* =========================================================
   ADD PAGE
========================================================= */

.add-page-btn {
    margin-top: 12px;

    padding: 11px 22px;

    border-radius: 10px;

    border: 1px dashed #9c8de7;

    background: #faf9ff;

    color: #6754d9;

    font-family: 'Poppins', sans-serif;

    font-weight: 600;

    cursor: pointer;

    transition: 0.2s;
}

.add-page-btn:hover {
    background: #f0edff;
}

/* =========================================================
   EXTEND PAGE
========================================================= */

.extend-page-btn {
    margin-top: 10px;

    border: none;

    background: transparent;

    color: #999;

    cursor: pointer;

    font-family: 'Poppins', sans-serif;

    font-size: 12px;
}

.extend-page-btn:hover {
    color: #6754d9;
}

/* =========================================================
   FOOTER
========================================================= */

footer {
    display: none;

    text-align: center;

    padding: 18px;

    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
}

footer p {
    color: #64748b;
    font-size: 14px;
}

/* =========================================================
   BUTTON GENERAL
========================================================= */

button {
    transition: 0.25s ease;
}

button:active {
    transform: scale(0.96);
}

/* =========================================================
   ROOM PAGE
========================================================= */

.room-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f7f6f2;
}

.room-card {
    width: 420px;

    padding: 40px;

    background: white;

    border-radius: 20px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.10);

    text-align: center;
}

.room-card h1 {
    margin-bottom: 8px;
}

.room-card p {
    color: #777;
    margin-bottom: 30px;
}

.room-card button {
    width: 100%;

    padding: 13px;

    margin-top: 10px;

    border: none;

    border-radius: 10px;

    cursor: pointer;

    font-family: 'Poppins', sans-serif;

    font-size: 15px;
}

#createRoomBtn {
    background: #111827;
    color: white;
}

#joinRoomBtn {
    background: #f1f3f7;
    color: #222;
}

.join-section,
.created-room {
    display: none;

    margin-top: 20px;
}

.join-section input,
.created-room input {
    width: 100%;

    box-sizing: border-box;

    padding: 12px;

    border: 1px solid #ddd;

    border-radius: 8px;

    margin-bottom: 8px;

    font-family: 'Poppins', sans-serif;
}

.created-room {
    padding: 15px;

    background: #f7f7ff;

    border-radius: 12px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {

    header {
        padding: 0 20px;
    }

    .document-info small {
        display: none;
    }

    .brush-slider {
        display: none;
    }

    .notebook-area {
        padding: 0;
    }

    .notebook-page {
        width: 100%;
        min-height: 0;
    }
}

@media (max-width: 600px) {

    header {
        height: auto;

        padding: 15px;

        flex-direction: column;

        gap: 12px;
    }

    .logo h2 {
        font-size: 22px;
    }

    .canvas-topbar {
        padding: 0 12px;
    }

    .collaborators .avatar {
        display: none;
    }

    .share-btn {
        margin-left: 0;
    }

    .canvas-toolbar {
        overflow-x: auto;
    }

    .notebook-page { min-height: 0; }
}
/* ============================================================
   SHAPE MODAL
============================================================ */

.shape-modal {
    position: fixed;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    width: 420px;

    background: #ffffff;

    border: 1px solid #e5e5e5;

    border-radius: 18px;

    padding: 18px;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.22);

    z-index: 99999;

    display: none;
}


/* OPEN */

.shape-modal.show {
    display: block;
}


/* HEADER */

.shape-modal-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;

    font-size: 18px;
    font-weight: 700;
}


#closeShapePicker {
    border: none;

    background: transparent;

    font-size: 18px;

    cursor: pointer;

    width: 32px;
    height: 32px;

    border-radius: 8px;
}

#closeShapePicker:hover {
    background: #f1f1f1;
}


/* GRID */

.shape-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 10px;
}


/* SHAPE BUTTON */

.shape-option {
    height: 85px;

    border: 1px solid #e5e5e5;

    background: #fafafa;

    border-radius: 12px;

    cursor: pointer;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 5px;

    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border 0.15s ease;
}


.shape-option span {
    font-size: 30px;

    line-height: 1;

    color: #6754d9;
}


.shape-option small {
    font-size: 11px;

    color: #555;
}


.shape-option:hover {
    background: #f0edff;

    border-color: #6754d9;

    transform: translateY(-2px);
}

.board-code-btn {
    border: 1px solid #dbe3f4;
    background: #f7f6f2;
    color: #1e293b;
    padding: 9px 13px;
    border-radius: 9px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.board-code-btn:hover {
    background: #ffffff;
    transform: translateY(-1px);
}

/* =========================================================
   FLOATING CANVAS WORKSPACE
   Keeps the existing controls, but presents them as a board UI.
========================================================= */

body {
    background: #f8fafc;
}

header {
    position: fixed;
    top: 16px;
    left: 18px;
    right: 18px;
    z-index: 300;
    width: auto;
    height: 44px;
    padding: 0;
    background: transparent;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

header .logo {
    display: flex;
    height: 44px;
    padding: 0 13px;
    gap: 7px;
    border: 1px solid #e8edf4;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.10);
    pointer-events: auto;
}

header .logo-img {
    width: 27px;
    height: 27px;
}

header .logo h2 {
    font-size: 17px;
    letter-spacing: 0;
}

header .auth-section {
    pointer-events: auto;
}

.auth-section button {
    padding: 9px 12px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
}

main {
    height: 100vh;
}

.canvas-section {
    background: #f8fafc;
}

.canvas-topbar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 0;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
    z-index: 200;
}

.document-info {
    position: fixed;
    top: 16px;
    left: 238px;
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e8edf4;
    border-radius: 12px;
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.10);
}

/* .document-info::before {
    content: "◈";
    color: #6754d9;
    font-size: 18px;
    margin-right: 7px;
} */

.document-info input {
    width: 18px;
    min-width: 18px;
    max-width: 260px;
    padding: 4px 2px;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
}

.collaborators {
    position: fixed;
    top: 16px;
    right: 78px;
    min-height: 44px;
    padding: 3px 5px 3px 10px;
    gap: 7px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e8edf4;
    border-radius: 12px;
    box-shadow: 0 7px 22px rgba(15, 23, 42, 0.10);
}

.collaborator-list {
    gap: 0;
}

.collaborator-list .avatar,
.avatar {
    margin-left: -7px;
    width: 32px;
    height: 32px;
}

.share-btn {
    margin-left: -15px;
    padding: 8px 11px;
    border-radius: 9px;
    background: #6754d9;
    box-shadow: none;
}

.board-code-btn {
    padding: 8px 10px;
    background: #f8fafc;
}

.canvas-toolbar {
    position: absolute;
    top: 200px;
    left: 18px;
    z-index: 150;
    width: 52px;
    height: auto;
    max-height: calc(100vh - 104px);
    padding: 7px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e8edf4;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.tool {
    flex: 0 0 38px;
}

.toolbar-divider {
    width: 28px;
    height: 1px;
    min-height: 1px;
    margin: 4px 0;
}

.toolbar-spacer {
    display: none;
}

.color-tool {
    flex: 0 0 38px;
}

.brush-slider {
    width: 18px;
    height: 72px;
    margin: 3px 0;
    writing-mode: vertical-lr;
    direction: rtl;
}

/* This dock is outside the scrollable tool rail, so it can never be clipped. */
.canvas-navigation {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 400;
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #e8edf4;
    border-radius: 13px;
    box-shadow: 0 9px 26px rgba(15, 23, 42, 0.14);
}

.canvas-navigation .tool {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 9px;
}

.canvas-navigation .tool:hover {
    background: #f1efff;
}

.navigation-divider {
    width: 1px;
    height: 24px;
    margin: 0 4px;
    background: #e5e7eb;
}

.canvas-navigation #zoomValue {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 38px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.notebook-area {
    background-color: #fbfcfe;
    background-image: radial-gradient(circle, rgba(148, 163, 184, 0.28) 1.1px, transparent 1.2px);
    background-size: 24px 24px;
}

.notebook-page {
    background: transparent;
}

/* Tool settings are lightweight board popovers, not browser dialogs. */
.tool-settings-popover {
    position: fixed;
    left: 82px;
    z-index: 100000;
    display: none;
    width: 282px;
    padding: 16px;
    color: #f8fafc;
    background: #24262f;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.tool-settings-popover.show {
    display: block;
}

.tool-settings-heading {
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
}

.tool-colors {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-bottom: 16px;
}

.tool-colors.is-hidden {
    display: none;
}

.tool-colors button,
.tool-custom-color {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: var(--swatch);
    cursor: pointer;
}

.tool-colors button:hover {
    transform: scale(1.12);
    border-color: #ffffff;
}

.tool-custom-color {
    display: grid;
    place-items: center;
    overflow: hidden;
    background: conic-gradient(#ef4444, #f59e0b, #22c55e, #3b82f6, #8b5cf6, #ef4444);
}

.tool-custom-color input {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    opacity: 0;
    cursor: pointer;
}

.tool-width-control {
    display: grid;
    grid-template-columns: 1fr 1fr 38px;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.tool-width-control input {
    width: 100%;
    accent-color: #8b5cf6;
}

.tool-width-control output {
    display: grid;
    place-items: center;
    height: 32px;
    border: 1px solid #505361;
    border-radius: 9px;
    color: #ffffff;
}

/* The shape picker is moved above the board when its tool is pressed. */
.shape-modal {
    width: 320px;
    padding: 14px;
    color: #f8fafc;
    background: #24262f;
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.shape-modal-header {
    font-size: 16px;
}

.shape-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.shape-option {
    height: 64px;
    border-color: #444856;
    background: #30333e;
}

.shape-option span {
    font-size: 23px;
    color: #c4b5fd;
}

.shape-option small {
    color: #e2e8f0;
}

#closeShapePicker {
    color: #f8fafc;
}

/* Left-anchored glass controls keep tools close to the rail without blocking
   the centre of the canvas. */
.tool-settings-popover,
.shape-modal {
    left: 82px;
    color: #172033;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.78);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.shape-modal {
    top: 84px;
    width: 282px;
    padding: 16px;
    transform: none;
}

.shape-grid {
    grid-template-columns: repeat(2, 1fr);
}

.shape-option {
    height: 72px;
    border-color: rgba(148, 163, 184, 0.36);
    background: rgba(255, 255, 255, 0.58);
}

.shape-option span,
.shape-option small,
#closeShapePicker {
    color: #172033;
}

.shape-option:hover {
    background: rgba(237, 233, 254, 0.72);
    border-color: #8b5cf6;
}

.shape-color-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.shape-color-control input,
.tool-custom-color {
    width: 34px;
    height: 30px;
    border: 1px solid rgba(100, 116, 139, 0.34);
    border-radius: 8px;
    background: linear-gradient(135deg, #ff4d6d, #f9c74f 32%, #4ade80 56%, #60a5fa 76%, #a78bfa);
    cursor: pointer;
}

.shape-color-control input {
    padding: 2px;
    background: transparent;
    overflow: hidden;
    border-radius: 9px;
}

.shape-color-control input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.shape-color-control input::-webkit-color-swatch {
    border: 0;
    border-radius: 6px;
}

.tool-colors button {
    border-color: rgba(71, 85, 105, 0.28);
}

.tool-colors button.is-selected,
.tool-custom-color.is-selected {
    border: 2px solid #111827;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.82);
}

.tool-custom-color {
    position: relative;
    overflow: hidden;
    border-radius: 9px;
}

.tool-custom-color input {
    width: 100%;
    height: 100%;
    opacity: 0;
}

.tool-width-control output {
    border-color: rgba(100, 116, 139, 0.34);
    color: #334155;
    background: rgba(255, 255, 255, 0.42);
}

.tool-width-control.is-hidden {
    display: none;
}

/* Final canvas control polish */
.canvas-toolbar {
    max-height: none;
    overflow: visible;
}

.share-btn {
    margin-left: 4px;
}

.tool-colors {
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.42);
}

.shape-modal {
    width: 282px;
    padding: 16px;
}

.shape-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.shape-option {
    height: 44px;
    border-radius: 10px;
}

.shape-option span {
    font-size: 24px;
}

.shape-option small {
    display: none;
}

.tool-custom-color {
    width: 32px;
    height: 32px;
    /* Round the visible native-picker trigger without replacing the OS dialog. */
    border-radius: 9px;
    background: conic-gradient(#ef4444, #f59e0b, #22c55e, #3b82f6, #8b5cf6, #ef4444);
}

.collaborators {
    padding: 4px 6px;
    gap: 6px;
}

.collaborator-list {
    gap: 4px;
}

.collaborator-list .avatar {
    width: 36px;
    height: 36px;
    margin-left: 0;
    overflow: hidden !important;
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16);
}

.collaborator-list .avatar img {
    object-fit: cover;
    object-position: center;
}

#avatarGlobalTooltip {
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 7px;
}

#objectLayer img.is-selected-object,
#objectLayer [data-type="text"].is-selected-object,
#objectLayer [data-type="sticky"].is-selected-object {
    outline: 3px solid #6754d9;
    outline-offset: 3px;
}

.canvas-toolbar .tool {
    position: relative;
}

.canvas-toolbar .tool[data-tooltip]::after {
    position: absolute;
    top: calc(100% + 7px);
    left: 50%;
    z-index: 20;
    padding: 4px 7px;
    color: #ffffff;
    background: #172033;
    border-radius: 6px;
    content: attr(data-tooltip);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(-2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.canvas-toolbar .tool[data-tooltip]:hover::after,
.canvas-toolbar .tool[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sticky-note {
    position: absolute;
    box-sizing: border-box;
    width: 180px;
    min-height: 120px;
    padding: 18px;
    overflow-wrap: anywhere;
    color: #3f3320;
    background: #fff3a6;
    border: 1px solid rgba(181, 146, 33, 0.25);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    cursor: text;
    pointer-events: auto;
    outline: none;
}

.sticky-note:empty::before {
    content: "Write something…";
    color: #897c56;
}

.sticky-note:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

@media (max-width: 760px) {
    header {
        left: 10px;
        right: 10px;
    }

    header .logo h2 {
        display: none;
    }

    .document-info input {
        min-width: 18px;
        max-width: 200px;
    }

    .collaborators {
        top: 68px;
        right: 12px;
    }

    .canvas-toolbar {
        top: 126px;
        left: 10px;
    }

    .board-code-btn {
        display: none;
    }

    .document-info {
        top: 68px;
        left: 10px;
    }
}
