/* ========= GLOBAL & RESPONSIVE ========= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at 80% 10%, #4a1c10, #2d0a1a, #1a0a0a);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  padding: clamp(12px, 3vw, 40px);
  position: relative;
  overflow-x: hidden;
}

/* ========= BACKGROUND ORBS ========= */
.bg-orb {
  position: fixed;
  width: 40vw;
  height: 40vw;
  max-width: 800px;
  max-height: 800px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: float 20s infinite alternate;
}

.orb-1 {
  top: 5%;
  left: -10%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.25), transparent);
}

.orb-2 {
  bottom: 0%;
  right: -10%;
  background: radial-gradient(circle, rgba(255, 80, 40, 0.4), transparent);
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(50px, 50px) scale(1.2);
  }
}

/* ========= PORTAL CONTAINER ========= */
.portal-container {
  max-width: 1800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  opacity: 1;
}

/* Optional fade-in effect */
.portal-container.fade-in {
  animation: fadeIn 0.7s ease forwards;
}

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

/* ========= HERO CARD ========= */
.hero-card {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  border-radius: clamp(16px, 5vw, 48px);
  padding: clamp(20px, 4vw, 48px);
  margin-bottom: clamp(24px, 5vw, 48px);
  text-align: center;
  border: 1px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.main-title {
  font-size: clamp(1.6rem, 8vw, 3.4rem);
  font-weight: 800;
  background: linear-gradient(135deg, #ffb347, #ff6b35);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  line-height: 1.2;
}

.main-title .subtitle {
  font-size: 0.65em;
  background: linear-gradient(135deg, #facc15, #ffaa44);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.subhead {
  font-size: clamp(0.9rem, 3vw, 1.3rem);
  opacity: 0.9;
  color: #ffe0b3;
}

.divider {
  width: clamp(80px, 12vw, 160px);
  height: 4px;
  background: linear-gradient(to right, #ffdd00, #ff6b35);
  margin: 20px auto 0;
  border-radius: 4px;
}

/* ========= MENU BUTTON ========= */
.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: linear-gradient(145deg, #f97316, #ea580c);
  border: 2px solid #ffcc00;
  padding: 0.7rem 1.8rem;
  border-radius: 3rem;
  color: white;
  font-weight: bold;
  text-decoration: none;
  margin-top: 1.5rem;
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
  transition: all 0.3s ease;
}

.menu-btn i {
  font-size: 1.2rem;
  color: #ffcc00;
}

.menu-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.6);
  border-color: #ffaa00;
}

/* ========= SETS GRID ========= */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.set-card {
  background: linear-gradient(145deg, #f97316, #c2410c);
  border: 2px solid #ffcc00;
  border-radius: 2rem;
  padding: 1rem 0.5rem;
  text-align: center;
  font-weight: 700;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  color: white;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(194, 65, 12, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.set-card span {
  position: relative;
  z-index: 2;
}

.set-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 30px -8px #f97316;
  border-color: transparent;
}

.set-card:hover::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 2rem;
  padding: 2px;
  background: conic-gradient(from var(--angle, 0deg), #ffdd00, #ffaa33, #ff6600, #ffdd00);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  animation: rotate-border 1.2s linear infinite;
  pointer-events: none;
}

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotate-border {
  100% {
    --angle: 360deg;
  }
}

/* ========= INFO BANNER ========= */
.info-banner {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: clamp(12px, 3vw, 28px);
  padding: clamp(12px, 3vw, 24px);
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
  margin: 30px 0 20px;
  border-left: 5px solid #ffcc00;
  flex-wrap: wrap;
}

.info-banner i {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  color: #ffcc00;
}

.banner-text {
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  flex: 1;
  color: #ffeedd;
}

/* ========= FOOTER ========= */
.portal-footer {
  margin-top: clamp(30px, 6vw, 70px);
  text-align: center;
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  opacity: 0.8;
  border-top: 1px solid rgba(255, 204, 0, 0.3);
  padding-top: 20px;
  color: #ffd9b5;
}

.portal-footer .footer-small {
  margin-top: 8px;
  font-size: 0.75rem;
}

/* ========= EXAM PAGE ========= */
.timer-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  color: white;
  margin: 1rem 1rem 0.5rem;
  padding: 0.8rem 1.2rem;
  border-radius: 3rem;
  flex-wrap: wrap;
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.timer {
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: bold;
  color: #ffdd00;
  white-space: nowrap;
}

/* ========= PASSAGE ========= */
.passage-container {
  margin: 1rem;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border-radius: 1.5rem;
  padding: 1.5rem;
  border-left: 5px solid #ff6b35;
  line-height: 1.75;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  color: #fef7e0;
}

.blank-number {
  display: inline-block;
  background: #ff7b00;
  color: white;
  font-weight: bold;
  font-size: 0.7rem;
  border-radius: 40px;
  padding: 2px 10px;
  margin-right: 6px;
  vertical-align: middle;
}

.blank-input {
  width: 130px;
  padding: 8px 10px;
  border: 2px solid #ffb347;
  border-radius: 32px;
  font-size: 0.9rem;
  text-align: center;
  margin: 0 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff2df;
  transition: all 0.2s;
  font-weight: 500;
}

.blank-input:hover {
  border-color: #ffcc00;
  background-color: rgba(0, 0, 0, 0.8);
  outline: 3px solid rgba(255, 204, 0, 0.3);
}

.blank-input:focus {
  outline: none;
  border-color: #ff9e6d;
  box-shadow: 0 0 0 3px #ffb34766;
}

/* ========= CONTROLS ========= */
.controls {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin: 1.8rem 1rem 2rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.9rem;
  border: none;
  border-radius: 3rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  transition: 0.2s;
  background: linear-gradient(145deg, #f97316, #ea580c);
  color: white;
}

.btn-primary {
  background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  outline: 3px solid #ffcc00;
  outline-offset: 2px;
}

.btn-primary:disabled {
  background: #4a5568;
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-back {
  background: linear-gradient(145deg, #3498db, #2980b9);
}

.btn-back:hover {
  transform: translateY(-2px);
  outline: 3px solid #ffcc00;
  outline-offset: 2px;
}

/* ========= RESULTS AREA ========= */
.results-modal {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  margin: 1.5rem;
  padding: 1.8rem;
  border-radius: 1.8rem;
  border: 1px solid rgba(255, 204, 0, 0.5);
}

.results-heading {
  color: #ffb347;
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.no-score-text {
  font-size: 1.8rem;
  text-align: center;
  font-weight: bold;
  margin: 10px;
  color: #ffdd00;
}

.results-modal .timestamp {
  text-align: center;
  color: #bbefe5;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.answer-feedback {
  border-left: 6px solid;
  margin: 1rem 0;
  padding: 0.9rem 1.2rem;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: #fef7e0;
}

.answer-feedback.correct {
  border-left-color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
}

.answer-feedback.incorrect {
  border-left-color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
}

.answer-feedback.unattempted {
  border-left-color: #f39c12;
  background: rgba(243, 156, 18, 0.15);
}

.correct-answer {
  color: #2ecc71;
  font-weight: bold;
}

.passage-answers {
  background: rgba(0, 0, 0, 0.5);
  padding: 1.8rem;
  border-radius: 1.5rem;
  margin-top: 1.5rem;
  border-left: 8px solid #ff9e6d;
  color: #fff0dd;
  line-height: 1.75;
}

.passage-answers .correct-word,
.passage-answers span[class*="correct"],
.passage-answers ins {
  display: inline-block;
  background-color: #f97316 !important;
  color: white !important;
  padding: 4px 12px;
  border-radius: 2rem;
  text-decoration: none !important;
  font-weight: bold;
  margin: 0 2px;
  white-space: nowrap;
}

.passage-answers span[style*="text-decoration: underline"],
.passage-answers u {
  background-color: #f97316 !important;
  color: white !important;
  padding: 4px 12px;
  border-radius: 2rem;
  text-decoration: none !important;
  font-weight: bold;
}

/* ========= UTILITY ========= */
.hidden {
  display: none !important;
}

#printReport {
  display: none;
}

/* ========= PRINT REPORT CONTENT ========= */
.print-report-content {
  font-family: "Segoe UI", Arial, sans-serif;
  max-width: 950px;
  margin: 0 auto;
  padding: 25px;
  background: white;
  color: #1e1e2f;
}

.print-report-content h1 {
  color: #118ab2;
}

.print-report-content .print-passage {
  background: #fef9e6;
  padding: 18px;
  border-left: 8px solid #ff9e6d;
}

.print-report-content .print-footer {
  margin-top: 40px;
  text-align: center;
}

/* ========= RESPONSIVE BREAKPOINTS ========= */
@media (max-width: 680px) {
  body {
    padding: 0.8rem;
  }

  .sets-grid {
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .set-card {
    padding: 0.6rem 0.2rem;
    font-size: 0.8rem;
  }

  .blank-input {
    width: 85px;
    font-size: 0.75rem;
    padding: 5px 6px;
  }

  .timer {
    font-size: 1.2rem;
    white-space: normal;
    text-align: center;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .passage-container {
    padding: 1rem;
    margin: 0.5rem;
  }

  .controls {
    gap: 0.8rem;
  }

  .timer-section {
    justify-content: center;
    flex-wrap: wrap;
  }

  .results-heading {
    font-size: 1.3rem;
  }

  .no-score-text {
    font-size: 1.3rem;
  }

  .passage-answers .correct-word,
  .passage-answers span[class*="correct"] {
    white-space: normal;
    padding: 3px 8px;
  }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .sets-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.2rem;
  }

  .set-card {
    padding: 0.8rem 0.3rem;
    font-size: 1rem;
  }
}

@media (min-width: 1025px) and (max-width: 1919px) {
  .sets-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1920px) {
  .portal-container {
    max-width: 2000px;
  }

  .sets-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
  }

  .set-card {
    padding: 1.2rem 0.5rem;
    font-size: 1.3rem;
  }

  .main-title {
    font-size: 4rem;
  }

  .blank-input {
    width: 160px;
    font-size: 1.1rem;
    padding: 10px 14px;
  }

  .passage-container {
    font-size: 1.2rem;
  }

  .timer {
    font-size: 2rem;
  }
}

/* ========= PRINT STYLES ========= */
@media print {
  body * {
    visibility: hidden;
  }

  #printReport,
  #printReport * {
    visibility: visible;
  }

  #printReport {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: white;
    z-index: 99999;
  }
}