/* ------------------------------
   Full styles.css including sidebar
   ------------------------------ */

/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  color: white;
  background: linear-gradient(270deg, #1c1c1c, #2a2a2a, #1c1c1c);
  background-size: 600% 600%;
  animation: waterflow 20s ease infinite;
  background-attachment: fixed;
  line-height: 1.6;
  min-height: 100vh;
  padding: 40px 18px;
}

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

.page::before {
  content: "";
  position: fixed;
  inset: -10% -10% auto auto;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle at 30% 30%, rgba(56, 85, 170, 0.06), transparent 30%),
              radial-gradient(circle at 70% 70%, rgba(30, 180, 180, 0.03), transparent 30%);
  filter: blur(30px);
  z-index: 0;
  pointer-events: none;
}

/* MATCH MAIN PAGE PADDING AND WIDTH HERE! */
.page {
  max-width: 900px;
  margin: auto;
  padding: 2rem;
  position: relative;
  z-index: 2;
  transform: translateZ(0);
}
/* END PATCH */

/* Sidebar */
.sidebar {
  height: 100%;
  width: 0;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(17, 17, 17, 0.4);
  backdrop-filter: blur(10px);
  overflow-x: hidden;
  transition: width 0.3s ease;
  padding-top: 60px;
  z-index: 1000;
}

.sidebar a {
  padding: 12px 25px;
  text-decoration: none;
  font-size: 18px;
  color: #ccc;
  display: block;
  transition: 0.3s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar.open {
  width: 250px;
}

/* Hamburger Icon */
.hamburger {
  position: fixed;
  top: 15px;
  left: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 22px;
  cursor: pointer;
  z-index: 1101;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Quiz styles */
.header { text-align: center; margin-bottom: 18px; }
.title { font-size: 32px; letter-spacing: 0.6px; font-weight: 700; margin-bottom: 6px; }
.subtitle { font-size: 13px; color: #dcdcdc; opacity: 0.9; }

.controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 22px;
  align-items: center;
}

.select-wrapper { display:flex; flex-direction:column; gap:6px; font-size:13px; color:#e8e8e8; position: relative; }

.select-wrapper select {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
  cursor: pointer;
}

/* custom select overlay, arrow, options, etc. */
.custom-select { position: relative; display: block; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); color: #fff; padding: 8px 36px 8px 12px; border-radius: 10px; font-size: 14px; min-width: 140px; pointer-events: auto; user-select: none; }
.select-wrapper::after { content: "▾"; position: absolute; right: 10px; top: 30px; pointer-events: none; font-size: 14px; opacity: 0.85; color: #fff; }

.custom-options { position: absolute; left: 0; top: calc(100% + 8px); width: 100%; max-height: 220px; overflow-y: auto; border-radius: 12px; background: rgba(18,18,18,0.45); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 12px 40px rgba(2,6,23,0.6); z-index: 999; }
.custom-options .custom-option { padding: 10px 12px; cursor: pointer; color: #fff; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.custom-options .custom-option:last-child { border-bottom: none; }
.custom-options .custom-option:hover { background: rgba(255,255,255,0.03); }

.btn { padding: 9px 14px; font-weight: 600; border-radius: 10px; border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.03); color: #fff; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; box-shadow: 0 6px 18px rgba(2,6,23,0.12); touch-action: manipulation; }
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(0); }

.btn.primary { background: linear-gradient(180deg, rgba(63,131,255,0.14), rgba(45,95,255,0.06)); border: 1px solid rgba(80,140,255,0.18); box-shadow: 0 6px 40px rgba(73,114,255,0.08); }
.btn.secondary { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.btn.ghost { background: transparent; border: 1px dashed rgba(255,255,255,0.06); }

.left-controls { display:flex; gap:10px; align-items:center; }
.right-controls { display:flex; gap:8px; align-items:center; }

.quiz-area { margin-top: 6px; }
.hidden { display: none; }

.meta-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}

.progress-wrap {
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 200px;
}

.progress-bar {
  width: 260px;
  height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.03);
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #47d1ff, #6a86ff);
  transition: width .45s ease;
}
.progress-text { font-size: 13px; color:#ddd; }

.score-wrap { text-align:right; min-width:120px; }
.score-pill {
  background: rgba(255,255,255,0.06);
  padding: 6px 10px;
  border-radius: 999px;
  display:inline-block;
  margin-top:6px;
  font-weight:700;
  color:#fff;
}
.best { font-size:12px; color: #cfcfcf; margin-top:6px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.03);
  will-change: transform;
}
.question-card {
  min-height: 260px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.question-text {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #ffffff;
  line-height:1.45;
  word-wrap: break-word;
  text-align: left;
}

.options-list {
  list-style:none;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.option-btn {
  width:100%;
  padding: 14px;
  text-align:left;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.03);
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  font-weight: 400;
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
}
.option-btn:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.option-btn:disabled { cursor: default; opacity: 0.95; transform:none; box-shadow:none; }

.option-btn.correct {
  background: linear-gradient(90deg, rgba(72,187,120,0.18), rgba(46,160,94,0.10));
  border: 1px solid rgba(72,187,120,0.28);
  color: #eaffea;
  transform: scale(1.02);
  animation: pop .18s ease;
}
.option-btn.wrong {
  background: linear-gradient(90deg, rgba(240,90,90,0.14), rgba(190,50,50,0.06));
  border: 1px solid rgba(240,90,90,0.28);
  color: #ffecec;
  transform: scale(0.995);
  animation: shake .32s ease;
}

@keyframes pop {
  0% { transform: scale(0.98); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1.02); }
}
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

.controls-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:8px;
}
.timer-wrap { display:flex; align-items:center; gap:10px; }
.timer {
  background: rgba(255,255,255,0.03);
  padding:8px 12px;
  border-radius: 999px;
  font-weight:700;
  letter-spacing:0.6px;
}

.result-area { margin-top: 18px; }
.result-card { text-align:center; padding:26px; }
.result-actions {
  display:flex;
  gap:12px;
  justify-content:center;
  margin-top:12px;
}

.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 9999;
}

.site-footer {
  margin-top: 28px;
  padding: 18px 8px;
  text-align: center;
  color: #cfcfcf;
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.03);
}

/* Responsive mobile improvements */
@media (max-width: 980px) {
  body { padding: 30px 14px; }
  .title { font-size: 28px; }
  .page { max-width: 880px; }
}

@media (max-width: 720px) {
  .controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .left-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
  .select-wrapper { flex: 1 1 160px; min-width: 120px; margin-bottom: 0; }
  .custom-select { min-width: 0; width: 100%; padding-right: 38px; }
  .right-controls { display:flex; justify-content: center; gap: 8px; }
  .right-controls .btn { min-width: 120px; }
  .meta-row { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 12px; }
  .progress-wrap { width: 100%; display:flex; justify-content:center; }
  .progress-bar { width: 100%; max-width: 100%; }
  .score-wrap { text-align: center; min-width: auto; }
  .best { display:block; margin-top:6px; }
  .options-list { grid-template-columns: 1fr; gap: 10px; }
  .option-btn { padding: 14px; font-size: 16px; }
  .controls-row { flex-direction: row; justify-content: space-between; gap: 10px; }
  .action-buttons { display:flex; gap:8px; align-items:center; }
  .card { padding: 16px; }
  .question-card { min-height: auto; }
  .custom-options { left: 0; top: calc(100% + 8px); width: 100%; }
  .question-text { font-size: 18px; }
}

@media (max-width: 520px) {
  body { padding: 18px 12px; }
  .title { font-size: 24px; }
  .subtitle { font-size: 12px; }
  .select-wrapper { flex: 1 1 120px; min-width: 100px; }
  .custom-select { padding: 8px 36px 8px 10px; font-size: 13px; }
  .progress-bar { height: 9px; }
  .question-text { font-size: 16px; margin-bottom: 12px; }
  .option-btn { padding: 12px; font-size: 15px; border-radius: 10px; }
  .controls-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .action-buttons { justify-content: center; }
  .card { padding: 12px; }
  .page { padding-left: 8px; padding-right: 8px; }
}

@media (max-width: 420px) {
  .title { font-size: 20px; }
  .question-text { font-size: 15px; }
  .option-btn { font-size: 14px; padding: 10px; }
  .btn { padding: 8px 12px; font-size: 14px; }
  .progress-bar { height: 8px; border-radius: 8px; }
}

@media (max-width: 768px) {
  body { background-attachment: scroll; }
  .card, .option-btn, .custom-options { transform: translateZ(0); backface-visibility: hidden; }
}