@import url('https://fonts.googleapis.com/css2?family=Gotu&display=swap');

:root {
  --blue:        #ffffff;
  --lavender:    #d6dce9;
  --cream:       #f1e5bf;
  --beige:       #e7e0d7;
  --steel:       #5b6f7a;
  --navy:        #363c62;
  --navy-dark:   #252948;
  --white:       #ffffff;
  --bg:          #dce8ed;
  --bg-card:     #ffffff;
  --text-primary:#000000;
  --text-muted:  #7e929d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Gotu', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* ─── WAVE DECORATION ─────────────────────────────────── */
.wave-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.wave-layer svg { width: 100%; height: 100%; }

/* ─── APP SHELL ──────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

/* ─── TITLE ──────────────────────────────────────────── */
.app-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.app-title-sub {
  font-size: 10px;
  letter-spacing: 0.45em;
  color: var(--steel);
  opacity: 0.75;
  text-transform: uppercase;
}

.app-title-main {
  font-size: 32px;
  color: var(--navy);
  letter-spacing: 0.06em;
}

/* ─── CAROUSEL ───────────────────────────────────────── */
.carousel-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ─── SMALL CIRCLES COLUMN ───────────────────────────── */
.small-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.small-col-left  { margin-right: 8px; }
.small-col-right { margin-left: 8px; }

.circle-small {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.4s cubic-bezier(.4,0,.2,1),
              opacity 0.4s ease,
              box-shadow 0.4s ease,
              border-color 0.4s ease;
  background: radial-gradient(circle at 38% 35%, var(--lavender), var(--navy-dark));
  border: 1.5px solid rgba(168,209,218,0.65);
  box-shadow: 0 0 18px rgba(126,146,157,0.22), 0 4px 16px rgba(54,60,98,0.18);
  user-select: none;
}

.small-col-left  .circle-small:first-child { animation: floatSmall 4.2s ease-in-out infinite 0s; }
.small-col-left  .circle-small:last-child  { animation: floatSmall 4.2s ease-in-out infinite 1.1s; }
.small-col-right .circle-small:first-child { animation: floatSmall 4.2s ease-in-out infinite 0.55s; }
.small-col-right .circle-small:last-child  { animation: floatSmall 4.2s ease-in-out infinite 1.65s; }

.circle-small:hover:not(.locked) {
  transform: scale(1.12) !important;
  border-color: var(--blue);
  box-shadow: 0 0 28px rgba(168,209,218,0.5), 0 8px 24px rgba(54,60,98,0.25);
}

.circle-small .sm-roman {
  font-family: 'Gotu', sans-serif;
  font-size: 16px;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 4px;
}

.circle-small .sm-label {
  font-size: 8px;
  color: var(--lavender);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* ─── CONNECTORS ─────────────────────────────────────── */
.connector {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 18px;
}

.connector span {
  display: block;
  border-radius: 50%;
  background: rgba(126,146,157,0.65);
  animation: pulse 2.4s ease-in-out infinite;
}

.connector-left span:nth-child(1) { width: 5px; height: 5px; animation-delay: 0.6s; }
.connector-left span:nth-child(2) { width: 4px; height: 4px; animation-delay: 0.3s; opacity: 0.65; }
.connector-left span:nth-child(3) { width: 3px; height: 3px; animation-delay: 0s;   opacity: 0.35; }

.connector-right span:nth-child(1) { width: 3px; height: 3px; animation-delay: 0s;   opacity: 0.35; }
.connector-right span:nth-child(2) { width: 4px; height: 4px; animation-delay: 0.3s; opacity: 0.65; }
.connector-right span:nth-child(3) { width: 5px; height: 5px; animation-delay: 0.6s; }

/* ─── LARGE CIRCLE ───────────────────────────────────── */
.circle-large {
  width: 290px;
  height: 290px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at 38% 32%, var(--blue), var(--steel) 55%, var(--navy-dark));
  box-shadow:
    0 0 0 2px rgba(168,209,218,0.5),
    0 0 0 8px rgba(168,209,218,0.08),
    0 0 70px rgba(126,146,157,0.28),
    0 24px 70px rgba(54,60,98,0.32);
  animation: floatLarge 3.5s ease-in-out infinite;
  transition: background 0.6s ease;
  cursor: default;
  flex-shrink: 0;
}

.circle-large::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid rgba(168,209,218,0.30);
  animation: rotateSlow 20s linear infinite;
}

.circle-large::after {
  content: '';
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  border: 1px dashed rgba(214,220,233,0.18);
  animation: rotateSlow 35s linear infinite reverse;
}

.large-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.large-roman {
  font-family: 'Gotu', sans-serif;
  font-size: 80px;
  color: rgba(255,255,255,0.12);
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
  letter-spacing: -2px;
}

.large-chuong {
  font-size: 10px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.85;
}

.large-title {
  font-family: 'Gotu', sans-serif;
  font-size: 26px;
  color: var(--white);
  letter-spacing: 0.04em;
}

.large-count {
  font-size: 12px;
  color: rgba(241,229,191,0.65);
  letter-spacing: 0.10em;
  margin-top: 2px;
}

/* ─── RANGE SELECTOR + SHUFFLE TOGGLE (cùng hàng) ─────────────────────────────────── */
.range-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255,255,255,0.60);
  border: 1.5px solid rgba(168,209,218,0.50);
  border-radius: 100px;
  padding: 8px 22px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(54,60,98,0.08);
}

.range-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.range-label {
  font-size: 13px;
  color: var(--navy);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.range-input {
  width: 62px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(126,146,157,0.35);
  background: rgba(255,255,255,0.85);
  color: var(--navy);
  font-family: 'Gotu', sans-serif;
  font-size: 14px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.range-input:focus {
  border-color: var(--blue);
}

/* hide spinner arrows */
.range-input::-webkit-inner-spin-button,
.range-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.range-input[type=number] { -moz-appearance: textfield; }

.range-max {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── SHUFFLE TOGGLE INLINE (cùng hàng) ─────────────────────────────────── */
.shuffle-toggle-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 4px 12px;
  border-left: 1.5px solid rgba(126,146,157,0.35);
  margin-left: 5px;
}

.shuffle-toggle-inline input {
  display: none;
}

.toggle-slider-inline {
  position: relative;
  width: 40px;
  height: 20px;
  background: rgba(126,146,157,0.35);
  border-radius: 50px;
  transition: all 0.3s ease;
  display: inline-block;
  flex-shrink: 0;
}

.toggle-slider-inline:before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--navy);
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.shuffle-toggle-inline input:checked + .toggle-slider-inline {
  background: var(--navy);
}

.shuffle-toggle-inline input:checked + .toggle-slider-inline:before {
  transform: translateX(20px);
  background: white;
}

.toggle-label-inline {
  font-size: 12px;
  color: var(--navy);
  letter-spacing: 0.05em;
  white-space: nowrap;
  font-weight: 500;
}

.shuffle-toggle-inline:hover {
  opacity: 0.8;
}

/* ─── ACTION BUTTONS ─────────────────────────────────── */
.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-chapter {
  padding: 14px 40px;
  border-radius: 100px;
  border: none;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  color: var(--white);
  font-family: 'Gotu', sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.35s ease;
  box-shadow: 0 4px 28px rgba(54,60,98,0.32), inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}

.btn-chapter::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-chapter:hover::after { opacity: 1; }
.btn-chapter:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(54,60,98,0.48);
}

.btn-chapter:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-all {
  padding: 14px 40px;
  border-radius: 100px;
  border: 1.5px solid rgba(54,60,98,0.40);
  background: rgba(255,255,255,0.55);
  color: var(--navy);
  font-family: 'Gotu', sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.35s ease;
  backdrop-filter: blur(4px);
}

.btn-all:hover {
  background: rgba(255,255,255,0.85);
  border-color: var(--navy);
  color: var(--navy-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(54,60,98,0.14);
}

.btn-all:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── TRANSITION ─────────────────────────────────────── */
.transitioning .circle-large {
  animation: none;
  transform: scale(0.85);
  opacity: 0.5;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.transitioning .circle-small {
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

/* ─── KEYFRAMES ──────────────────────────────────────── */
@keyframes floatLarge {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-14px); }
}

@keyframes floatSmall {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

@keyframes rotateSlow {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.fade-in { animation: fadeIn 0.5s ease forwards; }

/* ─── LOCKED CIRCLE ──────────────────────────────────── */
.circle-small.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.circle-small.locked:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: rgba(168,209,218,0.25) !important;
}

/* ─── QUIZ PAGE ──────────────────────────────────────── */
.quiz-app {
  position: relative;
  z-index: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 60px;
}

/* ─── STICKY HEADER ──────────────────────────────────── */
.quiz-header {
  width: 100%;
  max-width: 760px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(220,232,237,0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0 10px;
  margin-bottom: 8px;
}

.quiz-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-back {
  background: rgba(255,255,255,0.75);
  border: 1.5px solid rgba(168,209,218,0.65);
  color: var(--navy);
  font-family: 'Gotu', sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 8px 20px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s;
}
.quiz-back:hover {
  background: var(--white);
  color: var(--navy-dark);
  border-color: var(--steel);
}

.quiz-meta {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-align: right;
}

/* ─── PROGRESS BAR ───────────────────────────────────── */
.progress-wrap {
  width: 100%;
  height: 5px;
  background: rgba(126,146,157,0.18);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy-dark), var(--navy), var(--blue));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* ─── QUESTIONS LIST ─────────────────────────────────── */
.questions-list {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 8px;
}

/* ─── QUESTION BLOCK ─────────────────────────────────── */
.question-block {
  width: 100%;
  background: var(--white);
  border: 1.5px solid rgba(168,209,218,0.40);
  border-radius: 16px;
  padding: 26px 30px;
  box-shadow: 0 3px 16px rgba(54,60,98,0.06);
  animation: fadeIn 0.35s ease;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.question-block.answered-correct {
  border-color: rgba(74,154,106,0.50);
  box-shadow: 0 3px 16px rgba(74,154,106,0.08);
}

.question-block.answered-wrong {
  border-color: rgba(192,96,96,0.40);
  box-shadow: 0 3px 16px rgba(192,96,96,0.06);
}

/* ── Tăng font size cho phần làm trắc nghiệm ── */
.q-number {
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 10px;
  opacity: 0.7;
}

.q-text {
  font-family: 'Gotu', sans-serif;
  font-size: 18px;
  color: var(--text-primary);
  line-height: 1.80;
  margin-bottom: 18px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(126,146,157,0.28);
  background: rgba(214,220,233,0.20);
  color: var(--text-primary);
  font-family: 'Gotu', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  cursor: pointer;
  text-align: left;
  transition: all 0.22s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: rgba(168,209,218,0.18);
  transform: translateX(3px);
}

.option-btn .opt-label {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lavender);
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Gotu', sans-serif;
  transition: all 0.22s;
}

.option-btn.correct {
  border-color: #4a9a6a;
  background: rgba(74,154,106,0.12);
}
.option-btn.correct .opt-label {
  background: #4a9a6a;
  color: #fff;
}

.option-btn.wrong {
  border-color: #c06060;
  background: rgba(192,96,96,0.10);
  opacity: 0.82;
}
.option-btn.wrong .opt-label {
  background: #c06060;
  color: #fff;
}

.option-btn:disabled { cursor: default; }

/* ─── RESULT SCREEN ──────────────────────────────────── */
.result-screen {
  width: 100%;
  max-width: 520px;
  text-align: center;
  animation: fadeIn 0.6s ease;
  margin: 48px auto;
}

.result-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, var(--blue), var(--steel) 55%, var(--navy-dark));
  box-shadow: 0 0 0 3px rgba(168,209,218,0.40), 0 0 60px rgba(126,146,157,0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
  animation: floatLarge 3.5s ease-in-out infinite;
}

.result-score {
  font-family: 'Gotu', sans-serif;
  font-size: 48px;
  color: var(--white);
  line-height: 1;
}

.result-total {
  font-size: 13px;
  color: var(--cream);
  letter-spacing: 0.1em;
}

.result-title {
  font-family: 'Gotu', sans-serif;
  font-size: 26px;
  color: var(--navy);
  margin-bottom: 12px;
}

.result-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 40px;
  line-height: 1.7;
}

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* ─── SINGLE COL OPTIONS ─────────────────────────────── */
.options-grid.single-col {
  grid-template-columns: 1fr;
}

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 700px) {
  .carousel-wrap { gap: 0; }
  .circle-large { width: 200px; height: 200px; }
  .large-roman { font-size: 58px; }
  .large-title { font-size: 20px; }
  .circle-small { width: 68px; height: 68px; }
  .circle-small .sm-roman { font-size: 13px; }
  .connector { padding: 0 10px; }
  .question-block { padding: 18px 14px; }
  .options-grid { grid-template-columns: 1fr; }
  .q-text { font-size: 16px; }
  .option-btn { font-size: 14.5px; }
  .app-title-main { font-size: 24px; }
  .quiz-app { padding: 0 14px 40px; }
  
  /* Responsive cho range wrap + toggle */
  .range-wrap {
    flex-direction: column;
    border-radius: 20px;
    padding: 12px 20px;
    gap: 12px;
  }
  
  .range-controls {
    justify-content: center;
  }
  
  .shuffle-toggle-inline {
    border-left: none;
    border-top: 1.5px solid rgba(126,146,157,0.35);
    padding: 8px 12px 4px;
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  
  .range-max {
    font-size: 10px;
  }
  
  .range-input {
    width: 55px;
    font-size: 13px;
  }
  
  .range-label {
    font-size: 12px;
  }
}