:root {
  --navy: #123562;
  --ocean: #0076c8;
  --teal: #00b39f;
  --lime: #78d64b;
  --sun: #ffcc47;
  --coral: #ff5f5f;
  --berry: #ff3e8f;
  --paper: #f7fbff;
  --ink: #13263f;
  --muted: #3c5170;
  --good: #0c9652;
  --bad: #d92246;
  --card-shadow: 0 14px 30px rgba(18, 53, 98, 0.2);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", "Gill Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 6%, rgba(103, 232, 249, 0.88), transparent 42%),
    radial-gradient(circle at 90% 2%, rgba(255, 209, 102, 0.82), transparent 35%),
    radial-gradient(circle at 82% 82%, rgba(255, 95, 95, 0.66), transparent 36%),
    linear-gradient(130deg, #1f7af7 0%, #00c3a6 33%, #ffe373 66%, #ff8d52 100%);
  background-size: 180% 180%;
  animation: sky-shift 22s ease infinite;
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
  filter: blur(2px);
  mix-blend-mode: screen;
}

.shape-a {
  width: 250px;
  height: 250px;
  background: #63d8ff;
  top: 66%;
  left: -90px;
  animation: drift 14s ease-in-out infinite;
}

.shape-b {
  width: 210px;
  height: 210px;
  background: #ffd85b;
  top: 8%;
  right: -70px;
  animation: drift 11s ease-in-out infinite reverse;
}

.shape-c {
  width: 170px;
  height: 170px;
  background: #ff66a2;
  top: 42%;
  right: 20%;
  animation: drift 9s ease-in-out infinite;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100% - 2rem);
  margin: 1.3rem auto 2.4rem;
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.15rem;
  animation: rise-in 0.35s ease;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--ocean) 0%,
    var(--teal) 26%,
    var(--lime) 46%,
    var(--sun) 68%,
    var(--berry) 100%
  );
  pointer-events: none;
}

.header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.95rem;
}

.header h1,
.header h2 {
  margin: 0;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.header p {
  margin: 0;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 122, 247, 0.24);
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 0.33rem 0.68rem;
  color: var(--navy);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.9), rgba(230, 246, 255, 0.9));
}

.theme-section + .theme-section {
  margin-top: 1.05rem;
}

.theme-title {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
  color: var(--navy);
}

.theme-description {
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.quiz-card {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 122, 247, 0.25);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(230, 243, 255, 0.9));
  padding: 0.8rem;
  display: grid;
  gap: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-card:nth-child(4n + 1) {
  border-color: rgba(0, 118, 200, 0.34);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(228, 244, 255, 0.92));
}

.quiz-card:nth-child(4n + 2) {
  border-color: rgba(255, 95, 95, 0.34);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 236, 228, 0.92));
}

.quiz-card:nth-child(4n + 3) {
  border-color: rgba(0, 179, 159, 0.34);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(227, 255, 249, 0.92));
}

.quiz-card:nth-child(4n + 4) {
  border-color: rgba(255, 62, 143, 0.3);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 232, 245, 0.9));
}

.quiz-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(18, 53, 98, 0.2);
}

.quiz-card h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--navy);
}

.quiz-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.63rem 0.92rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--coral) 0%, #ff894d 42%, var(--sun) 100%);
  box-shadow: 0 7px 14px rgba(255, 95, 95, 0.26);
}

.secondary {
  color: #fff;
  background: linear-gradient(130deg, #008ed8 0%, var(--teal) 100%);
  box-shadow: 0 7px 14px rgba(0, 118, 200, 0.24);
}

.ghost {
  background: rgba(255, 255, 255, 0.78);
  color: var(--navy);
  border: 1px solid rgba(18, 53, 98, 0.2);
}

.progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0.5rem 0 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(219, 238, 255, 0.9);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ocean) 0%, var(--teal) 35%, var(--lime) 63%, var(--sun) 100%);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.question-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--navy);
}

.options {
  margin-top: 0.95rem;
  display: grid;
  gap: 0.52rem;
}

.option {
  text-align: left;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(18, 53, 98, 0.16);
  color: var(--ink);
  padding: 0.7rem 0.76rem;
  border-radius: 10px;
  animation: rise-in 0.26s ease;
}

.options .option:nth-child(1) {
  border-left: 4px solid #1f7af7;
}

.options .option:nth-child(2) {
  border-left: 4px solid #00b39f;
}

.options .option:nth-child(3) {
  border-left: 4px solid #ffb433;
}

.options .option:nth-child(4) {
  border-left: 4px solid #ff4d94;
}

.option.selected {
  border-color: rgba(18, 53, 98, 0.4);
  background: linear-gradient(120deg, rgba(68, 158, 255, 0.23), rgba(255, 204, 71, 0.33));
}

.feedback {
  border-radius: 10px;
  border: 1px solid rgba(31, 122, 247, 0.22);
  background: rgba(239, 249, 255, 0.86);
  padding: 0.67rem;
  margin: 0.8rem 0;
  color: var(--muted);
}

.score-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  border-radius: 999px;
  background: linear-gradient(130deg, rgba(255, 95, 95, 0.18), rgba(255, 204, 71, 0.32));
  color: var(--navy);
  border: 1px solid rgba(255, 95, 95, 0.24);
  padding: 0.38rem 0.78rem;
  font-weight: 700;
}

.review-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.review-item {
  border-radius: 10px;
  border: 1px solid rgba(18, 53, 98, 0.16);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95), rgba(243, 249, 255, 0.9));
  padding: 0.62rem 0.75rem;
}

.review-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.review-correct {
  color: var(--good);
}

.review-wrong {
  color: var(--bad);
}

.small-note {
  color: rgba(19, 38, 63, 0.8);
  font-size: 0.88rem;
}

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

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@media (max-width: 680px) {
  .app-shell {
    width: min(980px, 100% - 1rem);
    margin-top: 0.8rem;
  }

  .panel {
    padding: 0.88rem;
  }

  .header h1 {
    font-size: 1.48rem;
  }

  .question-title {
    font-size: 1.1rem;
  }

  button {
    width: 100%;
  }

  .btn-row {
    display: grid;
    grid-template-columns: 1fr;
  }
}
