/* ========================================
   COMPLETE STYLE.CSS - مع إضافة أنماط زر العين القابل للسحب داخل PDF
   ======================================== */

:root {
  /* بنعرف المتصفح إن الموقع تصميمه داكن أصلاً */
  color-scheme: dark !important;
}

/* أهم كود لمنع المتصفح من تغيير ألوان الـ SVG والمستطيلات */
#main-svg, .m, rect, text {
  /* بيمنع المتصفح (خصوصاً Chrome Mobile) من إعادة تلوين العناصر */
  forced-color-adjust: none !important;
}

html, body {
  background-color: black !important;
  color: white !important;
  /* حماية إضافية ضد الـ Auto Dark Mode */
  color-scheme: only dark;
}

/* [000] شاشة Preload */
#preload-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow-y: auto;
}

#preload-screen.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.preload-container {
  width: 100%;
  max-width: 450px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  max-height: 95vh;
  overflow-y: auto;
}

.preload-container .notice {
  font-size: 12px;
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 15px;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.preload-container .logo {
  font-size: 50px;
  margin-bottom: 10px;
}

.preload-container h1 {
  font-size: 24px;
  margin: 10px 0;
  color: #3498db;
}

.preload-container .subtitle {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 15px;
}

.progress-container {
  background: #222;
  border-radius: 10px;
  overflow: hidden;
  height: 25px;
  margin: 15px 0;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  transition: width 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 13px;
}

.file-status {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px;
  border-radius: 8px;
  margin: 10px 0;
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.continue-btn {
  display: none;
  margin: 15px 0;
  padding: 12px 30px;
  width: 100%;
  border: none;
  border-radius: 25px;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 20px rgba(46, 204, 113, 0.5);
}

.continue-btn:active {
  transform: translateY(0);
}

.game-container {
  background: linear-gradient(180deg, #1a1a2e, #0f0f1e);
  height: 500px;
  border-radius: 15px;
  position: relative;
  overflow: hidden;
  margin: 15px 0;
  border: 2px solid rgba(52, 152, 219, 0.3);
}

.game-stats {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  z-index: 1;
  pointer-events: none;
}

.game-stat {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.runner {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 35px;
  z-index: 1;
  transition: left 0.2s ease;
}

.falling-item {
  position: absolute;
  top: -40px;
  font-size: 30px;
  z-index: 1;
}

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2;
  backdrop-filter: blur(5px);
}

.game-overlay h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: #e74c3c;
}

.final-score {
  font-size: 20px;
  margin: 10px 0;
  color: #3498db;
}

.restart-btn {
  font-size: 40px;
  background: none;
  border: none;
  color: #2ecc71;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.restart-btn:hover {
  transform: scale(1.2);
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.control-btn {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  font-weight: bold;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.control-btn:active {
  transform: scale(0.95);
}

.leaderboard {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px;
  margin-top: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 300px;
  overflow-y: auto;
}

.leaderboard h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #f39c12;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  margin: 5px 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 14px;
}

.leaderboard-rank {
  font-weight: bold;
  color: #3498db;
  min-width: 30px;
}

.leaderboard-name {
  flex: 1;
  text-align: center;
  color: #ecf0f1;
}

.leaderboard-score {
  font-weight: bold;
  color: #2ecc71;
  min-width: 50px;
  text-align: right;
}

.leaderboard-item.top1 .leaderboard-rank { color: #f39c12; }
.leaderboard-item.top2 .leaderboard-rank { color: #95a5a6; }
.leaderboard-item.top3 .leaderboard-rank { color: #cd7f32; }

.leaderboard-item.current-player {
  background: rgba(255, 204, 0, 0.2) !important;
  border: 2px solid rgba(255, 204, 0, 0.5) !important;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
  transform: scale(1.02);
}

.leaderboard-item.current-player .leaderboard-name {
  color: #ffcc00 !important;
  font-weight: 700;
}

.leaderboard-item.current-player .leaderboard-score {
  color: #ffcc00 !important;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.no-scores {
  color: #999;
  text-align: center;
  padding: 30px;
  font-size: 16px;
}

@media (max-width: 480px) {
  .game-container { height: 250px; }
  .runner { font-size: 30px; }
  .falling-item { font-size: 25px; }
}

/* [000-B] شاشة اختيار طريقة الفتح */
#open-method-popup {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

#open-method-popup.active {
  display: flex !important;
}

.method-container {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: 20px;
  padding: 20px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 204, 0, 0.3);
  border: 2px solid #ffcc00;
}

.method-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 204, 0, 0.3);
}

.method-header h2 {
  color: #ffcc00;
  font-size: 20px;
  margin: 0;
}

.method-close {
  font-size: 24px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s;
  background: rgba(255, 0, 0, 0.2);
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.method-close:hover {
  transform: scale(1.2);
  background: rgba(255, 0, 0, 0.4);
}

.method-preview {
  background: #000;
  border-radius: 10px;
  min-height: 300px;
  max-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0;
  position: relative;
}

#method-preview-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.method-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: #ffcc00;
  font-size: 18px;
}

.method-loading.hidden {
  display: none;
}

.method-filename {
  text-align: center;
  color: #ffcc00;
  font-size: 14px;
  font-weight: bold;
  margin: 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method-buttons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0 0 10px 10px;
}

.method-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.method-btn-icon {
  font-size: 20px;
}

.method-btn-text {
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}

.mozilla-btn {
  background: rgba(255, 69, 0, 0.2);
  border-color: #ff4500;
  color: #ff4500;
}

.mozilla-btn:hover {
  background: rgba(255, 69, 0, 0.4);
  transform: translateY(-2px);
}

.browser-btn {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
  color: #3498db;
}

.browser-btn:hover {
  background: rgba(52, 152, 219, 0.4);
  transform: translateY(-2px);
}

.drive-btn {
  background: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
  color: #4caf50;
}

.drive-btn:hover {
  background: rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.method-btn:active {
  transform: translateY(0) scale(0.98);
}

/* [001] الإعدادات الأساسية */
*, *::before, *::after {
  box-sizing: border-box !important;
  -webkit-tap-highlight-color: transparent;
}

:root {
  color-scheme: only light !important;
  --color-q: red;
  --color-v: blue;
  --color-i: white;
  --color-a: purple;
  --color-s: green;
  --color-l: yellow;
  --color-is: #c8ff8e;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100svh;
  width: 100vw;
  overflow: hidden;
  background-color: black !important;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: white;
}

#scroll-container {
  width: 100vw;
  height: 100svh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  direction: ltr;
  scrollbar-width: thin;
  scrollbar-color: #444 black;
}

#main-svg {
  height: 100%;
  width: auto;
  display: block;
  transition: opacity 0.2s ease-out;
  opacity: 0;
  visibility: hidden;
}

#main-svg.loaded {
  opacity: 1;
  visibility: visible;
}

/* [002] المستطيلات التفاعلية */
.m {
  fill: transparent !important;
  stroke-width: 2px;
  transform-origin: center center;
  transition: filter 0.2s ease, stroke-width 0.2s ease;
  cursor: pointer;
  forced-color-adjust: none !important; 
}

.q { stroke: var(--color-q); }
.v { stroke: var(--color-v); }
.i { stroke: var(--color-i); }
.a { stroke: var(--color-a); }
.s { stroke: var(--color-s); }
.l { stroke: var(--color-l); }
.is { stroke: var(--color-is); }

/* [003] شاشة اختيار المجموعة */
#group-selection-screen {
  height: 100svh;
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#group-selection-screen.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

#group-selection-content {
  text-align: center;
  width: 90%;
  max-width: 600px;
  transform: scale(0.85);
}

#main-logo {
  width: 300px;
  max-width: 80vw;
  height: auto;
  margin-bottom: 30px;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
}

#group-selection-content h1 {
  color: #ffcc00;
  font-size: clamp(1.2rem, 4vw, 2rem);
  margin-bottom: 40px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

#group-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 20px;
}

.group-btn {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 2px solid #444;
  border-radius: 15px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.group-btn:hover {
  border-color: #ffcc00;
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 204, 0, 0.3);
}

.group-btn:active {
  transform: translateY(-2px) scale(0.98);
}

.group-letter {
  font-size: 3rem;
  font-weight: bold;
  color: #ffcc00;
}

.group-label {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 2px;
}

@media (max-width: 480px) {
  #group-buttons {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .group-letter { font-size: 2.5rem; }
  #main-logo { width: 200px; }
}

/* [004] عارض PDF */
#pdf-overlay {
  height: 100svh;
  transition: transform 0.2s ease, opacity 0.2s ease;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 4;
  display: flex;
  flex-direction: column;
}

#pdf-overlay.hidden {
  transform: translateY(100%);
  pointer-events: none;
}

#toolbar {
  height: 50px;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid #555;
}

#pdf-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

#pdfFrame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

.toolbar-btn, .pdf-control-btn {
  background: #555;
  color: white;
  border: 1px solid #777;
  padding: 5px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

#expand-toolbar-btn {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

#expand-toolbar-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.6);
}

#expand-toolbar-btn:active {
  transform: scale(0.95);
}

#pdf-overlay.fullscreen-mode #pdf-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: all 0.3s ease;
}

#pdf-overlay.fullscreen-mode:hover #pdf-controls {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

#pdf-overlay.fullscreen-mode #expand-toolbar-btn {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

/* إخفاء شريط الأدوات عند تفعيل وضع "العين" */
#pdf-overlay.toolbar-hidden #toolbar {
  display: none !important;
}

/* توسعة الـ iframe ليملأ كامل المساحة عند إخفاء الشريط */
#pdf-overlay.toolbar-hidden #pdfFrame {
  height: 100vh !important;
}

/* زر العين القابل للسحب داخل PDF */
.pdf-eye-draggable {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: white;
}

.pdf-eye-draggable.dragging {
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(255, 204, 0, 0.6);
  z-index: 10;
}

.pdf-eye-draggable:hover:not(.dragging) {
  transform: scale(1.15);
  background-color: rgba(0, 0, 0, 1);
}

.pdf-eye-draggable.active {
  background-color: rgba(255, 204, 0, 0.9);
  color: black;
  border-color: #ffcc00;
}

/* [005] نافذة معاينة PDF */
#pdf-preview-popup {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

#pdf-preview-popup.active {
  display: flex;
}

.preview-container {
  background: #1a1a1a;
  border-radius: 20px;
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(255, 204, 0, 0.5);
  border: 2px solid #ffcc00;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 204, 0, 0.3);
}

.preview-title {
  color: #ffcc00;
  font-size: 18px;
  font-weight: bold;
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-btn {
  background: rgba(255, 204, 0, 0.2);
  border: 1px solid #ffcc00;
  color: white;
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.preview-btn:hover {
  background: rgba(255, 204, 0, 0.4);
  transform: scale(1.05);
}

.preview-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  border-radius: 10px;
  position: relative;
  min-height: 400px;
}

#preview-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: #ffcc00;
  font-size: 20px;
  z-index: 1;
}

.preview-loading.hidden {
  display: none;
}

.preview-hint {
  margin-top: 10px;
  text-align: center;
  color: rgba(255, 204, 0, 0.8);
  font-size: 11px;
}

/* [006] شاشة التحميل */
#loading-overlay {
  position: fixed;
  height: 100svh;
  inset: 0;
  background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: opacity 0.3s ease-out;
  opacity: 0;
  pointer-events: none;
}

#loading-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

#loading-content {
  text-align: center;
  width: 90%;
  max-width: 600px;
}

#splash-image {
  width: 400px;
  max-width: 85vw;
  height: auto;
  display: block;
  margin: -60px auto 10px auto;
  border-radius: 15px;
}

#loading-content h1 {
  color: #ffcc00;
  margin: 10px 0;
  font-size: 1.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#loader-lights {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.light-bulb {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: #222;
  border: 1px solid #444;
  transition: all 0.2s ease;
}

#bulb-1.on {
  background-color: #4dff88;
  box-shadow: 0 0 15px #4dff88;
  border-color: #fff;
}

#bulb-2.on {
  background-color: #ffff4d;
  box-shadow: 0 0 15px #ffff4d;
  border-color: #fff;
}

#bulb-3.on {
  background-color: #ffaa00;
  box-shadow: 0 0 15px #ffaa00;
  border-color: #fff;
}

#bulb-4.on {
  background-color: #ff4d4d;
  box-shadow: 0 0 15px #ff4d4d;
  border-color: #fff;
}

#legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 30px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eee;
  font-size: 13px;
}

.legend-item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background-color: var(--item-color);
  box-shadow: 0 0 10px var(--item-color);
  flex-shrink: 0;
}

.legend-item.red    { --item-color: var(--color-q); }
.legend-item.blue   { --item-color: var(--color-v); }
.legend-item.white  { --item-color: var(--color-i); }
.legend-item.purple { --item-color: var(--color-a); }
.legend-item.green  { --item-color: var(--color-s); }
.legend-item.yellow { --item-color: var(--color-l); }
.legend-item.is     { --item-color: var(--color-is); }

/* [007] شريط الأدوات */
#js-toggle-container {
  position: fixed;
  right: 20px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: white;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 180px;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#js-toggle-container.fully-hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

#js-toggle-container.top    { top: 20px; }
#js-toggle-container.bottom { bottom: 20px; }

#search-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

#search-input {
  padding: 8px 10px 8px 45px;
  border: 1px solid #444;
  border-radius: 5px;
  width: 100%;
  height: 36px;
  background: #222;
  color: white;
  font-size: 13px;
}

.clickable-area {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 1;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 8px;
}

#move-toggle, #eye-toggle {
  cursor: pointer;
  user-select: none;
  padding: 6px;
  font-size: 16px;
  transition: all 0.2s ease;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
}

#eye-toggle {
  font-size: 14px;
  min-width: 28px;
  min-height: 28px;
}

#move-toggle:hover, #eye-toggle:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.1);
}

.hover-toggle-container {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #444;
  transition: 0.2s;
  border-radius: 18px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider { background-color: #2196F3; }
input:checked + .slider:before { transform: translateX(18px); }

#eye-toggle-standalone {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#eye-toggle-standalone.dragging {
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(255, 204, 0, 0.6);
  z-index: 3;
}

#eye-toggle-standalone:hover:not(.dragging) {
  transform: scale(1.15);
  background-color: rgba(0, 0, 0, 1);
}

/* [008] الأزرار الثابتة */
#fixed-controls-layer {
  z-index: 3;
  pointer-events: none;
}

#reset-btn, #change-group-btn, #back-button-group, #preload-btn {
  cursor: pointer;
  pointer-events: auto;
}

#reset-btn rect, #change-group-btn rect, #back-btn, #preload-btn rect {
  transition: filter 0.2s ease, fill 0.2s ease;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.8));
  stroke: none;
  pointer-events: auto;
}

#reset-btn:hover rect, #change-group-btn:hover rect,
#back-button-group:hover rect, #preload-btn:hover rect {
  filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.9))
          drop-shadow(0 0 25px rgba(255, 204, 0, 0.8));
}

#reset-btn text, #change-group-btn text, #back-btn-text,
#preload-btn text, #group-btn-text {
  pointer-events: none;
  user-select: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 900;
  font-size: 26px;
  fill: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

#back-btn-text { font-size: 30px; }

#reset-btn rect, #change-group-btn rect, #preload-btn rect, #back-btn {
  fill: #000000;
}

#reset-btn:hover rect, #change-group-btn:hover rect,
#preload-btn:hover rect, #back-button-group:hover #back-btn {
  fill: #1a1a1a;
}

/* [009] Utilities */
.label-bg { rx: 3; ry: 3; opacity: 0.9; }
.rect-label { font-weight: bold; pointer-events: none; }

img, image, svg, rect {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.scrollable-content {
  transition: transform 0.1s ease-out;
  cursor: grab;
  user-select: none;
}

.scrollable-content:active {
  cursor: grabbing;
}

.scrollable-content.grabbing {
  cursor: grabbing !important;
}

.scroll-handle {
  transition: y 0.1s ease-out;
}

.scroll-handle:hover {
  fill: #ffd54f;
}

#scroll-container::-webkit-scrollbar {
  height: 8px;
}

#scroll-container::-webkit-scrollbar-track {
  background: #000;
}

#scroll-container::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.wood-folder-group,
.wood-file-group {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.wood-folder-group:active,
.wood-file-group:active {
  opacity: 0.7;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 204, 40, 0.5); }
  50%       { box-shadow: 0 0 40px rgba(255, 204, 40, 0.8); }
}

.long-press-active {
  animation: pulseGlow 1s infinite;
}

.fully-hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

@media (max-width: 768px) {
  #reset-btn text, #change-group-btn text,
  #preload-btn text, #group-btn-text { font-size: 22px; }
  #back-btn-text { font-size: 26px; }

  .method-container { padding: 20px; }
  .method-header h2 { font-size: 18px; }
  .method-preview   { height: 250px; }
  .method-btn       { padding: 8px 6px; font-size: 12px; }
  .method-btn-icon  { font-size: 18px; }
}

@media (max-width: 480px) {
  #reset-btn text, #change-group-btn text,
  #preload-btn text, #group-btn-text { font-size: 19px; }
  #back-btn-text { font-size: 23px; }

  .method-container { padding: 15px; max-width: 95%; }
  .method-header h2 { font-size: 16px; }
  .method-preview   { height: 200px; }
  .method-btn       { padding: 8px 4px; font-size: 11px; }
  .method-btn-icon  { font-size: 16px; }
  .method-filename  { font-size: 12px; }
}

@media print {
  #js-toggle-container, #loading-overlay, #group-selection-screen,
  #pdf-overlay, #preload-screen, #pdf-preview-popup, #open-method-popup {
    display: none !important;
  }
}

/* ========================================
   🏆 Live Leaderboard - تحت اللعبة
   ======================================== */
#live-leaderboard-section {
  background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(20,20,40,0.95));
  border: 1px solid rgba(243, 156, 18, 0.4);
  border-radius: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

.live-lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(243, 156, 18, 0.25);
}

.live-lb-title {
  font-size: 14px;
  font-weight: 700;
  color: #f39c12;
  letter-spacing: 0.5px;
}

.live-lb-status {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  transition: color 0.3s ease;
}

.live-lb-status.loaded { color: #2ecc71; }
.live-lb-status.error  { color: #e74c3c; }

.live-lb-scroll {
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(243,156,18,0.5) transparent;
}

.live-lb-scroll::-webkit-scrollbar       { width: 4px; }
.live-lb-scroll::-webkit-scrollbar-track { background: transparent; }
.live-lb-scroll::-webkit-scrollbar-thumb {
  background: rgba(243,156,18,0.5);
  border-radius: 4px;
}
.live-lb-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(243,156,18,0.8);
}

.live-lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.live-lb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  transition: background 0.2s, transform 0.2s;
  animation: lbFadeIn 0.35s ease both;
}

.live-lb-item:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(-2px);
}

@keyframes lbFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.live-lb-rank {
  font-size: 15px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.live-lb-name {
  flex: 1;
  font-size: 13px;
  color: #ecf0f1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-lb-score {
  font-size: 13px;
  font-weight: 700;
  color: #2ecc71;
  min-width: 48px;
  text-align: left;
  flex-shrink: 0;
}

.live-lb-item.lb-rank-1 { border-color: rgba(243,156,18,0.5);  background: rgba(243,156,18,0.08); }
.live-lb-item.lb-rank-2 { border-color: rgba(189,195,199,0.4); background: rgba(189,195,199,0.05); }
.live-lb-item.lb-rank-3 { border-color: rgba(205,127,50,0.4);  background: rgba(205,127,50,0.05);  }

.live-lb-item.lb-current {
  border-color: rgba(255,204,0,0.6) !important;
  background: rgba(255,204,0,0.12) !important;
  box-shadow: 0 0 10px rgba(255,204,0,0.2);
}
.live-lb-item.lb-current .live-lb-name  { color: #ffcc00; font-weight: 700; }
.live-lb-item.lb-current .live-lb-score { color: #ffcc00; }

/* Skeleton Loader */
.live-lb-item.live-lb-loading { pointer-events: none; animation: none; }

.live-lb-skeleton {
  display: inline-block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.06) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite;
  min-width: 30px;
  flex-shrink: 0;
}

@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.live-lb-empty {
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  padding: 20px 0;
}