/* ========= 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;
}

.exam-title {
  margin-bottom: 0;
}

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

.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;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  color: white;
  margin: 1rem;
  padding: 0.8rem 1.2rem;
  border-radius: 3rem;
  flex-wrap: wrap;
  gap: 0.5rem;
  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;
}

/* ========= QUESTION NAVIGATOR ========= */
.question-navigator {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 1rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  border-radius: 2rem;
}

.nav-circle {
  width: clamp(36px, 8vw, 44px);
  height: clamp(36px, 8vw, 44px);
  border-radius: 50%;
  background-color: #e74c3c;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  cursor: pointer;
  transition: 0.1s;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-circle.answered {
  background-color: #2ecc71;
}

.nav-circle.active-question {
  border: 3px solid #ffcc00;
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.6);
}

.nav-circle:hover {
  outline: 2px solid #ffcc00;
  transform: scale(1.05);
}

/* ========= QUESTION CONTAINER ========= */
.question-container {
  padding: 0.5rem 1rem;
}

.question-label {
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: bold;
  color: #ffb347;
  margin-bottom: 0.8rem;
}

/* ========= EXPLANATION BOX ========= */
.explanation-box {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 5px solid #ffcc00;
  color: #ffdd99;
}

.explanation-box i {
  margin-right: 8px;
}

/* ========= WORD POOL & CONSTRUCTION QUEUE ========= */
.word-pool,
.construction-queue {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.pool-label,
.queue-label {
  width: 100%;
  font-size: 0.9rem;
  color: #ffaa66;
  margin-bottom: 0.3rem;
}

/* ========= WORD BUTTONS ========= */
.pool-word {
  background: #f97316;
  border: 1px solid #ffcc00;
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.pool-word:hover {
  background: #ff8c42;
  transform: scale(1.02);
  border-color: #ffdd88;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.constructed-word {
  background: #1f8a4c;
  border: 1px solid #ffcc00;
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.constructed-word:hover {
  background: #2eaa62;
  transform: scale(1.02);
  border-color: #ffdd88;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.empty-msg {
  color: #ffd9b5;
  font-style: italic;
  width: 100%;
  text-align: center;
}

/* ========= NAVIGATION BUTTONS ========= */
.navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.navigation button {
  padding: 0.8rem 1.5rem;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  border-radius: 2rem;
  border: none;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(145deg, #f97316, #ea580c);
  color: white;
  transition: all 0.2s;
  touch-action: manipulation;
  min-height: 48px;
  min-width: 120px;
}

.navigation button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(249, 115, 22, 0.4);
  border: 1px solid #ffcc00;
}

.navigation button:disabled {
  background: #4a5568;
  cursor: not-allowed;
  opacity: 0.5;
}

/* ========= SUBMIT BUTTON ========= */
.submit-wrapper {
  text-align: center;
  margin: 1rem;
}

.submit-btn {
  background: linear-gradient(145deg, #2ecc71, #27ae60);
  padding: 0.8rem 2rem;
  font-size: 1rem;
  border-radius: 2rem;
  border: none;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  min-width: 180px;
  min-height: 48px;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
  border: 1px solid #ffcc00;
}

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

/* ========= RESULTS / PDF REPORT ========= */
.pdf-report {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  border-radius: 2rem;
  padding: 2rem;
  text-align: center;
  margin: 1rem;
  border: 1px solid rgba(255, 204, 0, 0.4);
}

.pdf-report,
.pdf-report * {
  color: #f0f0f0;
}

.pdf-header {
  border-bottom: 2px solid #ffcc00;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.pdf-header h1 {
  color: #ffdd00;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.score-display {
  font-size: 2rem;
  font-weight: bold;
  color: #ffdd00;
  margin: 0.5rem 0;
}

.timestamp {
  color: #bbefe5;
  font-size: 0.9rem;
}

.detail-card {
  background: rgba(0, 0, 0, 0.5);
  border-left: 6px solid;
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.detail-card.correct {
  border-left-color: #2ecc71;
}

.detail-card.incorrect {
  border-left-color: #e74c3c;
}

.user-sentence {
  font-weight: bold;
  margin: 0.5rem 0;
}

.explanation {
  margin-top: 0.5rem;
  font-style: italic;
  color: #ffd9b5;
}

.pdf-buttons {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.set-btn {
  background: linear-gradient(145deg, #f97316, #c2410c);
  border: none;
  border-radius: 2rem;
  padding: 0.6rem 1.5rem;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
  display: inline-block;
  margin: 0.3rem;
  min-height: 44px;
}

.set-btn:hover {
  transform: translateY(-2px);
  border: 1px solid #ffcc00;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

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

/* ========= 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;
  }

  .navigation {
    flex-direction: column;
    align-items: stretch;
  }

  .navigation button,
  .submit-btn {
    width: 100%;
    min-width: auto;
  }

  .info-banner {
    flex-direction: column;
    text-align: center;
    border-left: none;
    border-top: 5px solid #ffcc00;
  }

  .nav-circle {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .timer-section {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .timer {
    white-space: normal;
  }

  .pdf-buttons {
    flex-direction: column;
  }

  .set-btn {
    width: 100%;
  }

  .word-pool,
  .construction-queue {
    padding: 0.8rem;
  }

  .pool-word,
  .constructed-word {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
}

@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;
  }

  .timer {
    font-size: 2rem;
  }

  .nav-circle {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
  }

  .pool-word,
  .constructed-word {
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
  }

  .navigation button,
  .submit-btn {
    padding: 1rem 2rem;
    font-size: 1.3rem;
    min-width: 160px;
  }

  .set-btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
  }
}

/* ========= PRINT STYLES ========= */
@media print {
  body {
    background: white;
    padding: 0;
    margin: 0;
  }

  .bg-orb,
  .hero-card .menu-btn,
  .divider,
  .pdf-buttons,
  .navigation,
  .timer-section,
  .question-navigator,
  .submit-wrapper {
    display: none !important;
  }

  .pdf-report {
    display: block !important;
    background: white;
    margin: 0;
    padding: 1rem;
    border: none;
    box-shadow: none;
  }

  .pdf-report * {
    color: black !important;
  }

  .pdf-header h1,
  .score-display,
  .timestamp {
    color: #2c3e50 !important;
  }

  .detail-card {
    break-inside: avoid;
    page-break-inside: avoid;
    background: #f9f9f9;
    border: 1px solid #ccc;
    color: black !important;
  }
}