/**
 * EPSTEIN CASE INVESTIGATION BOARD - EXPANDED STYLES
 * Visual system: Detective investigation board with analog aesthetic
 */

/* ============================================
   CSS VARIABLES & ROOT SETUP
   ============================================ */
:root {
  /* Board colors */
  --cork-light: #c4956a;
  --cork-dark: #8b6914;
  --cork-base: #b8860b;

  /* String colors */
  --string-red: #c41e3a;
  --string-orange: #e07020;
  --string-blue: #1e4d8c;
  --string-black: #1a1a1a;

  /* UI colors */
  --paper-white: #f5f5dc;
  --sticky-yellow: #fff740;
  --sticky-shadow: rgba(0, 0, 0, 0.3);
  --panel-bg: rgba(30, 25, 20, 0.98);
  --text-dark: #2a2520;
  --text-light: #f0ebe0;

  /* Role colors */
  --role-central: #c41e3a;
  --role-victim: #9b59b6;
  --role-accused: #e74c3c;
  --role-associate: #e67e22;
  --role-named: #3498db;
  --role-financial: #27ae60;
  --role-legal: #95a5a6;

  /* Pin colors */
  --pin-red: #c0392b;
  --pin-silver: #bdc3c7;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-medium: 0.3s ease;
  --transition-slow: 0.5s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
  background: #1a1510;
  cursor: grab;
  user-select: none;
}

body.dragging {
  cursor: grabbing;
}

body.grabbing {
  cursor: grabbing !important;
}

body.grabbing * {
  cursor: grabbing !important;
}

/* ============================================
   MAIN BOARD CONTAINER
   ============================================ */
#board-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #b8860b;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
    /* Darkening overlay */
    url('assets/images/cork_pattern.png');
  background-repeat: repeat;
  background-size: auto, 500px auto;
  /* Overlay matches container, pattern scales */
  touch-action: none;
  /* Enables custom touch gestures */
}

#investigation-board {
  position: absolute;
  width: 5000px;
  /* Increased canvas size */
  height: 4000px;
  background: transparent;
  box-shadow: none;
  border: none;
  transform-origin: 0 0;
  transition: transform 0.05s linear;
}



/* ============================================
   SVG CONNECTIONS LAYER
   ============================================ */
#connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.connection-line {
  fill: none;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-dasharray: none;
  transition: opacity var(--transition-medium), stroke-width var(--transition-fast);
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.4));
}

.connection-line.type-red {
  stroke: var(--string-red);
}

.connection-line.type-orange {
  stroke: var(--string-orange);
}

.connection-line.type-blue {
  stroke: var(--string-blue);
}

.connection-line.type-black {
  stroke: var(--string-black);
  stroke-width: 2px;
}

.connection-line.highlighted {
  stroke-width: 4px;
  filter: drop-shadow(0 0 8px currentColor);
}

.connection-line.faded {
  opacity: 0.08;
}

/* ============================================
   PERSON CARDS (POLAROID STYLE)
   ============================================ */
.person-card {
  position: absolute;
  width: 160px;
  background: var(--paper-white);
  padding: 8px 8px 40px 8px;
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-medium);
  z-index: 10;
  border-bottom: 4px solid var(--role-border, #999);
}

.person-card::before {
  /* Paper texture */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
  pointer-events: none;
}

/* Slight random rotations */
.person-card.rotate-1 {
  transform: rotate(-2deg);
}

.person-card.rotate-2 {
  transform: rotate(1.5deg);
}

.person-card.rotate-3 {
  transform: rotate(-1deg);
}

.person-card.rotate-4 {
  transform: rotate(2deg);
}

.person-card.rotate-5 {
  transform: rotate(-2.5deg);
}

.person-card:hover {
  transform: rotate(0deg) scale(1.05);
  z-index: 110 !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.person-card.dragging-item {
  transform: rotate(0deg) scale(1.02) !important;
  z-index: 1000 !important;
  opacity: 0.9;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
  transition: none !important;
}

.person-card.selected {
  border-color: #fff;
  box-shadow: 0 0 20px var(--role-glow), 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 90;
}

.person-card.highlighted {
  z-index: 50;
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.5),
    0 0 15px var(--role-glow, rgba(255, 255, 255, 0.2));
}

.person-card.faded {
  opacity: 0.15;
  filter: grayscale(80%);
}

/* Role-based bottom border colors will be set inline */
.person-card[data-role="central"] {
  border-bottom-color: var(--role-central);
}

.person-card[data-role="victim"] {
  border-bottom-color: var(--role-victim);
}

.person-card[data-role="accused"] {
  border-bottom-color: var(--role-accused);
}

.person-card[data-role="associate"] {
  border-bottom-color: var(--role-associate);
}

.person-card[data-role="named"] {
  border-bottom-color: var(--role-named);
}

.person-card[data-role="financial"] {
  border-bottom-color: var(--role-financial);
}

.person-card[data-role="legal"] {
  border-bottom-color: var(--role-legal);
}

/* Push pin */
.push-pin {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 30% 30%, var(--pin-color, #c41e3a), #440000);
  border-radius: 50%;
  z-index: 10;
  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.push-pin:active {
  cursor: grabbing;
}

.push-pin::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 14px;
  background: linear-gradient(to bottom, #888 0%, #555 100%);
  border-radius: 0 0 2px 2px;
}

.push-pin::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 30% 30%,
      color-mix(in srgb, var(--pin-color, #e74c3c) 70%, white) 0%,
      var(--pin-color, #e74c3c) 50%,
      color-mix(in srgb, var(--pin-color, #e74c3c) 70%, black) 100%);
  border-radius: 50%;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* Photo container */
.photo-container {
  width: 100%;
  height: 140px;
  background: #2a2a2a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(0.95);
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(145deg, #4a4a4a 0%, #2a2a2a 50%, #1a1a1a 100%),
    radial-gradient(ellipse at center, rgba(100, 100, 100, 0.1) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(200, 200, 200, 0.7);
  font-size: 42px;
  font-weight: bold;
  letter-spacing: 3px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-family: 'Arial Black', sans-serif;
  position: relative;
}

.photo-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px);
}

/* Name label */
.person-name {
  position: absolute;
  bottom: 20px;
  left: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: bold;
  color: var(--text-dark);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-role-badge {
  position: absolute;
  bottom: 5px;
  left: 8px;
  right: 8px;
  font-size: 8px;
  color: #666;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.disclaimer-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  z-index: 5;
}

/* ============================================
   EVIDENCE PHOTOS
   ============================================ */
.evidence-photo {
  position: absolute;
  width: 200px;
  background: var(--paper-white);
  padding: 8px 8px 25px 8px;
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.5);
  z-index: 8;
  transition: transform var(--transition-fast);
}

/* Tape effect on top of evidence photos */
.evidence-photo::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 60px;
  height: 22px;
  background: linear-gradient(180deg,
      rgba(255, 255, 220, 0.9) 0%,
      rgba(255, 255, 200, 0.75) 50%,
      rgba(240, 235, 180, 0.8) 100%);
  border: 1px solid rgba(200, 190, 150, 0.3);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 0 5px rgba(255, 255, 255, 0.3);
  z-index: 10;
}

/* Tape texture overlay */
.evidence-photo::after {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 60px;
  height: 22px;
  background: repeating-linear-gradient(90deg,
      transparent 0px,
      rgba(0, 0, 0, 0.02) 1px,
      transparent 2px);
  z-index: 11;
  pointer-events: none;
}

.evidence-photo.rotate-1 {
  transform: rotate(-3deg);
}

.evidence-photo.rotate-2 {
  transform: rotate(2deg);
}

.evidence-photo.rotate-3 {
  transform: rotate(-1.5deg);
}

.evidence-photo.rotate-4 {
  transform: rotate(3deg);
}

.evidence-photo.rotate-5 {
  transform: rotate(-2deg);
}

.evidence-photo:hover {
  transform: scale(1.1) rotate(0deg) !important;
  z-index: 60;
}

.evidence-photo img {
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(10%) contrast(1.1);
}

.evidence-pin {
  display: none;
  /* Using tape instead of pin */
}

.evidence-caption {
  font-size: 9px;
  color: #333;
  text-align: center;
  margin-top: 5px;
  font-style: italic;
}

/* ============================================
   LOCATION MARKERS
   ============================================ */
/* ============================================
   LOCATION MARKERS
   ============================================ */
.location-marker {
  position: absolute;
  z-index: 6;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 140px;
  /* Increased to hold label */
}

/* The visual pin */
.location-pin {
  font-size: 32px;
  filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.5));
  transition: transform var(--transition-fast);
  z-index: 10;
  position: relative;
}

/* Torn paper label below pin */
.location-label {
  margin-top: -10px;
  /* Overlap with pin slightly */
  background: #fdfbf7;
  padding: 8px 10px 12px 10px;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  font-weight: bold;
  color: #2c3e50;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  width: 100%;
  transform: rotate(-1deg);
  /* Torn edge effect at bottom */
  mask-image: radial-gradient(circle at 10px bottom, transparent 6px, black 6.5px);
  mask-size: 20px 100%;
  mask-position: -10px 0;
  mask-repeat: repeat-x;

  /* Fallback clip-path for torn bottom */
  clip-path: polygon(0% 0%, 100% 0%,
      100% 92%,
      95% 100%, 90% 94%, 85% 100%, 80% 93%, 75% 100%, 70% 92%, 65% 100%, 60% 92%, 55% 100%, 50% 92%, 45% 100%, 40% 92%, 35% 100%, 30% 92%, 25% 100%, 20% 92%, 15% 100%, 10% 92%, 5% 100%, 0% 92%);
  z-index: 8;
  transition: transform var(--transition-fast), background var(--transition-medium);
}

/* Taped Note Style (White Lined Paper) */
.taped-note {
  position: absolute;
  /* Use shorthand to nuke any conflicted background properties */
  background:
    linear-gradient(90deg, transparent 39px, #ffcccc 39px, #ffcccc 40px, transparent 40px),
    linear-gradient(#eee .1em, transparent .1em) #fff !important;
  background-size: 100% 100%, 100% 25px !important;

  padding: 15px 15px 15px 45px;
  width: 170px;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: bold;
  color: #2c3e50;
  text-align: left;
  line-height: 25px;
  transform: rotate(2deg);
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 500;
}

/* Simulated Tape */
.taped-note::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 50px;
  height: 25px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(1px);
  /* Subtle blur for scotch tape feel */
}

.location-marker:hover .location-label {
  background: #fff;
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.location-marker:hover .location-pin {
  transform: scale(1.2) translateY(-5px);
}

.location-thumb-container {
  width: 100%;
  height: 60px;
  margin-bottom: 5px;
  border: 4px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: #eee;
  transform: rotate(1deg);
}

.location-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hide old location card on hover, we will use click -> side panel */
.location-card {
  display: none !important;
}

.location-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.location-name {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 4px;
  color: #f39c12;
}

.location-address {
  font-size: 10px;
  color: #999;
  margin-bottom: 8px;
}

.location-desc {
  font-size: 11px;
  line-height: 1.5;
  color: #ccc;
}

/* ============================================
   STICKY NOTES
   ============================================ */
.sticky-note {
  position: absolute;
  width: 180px;
  min-height: 140px;
  background: #fdfd96;
  padding: 20px;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: #333;
  line-height: 1.2;
  border-bottom-right-radius: 40px 5px;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 20;
  pointer-events: all;
  cursor: grab;
  user-select: none;
}

.sticky-note.dragging-item {
  transform: rotate(0deg) scale(1.02) !important;
  z-index: 1000 !important;
  box-shadow: 10px 10px 25px rgba(0, 0, 0, 0.3) !important;
  transition: none !important;
}

/* Handwritten Note Variant */
.sticky-note.handwritten {
  background: #fcfcfc;
  background-image:
    linear-gradient(90deg, transparent 19px, rgba(255, 0, 0, 0.2) 20px, transparent 21px),
    /* Margin */
    repeating-linear-gradient(transparent, transparent 19px, #d0d0ec 20px);
  /* Lines */
  font-family: 'Caveat', cursive;
  font-size: 16px;
  line-height: 20px;
  padding: 15px 15px 15px 25px;
  /* Extra left padding for margin */
  color: #2c3e50;
  border-radius: 2px;
}

.sticky-note.handwritten::before {
  display: none;
  /* No top shadow for paper variant */
}

/* Tape for handwritten notes */
.sticky-note.handwritten::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 40px;
  height: 15px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sticky-note::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 25px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 0%, transparent 100%);
  pointer-events: none;
}

.sticky-note:hover {
  transform: rotate(0deg) scale(1.08) !important;
  z-index: 80;
  box-shadow:
    5px 5px 20px rgba(0, 0, 0, 0.4);
}

.sticky-note strong {
  display: block;
  font-size: 12px;
  color: #c41e3a;
  margin-bottom: 5px;
}

.sticky-note .note-bullet {
  display: block;
  padding-left: 5px;
  font-size: 10px;
}

/* ============================================
   DETAIL PANEL
   ============================================ */
#detail-panel {
  position: fixed;
  top: 0;
  right: -450px;
  width: 420px;
  height: 100vh;
  background: var(--panel-bg);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  transition: right var(--transition-medium);
  overflow-y: auto;
  color: var(--text-light);
}

#detail-panel.open {
  right: 0;
}

.panel-header {
  position: relative;
  padding: 25px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text-light);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.panel-photo {
  width: 130px;
  height: 160px;
  object-fit: cover;
  border: 5px solid var(--paper-white);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  margin-bottom: 15px;
}

.panel-name {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 8px;
  font-family: 'Georgia', serif;
}

.panel-role {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.panel-role.role-central {
  background: var(--role-central);
}

.panel-role.role-victim {
  background: var(--role-victim);
}

.panel-role.role-accused {
  background: var(--role-accused);
}

.panel-role.role-associate {
  background: var(--role-associate);
}

.panel-role.role-named {
  background: var(--role-named);
}

.panel-role.role-financial {
  background: var(--role-financial);
}

.panel-role.role-legal {
  background: var(--role-legal);
}

#panel-disclaimer {
  display: none;
  margin-top: 12px;
  padding: 10px;
  background: rgba(243, 156, 18, 0.15);
  border-left: 3px solid #f39c12;
  font-size: 11px;
  color: #f39c12;
}

.panel-content {
  padding: 20px 25px;
}

.panel-section {
  margin-bottom: 28px;
}

.panel-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.panel-summary {
  font-size: 13px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.9);
}

/* Timeline */
.timeline {
  list-style: none;
}

.timeline-item {
  position: relative;
  padding-left: 22px;
  padding-bottom: 16px;
  font-size: 12px;
  line-height: 1.55;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  background: var(--string-red);
  border-radius: 50%;
  border: 2px solid var(--panel-bg);
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 15px;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-date {
  font-weight: bold;
  color: var(--string-red);
}

/* Connections list */
#panel-connections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.connection-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.connection-item .conn-color {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.connection-item.type-red .conn-color {
  background: var(--string-red);
}

.connection-item.type-orange .conn-color {
  background: var(--string-orange);
}

.connection-item.type-blue .conn-color {
  background: var(--string-blue);
}

.connection-item.type-black .conn-color {
  background: #666;
}

.connection-item .conn-name {
  font-weight: bold;
  font-size: 12px;
  flex-shrink: 0;
}

.connection-item .conn-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-more {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  padding: 5px;
}

/* External links */
.external-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #6ab0f3;
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition-fast);
}

.external-link:hover {
  color: #90caf9;
  text-decoration: underline;
}

.link-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.link-type {
  font-size: 9px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   COLOR LEGEND
   ============================================ */
#color-legend {
  position: fixed;
  bottom: 80px;
  left: 20px;
  background: rgba(25, 20, 15, 0.95);
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.5);
  z-index: 500;
  font-size: 11px;
  color: var(--text-light);
  backdrop-filter: blur(10px);
}

.legend-title {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  font-size: 9px;
  opacity: 0.6;
}

.legend-section {
  margin-bottom: 12px;
}

.legend-section:last-child {
  margin-bottom: 0;
}

.legend-section-title {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 20px;
  height: 4px;
  border-radius: 2px;
}

.legend-color.red {
  background: var(--string-red);
}

.legend-color.orange {
  background: var(--string-orange);
}

.legend-color.blue {
  background: var(--string-blue);
}

.legend-color.black {
  background: #666;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.central {
  background: var(--role-central);
}

.legend-dot.victim {
  background: var(--role-victim);
}

.legend-dot.accused {
  background: var(--role-accused);
}

.legend-dot.associate {
  background: var(--role-associate);
}

.legend-dot.named {
  background: var(--role-named);
}

.legend-dot.financial {
  background: var(--role-financial);
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
}

#search-input {
  width: 300px;
  padding: 12px 20px;
  background: rgba(25, 20, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  color: var(--text-light);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), width var(--transition-fast);
  backdrop-filter: blur(10px);
}

#search-input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  width: 350px;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#search-results {
  display: none;
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  background: rgba(25, 20, 15, 0.98);
  border-radius: 10px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.search-result-item {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.result-name {
  font-weight: bold;
  font-size: 13px;
}

.result-role {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
}

.search-no-results {
  padding: 15px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 15px;
  z-index: 500;
}

.stat-item {
  background: rgba(25, 20, 15, 0.95);
  padding: 10px 15px;
  border-radius: 8px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.stat-number {
  font-size: 22px;
  font-weight: bold;
  color: var(--string-red);
}

.stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   DISCLAIMER BANNER
   ============================================ */
#disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 12, 8, 0.98);
  color: rgba(255, 255, 255, 0.75);
  padding: 12px 20px;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  z-index: 600;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#disclaimer strong {
  color: #e74c3c;
}

/* ============================================
   ZOOM CONTROLS
   ============================================ */
#zoom-controls {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 500;
}

.zoom-btn {
  width: 42px;
  height: 42px;
  background: rgba(25, 20, 15, 0.95);
  border: none;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  backdrop-filter: blur(10px);
}

.zoom-btn:hover {
  background: rgba(50, 45, 35, 0.95);
}

#zoom-level {
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  padding: 5px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1510;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.6s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  color: var(--text-light);
  font-size: 16px;
  letter-spacing: 3px;
  margin-bottom: 20px;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar::after {
  content: '';
  display: block;
  width: 50%;
  height: 100%;
  background: var(--string-red);
  animation: loading 1s ease-in-out infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(300%);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  #detail-panel {
    width: 100%;
    right: -100%;
  }

  #color-legend {
    bottom: 70px;
    left: 10px;
    padding: 10px 12px;
    font-size: 10px;
  }

  .search-container {
    left: 10px;
    right: 10px;
    transform: none;
  }

  #search-input {
    width: 100%;
  }

  .stats-bar {
    top: 70px;
    right: 10px;
  }
}

/* ============================================
   LOCATION MARKER STYLES (Appended)
   ============================================ */
.location-marker {
  position: absolute;
  cursor: pointer;
  z-index: 100;
  transition: transform var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.location-marker:hover {
  transform: scale(1.1) translateY(-5px);
  z-index: 1000;
}

.location-marker.selected .location-pin {
  transform: scale(1.2);
  filter: drop-shadow(0 0 8px rgba(243, 156, 18, 0.8));
}

.location-pin {
  font-size: 24px;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
  z-index: 9;
}

.location-label {
  margin-top: -5px;
  background: #fdfbf7;
  padding: 5px;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  font-weight: bold;
  color: #2c3e50;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  width: 120px;
  transform: rotate(-1deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;

  /* Torn edge effect */
  mask-image: radial-gradient(circle at 10px bottom, transparent 6px, black 6.5px);
  mask-size: 20px 100%;
  mask-position: -10px 0;
  mask-repeat: repeat-x;

  /* Fallback */
  clip-path: polygon(0% 0%, 100% 0%,
      100% 90%,
      95% 100%, 90% 92%, 85% 100%, 80% 91%, 75% 100%, 70% 92%, 65% 100%, 60% 92%, 55% 100%, 50% 92%, 45% 100%, 40% 92%, 35% 100%, 30% 92%, 25% 100%, 20% 92%, 15% 100%, 10% 92%, 5% 100%, 0% 91%);
  z-index: 8;
  padding-bottom: 12px;
}

.location-thumb {
  width: 100%;
  height: 50px;
  object-fit: cover;
  border: 1px solid #ddd;
  filter: sepia(0.3);
  display: block;
}

/* Detail Panel Map Container */
.map-container {
  margin-top: 20px;
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: rotate(1.5deg);
  background: #eee;
  position: relative;
  overflow: hidden;
}

.map-container::after {
  content: "TOP SECRET";
  position: absolute;
  top: 10px;
  right: 10px;
  color: rgba(196, 30, 58, 0.4);
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  transform: rotate(-15deg);
  border: 2px solid rgba(196, 30, 58, 0.4);
  padding: 2px 5px;
  pointer-events: none;
  z-index: 10;
}

/* ============================================
   NEWSPAPER CLIPPINGS
   ============================================ */
.news-clipping {
  position: absolute;
  width: 220px;
  background-color: #f4f1ea;
  background-image:
    linear-gradient(rgba(0, 0, 0, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, .05) 1px, transparent 1px);
  background-size: 2px 2px;
  padding: 15px;
  box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 15;
  cursor: grab;
  color: #1a1a1a;
  border: 1px solid #d3d3d3;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.news-clipping::before {
  /* Torn edge effect at bottom */
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background: inherit;
  clip-path: polygon(0% 0%, 5% 100%, 10% 0%, 15% 100%, 20% 0%, 25% 100%, 30% 0%, 35% 100%, 40% 0%, 45% 100%, 50% 0%, 55% 100%, 60% 0%, 65% 100%, 70% 0%, 75% 100%, 80% 0%, 85% 100%, 90% 0%, 95% 100%, 100% 0%);
}

.news-clipping:hover {
  transform: scale(1.05) rotate(0deg) !important;
  z-index: 90;
  box-shadow: 5px 10px 25px rgba(0, 0, 0, 0.4);
}

.news-clipping.dragging-item {
  transform: scale(1.02) !important;
  z-index: 1000 !important;
  opacity: 0.9;
  transition: none !important;
}

.news-clipping .publisher {
  font-family: 'Old Standard TT', serif;
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  border-bottom: 2px solid #1a1a1a;
  margin-bottom: 10px;
  padding-bottom: 2px;
  display: block;
}

.news-clipping .headline-wrapper {
  margin-bottom: 10px;
}

.news-clipping .news-headline-link {
  text-decoration: none;
  color: inherit;
  display: block;
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 18px;
  line-height: 1.1;
  cursor: pointer;
  transition: color 0.2s;
}

.news-clipping .news-headline-link:hover {
  text-decoration: underline;
  color: #c41e3a;
}


.news-clipping .date {
  font-family: Arial, sans-serif;
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
}

.news-clipping .link-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  opacity: 0.3;
}

.news-clipping:hover .link-icon {
  opacity: 1;
  color: var(--string-red);
}

.news-clipping .push-pin {
  top: -10px;
  width: 16px;
  height: 16px;
  cursor: grab;
}

/* ============================================
   LIGHTBOX STYLES
   ============================================ */
#lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#lightbox-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 10px solid #fff;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#lightbox-overlay:not(.hidden) #lightbox-image {
  transform: scale(1);
}

#lightbox-caption {
  margin-top: 20px;
  color: #fff;
  font-family: 'Special Elite', monospace;
  font-size: 18px;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 4px;
}

#lightbox-close {
  position: absolute;
  top: 30px;
  right: 30px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 3001;
}

#lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  transform: rotate(90deg);
}

/* ============================================
   PASSWORD PROMPT
   ============================================ */
#password-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  backdrop-filter: blur(5px);
}

#password-prompt.hidden {
  display: none;
}

.password-box {
  background: #1a1a1a;
  border: 2px solid #c41e3a;
  padding: 30px;
  width: 320px;
  text-align: center;
  box-shadow: 0 0 30px rgba(196, 30, 58, 0.3);
  color: #fff;
  font-family: 'Special Elite', monospace;
}

.password-box h3 {
  color: #c41e3a;
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.password-box p {
  font-size: 14px;
  margin-bottom: 20px;
  opacity: 0.8;
}

#access-code {
  width: 100%;
  background: #000;
  border: 1px solid #444;
  color: #0f0;
  font-size: 24px;
  text-align: center;
  padding: 10px;
  letter-spacing: 15px;
  margin-bottom: 10px;
  font-family: monospace;
}

.error-msg {
  color: #f44336;
  font-size: 11px;
  min-height: 15px;
  margin-bottom: 15px;
  text-transform: uppercase;
}

.password-btns {
  display: flex;
  gap: 10px;
}

.password-btns button {
  flex: 1;
  padding: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  transition: all 0.2s;
}

#cancel-access {
  background: #333;
  color: #ccc;
}

#submit-access {
  background: #c41e3a;
  color: #fff;
}

#submit-access:hover {
  background: #e74c3c;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* ============================================
   SIMULATED WINDOWS FOLDER
   ============================================ */
#secret-folder-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 500px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #0a0a0a #0a0a0a #dfdfdf;
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 4500;
  padding: 2px;
}

.window-titlebar {
  cursor: grab;
}

.window-titlebar:active {
  cursor: grabbing;
}

#secret-folder-window.hidden {
  display: none;
}

.window-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  padding: 3px 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  font-family: sans-serif;
  font-weight: bold;
  font-size: 13px;
  height: 24px;
}

.window-controls button {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #dfdfdf #0a0a0a #0a0a0a #dfdfdf;
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-toolbar,
.window-addressbar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 4px 8px;
  display: flex;
  gap: 15px;
  font-size: 11px;
  font-family: sans-serif;
}

.window-addressbar {
  align-items: center;
  gap: 10px;
}

.address-input {
  background: white;
  border: 1px solid #808080;
  flex: 1;
  padding: 2px 5px;
  font-family: monospace;
}

.window-body {
  background: white;
  flex: 1;
  overflow-y: auto;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  grid-gap: 20px;
  align-content: start;
}

.window-statusbar {
  background: #c0c0c0;
  border-top: 1px solid #808080;
  padding: 2px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: sans-serif;
}

/* File Icons inside window */
.file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
}

.file-item:hover {
  background: rgba(0, 0, 128, 0.1);
}

.file-icon {
  width: 32px;
  height: 32px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 5px;
  image-rendering: pixelated;
}

.file-icon.image {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' d='M2 4h28v24H2z'/%3E%3Cpath fill='%23000080' d='M4 6h24v20H4z'/%3E%3Cpath fill='%23fff' d='M6 8l10 10 8-8v10H6z'/%3E%3C/svg%3E");
}

.file-name {
  font-size: 11px;
  font-family: sans-serif;
  word-break: break-all;
  padding: 2px;
}

.file-item:active .file-name {
  background: #000080;
  color: white;
}

/* Special folder anchor styling on the board */
.sticky-note.warning {
  background: #fdfbf7;
  color: #c41e3a;
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.1);
  transform: rotate(-5deg);
  min-height: auto;
  padding: 10px 15px;
}

.sticky-note.warning strong {
  color: #c41e3a;
  font-weight: 900;
  border-bottom: 2px solid #c41e3a;
}

.media-item[data-type="folder"] {
  width: 260px;
  height: 260px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 100;
  position: absolute;
}

.folder-visual {
  width: 180px;
  height: 140px;
  background: #ffd700;
  position: relative;
  border-radius: 0 10px 10px 10px;
  box-shadow: 10px 15px 30px rgba(0, 0, 0, 0.4);
}

.folder-visual::before {
  content: '';
  position: absolute;
  top: -25px;
  left: 0;
  width: 70px;
  height: 25px;
  background: #ffd700;
  border-radius: 10px 10px 0 0;
}

.folder-visual::after {
  content: 'TOP SECRET';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #900;
  font-weight: 900;
  font-size: 20px;
  border: 4px solid #900;
  padding: 8px;
  pointer-events: none;
  font-family: 'Special Elite', monospace;
}

/* Hide TOP SECRET label for the standard Files folder */
.media-item[data-id="media_files_shortcuts"] .folder-visual::after {
  content: '';
  border: none;
}

.media-item[data-type="folder"]:hover {
  transform: scale(1.05);
}

.media-item[data-type="folder"] .item-title {
  margin-top: 25px;
  color: #fff;
  background: rgba(196, 30, 58, 0.95);
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: bold;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(5px);
  }

  50% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }

  100% {
    transform: translateX(0);
  }
}

/* Custom ID Badge Styles - Image Based */
.sticky-note.custom-id {
  width: auto;
  height: auto;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  transform: rotate(-1deg);
  overflow: visible;
}

.id-badge-image {
  width: 400px;
  max-width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
}

/* ============================================
   MOBILE NAVIGATION IMPROVEMENTS
   ============================================ */

/* Mobile Legend Toggle Button */
.legend-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 10px;
  width: 44px;
  height: 44px;
  background: rgba(25, 20, 15, 0.95);
  border: none;
  border-radius: 50%;
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  z-index: 501;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.legend-toggle:hover {
  background: rgba(50, 45, 35, 0.95);
  transform: scale(1.1);
}

.legend-toggle.active {
  background: var(--string-red);
}

/* Mobile Navigation Hint */
.mobile-nav-hint {
  display: none;
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(25, 20, 15, 0.9);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 11px;
  z-index: 500;
  animation: fadeInOut 4s ease-in-out forwards;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }

  15% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  85% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */
@media (max-width: 768px) {

  /* Body adjustments for mobile */
  body {
    cursor: default;
  }

  /* Detail Panel - Full screen on mobile */
  #detail-panel {
    width: 100%;
    right: -100%;
    max-height: 70vh;
    top: auto;
    bottom: 0;
    border-radius: 20px 20px 0 0;
    height: auto;
  }

  #detail-panel.open {
    right: 0;
  }

  .panel-header {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 15px;
  }

  .panel-photo {
    width: 80px;
    height: 100px;
    margin-bottom: 0;
  }

  .panel-name {
    font-size: 18px;
  }

  .panel-content {
    padding: 15px;
    max-height: 50vh;
    overflow-y: auto;
  }

  .close-btn {
    top: 10px;
    right: 10px;
  }

  /* Legend - Collapsible on mobile */
  #color-legend {
    bottom: auto;
    top: 70px;
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 12px 15px;
    font-size: 10px;
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 12px;
  }

  #color-legend.mobile-visible {
    display: block;
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .legend-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .legend-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }

  .legend-item {
    flex: 0 0 calc(50% - 4px);
    margin-bottom: 2px;
  }

  /* Search Container - Improved mobile layout */
  .search-container {
    left: 10px;
    right: 60px;
    transform: none;
    top: 15px;
  }

  #search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 20px;
  }

  #search-input:focus {
    width: 100%;
  }

  #search-results {
    max-height: 250px;
    border-radius: 12px;
  }

  .search-result-item {
    padding: 10px 15px;
  }

  /* Stats Bar - Compact mobile version */
  .stats-bar {
    top: 15px;
    right: 10px;
    gap: 8px;
  }

  .stat-item {
    padding: 6px 10px;
    border-radius: 8px;
    min-width: 50px;
  }

  .stat-number {
    font-size: 16px;
  }

  .stat-label {
    font-size: 7px;
    letter-spacing: 0.5px;
  }

  /* Disclaimer - Hidden on mobile for better UX */
  #disclaimer {
    display: none;
  }

  /* Zoom Controls - Improved mobile layout */
  #zoom-controls {
    bottom: 20px;
    right: 10px;
    flex-direction: row;
    gap: 8px;
    background: rgba(25, 20, 15, 0.9);
    padding: 8px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
  }

  .zoom-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 50%;
    background: transparent;
  }

  .zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  #zoom-level {
    display: none;
  }

  #zoom-reset {
    margin-top: 0 !important;
  }

  /* Person Cards - Larger touch targets */
  .person-card {
    min-width: 140px;
  }

  .person-card:hover {
    transform: none;
  }

  .person-card:active {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  }

  .push-pin {
    width: 28px;
    height: 28px;
    top: -18px;
  }

  /* Sticky Notes - Touch friendly */
  .sticky-note {
    min-width: 160px;
  }

  .sticky-note:hover {
    transform: none !important;
  }

  .sticky-note:active {
    transform: scale(1.02) !important;
  }

  /* News Clippings - Touch friendly */
  .news-clipping {
    min-width: 180px;
  }

  .news-clipping:hover {
    transform: none !important;
  }

  .news-clipping:active {
    transform: scale(1.02) !important;
  }

  /* Location Markers - Larger touch area */
  .location-marker {
    min-width: 130px;
  }

  .location-marker:hover {
    transform: none;
  }

  .location-marker:active {
    transform: scale(1.05);
  }

  .location-pin {
    font-size: 28px;
  }

  /* Evidence Photos - Touch friendly */
  .evidence-photo:hover {
    transform: none !important;
  }

  .evidence-photo:active {
    transform: scale(1.05) !important;
  }

  /* Lightbox mobile adjustments */
  #lightbox-close {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  #lightbox-image {
    border-width: 5px;
    max-height: 70vh;
  }

  #lightbox-caption {
    font-size: 14px;
    padding: 8px 15px;
  }

  /* Password Prompt mobile */
  .password-box {
    width: 90%;
    max-width: 320px;
    padding: 20px;
  }

  /* Secret Folder Window - Mobile adjustments */
  #secret-folder-window {
    width: 95%;
    max-width: 600px;
    height: auto;
    max-height: 80vh;
  }

  .window-body {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
    padding: 15px;
  }

  /* Show mobile nav hint */
  .mobile-nav-hint {
    display: block;
  }

  /* Loading overlay adjustments */
  .loading-text {
    font-size: 12px;
    letter-spacing: 2px;
  }

  .loading-bar {
    width: 150px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .search-container {
    right: 55px;
  }

  .stats-bar {
    gap: 5px;
  }

  .stat-item {
    padding: 5px 8px;
    min-width: 40px;
  }

  .stat-number {
    font-size: 14px;
  }

  .stat-label {
    display: none;
  }

  #detail-panel {
    max-height: 80vh;
  }

  .panel-content {
    max-height: 60vh;
  }

  #color-legend {
    font-size: 9px;
  }

  .legend-item {
    flex: 0 0 100%;
  }

  #disclaimer {
    font-size: 7px;
    padding: 6px 10px;
  }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
  #detail-panel {
    width: 50%;
    max-height: 100vh;
    height: 100%;
    top: 0;
    bottom: 0;
    border-radius: 0;
  }

  .panel-content {
    max-height: calc(100vh - 180px);
  }

  #color-legend {
    max-height: 80vh;
  }

  #zoom-controls {
    bottom: 70px;
  }

  .legend-toggle {
    bottom: 70px;
  }
}

/* Touch device optimizations */
@media (pointer: coarse) {

  .person-card,
  .sticky-note,
  .news-clipping,
  .evidence-photo,
  .location-marker {
    -webkit-tap-highlight-color: transparent;
  }

  /* Disable hover effects on touch devices */
  .person-card:hover,
  .sticky-note:hover,
  .news-clipping:hover,
  .evidence-photo:hover,
  .location-marker:hover {
    transform: none !important;
  }
}