@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;700&display=swap");

:root {
  --bg-1: #fff8f3;
  --bg-2: #eef6ff;
  --bg-3: #f0fff6;
  --ink: #1d1d3a;
  --muted: #56607a;
  --white: #ffffff;
  --line: rgba(80, 102, 146, 0.2);
  --brand-a: #ff6f61;
  --brand-b: #ffbf4d;
  --brand-c: #00a6a6;
  --brand-d: #4d7cff;
  --ok: #0f9158;
  --bad: #cf264a;
  --shadow-soft: 0 10px 35px rgba(45, 52, 84, 0.12);
  --shadow-strong: 0 20px 45px rgba(45, 52, 84, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(1200px 600px at -10% -15%, rgba(255, 111, 97, 0.25), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(77, 124, 255, 0.24), transparent 58%),
    radial-gradient(1000px 650px at 85% 100%, rgba(0, 166, 166, 0.18), transparent 60%),
    linear-gradient(130deg, var(--bg-1), var(--bg-2) 48%, var(--bg-3));
  min-height: 100vh;
}

body.splash-active main.container {
  opacity: 0;
}

body.splash-done main.container {
  opacity: 1;
  transition: opacity 0.55s ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(8px);
  pointer-events: none;
}

body::before {
  width: 420px;
  height: 420px;
  right: -100px;
  bottom: -120px;
  background: linear-gradient(140deg, rgba(255, 191, 77, 0.45), rgba(255, 111, 97, 0.28));
}

body::after {
  width: 340px;
  height: 340px;
  left: -90px;
  top: 40%;
  background: linear-gradient(140deg, rgba(77, 124, 255, 0.35), rgba(0, 166, 166, 0.3));
}

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 2.2rem 0 3.2rem;
  animation: page-in 0.6s ease-out;
}

.splash-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #ffffff, #d8ebff 45%, #c0fff1 100%);
  overflow: hidden;
}

.splash-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: flash-pop 1.8s ease-in-out 2;
}

.splash-text {
  position: relative;
  font-size: clamp(2rem, 6vw, 4.4rem);
  font-weight: 800;
  color: #163258;
  text-align: center;
  padding: 0 1rem;
  text-shadow: 0 6px 20px rgba(60, 106, 168, 0.25);
  animation: splash-text-in 2.8s ease forwards;
}

.splash-intro.hide {
  animation: splash-out 0.5s ease forwards;
}

@keyframes flash-pop {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  25% {
    opacity: 0;
  }
  38% {
    opacity: 0.9;
  }
  55% {
    opacity: 0;
  }
  70% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
  }
}

@keyframes splash-text-in {
  0% {
    opacity: 0;
    transform: scale(0.95);
    letter-spacing: 0.02em;
  }
  20% {
    opacity: 1;
    transform: scale(1.02);
  }
  75% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.04);
    letter-spacing: 0.04em;
  }
}

@keyframes splash-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.3rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Plus Jakarta Sans", "Outfit", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
}

h3 {
  font-size: clamp(1.03rem, 2vw, 1.2rem);
}

.subtitle {
  margin-top: 0.42rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.section-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.batch-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.section-card,
.batch-card,
.question-card,
.result {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.section-card {
  --drag-x: 0px;
  --drag-y: 0px;
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: card-in 0.45s ease;
  transform: translate(var(--drag-x), var(--drag-y));
  user-select: none;
}

.section-card:hover {
  transform: translate(var(--drag-x), var(--drag-y)) translateY(-3px);
  box-shadow: var(--shadow-strong);
}

.batch-card:hover,
.question-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-strong);
}

.section-card.dragging {
  transition: none;
}

.section-card:nth-child(2n) {
  animation-delay: 0.05s;
}

.section-card:nth-child(3n) {
  animation-delay: 0.11s;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.section-card p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.section-progress {
  margin-top: 0.1rem;
  display: grid;
  gap: 0.2rem;
}

.section-progress .small {
  font-size: 0.82rem;
  color: #475877;
}

.badge {
  width: fit-content;
  font-size: 0.73rem;
  letter-spacing: 0.04em;
  color: #174366;
  background: linear-gradient(135deg, #e6f5ff, #e7fff3);
  border: 1px solid rgba(68, 132, 174, 0.22);
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
}

.btn,
.btn-link {
  border: 0;
  border-radius: 12px;
  padding: 0.64rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.14s ease, opacity 0.14s ease, box-shadow 0.16s ease;
  font-family: "Outfit", sans-serif;
}

.btn:hover,
.btn-link:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.btn-link.disabled,
.btn-link[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-link.disabled:hover,
.btn-link[aria-disabled="true"]:hover {
  transform: none;
}

.btn.primary,
.btn-link.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  box-shadow: 0 9px 22px rgba(255, 111, 97, 0.3);
}

.btn.primary:hover,
.btn-link.primary:hover {
  box-shadow: 0 13px 26px rgba(255, 111, 97, 0.35);
}

.batch-continue,
.btn-link.batch-continue {
  color: #fff !important;
  background: linear-gradient(135deg, #1faa59, #6ecb63) !important;
  box-shadow: 0 9px 22px rgba(31, 170, 89, 0.32) !important;
}

.batch-continue:hover,
.btn-link.batch-continue:hover {
  box-shadow: 0 13px 26px rgba(31, 170, 89, 0.38);
}

.btn-link.batch-retake {
  color: #fff !important;
  background: linear-gradient(135deg, #9d1dd3, #e2368c) !important;
  box-shadow: 0 9px 22px rgba(157, 29, 211, 0.32) !important;
}

.btn-link.batch-retake:hover {
  box-shadow: 0 13px 26px rgba(157, 29, 211, 0.38);
}

.btn.ghost,
.btn-link.ghost {
  color: #1b2d4d;
  background: linear-gradient(135deg, #e9f3ff, #f1f8ff);
  border: 1px solid rgba(64, 116, 170, 0.24);
}

.btn.warn {
  color: #fff;
  background: linear-gradient(135deg, #dd2555, #b1124f);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.batch-card {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
  animation: card-in 0.45s ease both;
}

.batch-fields {
  display: grid;
  gap: 0.15rem;
}

.small {
  color: var(--muted);
  font-size: 0.86rem;
}

.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #eff9ff, #effff6);
  border: 1px solid rgba(78, 124, 174, 0.22);
  border-radius: 999px;
  padding: 0.47rem 0.85rem;
  font-size: 0.9rem;
}

.quiz-list {
  display: grid;
  gap: 0.92rem;
}

.question-nav {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.8rem;
  margin-bottom: 0.9rem;
}

.q-nav-btn {
  border: 1px solid #c6d7ea;
  background: #f8fbff;
  color: #1e3f67;
  border-radius: 10px;
  height: 34px;
  cursor: pointer;
  font-weight: 600;
}

.q-nav-btn:hover {
  background: #eef6ff;
}

.q-nav-btn.active {
  background: linear-gradient(135deg, #4d7cff, #00a6a6);
  color: #fff;
  border-color: transparent;
}

.q-nav-btn.answered {
  box-shadow: inset 0 0 0 2px rgba(15, 145, 88, 0.35);
}

.q-nav-btn.flagged {
  position: relative;
}

.q-nav-btn.flagged::after {
  content: "!";
  position: absolute;
  top: -5px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #d62149;
  color: #fff;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.question-card {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
  animation: q-in 0.35s ease both;
}

.question-card:nth-child(2n) {
  animation-delay: 0.03s;
}

.question-card:nth-child(3n) {
  animation-delay: 0.06s;
}

@keyframes q-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.72rem;
}

.q-title {
  font-weight: 600;
  line-height: 1.45;
}

.speak-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid rgba(61, 111, 165, 0.25);
  background: linear-gradient(135deg, #f5fbff, #ecf7ff);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.speak-btn:hover {
  transform: translateY(-1px);
}

.speak-btn svg {
  width: 18px;
  height: 18px;
  fill: #20558c;
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.answer-item {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.answer-option {
  border: 1px solid #d5dfeb;
  background: linear-gradient(180deg, #ffffff, #f9fcff);
  border-radius: 12px;
  padding: 0.58rem 0.65rem;
  font-size: 0.9rem;
  color: #233349;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease;
}

.answer-option:hover {
  border-color: #6aa0d4;
  background: linear-gradient(180deg, #f8fcff, #ebf5ff);
  transform: translateY(-1px);
}

.answer-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-d);
  cursor: pointer;
  flex: 0 0 auto;
}

.answer-option span {
  flex: 1;
}

.answer-option.selected {
  border-width: 2px;
  border-color: var(--brand-d);
  background: linear-gradient(135deg, #eef5ff, #f7f2ff);
}

.answer-option.correct {
  color: var(--ok);
  border-color: #68c29b;
  background: linear-gradient(135deg, #ecf9f2, #f4fff7);
}

.answer-option.wrong {
  color: var(--bad);
  border-color: #f093a6;
  background: linear-gradient(135deg, #fff0f4, #fff6f7);
}

.result {
  margin-top: 1rem;
  padding: 1rem;
}

.hidden {
  display: none;
}

.warning {
  margin: 1rem 0 0;
  color: #5f6b82;
  font-size: 0.85rem;
}

.credit {
  margin-top: 1.2rem;
  text-align: center;
  color: #465774;
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.62rem;
  margin-top: 1rem;
}

input[type="checkbox"] {
  accent-color: var(--brand-c);
}

@media (max-width: 700px) {
  .container {
    width: min(1160px, 95vw);
    padding-top: 1.2rem;
  }

  .question-row {
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .btn,
  .btn-link {
    flex: 1;
    min-width: 140px;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .question-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) and (min-width: 701px) {
  .section-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
