:root {
  --primary: #8B0000; /* Stark Metallic Red */
  --secondary: #D4AF37; /* Stark Gold */
  --accent: #00E5FF; /* Arc Reactor Cyan */
  --background: rgba(10, 10, 10, 0.85); /* Dark background */
  --text-dark: #ffffff; /* White text for contrast */
  --text-light: #ffffff;
  --glass-bg: rgba(20, 20, 20, 0.85); /* Dark glass */
  --glass-border: rgba(0, 210, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(0, 210, 255, 0.3); /* Arc Reactor Glow */
  --success: #78e08f; /* Mint green for correct */
  --error: #ea8685; /* Soft red for wrong */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', sans-serif;
}

/* التمرير الجديد (Blue Scrollbar) */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--background);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

body {
  background: url('../images/11.png') center/cover fixed, linear-gradient(135deg, rgba(10,10,10,0.8) 0%, rgba(20,20,20,0.8) 100%);
  background-blend-mode: overlay;
  color: var(--text-dark);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* زخرفة خلفية ناعمة */
body::before {
  content: "";
}
body::after {
  content: "✨";
  position: fixed;
  bottom: 20%;
  left: 10%;
  font-size: 3rem;
  opacity: 0.1;
  z-index: -1;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

.app-container {
  max-width: 950px;
  margin: 0 auto;
  padding: 2.5rem 1rem;
}

/* Iron Man HUD Header */
.header {
  position: relative;
  background: linear-gradient(135deg, rgba(20,20,20,0.9) 0%, rgba(40,10,10,0.8) 100%);
  border: 2px solid var(--primary);
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 0 20px var(--accent), inset 0 0 20px rgba(139, 0, 0, 0.5);
  margin-bottom: 3rem;
  padding: 1.5rem 2rem;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 5% 100%, 0 85%);
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 229, 255, 0.05) 3px, rgba(0, 229, 255, 0.05) 4px);
  pointer-events: none;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 25px;
  position: relative;
  z-index: 1;
}

.header-logo {
  height: 90px;
  filter: drop-shadow(0 0 15px var(--accent));
  animation: pulse-glow 2s infinite alternate;
}

.header-title-wrapper {
  display: flex;
  flex-direction: column;
}

.header h1 {
  font-size: 2.8rem;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 30px var(--primary);
  margin: 0;
}

.hud-line {
  height: 3px;
  width: 100%;
  background: var(--accent);
  margin-top: 5px;
  box-shadow: 0 0 10px var(--accent);
  position: relative;
}

.hud-line::after {
  content: "";
  position: absolute;
  right: -10px;
  top: -3px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
}

@keyframes pulse-glow {
  0% { filter: drop-shadow(0 0 10px var(--accent)); }
  100% { filter: drop-shadow(0 0 25px var(--accent)) drop-shadow(0 0 15px white); }
}

/* Decorative Corners */
.hud-corner-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  box-shadow: -2px -2px 10px var(--accent);
}

.hud-corner-bottom-right {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-bottom: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
  box-shadow: 2px 2px 10px var(--accent);
}

/* Tabs Navigation */
.navigation-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.sub-tabs {
  margin-top: -1.5rem;
  margin-bottom: 2.5rem;
}

.sub-tabs .tab-btn {
  color: var(--text-dark);
  background: rgba(50, 50, 50, 0.6);
  font-size: 1rem;
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.6);
}

.tab-btn {
  color: var(--text-dark);
  background: rgba(50, 50, 50, 0.6);
  background: var(--glass-bg);
  border: 2px solid var(--primary);
  color: var(--secondary);
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(255, 77, 133, 0.1);
}

.tab-btn:hover {
  background: var(--accent);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 77, 133, 0.2);
}

.tab-btn.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: white;
  box-shadow: 0 6px 15px rgba(255, 77, 133, 0.4);
  transform: scale(1.05);
}

/* Glass Card */
.glass-card {
  color: var(--text-dark);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 30px;
  border: 2px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 2.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease-in-out;
  position: relative;
  overflow: hidden;
}

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

.section-title {
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 2rem;
  border-bottom: 3px dashed var(--primary);
  padding-bottom: 0.5rem;
  display: inline-block;
  position: relative;
}

.block-container {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed rgba(255, 77, 133, 0.3);
}

.block-title {
  font-size: 1.5rem;
  color: var(--secondary);
  margin-bottom: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.block-title::before {
  content: '🚀';
  font-size: 1.2rem;
}

.rule-box {
  background: rgba(255, 126, 179, 0.1);
  border-right: 5px solid var(--primary);
  padding: 1.5rem;
  border-radius: 15px;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: #5c1847;
  font-size: 1.2rem;
  line-height: 1.7;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 10px rgba(255, 126, 179, 0.05);
}

.explanation-box {
  color: var(--text-dark);
  background: rgba(30, 30, 30, 0.8);
  background: white;
  padding: 1.5rem;
  border-radius: 15px;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  line-height: 1.8;
  color: #4a154b;
  border: 1px solid rgba(255, 126, 179, 0.2);
  white-space: pre-wrap;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

/* Stark OS Tables */
.styled-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  font-size: 1.1rem;
  background: rgba(10, 15, 20, 0.6);
  color: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 229, 255, 0.2);
  border: 1px solid rgba(0, 229, 255, 0.3);
  backdrop-filter: blur(10px);
}

.styled-table th, .styled-table td {
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
}

.styled-table th {
  background-color: rgba(0, 229, 255, 0.15);
  color: #00E5FF;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
  letter-spacing: 1px;
}

.styled-table tr:last-child td {
  border-bottom: none;
}

.styled-table tr:nth-of-type(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

.question-row {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  border: 1px dashed var(--accent);
  transition: all 0.3s ease;
}

.question-row:hover {
  transform: translateX(-5px);
  box-shadow: 0 4px 12px rgba(255, 77, 133, 0.08);
}

.question-number {
  background: var(--secondary);
  color: white;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(255, 77, 133, 0.2);
}

.red-digit {
  color: var(--secondary);
  font-weight: bold;
}

.btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(255, 77, 133, 0.2);
}

.btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 77, 133, 0.4);
}

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

.answer {
  color: #ffffff;
  font-weight: bold;
  font-size: 1.2rem;
  display: none;
  margin-right: 1rem;
  padding: 0.8rem 1.2rem;
  background: #9b59b6;
  border-radius: 12px;
  white-space: pre-wrap;
  border: 1px solid #8e44ad;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.pattern-boxes {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.pattern-box {
  background: white;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-weight: bold;
  font-size: 1.3rem;
  color: #333333;
  box-shadow: 0 4px 10px rgba(255, 77, 133, 0.1);
}

.options-container {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.option-btn {
  color: #333333;
  background: white;
  border: 2px solid var(--accent);
  padding: 0.8rem 1.5rem;
  border-radius: 15px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-dark);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.option-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 77, 133, 0.15);
}

.option-btn.correct {
  background: #a8e6cf;
  border-color: #38ada9;
  color: #079992;
  box-shadow: 0 0 15px rgba(168, 230, 207, 0.8);
}

.option-btn.wrong {
  background: #ffb8b8;
  border-color: #ff3838;
  color: #b33939;
  box-shadow: 0 0 15px rgba(255, 184, 184, 0.8);
}

.text-lg {
  font-size: 1.2rem;
  font-weight: bold;
}

.carry-over {
  display: block;
  color: var(--secondary);
  font-size: 0.85em;
  margin-bottom: -5px;
}
.carry-over span {
  display: inline-block;
}

/* زر السبورة العائم */
.floating-board-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 15px 25px;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 77, 133, 0.4);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: bounce 2s infinite;
  display: none; /* يظهر فقط في قسم التمرينات */
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.floating-board-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 25px rgba(255, 77, 133, 0.6);
  animation: none;
}

/* نافذة السبورة المنبثقة */
.whiteboard-modal {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 45%;
  height: 65%;
  min-width: 300px;
  max-width: calc(100vw - 40px);
  min-height: 300px;
  z-index: 2000;
}

.whiteboard-container {
  background: rgba(255, 255, 255, 0.95);
  width: 100%;
  height: 100%;
  border-radius: 30px;
  border: 3px solid var(--primary);
  box-shadow: 0 20px 50px rgba(255, 77, 133, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.whiteboard-header {
  background: #f0f8ff;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent);
  flex-wrap: wrap;
  gap: 10px;
}

.whiteboard-tools {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.color-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.color-btn:hover, .color-btn.active {
  transform: scale(1.2);
  border-color: var(--primary);
}

.tool-btn {
  background: white;
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 8px 15px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.close-board-btn {
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.close-board-btn:hover {
  background: #d63031;
  transform: scale(1.05);
}

.canvas-wrapper {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  position: relative;
  cursor: crosshair;
}

#whiteboardCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* التجاوب مع الشاشات المختلفة (Responsiveness) */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }
  .header p {
    font-size: 1rem;
  }
  .tab-btn {
  color: var(--text-dark);
  background: rgba(50, 50, 50, 0.6);
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }
  .glass-card {
    padding: 1.5rem;
    border-radius: 20px;
  }
  .section-title {
    font-size: 1.5rem;
  }
  .block-title {
    font-size: 1.3rem;
  }
  .rule-box, .explanation-box {
    font-size: 1rem;
    padding: 1rem;
  }
  .styled-table {
    font-size: 0.9rem;
  }
  .floating-board-btn {
    bottom: 20px;
    right: 20px;
    padding: 10px 18px;
    font-size: 1.1rem;
  }
  .whiteboard-modal {
    width: 90%;
    height: 60%;
    left: 5%;
    bottom: 15px;
    min-width: unset;
  }
  .whiteboard-header {
    padding: 10px 15px;
  }
  .tool-btn, .close-board-btn {
    font-size: 1rem;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.7rem;
  }
  .navigation-tabs {
    gap: 0.5rem;
  }
  .tab-btn {
  color: var(--text-dark);
  background: rgba(50, 50, 50, 0.6);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-width: 1px;
  }
  .glass-card {
    padding: 1rem;
  }
  .question-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .options-container {
    flex-wrap: wrap;
    justify-content: center;
  }
  .whiteboard-modal {
    width: 95%;
    left: 2.5%;
    height: 50%;
  }
  .color-btn {
    width: 30px;
    height: 30px;
  }
}

/* --- Gamification & Interactive Elements --- */

.gamification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--glass-bg);
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.stars-counter {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f39c12;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(247, 215, 148, 0.2);
  padding: 5px 15px;
  border-radius: 20px;
  border: 2px solid var(--accent);
}

.star-icon {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.progress-container {
  flex-grow: 1;
  max-width: 60%;
  height: 12px;
  background: #eee;
  border-radius: 10px;
  overflow: hidden;
  margin-right: 20px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mascot Styles */
.mascot-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1500;
  transform: translateY(150%);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mascot-container.show {
  transform: translateY(0);
}

.mascot-bubble {
  background: white;
  padding: 10px 20px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 10px;
  position: relative;
  font-size: 1.1rem;
}

.mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: var(--primary) transparent transparent transparent;
  display: block;
  width: 0;
}

.mascot-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: url('../images/12.png') center/cover no-repeat;
  border: 4px solid var(--accent);
  box-shadow: 0 0 20px var(--accent);
  animation: float 3s ease-in-out infinite;
}

/* Interactive Feedback */
@keyframes starPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); color: #f1c40f; }
  100% { transform: scale(1); }
}

.star-pop-anim {
  animation: starPop 0.5s ease-out;
}

/* Update options correctness styling */
.option-btn.correct {
  background: var(--success);
  border-color: #26de81;
  color: white;
  box-shadow: 0 0 15px rgba(120, 224, 143, 0.6);
  transform: scale(1.05);
}

.option-btn.wrong {
  background: var(--error);
  border-color: #fc5c65;
  color: white;
  box-shadow: 0 0 15px rgba(234, 134, 133, 0.6);
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Advanced Gamification Styles --- */

/* Modal Overlays */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 3000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

.close-modal-btn {
  position: absolute;
  top: -15px;
  right: -15px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform 0.2s;
  z-index: 10;
}
.close-modal-btn:hover { transform: scale(1.1); }

/* Certificate Styles */
.certificate-container {
  position: relative;
  background: white;
  padding: 20px;
  border-radius: 20px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  text-align: center;
}

.certificate-content {
  background: url('../images/14.png') center/cover no-repeat, rgba(255,255,255,0.9);
  background-blend-mode: overlay;
  padding: 40px;
  border-radius: 20px;
  border: 5px solid var(--secondary);
  box-shadow: 0 0 30px var(--secondary);
  text-align: center;
  color: #111;
}
.certificate-content::before {
  content: '';
  position: absolute;
  top: 5px; left: 5px; right: 5px; bottom: 5px;
  border: 2px dashed var(--primary);
}

.cert-header {
  font-size: 3rem;
  color: var(--secondary);
  font-weight: 800;
  margin-bottom: 20px;
  font-family: 'Cairo', sans-serif;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.cert-body {
  font-size: 1.5rem;
  color: var(--text-dark);
  line-height: 2;
}

.cert-name {
  font-size: 2.5rem;
  color: var(--primary);
  font-weight: 800;
  display: block;
  margin: 10px 0;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding: 0 20px;
}

.cert-chapter {
  color: #8e44ad;
  font-weight: bold;
}

.cert-footer {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.cert-seal {
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  color: white;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(241, 196, 15, 0.4);
  border: 5px solid white;
  position: relative;
}
.cert-seal::after {
  content: '🌟';
  position: absolute;
  bottom: -15px;
  font-size: 2rem;
}

/* Print Media Query */
@media print {
  body * {
    visibility: hidden;
  }
  #printableCertificate, #printableCertificate * {
    visibility: visible;
  }
  #printableCertificate {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    border: none;
    padding: 0;
  }
}

/* Mini-Game Styles */
.minigame-container {
  position: relative;
  background: var(--glass-bg);
  padding: 30px;
  border-radius: 30px;
  width: 95%;
  max-width: 600px;
  border: 3px solid var(--primary);
}

.minigame-header {
  text-align: center;
  margin-bottom: 20px;
  color: var(--secondary);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.memory-card {
  aspect-ratio: 1;
  background: var(--accent);
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: transparent;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  user-select: none;
  direction: ltr; /* For math equations */
}
.memory-card.hidden-content {
    /* Background acts as the back of the card */
}

.memory-card.flipped {
  background: white;
  color: #111; /* Changed to dark so it's visible on white bg */
  border: 2px solid var(--primary);
  transform: rotateY(180deg) scale(1);
}
.memory-card.flipped .content {
    transform: rotateY(180deg);
}
.memory-card .content {
    transition: transform 0.3s;
}

.memory-card.matched {
  background: var(--success);
  color: white;
  border-color: #26de81;
  animation: pulse 1s;
}
.memory-card.matched .content {
    transform: rotateY(180deg);
}


/* Stark OS HUD Grid Navigation */
.treasure-map-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  padding: 40px 20px;
  justify-items: center;
  align-items: center;
}

.map-node {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 15px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5), 0 0 10px var(--accent);
  border: 2px solid var(--accent);
  position: relative;
  overflow: hidden;
  text-align: center;
  /* Techy cut corners */
  clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
}

.map-node:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 15px 25px rgba(0,0,0,0.6), 0 0 30px var(--accent);
  border-color: #fff;
}

.rainbow-active {
  background: linear-gradient(45deg, #ff9a9e, #fecfef, #a1c4fd, #c2e9fb) !important;
  background-size: 200% 200% !important;
  animation: rainbowBg 2s ease infinite !important;
  border-color: white !important;
}

@keyframes rainbowBg {
  0%{background-position:0% 50%}
  50%{background-position:100% 50%}
  100%{background-position:0% 50%}
}

/* Lock Screen Styles */
.lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--background);
  background-image: linear-gradient(135deg, #f0f8ff 0%, #e1f5fe 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.lock-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  padding: 3rem;
  border-radius: 30px;
  border: 2px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: fadeIn 0.5s ease-in-out;
}

.lock-card h2 {
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.lock-card p {
  color: var(--text-dark);
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

#activationCode {
  width: 100%;
  padding: 1rem;
  font-size: 1.2rem;
  border: 2px solid var(--accent);
  border-radius: 15px;
  margin-bottom: 1.5rem;
  text-align: center;
  outline: none;
  font-family: inherit;
}

#activationCode:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(116, 185, 255, 0.5);
}

.lock-message {
  margin-top: 1rem;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--error);
  min-height: 1.5rem;
}


/* Professional Stark Header */
.stark-header {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

.stark-header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  background: rgba(10, 15, 20, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-bottom: 3px solid #00E5FF;
  border-radius: 20px;
  padding: 15px 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 229, 255, 0.3);
  width: 100%;
  max-width: 800px;
  position: relative;
  overflow: hidden;
}

.stark-header-inner::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.1), transparent);
  animation: stark-scan 4s infinite linear;
}

@keyframes stark-scan {
  0% { left: -100%; }
  100% { left: 200%; }
}

.stark-logo-container {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #00E5FF;
  box-shadow: 0 0 15px #00E5FF, inset 0 0 15px #00E5FF;
  z-index: 2;
  flex-shrink: 0;
}

.stark-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
}

.arc-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 115px;
  height: 115px;
  border: 2px dashed rgba(0, 229, 255, 0.8);
  border-radius: 50%;
  animation: spin 15s linear infinite;
  z-index: 1;
}

@keyframes spin {
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.stark-title-container {
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.stark-title {
  margin: 0;
  font-size: 2.2rem;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
  font-family: 'Arial', sans-serif;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.stark-subtitle {
  font-family: 'Cairo', sans-serif;
  font-size: 1.8rem;
  color: #D4AF37; /* Iron Man Gold */
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

.stark-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-family: monospace;
  font-size: 0.9rem;
  color: #00E5FF;
  letter-spacing: 2px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #00E5FF;
  border-radius: 50%;
  box-shadow: 0 0 8px #00E5FF;
  animation: blink 1.5s infinite alternate;
}

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; box-shadow: 0 0 15px #00E5FF; }
}


/* Interactive Classroom Stark OS Theme */
.classroom-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: radial-gradient(circle at center, #0f2027, #203a43, #2c5364);
    border: 2px solid #00E5FF;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.4), inset 0 0 20px rgba(0, 229, 255, 0.2);
    position: relative;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.hologram-board {
    width: 100%;
    flex: 1;
    min-height: 250px;
    background: rgba(0, 20, 30, 0.7);
    border: 1px dashed #00E5FF;
    border-radius: 15px;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 229, 255, 0.1);
}

.hologram-board::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 229, 255, 0.05) 0px,
        rgba(0, 229, 255, 0.05) 1px,
        transparent 1px,
        transparent 10px
    ),
    repeating-linear-gradient(
        90deg,
        rgba(0, 229, 255, 0.05) 0px,
        rgba(0, 229, 255, 0.05) 1px,
        transparent 1px,
        transparent 10px
    );
    pointer-events: none;
}

.hologram-content {
    z-index: 2;
    text-align: center;
    color: #ffffff;
    font-family: monospace;
    font-size: 2.5rem;
    text-shadow: 0 0 15px #00E5FF, 0 0 30px #00E5FF;
    transition: all 0.5s ease;
}

.characters-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    height: 150px;
    padding: 0 20px;
    flex-shrink: 0;
}

.character {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.char-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid #D4AF37;
    box-shadow: 0 0 15px #D4AF37;
    object-fit: cover;
    transition: transform 0.3s;
}

.char-img.speaking {
    transform: scale(1.1);
    box-shadow: 0 0 25px #00E5FF, inset 0 0 10px #00E5FF;
    border-color: #00E5FF;
}

.student-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #c0392b;
    border: 2px solid #f39c12;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 0 15px #c0392b;
    transition: transform 0.3s;
}

.student-avatar-placeholder.speaking {
    transform: scale(1.1);
    box-shadow: 0 0 25px #f39c12;
    border-color: #f1c40f;
}

.dialogue-bubble {
    display: none !important;
    position: absolute;
    bottom: 120px;
    max-width: 300px;
    background: rgba(10, 15, 20, 0.9);
    border: 1px solid #00E5FF;
    border-radius: 15px;
    padding: 15px;
    color: white;
    font-size: 1.1rem;
    line-height: 1.5;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    transition: opacity 0.3s ease;
    z-index: 10;
}

.teacher-bubble {
    left: 0;
    border-bottom-left-radius: 0;
}

.student-bubble {
    right: 0;
    border-bottom-right-radius: 0;
    border-color: #f39c12;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.3);
}

.start-lesson-btn {
    margin-top: 15px;
    padding: 10px 30px;
    font-size: 1.2rem;
    background: linear-gradient(45deg, #D4AF37, #f39c12);
    color: black;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
    transition: transform 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}

.start-lesson-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.9);
}

.fade-in {
    animation: fadeIn 0.5s forwards;
}

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

/* Specific SVG animations */
.glow-text {
    color: #f1c40f;
    text-shadow: 0 0 15px #f1c40f;
    font-weight: bold;
}

.pulse-number {
    animation: pulseNum 1s infinite alternate;
}

@keyframes pulseNum {
    from { transform: scale(1); text-shadow: 0 0 10px #00E5FF; }
    to { transform: scale(1.1); text-shadow: 0 0 30px #00E5FF, 0 0 40px #fff; }
}

/* Games Section Styles */
.game-container {
    background: rgba(20, 20, 20, 0.9);
    border: 2px solid var(--accent);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 210, 255, 0.2);
}

.game-title {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.game-question {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.game-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.game-btn {
    background: linear-gradient(45deg, #1e3799, #0984e3);
    border: 2px solid #74b9ff;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.game-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(9, 132, 227, 0.4);
    background: linear-gradient(45deg, #0984e3, #74b9ff);
}

.game-btn.correct {
    background: linear-gradient(45deg, #00b894, #55efc4);
    border-color: #00b894;
    animation: pulseNum 0.5s;
}

.game-btn.wrong {
    background: linear-gradient(45deg, #d63031, #ff7675);
    border-color: #d63031;
    animation: shake 0.5s;
}

.game-feedback {
    font-size: 1.3rem;
    font-weight: bold;
    min-height: 2rem;
    margin-top: 1rem;
}

.game-score {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    font-weight: bold;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@media (max-width: 600px) {
  .minigame-container, .game-container {
    width: 95%;
    padding: 10px;
    margin-left: auto;
    margin-right: auto;
  }
  .memory-grid {
    gap: 5px;
  }
  .memory-card {
    font-size: 1rem;
    border-radius: 8px;
  }
  .game-title {
    font-size: 1.3rem;
  }
  .game-question {
    font-size: 1.1rem;
  }
  .game-btn {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    min-width: 100px;
  }
}
