/* Base Styles & Variables */
:root {
    --bg-dark: #120f0e;
    --sidebar-bg: #1a1512;
    --panel-bg: rgba(30, 24, 20, 0.75);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f5f0eb;
    --text-secondary: #a89f95;
    --text-muted: #6e645a;
    --accent-red: #ff3b30;
    --accent-red-hover: #e02e24;
    --accent-gold: #d4af37;
    --accent-gold-hover: #bda02b;
    --btn-bg-primary: #d4af37;
    --btn-text-primary: #120f0e;
    --btn-bg-secondary: #322923;
    --btn-text-secondary: #f5f0eb;

    /* Pin Colors */
    --pin-yellow: #f59e0b;
    --pin-blue: #3b82f6;
    --pin-green: #10b981;
    --pin-pink: #ec4899;
    --pin-white: #e5e7eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-gold);
}

.logo i {
    width: 24px;
    height: 24px;
}

.cases-section {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.section-title button {
    background: transparent;
    border: none;
    color: var(--accent-gold);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.section-title button:hover {
    background-color: var(--btn-bg-secondary);
    color: #fff;
}

.cases-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.case-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.case-item.active {
    background-color: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
}

.case-item.active .case-name {
    color: var(--accent-gold);
    font-weight: 600;
}

.case-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.case-name {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.case-item:hover .case-actions {
    opacity: 1;
}

.case-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-action-btn:hover {
    color: var(--accent-red);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-accent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--btn-bg-primary);
    color: var(--btn-text-primary);
}

.btn-primary:hover {
    background-color: var(--accent-gold-hover);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-secondary {
    background-color: var(--btn-bg-secondary);
    color: var(--btn-text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background-color: rgba(255, 59, 48, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn-accent {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-accent:hover,
.btn-accent.active {
    background-color: var(--accent-red);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.icon-btn-secondary {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn-secondary:hover {
    background-color: var(--btn-bg-secondary);
    color: #fff;
}

/* Workspace Layout */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background-color: #1e1b18;
}

/* Toolbar Styling */
.toolbar {
    height: 70px;
    background-color: rgba(26, 21, 18, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.case-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-info h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.search-filter-box {
    position: relative;
    width: 260px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

#search-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    padding: 8px 12px 8px 36px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

#search-input:focus {
    border-color: var(--accent-gold);
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.divider {
    width: 1px;
    height: 24px;
    background-color: var(--panel-border);
    margin: 0 8px;
}

.canvas-controls {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 4px;
}

.canvas-controls button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.canvas-controls button:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.canvas-controls span {
    font-size: 12px;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
    color: var(--text-secondary);
}

/* Board Viewport and Infinite Corkboard */
.board-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 100%;
}

#live-sync-banner {
    top: 72px !important;
    z-index: 7 !important;
}

/* Connect Mode Banner */
.connect-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 59, 48, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 8;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform-origin: center;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: none;
}

.connect-banner i {
    animation: pulse 1.5s infinite;
}

.connect-banner button {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: background-color 0.2s;
}

.connect-banner button:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.board-canvas {
    position: absolute;
    width: 6000px;
    height: 6000px;
    /* Corkboard Dynamic Texture - Blue Variant */
    background-color: #111a2e;
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 12px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 12px),
        radial-gradient(circle, #1e2d4a 10%, #0a101d 100%);
    background-size: 16px 16px, 16px 16px, 100% 100%;
    background-attachment: local;
    transform-origin: 0 0;
    cursor: grab;
    user-select: none;
}

/* LSSD Centered Background Logo */
.board-canvas::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1200px;
    height: 1200px;
    background-image: url('https://mdc-tr.gta.world/img/logo/en_ls/LSSD.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.board-canvas:active {
    cursor: grabbing;
}

/* SVG Connection Overlay */
.svg-connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.thread-path {
    stroke-width: 3.5;
    fill: none;
    stroke-linecap: round;
    filter: url(#shadow);
    cursor: pointer;
    pointer-events: stroke;
    transition: stroke-width 0.2s, stroke 0.2s;
}

.thread-path:hover {
    stroke-width: 6;
    filter: drop-shadow(0 0 6px var(--thread-color, rgba(255, 59, 48, 0.8))) url(#shadow);
}

.thread-label-bg {
    fill: #1e1b18;
    rx: 4px;
    stroke: var(--panel-border);
    stroke-width: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.thread-text {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 600;
    fill: var(--text-secondary);
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
}

/* Cards Layer */
.cards-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Clue Card Common Styles */
.clue-card {
    position: absolute;
    width: 230px;
    min-width: 160px;
    min-height: 120px;
    pointer-events: auto;
    cursor: grab;
    transform-origin: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s;
    user-select: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.clue-card.resizable {
    resize: both;
    overflow: hidden;
}

.clue-card:active {
    cursor: grabbing;
    transform: scale(1.04) rotate(var(--drag-tilt, 2deg)) !important;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000 !important;
}

.clue-card.connection-source {
    outline: 3px solid var(--accent-gold);
    outline-offset: 4px;
    animation: cardPulse 1.5s infinite;
}

/* Card Pin */
.card-pin {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 6px 6px, var(--pin-color, #ff3b30) 0%, #300 100%);
    box-shadow: 0 4px 2px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.card-pin::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 2px;
    height: 10px;
    background: linear-gradient(to bottom, #d1d5db, #6b7280);
    box-shadow: 0 6px 3px rgba(0, 0, 0, 0.5);
    transform: rotate(15deg);
}

/* Sticky Note Style */
.clue-card.card-note {
    padding: 24px 16px 16px 16px;
    border-radius: 1px;
}

.clue-card.card-note.style-yellow {
    background-color: #fef08a;
    color: #451a03;
}

.clue-card.card-note.style-blue {
    background-color: #bfdbfe;
    color: #1e3a8a;
}

.clue-card.card-note.style-green {
    background-color: #bbf7d0;
    color: #064e3b;
}

.clue-card.card-note.style-pink {
    background-color: #fbcfe8;
    color: #831843;
}

.clue-card.card-note.style-red {
    background-color: #fca5a5;
    color: #7f1d1d;
}

.clue-card.card-note.style-orange {
    background-color: #fed7aa;
    color: #7c2d12;
}

.clue-card.card-note.style-purple {
    background-color: #e9d5ff;
    color: #581c87;
}

.clue-card.card-note.style-white {
    background-color: #f9fafb;
    color: #111827;
    border-top: 3px solid #d1d5db;
}

.clue-card.card-note.style-dark {
    background-color: #1e1e2e;
    color: #cdd6f4;
    border-top: 3px solid #45475a;
}

.card-note .card-title {
    font-family: 'Special Elite', cursive;
    font-size: 15px;
    margin-bottom: 10px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.15);
    padding-bottom: 6px;
    text-transform: uppercase;
    font-weight: bold;
}

.card-note .card-content {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    flex: 1;
    overflow-y: auto;
}

.clue-card.card-image {
    padding: 12px 12px 24px 12px;
    border-radius: 2px;
}

.clue-card.card-image.style-white {
    background-color: #f5f2eb;
}

.clue-card.card-image.style-yellow {
    background-color: #fef08a;
}

.clue-card.card-image.style-blue {
    background-color: #bfdbfe;
}

.clue-card.card-image.style-green {
    background-color: #bbf7d0;
}

.clue-card.card-image.style-pink {
    background-color: #fbcfe8;
}

.clue-card.card-image.style-red {
    background-color: #fca5a5;
}

.clue-card.card-image.style-orange {
    background-color: #fed7aa;
}

.clue-card.card-image.style-purple {
    background-color: #e9d5ff;
}

.clue-card.card-image.style-dark {
    background-color: #1e1e2e;
}

.card-image-wrapper {
    width: 100%;
    flex: 1;
    min-height: 100px;
    background-color: #1a1512;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) contrast(0.9) brightness(0.95);
    transition: filter 0.3s;
}

.card-image:hover .card-image-wrapper img {
    filter: sepia(0.0) contrast(1.0) brightness(1.0);
}

.card-image .card-title {
    font-family: 'Indie Flower', cursive;
    font-size: 26px;
    text-align: center;
    color: #1a1512;
    margin-top: 12px;
    line-height: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.card-image .card-content {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 68px;
    font-size: 11px;
    color: #4b3e34;
    margin: 6px 4px 0 4px;
    line-height: 1.35;
    font-family: 'Outfit', sans-serif;
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 4px 6px;
    text-align: left;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
    position: relative;
    white-space: pre-wrap;
}

.card-image .card-content.expanded {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
}

/* Card-content description color variants */
.card-image .card-content.style-yellow {
    background-color: rgba(254, 240, 138, 0.35);
    border-color: rgba(254, 240, 138, 0.5);
    color: #451a03;
}

.card-image .card-content.style-blue {
    background-color: rgba(191, 219, 254, 0.35);
    border-color: rgba(191, 219, 254, 0.5);
    color: #1e3a8a;
}

.card-image .card-content.style-green {
    background-color: rgba(187, 247, 208, 0.35);
    border-color: rgba(187, 247, 208, 0.5);
    color: #064e3b;
}

.card-image .card-content.style-pink {
    background-color: rgba(251, 207, 232, 0.35);
    border-color: rgba(251, 207, 232, 0.5);
    color: #831843;
}

.card-image .card-content.style-red {
    background-color: rgba(252, 165, 165, 0.35);
    border-color: rgba(252, 165, 165, 0.5);
    color: #7f1d1d;
}

.card-image .card-content.style-orange {
    background-color: rgba(254, 215, 170, 0.35);
    border-color: rgba(254, 215, 170, 0.5);
    color: #7c2d12;
}

.card-image .card-content.style-purple {
    background-color: rgba(233, 213, 255, 0.35);
    border-color: rgba(233, 213, 255, 0.5);
    color: #581c87;
}

.card-image .card-content.style-white {
    background-color: rgba(249, 250, 251, 0.5);
    border-color: rgba(209, 213, 219, 0.5);
    color: #111827;
}

.card-image .card-content.style-dark {
    background-color: rgba(30, 30, 46, 0.6);
    border-color: rgba(69, 71, 90, 0.5);
    color: #cdd6f4;
}

/* Expand button for truncated descriptions */
.card-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    margin: 4px 4px 0 4px;
    padding: 3px 0;
    border: 1px dashed rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-family: 'Outfit', sans-serif;
    color: #6b5c4f;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
    box-sizing: border-box;
    max-width: calc(100% - 8px);
}

.card-expand-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.card-expand-btn svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    flex-shrink: 0;
}

.card-image.style-dark .card-expand-btn {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #a6adc8;
}

.card-image.style-dark .card-expand-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.card-image.style-dark .card-title {
    color: #cdd6f4;
}

/* Card content expansion overrides */
.clue-card.content-expanded {
    z-index: 9999 !important;
    height: auto !important;
    width: 320px !important;
}

.clue-card.content-expanded .card-content {
    display: block !important;
    -webkit-line-clamp: unset !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Active Detectives Widget style */
.active-users-widget {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(30, 30, 46, 0.95);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px;
    width: 180px;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-family: 'Outfit', sans-serif;
    color: #cdd6f4;
}

.active-users-widget .widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 6px;
    margin-bottom: 6px;
    color: var(--accent-gold);
}

.active-users-widget .widget-header svg {
    width: 14px;
    height: 14px;
}

.active-users-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
}

.active-users-widget li {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-users-widget li::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #34c759;
}

/* Specific UI Swatches */
.color-option.pin-red span {
    background-color: #ff3b30;
}

.color-option.pin-orange span {
    background-color: #ff9500;
}

.color-option.pin-purple span {
    background-color: #af52de;
}

.card-image .card-tags {
    margin: 8px 4px 0 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: flex-start;
}

.card-image .tag-badge {
    font-size: 9px;
    padding: 1px 4px;
    background-color: rgba(0, 0, 0, 0.04);
    color: #5c4d3c;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Card Tags & Footer elements (Notes only) */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.tag-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.05);
    color: currentColor;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Quick Action Menu */
.card-menu-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    background: transparent;
    border: none;
    color: currentColor;
    opacity: 0.2;
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    z-index: 15;
}

.clue-card:hover .card-menu-btn {
    opacity: 0.7;
}

.card-menu-btn:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Overlay Warnings & Helpers */
.instructions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(18, 15, 14, 0.4);
    z-index: 3;
    pointer-events: none;
}

.overlay-card {
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 40px;
    width: 440px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    pointer-events: auto;
    animation: fadeIn 0.4s ease;
}

.overlay-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-gold);
    margin-bottom: 20px;
}

.overlay-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.overlay-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.overlay-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.overlay-buttons button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--btn-bg-secondary);
    color: #fff;
    border: 1px solid var(--panel-border);
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.overlay-buttons button:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
}

.overlay-card small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

/* Modals styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 8, 7, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #221d19;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content.modal-sm {
    width: 380px;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s, color 0.2s;
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 70vh;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-gold);
}

.row-group {
    display: flex;
    gap: 16px;
}

.form-group-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Color Picker Inside Form */
.color-picker-grid,
.thread-picker-grid {
    display: flex;
    gap: 8px;
}

.color-option,
.thread-option {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.color-option:hover,
.thread-option:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.color-option input,
.thread-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.color-option span,
.thread-option span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: transform 0.2s;
}

.color-option input:checked+span,
.thread-option input:checked+span {
    transform: scale(0.7);
}

.color-option input:checked,
.thread-option input:checked {
    border-color: #fff;
}

.color-option:has(input:checked),
.thread-option:has(input:checked) {
    border-color: var(--accent-gold);
}

/* Specifc Colors Options */
.color-option.pin-red span {
    background-color: #ff3b30;
}

.color-option.pin-yellow span {
    background-color: #fef08a;
}

.color-option.pin-blue span {
    background-color: #bfdbfe;
}

.color-option.pin-green span {
    background-color: #bbf7d0;
}

.color-option.pin-pink span {
    background-color: #fbcfe8;
}

.color-option.pin-white span {
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
}

.color-option.pin-dark span {
    background-color: #1e1e2e;
    border: 1px solid #45475a;
}

.thread-option.t-red span {
    background-color: #ff3b30;
}

.thread-option.t-blue span {
    background-color: #007aff;
}

.thread-option.t-yellow span {
    background-color: #ffcc00;
}

.thread-option.t-green span {
    background-color: #34c759;
}

/* Image Upload Area */
.image-upload-zone {
    border: 2px dashed var(--panel-border);
    border-radius: 8px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.15);
    transition: border-color 0.2s, background-color 0.2s;
    position: relative;
    min-height: 120px;
}

.image-upload-zone:hover,
.image-upload-zone.dragover {
    border-color: var(--accent-gold);
    background-color: rgba(212, 175, 55, 0.03);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.image-upload-zone span {
    font-size: 13px;
    color: var(--text-secondary);
}

#clue-image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--panel-border);
}

.mr-auto {
    margin-right: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes cardPulse {
    0% {
        outline-color: rgba(212, 175, 55, 0.4);
    }

    50% {
        outline-color: rgba(212, 175, 55, 1);
        outline-offset: 6px;
    }

    100% {
        outline-color: rgba(212, 175, 55, 0.4);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Image URL Input Styling */
.image-url-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#clue-image-url {
    width: 100%;
}

.image-url-preview-box {
    width: 100%;
    height: 150px;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-url-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#clue-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

#clue-image-placeholder i {
    width: 24px;
    height: 24px;
}

/* Login Overlay Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 8, 7, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.login-card {
    background-color: #221d19;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 20px 0 6px 0;
    color: var(--text-primary);
}

.login-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-error-msg {
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    background-color: rgba(255, 59, 48, 0.1);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.login-card input {
    width: 100%;
    background-color: #161210;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    margin-top: 6px;
}

.login-card input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* User Badge in Header */
.user-badge-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    font-size: 12px;
}

#logged-user-badge {
    background-color: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

#btn-logout {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

#btn-logout:hover {
    color: var(--accent-red);
}

/* Admin Modal user table styling */
#admin-modal table {
    width: 100%;
}

#admin-modal th,
#admin-modal td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--panel-border);
}

#admin-modal tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Collaborator Cursor */
.collaborator-cursor {
    position: absolute;
    width: 14px;
    height: 20px;
    pointer-events: none;
    z-index: 99999;
    transition: left 0.1s linear, top 0.1s linear;
    /* smooth gliding */
}

.collaborator-cursor svg {
    fill: var(--cursor-color, #ff3b30);
    stroke: white;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.collaborator-cursor-badge {
    position: absolute;
    left: 14px;
    top: 14px;
    background-color: var(--cursor-color, #ff3b30);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

/* Toast Notification Messages styling */
.toast-message {
    background-color: rgba(30, 30, 46, 0.95);
    border: 1px solid var(--panel-border);
    color: #cdd6f4;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    border-left: 4px solid var(--accent-gold);
}

.toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Card custom font override classes */
.clue-card.font-typewriter .card-title,
.clue-card.font-typewriter .card-content,
.clue-card.font-typewriter .card-content-text {
    font-family: 'Special Elite', cursive !important;
}

.clue-card.font-handwritten .card-title,
.clue-card.font-handwritten .card-content,
.clue-card.font-handwritten .card-content-text {
    font-family: 'Indie Flower', cursive !important;
    font-size: 15px !important;
}

.clue-card.font-modern .card-title,
.clue-card.font-modern .card-content,
.clue-card.font-modern .card-content-text {
    font-family: 'Outfit', sans-serif !important;
}