/* LogicMatrix V3.1 — Mobile-First Arabic Investigation Stylesheet */
:root {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-blue: #38bdf8;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --accent-orange: #f97316;
  --border-color: #475569;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --touch-target: 48px;
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', Tahoma, 'Cairo', 'Tajawal', system-ui, sans-serif;
  direction: rtl;
  text-align: right;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* App Container - Mobile First <= 600px */
.v3-app-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* Header & Mission Selector */
.v3-header {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.v3-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.v3-brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.v3-rank-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Case Selector Tabs (10-Case Pilot Carousel) */
.v3-case-selector {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 4px 2px 8px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold) var(--bg-card);
  -webkit-overflow-scrolling: touch;
}

.v3-case-tab {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-target);
  min-width: 105px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.v3-case-tab:hover, .v3-case-tab.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.v3-case-tab.active {
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Progress Bar Row */
.v3-progress-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.v3-progress-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.v3-progress-pill-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.v3-progress-pill-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
}

/* Status & Deadlock Sentinel Bar */
.v3-sentinel-bar {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.v3-sentinel-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-green);
  font-weight: 600;
}

.v3-sentinel-indicator.warning {
  color: var(--accent-gold);
}

.v3-sentinel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.v3-sentinel-dot.warning {
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

/* Briefing & Scene Card */
.v3-briefing-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.v3-scene-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.v3-case-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.v3-briefing-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Evidence Board Section */
.v3-evidence-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v3-evidence-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-evidence-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  position: relative;
}

.v3-evidence-card:hover {
  border-color: var(--accent-blue);
}

.v3-evidence-card.selected {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}

.v3-evidence-card.highlight-linked {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  transform: scale(1.01);
}

.v3-evidence-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.v3-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-evidence { background: rgba(245, 158, 11, 0.2); color: var(--accent-gold); border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-testimony { background: rgba(56, 189, 248, 0.2); color: var(--accent-blue); border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-trace { background: rgba(249, 115, 22, 0.2); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.4); }
.badge-fact { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.4); }
.badge-doc { background: rgba(168, 85, 247, 0.2); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-log { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.4); }

.v3-evidence-card-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.v3-evidence-card-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Unlock Evidence Action Button */
.v3-btn-unlock-evidence {
  background: rgba(245, 158, 11, 0.15);
  border: 1px dashed var(--accent-gold);
  color: var(--accent-gold);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-btn-unlock-evidence:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

.v3-btn-unlock-evidence:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-style: solid;
}

/* Interaction Area - Archetype Specific */
.v3-interaction-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Archetype A: Suspect Lineup */
.v3-suspects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-suspect-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: all 0.2s ease;
}

.v3-suspect-card:hover {
  border-color: var(--accent-blue);
}

.v3-suspect-card.status-excluded {
  opacity: 0.72;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(239, 68, 68, 0.4);
}

.v3-suspect-card.status-confirmed {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.v3-suspect-main-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.v3-suspect-avatar {
  font-size: 2.2rem;
  background: var(--bg-surface);
  padding: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.v3-suspect-info {
  flex: 1;
}

.v3-suspect-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.v3-suspect-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.v3-suspect-role {
  font-size: 0.8rem;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.v3-suspect-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Status Stamp Badge */
.v3-status-stamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.stamp-suspicious {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.stamp-excluded {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.stamp-confirmed {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Linked Evidence Strip on Suspect Card */
.v3-linked-evidence-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.v3-link-chip {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.v3-link-chip:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-blue);
}

/* Elimination Reason Banner inside Excluded Card */
.v3-exclusion-reason-box {
  background: rgba(239, 68, 68, 0.08);
  border-right: 3px solid var(--accent-red);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #fca5a5;
  line-height: 1.4;
}

.v3-suspect-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.v3-btn-eliminate {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.v3-btn-eliminate:hover {
  background: rgba(239, 68, 68, 0.28);
}

.v3-btn-accuse {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.v3-btn-accuse:hover {
  background: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.v3-btn-accuse.primary-focus {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Archetype B: Timeline Slots */
.v3-timeline-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-timeline-slot {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.v3-timeline-slot.filled {
  border-style: solid;
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
}

.v3-timeline-slot-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.v3-unplaced-events-tray {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.v3-event-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  min-height: var(--touch-target);
}

.v3-event-chip:hover, .v3-event-chip.active {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
}

/* Archetype C: Contradiction Hunt */
.v3-statements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-statement-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.v3-statement-card:hover {
  border-color: var(--accent-blue);
}

.v3-statement-card.selected {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
}

.v3-btn-clash {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transition: transform 0.15s ease;
}

.v3-btn-clash:hover {
  transform: translateY(-2px);
}

/* Interactive Modal (Elimination Flow & Accusation) */
.v3-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.v3-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.v3-modal-sheet {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 520px;
  padding: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.v3-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.v3-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.v3-modal-clue-option {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}

.v3-modal-clue-option:hover {
  border-color: var(--accent-blue);
}

.v3-modal-clue-option.selected {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
}

.v3-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.v3-btn-modal-confirm {
  background: var(--accent-green);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
}

.v3-btn-modal-cancel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
}

/* Feedback & Resolution Modal */
.v3-feedback-banner {
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  display: none;
}

.v3-feedback-banner.success {
  display: block;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-green);
  color: #6ee7b7;
}

.v3-feedback-banner.error {
  display: block;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
}

/* Case File Drawer Toggle & Bottom Sheet */
.v3-drawer-toggle-btn {
  position: sticky;
  bottom: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px auto 0;
  z-index: 100;
  min-height: var(--touch-target);
}

/* Drawer overlay and sheet */
.v3-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.v3-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.v3-drawer-sheet {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 20px;
  z-index: 210;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 80vh;
  overflow-y: auto;
}

.v3-drawer-overlay.open .v3-drawer-sheet {
  transform: translateY(0);
}

.v3-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.v3-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.v3-btn-close-drawer {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ==============================================================
   Smart Hint System Styles
   ============================================================== */
.v3-hint-control-row {
  display: flex;
  margin-top: 8px;
  justify-content: flex-start;
}

.v3-btn-hint {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-btn-hint:hover {
  background: rgba(245, 158, 11, 0.22);
}

.v3-hint-banner {
  background: #1e293b;
  border: 1px solid var(--accent-gold);
  border-right: 4px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fef08a;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: var(--shadow-card);
}

/* ==============================================================
   Case 4: Evidence Matching Styles
   ============================================================== */
.v3-matching-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-trace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.v3-trace-card.selected {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.v3-trace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  color: #d8b4fe;
}

.v3-matching-slots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.v3-match-btn {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 38px;
  transition: all 0.2s ease;
}

.v3-match-btn.active {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--accent-purple);
  color: #f3e8ff;
  font-weight: 700;
}

/* ==============================================================
   Case 5: Route Reasoning Styles
   ============================================================== */
.v3-route-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-route-node {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-route-node.selected {
  background: rgba(14, 165, 233, 0.2);
  border-color: var(--accent-blue);
  color: #e0f2fe;
}

.v3-route-badge {
  background: #0284c7;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.v3-route-summary {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--accent-blue);
}

/* ==============================================================
   Case 6: Hidden Identity Styles
   ============================================================== */
.v3-identity-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-passenger-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v3-passenger-card.selected {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.1);
}

.v3-trait-selector-box {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v3-trait-pill {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v3-trait-pill.selected {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.2);
  color: #fbcfe8;
  font-weight: 700;
}

/* ==============================================================
   Case 8: Sequence Ordering Styles
   ============================================================== */
.v3-sequence-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-sequence-slot {
  background: #1e293b;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v3-sequence-slot.filled {
  border-style: solid;
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}

.v3-disc-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-disc-chip.active {
  border-color: #818cf8;
  background: rgba(129, 140, 248, 0.2);
}

/* ==============================================================
   Case 9: Multi-Stage Investigation Styles
   ============================================================== */
.v3-multistage-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3-stage-indicator-bar {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.v3-stage-tab {
  flex: 1;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-secondary);
}

.v3-stage-tab.current {
  background: #0d9488;
  color: #fff;
}

.v3-stage-tab.completed {
  background: #1e293b;
  color: #10b981;
}

.v3-location-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-location-card.selected {
  border-color: #14b8a6;
  background: rgba(20, 184, 166, 0.15);
}

/* ==============================================================
   Case 10: Modern Logic Grid V3 Styles
   ============================================================== */
.v3-logic-grid-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: auto;
}

.v3-grid-matrix {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.8rem;
}

.v3-grid-matrix th, .v3-grid-matrix td {
  border: 1px solid var(--border-color);
  padding: 8px 4px;
  text-align: center;
}

.v3-grid-matrix th {
  background: #1e293b;
  color: var(--accent-gold);
  font-weight: 700;
}

.v3-matrix-cell {
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  user-select: none;
  transition: background 0.15s ease;
}

.v3-matrix-cell:hover {
  background: rgba(255, 255, 255, 0.05);
}

.v3-matrix-cell.cell-yes {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.v3-matrix-cell.cell-no {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ========================================================
   V3.2.2 UX: Text Truncation & Overflow Protection
   ======================================================== */
.v3-case-title,
.v3-briefing-text,
.v3-evidence-card-title,
.v3-evidence-card-body,
.v3-suspect-bio,
.v3-suspect-name,
.v3-statement-card,
.v3-objective-title,
.v3-modal-title,
.v3-drawer-title,
.v3-map-node-name,
.v3-map-region-title,
.v3-inventory-item-name,
.v3-inventory-item-desc,
.v3-scene-object-name,
.v3-route-node-title,
.v3-route-node-desc,
.v3-sequence-slot-header,
.v3-disc-title,
.v3-stage-step {
  overflow-wrap: break-word;
  word-break: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* Line clamping for long bio/description text */
.v3-suspect-bio,
.v3-evidence-card-body,
.v3-inventory-item-desc,
.v3-route-node-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Expand on tap/click */
.v3-suspect-card.expanded .v3-suspect-bio,
.v3-evidence-card.expanded .v3-evidence-card-body,
.v3-inventory-item-card.expanded .v3-inventory-item-desc,
.v3-route-node-card.expanded .v3-route-node-desc {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* ========================================================
   V3.2.2 UX: Loading / Empty / Error States
   ======================================================== */
.v3-state-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.v3-state-loading .v3-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: v3Spin 0.8s linear infinite;
}

@keyframes v3Spin {
  to { transform: rotate(360deg); }
}

.v3-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.v3-state-empty .v3-empty-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.v3-state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 20px;
  text-align: center;
  color: #fca5a5;
  font-size: 0.88rem;
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.v3-state-error .v3-error-icon {
  font-size: 1.8rem;
}

.v3-state-error .v3-btn-retry {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-state-error .v3-btn-retry:hover {
  background: rgba(239, 68, 68, 0.28);
}

/* ========================================================
   V3.2.2 UX: Result / Case-Closed / Retry Screen
   ======================================================== */
.v3-result-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 20px;
  text-align: center;
  border-radius: var(--radius-lg);
  animation: v3FadeIn 0.4s ease-out;
}

.v3-result-banner.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08));
  border: 2px solid rgba(16, 185, 129, 0.5);
}

.v3-result-banner.failure {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(220, 38, 38, 0.06));
  border: 2px solid rgba(239, 68, 68, 0.4);
}

.v3-result-icon {
  font-size: 3rem;
  line-height: 1;
}

.v3-result-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.v3-result-message {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 420px;
}

.v3-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.v3-btn-result {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  border: none;
  transition: all 0.2s ease;
}

.v3-btn-result.next {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
}

.v3-btn-result.next:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.v3-btn-result.retry {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
}

.v3-btn-result.retry:hover {
  background: rgba(245, 158, 11, 0.28);
}

.v3-btn-result.map {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
}

.v3-btn-result.map:hover {
  background: rgba(168, 85, 247, 0.28);
}

/* ========================================================
   V3.2.2 UX: Start Screen & Interaction Hints
   ======================================================== */
.v3-start-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 20px;
  text-align: center;
  transition: opacity 0.4s ease;
}

.v3-start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.v3-start-logo {
  font-size: 3.5rem;
  animation: v3FadeIn 0.6s ease-out;
}

.v3-start-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.3;
}

.v3-start-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 400px;
}

.v3-start-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
  max-width: 360px;
  width: 100%;
}

.v3-start-feature-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.v3-start-feature-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.v3-btn-start {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 54px;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transition: all 0.25s ease;
  animation: pulseGold 2.5s infinite;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.v3-btn-start:hover, .v3-btn-start:active {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(245, 158, 11, 0.5);
}

.v3-interaction-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.v3-interaction-hint .v3-hint-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  animation: v3Pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes v3Pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ========================================================
   V3.2.2 UX: Improved Route & Sequence Card Classes
   ======================================================== */
.v3-route-nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.v3-route-node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v3-route-node-card.selected {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.15);
}

.v3-route-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.v3-route-node-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.v3-route-node-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.v3-route-order-badge {
  background: var(--accent-blue);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.v3-sequence-slots-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v3-sequence-slot-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.v3-sequence-slot-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.v3-sequence-items-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.v3-disc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
  text-align: center;
}

.v3-disc-card.selected {
  border-color: #818cf8;
  background: rgba(129, 140, 248, 0.2);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
}

.v3-disc-card.placed {
  opacity: 0.4;
  pointer-events: none;
}

.v3-disc-symbol {
  font-size: 1.5rem;
}

.v3-disc-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.v3-stage-step {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.v3-stage-step.active {
  background: #0d9488;
  color: #fff;
}

.v3-stage-step.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.v3-stage-step.locked {
  opacity: 0.4;
}

/* ========================================================
   V3.2.2 UX: Contradiction & Hidden Identity Improved Classes
   ======================================================== */
.v3-contradiction-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-identity-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-suspect-card.status-suspicious {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
}

/* ========================================================
   V3.2.2 UX: Feedback Banner Improvements
   ======================================================== */
.v3-feedback-banner.info {
  display: block;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-blue);
  color: #7dd3fc;
}

.v3-feedback-banner {
  animation: v3FadeIn 0.3s ease-out;
}

@keyframes v3FadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   V3.2.2 UX: Responsive Breakpoints 360 / 390 / 412 / 600
   ======================================================== */

/* 360px — Very small phones */
@media (max-width: 360px) {
  .v3-app-container {
    padding: 8px;
    gap: 10px;
  }
  .v3-header {
    padding: 10px;
  }
  .v3-brand-title {
    font-size: 1rem;
  }
  .v3-case-tab {
    font-size: 0.72rem;
    padding: 6px 4px;
    min-width: 90px;
  }
  .v3-case-title {
    font-size: 1.05rem;
  }
  .v3-briefing-text {
    font-size: 0.85rem;
  }
  .v3-objective-title {
    font-size: 0.82rem;
  }
  .v3-btn-context-help {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
  .v3-progress-row {
    gap: 4px;
  }
  .v3-progress-pill {
    padding: 4px 4px;
  }
  .v3-progress-pill-label {
    font-size: 0.65rem;
  }
  .v3-progress-pill-val {
    font-size: 0.85rem;
  }
  .v3-suspect-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
  }
  .v3-suspect-name {
    font-size: 0.95rem;
  }
  .v3-evidence-card {
    padding: 10px;
  }
  .v3-interaction-panel {
    padding: 10px;
  }
  .v3-btn-clash, .v3-btn-accuse, .v3-btn-eliminate {
    font-size: 0.82rem;
    padding: 10px;
  }
  .v3-grid-matrix {
    font-size: 0.72rem;
  }
  .v3-matrix-cell {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }
  .v3-scene-objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .v3-map-nodes-list {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .v3-sequence-items-pool {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .v3-route-nodes-grid {
    grid-template-columns: 1fr;
  }
  .v3-start-title {
    font-size: 1.3rem;
  }
  .v3-start-features {
    max-width: 300px;
  }
  .v3-start-feature-row {
    font-size: 0.82rem;
    padding: 8px 10px;
  }
  .v3-result-title {
    font-size: 1.05rem;
  }
  .v3-result-message {
    font-size: 0.85rem;
  }
}

/* 390px — Standard phones (iPhone 12/13/14) */
@media (min-width: 361px) and (max-width: 390px) {
  .v3-app-container {
    padding: 10px;
    gap: 12px;
  }
  .v3-case-tab {
    font-size: 0.78rem;
    min-width: 100px;
  }
  .v3-suspect-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.8rem;
  }
  .v3-grid-matrix {
    font-size: 0.78rem;
  }
  .v3-matrix-cell {
    width: 40px;
    height: 40px;
  }
}

/* 412px — Larger phones (Galaxy/Pixel) */
@media (min-width: 391px) and (max-width: 412px) {
  .v3-app-container {
    padding: 12px;
    gap: 14px;
  }
  .v3-case-tab {
    min-width: 110px;
  }
  .v3-scene-objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* 600px and up — Tablets / larger screens */
@media (min-width: 600px) {
  .v3-app-container {
    max-width: 600px;
    padding: 20px;
    gap: 18px;
  }
  .v3-header {
    padding: 20px;
  }
  .v3-case-selector {
    gap: 10px;
  }
  .v3-case-tab {
    min-width: 120px;
    font-size: 0.85rem;
  }
  .v3-evidence-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .v3-scene-objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .v3-suspects-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .v3-route-nodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .v3-sequence-items-pool {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .v3-grid-matrix {
    font-size: 0.88rem;
  }
  .v3-matrix-cell {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }
}

/* Horizontal scroll prevention for grid tables */
.v3-logic-grid-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.v3-logic-grid-container .v3-grid-matrix {
  min-width: 320px;
}

/* Touch target enforcement for all interactive elements */
button.v3-case-tab,
button.v3-btn-clash,
button.v3-btn-accuse,
button.v3-btn-eliminate,
button.v3-btn-hint,
button.v3-btn-unlock-evidence,
button.v3-btn-inventory,
button.v3-btn-map-toggle,
button.v3-btn-context-help,
button.v3-btn-modal-confirm,
button.v3-btn-modal-cancel,
button.v3-btn-result,
button.v3-btn-start,
button.v3-drawer-toggle-btn,
.v3-suspect-card,
.v3-evidence-card,
.v3-statement-card,
.v3-scene-object-card,
.v3-map-node-btn,
.v3-route-node-card,
.v3-disc-card,
.v3-sequence-slot {
  min-height: var(--touch-target);
}

/* Prevent horizontal overflow globally */
.v3-interaction-panel,
.v3-evidence-section,
.v3-briefing-card,
.v3-scene-objects-section {
  overflow-x: hidden;
  max-width: 100%;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================================
   LogicMatrix V3.2.1: Objective Bar & Contextual Help
   ======================================================== */
.v3-objective-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.v3-objective-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.v3-objective-icon {
  font-size: 1.25rem;
}

.v3-objective-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.v3-btn-context-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-flex;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-btn-context-help:hover, .v3-btn-context-help:active {
  background: rgba(56, 189, 248, 0.28);
  border-color: var(--accent-blue);
}

/* ========================================================
   Scene Affordances & Searchable Objects
   ======================================================== */
.v3-scene-objects-section {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-scene-objects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.v3-scene-object-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 80px;
  justify-content: center;
}

.v3-scene-object-card:hover, .v3-scene-object-card:active {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.1);
}

.v3-scene-object-card.searched {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

.v3-scene-object-icon {
  font-size: 1.4rem;
}

.v3-scene-object-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.v3-scene-object-status {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ========================================================
   Inventory Drawer ("حقيبة الأدلة")
   ======================================================== */
.v3-inventory-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.v3-btn-inventory {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-btn-inventory:hover, .v3-btn-inventory:active {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--accent-purple);
}

.v3-btn-map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

.v3-btn-map-toggle:hover, .v3-btn-map-toggle:active {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-gold);
}

.v3-inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 8px 0;
}

.v3-inventory-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v3-inventory-item-card:hover, .v3-inventory-item-card.selected {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.12);
}

.v3-inventory-item-icon {
  font-size: 1.7rem;
}

.v3-inventory-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.v3-inventory-item-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* ========================================================
   Resume Unfinished Case Banner
   ======================================================== */
.v3-resume-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  animation: v3FadeIn 0.3s ease-out;
}

.v3-resume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v3-resume-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 6px;
}

.v3-resume-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.v3-btn-resume {
  flex: 1;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: var(--touch-target);
}

.v3-btn-restart-case {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-target);
}

/* ========================================================
   World Map Modal View
   ======================================================== */
.v3-map-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}

.v3-map-region-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v3-map-region-card.locked {
  opacity: 0.6;
  filter: grayscale(40%);
}

.v3-map-region-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v3-map-nodes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.v3-map-node-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  min-height: 64px;
  justify-content: center;
  transition: all 0.2s ease;
}

.v3-map-node-btn.status-completed {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.12);
}

.v3-map-node-btn.status-available {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.1);
}

.v3-map-node-btn.status-in-progress {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
}

.v3-map-node-btn.status-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.v3-map-node-num {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.v3-map-node-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.v3-map-node-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* ==========================================================================
 * Unified Solving Action Dock (Direct Action Clarity: ✗, ✓, ↺, ✅)
 * ========================================================================== */
.v3-action-dock {
  position: sticky;
  bottom: 12px;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 158, 11, 0.15);
  margin-top: 12px;
}

.v3-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 4px;
}

.v3-dock-btn .dock-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.v3-dock-btn.dock-eliminate {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}
.v3-dock-btn.dock-eliminate:hover,
.v3-dock-btn.dock-eliminate:active {
  background: rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.v3-dock-btn.dock-select {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}
.v3-dock-btn.dock-select:hover,
.v3-dock-btn.dock-select:active {
  background: rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.v3-dock-btn.dock-undo {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
.v3-dock-btn.dock-undo:hover,
.v3-dock-btn.dock-undo:active {
  background: rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.v3-dock-btn.dock-verify {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(14, 165, 233, 0.35));
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
}
.v3-dock-btn.dock-verify:hover,
.v3-dock-btn.dock-verify:active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(14, 165, 233, 0.5));
  transform: translateY(-1px);
}

.v3-btn-undo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}


