@charset "UTF-8";

/* ==========================================================================
   Mugi Talk - P2P Online Whiteboard Overlay (#draw-screen)
   ========================================================================== */

.draw-screen-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    background: #0f172a;
    z-index: 95000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Whiteboard Top Header */
.draw-header {
    height: 56px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    z-index: 20;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.draw-header-left,
.draw-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.draw-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

/* Single Writer Lock Status Pill */
.writer-status-pill {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all 0.2s ease;
}

.writer-status-pill.status-free {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.writer-status-pill.status-me {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.writer-status-pill.status-locked {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    animation: pulseWriter 1.5s infinite;
}

@keyframes pulseWriter {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.draw-icon-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.7);
    color: #cbd5e1;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.draw-icon-btn:hover {
    background: rgba(51, 65, 85, 0.9);
    color: #ffffff;
}

.draw-icon-btn svg {
    width: 18px;
    height: 18px;
}

.stylus-badge {
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 0.72rem !important;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 9999px;
    display: inline-flex;
    align-items: gap;
    gap: 4px;
    font-weight: 600;
}

.stylus-badge svg {
    width: 13px;
    height: 13px;
}

.draw-share-btn {
    width: auto !important;
    padding: 7px 12px !important;
    border-radius: 10px;
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--btn-top-highlight), 0 2px 8px rgba(16, 185, 129, 0.25);
}

.draw-share-btn:hover {
    background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
}

.draw-share-btn svg {
    width: 15px;
    height: 15px;
}

.draw-close-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.8);
    color: #cbd5e1;
    border: 1px solid var(--card-border);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.draw-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Canvas Area */
.draw-canvas-main {
    position: relative;
    flex: 1;
    width: 100%;
    background: #0b0f19;
    overflow: hidden;
}

.draw-canvas-layer {
    position: absolute;
    display: block;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

#drawingCanvas {
    touch-action: none;
    cursor: crosshair;
    background: transparent;
}

.pointer-events-none {
    pointer-events: none;
}

.canvas-empty-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #94a3b8;
    transition: opacity 0.25s ease;
}

.canvas-empty-hint.opacity-0 {
    opacity: 0;
}

.canvas-empty-hint svg {
    width: 38px;
    height: 38px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.canvas-empty-hint p {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 0;
    opacity: 0.75;
}

/* Floating Bottom Toolbar & Accordion */
.draw-footer {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 540px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.draw-accordion {
    width: 100%;
    background: rgba(17, 24, 39, 0.96);
    color: #ffffff;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-2xl);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.6), var(--btn-top-highlight);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin 0.3s ease, padding 0.3s ease;
}

.draw-accordion.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0;
}

.draw-accordion.expanded {
    max-height: 320px;
    opacity: 1;
    pointer-events: auto;
}

.draw-accordion-section {
    margin-bottom: 12px;
}

.draw-section-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.draw-section-label svg {
    width: 14px;
    height: 14px;
}

.draw-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    background: rgba(15, 23, 42, 0.9);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.tool-mode-btn {
    padding: 8px 10px !important;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-sub);
    box-shadow: none;
}

.tool-mode-btn.active {
    background: var(--gaming-gold);
    color: #0b0f19;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.tool-mode-btn svg {
    width: 15px;
    height: 15px;
}

.draw-palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.draw-color-code {
    font-size: 0.7rem;
    color: var(--text-sub);
    font-family: monospace;
}

.draw-extra-colors {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px;
}

/* Main Always-Visible Toolbar */
.draw-main-toolbar {
    width: 100%;
    background: rgba(17, 24, 39, 0.96);
    color: #ffffff;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-2xl);
    padding: 10px 12px;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.6), var(--btn-top-highlight);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.draw-quick-colors {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-btn {
    position: relative;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border-radius: 50%;
    border: 2px solid #334155;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: none;
}

.color-btn.active-color {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px #ffffff;
}

.active-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0;
    transition: opacity 0.15s;
}

.active-indicator.dark-dot {
    background: #0b0f19;
}

.color-btn.active-color .active-indicator {
    opacity: 1;
}

.custom-color-label {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(45deg, #f43f5e, #fbbf24, #6366f1);
}

.custom-color-label input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.custom-color-label svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
    pointer-events: none;
}

.toolbar-divider {
    height: 24px;
    width: 1px;
    background: #1f2937;
    margin: 0 2px;
}

.toolbar-tool-btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-sub);
    box-shadow: none;
}

.toolbar-tool-btn:hover:not(:disabled) {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.toolbar-tool-btn.active-tool {
    background: #ffffff;
    color: #0b0f19;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.25);
}

.toolbar-tool-btn svg {
    width: 18px;
    height: 18px;
}

.accordion-toggle-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid #334155;
}

.accordion-toggle-btn.active-accordion {
    background: var(--gaming-gold);
    color: #0b0f19;
    border-color: var(--gaming-gold);
}

.draw-size-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 10px;
    padding: 2px;
    border: 1px solid var(--card-border);
}

.size-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 8px;
    background: transparent;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.size-btn.active {
    background: #334155;
    color: #ffffff;
}

.size-dot {
    background: currentColor;
    border-radius: 50%;
    display: block;
}

.dot-sm { width: 5px; height: 5px; }
.dot-md { width: 9px; height: 9px; }
.dot-lg { width: 13px; height: 13px; }

.draw-history-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Whiteboard Modals */
.draw-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 98000;
    background: rgba(11, 15, 25, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.draw-modal-card {
    background: #111827;
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--btn-top-highlight);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
}

.draw-modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.draw-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.draw-modal-title h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.draw-modal-title svg {
    width: 18px;
    height: 18px;
    color: var(--gaming-gold);
}

.draw-modal-close {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 50%;
    background: transparent;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.draw-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-save-guide {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    font-size: 0.78rem;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    width: 100%;
    text-align: center;
    line-height: 1.5;
}

.photo-save-preview-box {
    width: 100%;
    max-height: 48dvh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0f19;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid var(--card-border);
}

.photo-save-preview-box img {
    max-width: 100%;
    max-height: 44dvh;
    object-fit: contain;
    border-radius: 8px;
}

.draw-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    gap: 8px;
}

.draw-modal-btn-secondary {
    flex: 1;
    padding: 10px 12px !important;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.draw-modal-btn-primary {
    flex: 1;
    padding: 10px 12px !important;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--gaming-green);
    color: #ffffff;
}

.draw-modal-btn-danger {
    flex: 1;
    padding: 10px 12px !important;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--gaming-red);
    color: #ffffff;
}

.confirm-card {
    padding: 22px;
    max-width: 320px;
    text-align: center;
}

.confirm-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
}

.confirm-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 700;
}

.confirm-desc {
    margin: 0 0 18px 0;
    font-size: 0.82rem;
    color: var(--text-sub);
    line-height: 1.5;
}

.confirm-btn-row {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   Mobile Optimization for Whiteboard
   ========================================================================== */
@media screen and (max-width: 480px) {
    .draw-main-toolbar { 
        padding: 8px; 
        gap: 4px; 
    }
    .color-btn { 
        width: 26px !important; 
        height: 26px !important; 
    }
    .writer-status-pill { 
        font-size: 0.72rem; 
        padding: 5px 10px; 
    }
}