:root {
  --bg: #f3f7ff;
  --ink: #10213d;
  --muted: #5e6d88;
  --surface: #ffffff;
  --line: #d8e3ff;
  --brand: #0068ff;
  --brand-2: #00a8e8;
  --accent: #ffd166;
  --ok: #1d8a5a;
  --bad: #d64545;
  --shadow: 0 24px 60px rgba(16, 33, 61, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito Sans', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 168, 232, 0.22), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(0, 104, 255, 0.19), transparent 32%),
    linear-gradient(165deg, #f7fbff 0%, #eef3ff 48%, #e7f6ff 100%);
  position: relative;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(16, 33, 61, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 33, 61, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 88%);
  z-index: 0;
}

.glow {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(20px);
  z-index: 0;
}

.glow-a {
  width: 220px;
  height: 220px;
  background: rgba(0, 104, 255, 0.28);
  top: -70px;
  right: 8vw;
}

.glow-b {
  width: 260px;
  height: 260px;
  background: rgba(255, 209, 102, 0.28);
  bottom: -110px;
  left: 6vw;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 94vw);
  margin: 24px auto 44px;
}

.hero {
  margin-bottom: 16px;
  animation: rise 520ms ease-out;
}

.badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #053773;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #bed1ff;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: 'Teko', 'Impact', sans-serif;
  letter-spacing: 0.03em;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
}

h3 {
  font-size: 1.38rem;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 640px;
  color: var(--muted);
}

.card {
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 252, 255, 0.95) 100%);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise 460ms ease-out;
}

.card-head {
  margin-bottom: 10px;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #27406f;
}

input,
textarea {
  width: 100%;
  font: inherit;
  border: 1px solid #c6d7ff;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fdfefe;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(0, 104, 255, 0.2);
  border-color: #92b4ff;
}

textarea {
  resize: vertical;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.between {
  justify-content: space-between;
}

.auth-actions {
  justify-content: flex-end;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(125deg, var(--brand), var(--brand-2));
}

.btn.secondary {
  color: #13315d;
  background: #dbe6ff;
}

.btn.ghost {
  color: #21437a;
  border: 1px solid #b9ccff;
  background: rgba(255, 255, 255, 0.75);
}

.hidden {
  display: none;
}

.muted {
  color: var(--muted);
  margin: 4px 0 10px;
}

.message {
  margin: 8px 0 0;
  min-height: 20px;
  color: #1a5fbf;
  font-weight: 700;
}

.timer-settings {
  border: 1px solid #cfe0ff;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(230, 240, 255, 0.6), rgba(242, 248, 255, 0.8));
  padding: 12px;
  margin-bottom: 14px;
}

.timer-title {
  margin: 0 0 8px;
  font-weight: 800;
  color: #1d4fa8;
}

.folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.folder-item {
  border: 1px solid #b8cbff;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #21437a;
  background: #fff;
}

.folder-item.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(140deg, #2262ff, #1496f4);
}

.set-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.set-item {
  border-radius: 14px;
  border: 1px solid #d6e2ff;
  background: #fff;
  padding: 12px;
}

.set-item h3 {
  line-height: 1;
}

.set-item-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.set-completed-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.set-completed-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 5px;
}

.set-note-wrap {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.set-note-wrap span {
  font-size: 0.88rem;
  font-weight: 700;
  color: #335285;
}

.set-note-input {
  min-height: 68px;
  font-size: 0.92rem;
  background: #f9fbff;
}

.set-progress-message {
  margin: 7px 0 0;
  min-height: 18px;
  font-size: 0.83rem;
  color: var(--ok);
}

.set-progress-message.is-error {
  color: var(--bad);
}

.quiz-top {
  align-items: center;
}

.timer {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #bdd1ff;
  color: #16438e;
  background: rgba(255, 255, 255, 0.85);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.timer.danger {
  color: #8c1f1f;
  border-color: #f39a9a;
  background: #fff4f4;
}

.question {
  margin-bottom: 16px;
  border: 1px solid #d7e3ff;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.question > div:first-child {
  font-size: 1.16rem;
  line-height: 1.4;
}

.question-image-wrap {
  margin: 10px 0;
}

.question-image {
  width: min(100%, 560px);
  display: block;
  border: 1px solid #d8e3ff;
  border-radius: 12px;
  background: #f7fbff;
}

.options {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 10px;
  background: #f7fbff;
  border: 1px solid #d9e5ff;
  padding: 10px 12px;
  cursor: pointer;
}

.option:hover {
  background: #ecf3ff;
}

.option input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
}

.option.is-correct {
  background: #eafaf3;
  border-color: #9ed9bc;
}

.option.is-wrong {
  background: #fff0f0;
  border-color: #f0acac;
}

.answer-status {
  margin: 8px 0 0;
  min-height: 18px;
  font-weight: 700;
}

.ok {
  color: var(--ok);
}

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

.top-gap {
  margin-top: 14px;
}

.submit-row {
  align-items: flex-start;
}

.score {
  margin: 8px 0 12px;
  font-size: 1.2rem;
  font-weight: 900;
  color: #0d3b86;
}

.result-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #d7e3ff;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
}

.result-item {
  border-bottom: 1px solid #e4edff;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item-head {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  color: inherit;
  font: inherit;
  font-weight: 700;
}

.result-item-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease;
}

.result-item-content {
  padding: 0 8px 10px;
}

.result-question-text {
  margin: 0 0 8px;
  line-height: 1.45;
}

.result-option-list {
  margin: 0;
  padding-left: 18px;
  color: #324c75;
}

.result-option-list li {
  margin: 4px 0;
}

.result-correct-tag {
  margin-left: 6px;
  display: inline-block;
  border: 1px solid #bde4cf;
  color: var(--ok);
  background: #e9f7ef;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.74rem;
}

.result-chevron {
  display: inline-block;
  transition: transform 180ms ease;
}

.result-item.open .result-chevron {
  transform: rotate(180deg);
}

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

@media (max-width: 780px) {
  .row {
    flex-wrap: wrap;
  }

  .between {
    align-items: flex-start;
  }

  .btn {
    width: 100%;
  }

  .set-item-actions .btn {
    width: auto;
  }

  .timer {
    order: 3;
  }

  h1 {
    line-height: 1;
  }
}
