body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(22, 163, 74, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(29, 78, 216, 0.14), transparent 30%),
    #f8fafc;
  color: #0f172a;
  min-height: 100vh;
}

.website,
.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.app {
  max-width: 980px;
}

.app-header {
  display: flex;
  justify-content: center;
  padding: 18px 0 8px;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 18px;
  margin-bottom: 22px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #0f172a;
  text-decoration: none;
  font-weight: bold;
}

.brand-logo {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16a34a, #1d4ed8);
  color: white;
  border-radius: 16px;
  font-size: 24px;
  font-family: Consolas, monospace;
  box-shadow: 0 12px 30px rgba(29, 78, 216, 0.25);
}

.brand-text {
  font-size: 30px;
  color: #1d4ed8;
}

.topbar-link,
.home-link {
  color: white;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: bold;
}

/* الصفحة الرئيسية */
.website .app-header {
  justify-content: center;
  margin-bottom: 25px;
}

.hero {
  min-height: 72vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
  padding: 40px 20px 55px;
}

.hero-content {
  text-align: right;
}

.badge {
  display: inline-block;
  background-color: rgba(34, 197, 94, 0.14);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: bold;
  margin-bottom: 16px;
}

.hero h1 {
  color: #0f172a;
  font-size: 48px;
  line-height: 1.25;
  margin: 14px 0;
}

.hero-text {
  font-size: 20px;
  line-height: 1.9;
  color: #475569;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 22px;
}

.start-link,
.practice-link,
.home-link,
button {
  display: inline-block;
  color: white;
  text-decoration: none;
  padding: 14px 24px;
  margin: 8px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

.start-link,
button {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.practice-link,
.home-link {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.code-preview {
  direction: ltr;
  text-align: left;
  background-color: #020617;
  color: #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #334155;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.code-preview pre {
  margin: 0;
  padding: 26px;
  font-size: 18px;
  line-height: 1.9;
  font-family: Consolas, monospace;
  white-space: pre-wrap;
  direction: ltr;
  unicode-bidi: isolate;
}

.code-header {
  display: flex;
  gap: 8px;
  padding: 14px;
  background-color: #111827;
}

.code-header span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background-color: #ef4444;
}

.code-header span:nth-child(2) {
  background-color: #f59e0b;
}

.code-header span:nth-child(3) {
  background-color: #22c55e;
}

.features,
.steps,
.cta {
  padding: 45px 20px;
  text-align: center;
}

.features h2,
.steps h2,
.cta h2 {
  color: #1e40af;
}

.features-grid,
.steps-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.feature-card,
.steps-list div {
  background-color: white;
  padding: 24px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.feature-card h3 {
  color: #166534;
}

.feature-card p,
.cta p {
  color: #4b5563;
  line-height: 1.7;
}

/* صفحة التطبيق */
.code-identity-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 24px;
  padding: 34px;
  min-height: 420px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(30, 64, 175, 0.94)),
    #0f172a;
  color: white;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.code-identity-hero::before {
  content: "{ }  < />  const  let  function  ===  CSS  HTML  JS";
  position: absolute;
  left: 24px;
  top: 22px;
  max-width: 90%;
  color: rgba(255, 255, 255, 0.07);
  font-size: 38px;
  font-weight: bold;
  letter-spacing: 3px;
  line-height: 1.7;
  pointer-events: none;
}

.code-hero-content {
  position: relative;
  z-index: 1;
  text-align: right;
}

.code-identity-hero .badge {
  color: #bbf7d0;
  border: 1px solid rgba(134, 239, 172, 0.35);
}

.code-identity-hero h1 {
  color: white;
  font-size: 44px;
  line-height: 1.25;
  margin: 10px 0 14px;
}

.code-identity-hero .intro {
  color: #dbeafe;
  font-size: 20px;
  line-height: 1.9;
  margin: 0;
  text-align: right;
}

.tech-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  justify-content: flex-end;
  direction: ltr;
}

.tech-tags span {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(134, 239, 172, 0.35);
  color: #bbf7d0;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: bold;
  direction: ltr;
  unicode-bidi: isolate;
}

.terminal-card {
  position: relative;
  z-index: 1;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  direction: ltr;
  align-self: center;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111827;
  padding: 12px 14px;
  color: #cbd5e1;
  font-family: Consolas, monospace;
}

.terminal-header span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-header span:nth-child(1) {
  background: #ef4444;
}

.terminal-header span:nth-child(2) {
  background: #f59e0b;
}

.terminal-header span:nth-child(3) {
  background: #22c55e;
}

.terminal-card pre {
  margin: 0;
  padding: 24px;
  color: #86efac;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    #020617;
  background-size: 100% 32px;
  font-family: Consolas, monospace;
  line-height: 1.9;
  white-space: pre-wrap;
}

.card {
  margin: 18px 0;
  background-color: white;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

#nameBox {
  border-top: 6px solid #f59e0b;
}

#lessonBox {
  border-top: 6px solid #16a34a;
}

#quizBox {
  border-top: 6px solid #1d4ed8;
}

.practice-lab {
  border-top: 6px solid #7c3aed;
}

.card h2 {
  color: #1e40af;
}

.card h3 {
  color: #166534;
}

.progress {
  display: inline-block;
  background: #fff7ed;
  color: #c2410c;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: bold;
}

input,
textarea {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}

textarea {
  min-height: 170px;
  direction: ltr;
  text-align: left;
  font-family: Consolas, monospace;
}

.app pre {
  direction: ltr;
  text-align: left;
  background-color: #111827;
  color: #e5e7eb;
  border-radius: 14px;
  overflow-x: auto;
  margin: 0;
  padding: 22px;
  font-size: 16px;
  line-height: 1.8;
}

#answers {
  display: grid;
  gap: 12px;
}

#answers button {
  width: 100%;
  text-align: right;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

#answers button:hover {
  background: #ecfdf5;
  border-color: #16a34a;
}

#answers button.answer-selected {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #1d4ed8, #16a34a);
}

.quiz-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

#prevButton {
  background: #64748b;
}

#clearAnswerButton {
  background: #dc2626;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#result {
  font-weight: bold;
  color: #1d4ed8;
}

.final-result,
.practice-lab,
.certificate-section {
  display: none;
}

.final-result,
.certificate-section {
  text-align: center;
}

#finalMessage {
  font-size: 20px;
  font-weight: bold;
  color: #166534;
}

#codeOutput {
  background-color: #eef2ff;
  color: #1f2937;
  min-height: 55px;
}

.certificate {
  max-width: 850px;
  margin: 20px auto;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fef3c7, #dbeafe, #dcfce7);
  box-shadow: 0 18px 45px rgba(0,0,0,0.14);
}

.certificate-border {
  padding: 45px 30px;
  border: 6px double #c89b2c;
  border-radius: 14px;
  background: white;
}

.certificate-small,
.signature {
  color: #92400e;
  font-weight: bold;
}

.certificate h2 {
  color: #1d4ed8;
  font-size: 42px;
}

#certificateName {
  margin: 20px auto;
  padding: 12px 20px;
  max-width: 520px;
  color: #166534;
  font-size: 34px;
  border-bottom: 3px solid #c89b2c;
}

.certificate-info {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 25px;
  font-weight: bold;
}

@media (max-width: 850px) {
  .app-topbar {
    flex-direction: column;
    gap: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content {
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero h1,
  .code-identity-hero h1 {
    font-size: 34px;
  }

  .features-grid,
  .steps-list {
    grid-template-columns: 1fr;
  }

  .code-identity-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 24px;
    text-align: center;
  }

  .code-hero-content,
  .code-identity-hero .intro {
    text-align: center;
  }

  .tech-tags,
  .quiz-buttons {
    justify-content: center;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .certificate-section,
  .certificate-section * {
    visibility: visible;
  }

  .certificate-section {
    display: block;
  }

  .certificate-section button,
  .certificate-section .home-link {
    display: none;
  }

  .certificate {
    box-shadow: none;
  }
}
