:root {
  --bg: #f7f9fe;
  --surface: #ffffff;
  --primary: #5b6cff;
  --primary-dark: #273c8a;
  --accent: #2ec7ff;
  --text: #11213a;
  --muted: #5f6f88;
  --border: #e2eaf7;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(46, 199, 255, 0.14), transparent 28%),
    linear-gradient(135deg, #f9fbff 0%, var(--bg) 100%);
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark-theme {
  --bg: #07111f;
  --surface: #102033;
  --primary: #86a4ff;
  --primary-dark: #dce8ff;
  --accent: #4ad7ff;
  --text: #f4f8ff;
  --muted: #a5b6cf;
  --border: #22364d;
  background:
    radial-gradient(circle at top left, rgba(74, 215, 255, 0.16), transparent 28%),
    linear-gradient(135deg, #07111f 0%, var(--bg) 100%);
}

img {
  max-width: 100%;
  display: block;
}

.hero {
  position: relative;
  min-height: 92vh;
  background: linear-gradient(135deg, #13295a 0%, #1d3f8f 45%, #5677ff 100%);
  color: #fdfefe;
  padding: 1.2rem 1.5rem 3.5rem;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  animation: float 8s ease-in-out infinite;
}

.hero::before {
  width: 240px;
  height: 240px;
  top: -55px;
  right: -50px;
}

.hero::after {
  width: 180px;
  height: 180px;
  bottom: 25px;
  left: -28px;
  animation-delay: 2s;
}

.floating-panel {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-end;
}

.nav {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: rgba(7, 20, 42, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.top-controls {
  display: flex;
  gap: 0.6rem;
}

.control-btn,
.nav a {
  color: #fdfefe;
  text-decoration: none;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.control-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.control-btn {
  font-family: inherit;
}

.nav a:hover,
.control-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.hero-content {
  max-width: 820px;
  margin: 4rem auto 0;
  text-align: center;
  position: relative;
  z-index: 2;
  animation: fadeInUp 0.8s ease both;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  font-weight: 800;
  color: #e2e9ff;
  margin-bottom: 0.7rem;
}

h1,
h2,
h3 {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 1rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.8rem 1.3rem;
  background: white;
  color: var(--primary-dark);
  border: none;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #fdfefe;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.intro {
  text-align: center;
  padding-top: 3.5rem;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.card,
.panel,
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.8s ease both;
}

.card:nth-child(2) {
  animation-delay: 0.12s;
}

.card:nth-child(3) {
  animation-delay: 0.24s;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.card:hover img {
  transform: scale(1.03);
}

.card img {
  transition: transform 0.3s ease;
}

.image-trigger {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 14px;
  overflow: hidden;
}

.image-trigger:hover img {
  transform: scale(1.03);
}

.image-trigger:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card img {
  border-radius: 14px;
  margin-bottom: 1rem;
  height: 180px;
  object-fit: cover;
  width: 100%;
}

.tag {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}

body.dark-theme .tag {
  background: rgba(134, 164, 255, 0.16);
}

body:not(.dark-theme) .tag {
  background: #eaf2ff;
  color: #2d4aa8;
}

.learn-btn {
  margin-top: 0.6rem;
  padding: 0.65rem 0.9rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.fact-box {
  margin-top: 0.7rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: #f8fbff;
  color: var(--primary-dark);
  border: 1px dashed var(--accent);
}

body.dark-theme .fact-box {
  background: rgba(74, 215, 255, 0.1);
  color: var(--text);
}

.surprise-fact {
  margin-top: 1rem;
  font-weight: 600;
  color: #f4f8ff;
}

.video-link {
  margin-top: 1rem;
}

.video-link a {
  display: inline-block;
  color: #fdfefe;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.6rem 0.95rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.video-link a:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.intro-video-link {
  margin-top: 0.8rem;
}

.intro-video-link a {
  color: var(--primary-dark);
  background: rgba(91, 108, 255, 0.12);
  border-color: rgba(91, 108, 255, 0.25);
}

body.dark-theme .intro-video-link a {
  color: var(--text);
  background: rgba(134, 164, 255, 0.16);
  border-color: rgba(134, 164, 255, 0.25);
}

ul {
  padding-left: 1.1rem;
}

li {
  margin-bottom: 0.45rem;
}

.quiz-card {
  background: linear-gradient(135deg, #fefefe 0%, #f4f8ff 100%);
}

body.dark-theme .quiz-card {
  background: linear-gradient(135deg, #132639 0%, #091722 100%);
}

.quiz-item {
  margin-bottom: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--border);
}

body.dark-theme .quiz-item {
  background: rgba(255, 255, 255, 0.04);
}

.quiz-item label {
  display: block;
  margin-top: 0.45rem;
}

.quiz-option {
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.quiz-option.correct {
  background: #dff7e8;
  color: #166534;
}

.quiz-option.incorrect {
  background: #fde7e7;
  color: #991b1b;
}

body.dark-theme .quiz-option.correct {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

body.dark-theme .quiz-option.incorrect {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.quiz-explanation {
  margin: 0.35rem 0 0.6rem 0;
  padding: 0.45rem 0.6rem;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: rgba(91, 108, 255, 0.08);
  font-size: 0.95rem;
  color: var(--text);
}

body.dark-theme .quiz-explanation {
  background: rgba(134, 164, 255, 0.12);
}

.quiz-result {
  margin-top: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(7, 20, 42, 0.84);
}

.image-modal[hidden] {
  display: none;
}

.image-modal-content {
  position: relative;
  width: min(920px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.image-modal-content img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 14px;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  border: none;
  background: rgba(7, 20, 42, 0.8);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-caption {
  margin: 0.8rem 0 0;
  font-weight: 700;
  color: var(--primary-dark);
}

body.modal-open {
  overflow: hidden;
}

.summary {
  padding-top: 1rem;
  padding-bottom: 4rem;
}

.panel {
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}

body.dark-theme .panel {
  background: linear-gradient(135deg, #12253b 0%, #0f1e2e 100%);
}

footer {
  text-align: center;
  padding: 1.2rem 1rem 2rem;
  color: var(--muted);
}

.signature {
  margin-top: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  font-style: italic;
}

body.dark-theme .signature {
  color: var(--accent);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .floating-panel {
    position: static;
    align-items: stretch;
    margin-bottom: 1rem;
  }

  .nav {
    justify-content: center;
    border-radius: 20px;
  }
}
