:root {
  --bg: #eef7f8;
  --panel: rgba(255, 255, 255, 0.76);
  --ink: #072463;
  --muted: #334155;
  --line: #d8e1ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #6d28d9;
  --success: #16803f;
  --danger: #d33131;
  --shadow: 0 20px 44px rgba(15, 23, 42, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", Times, serif;
  color: var(--ink);
  background: var(--bg);
}

main {
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 54px;
}

.hero {
  padding: 6px 0 26px;
  text-align: center;
}

h1 {
  margin: 0;
  background: linear-gradient(90deg, #072463 0%, #072463 57%, #6d28d9 67%, #1d1f91 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: clamp(42px, 6.4vw, 78px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.hero p:last-child {
  width: min(760px, 100%);
  margin: 22px auto 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1.5;
}

.hero::after {
  content: "";
  display: block;
  width: 128px;
  height: 6px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6d28d9, #ec4899);
  box-shadow: 15px 0 0 -1px #ec4899;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
  margin-top: 8px;
}

.task-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 24px 28px 28px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.task-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.task-card-wide {
  grid-column: 1 / -1;
}

.task-card:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 250, 232, 0.88), rgba(255, 255, 255, 0.72));
}

.task-card:nth-child(2) {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.88), rgba(255, 255, 255, 0.72));
}

.task-card:nth-child(3) {
  background: linear-gradient(135deg, rgba(239, 249, 255, 0.9), rgba(255, 255, 255, 0.72));
}

.task-card:nth-child(4) {
  background: linear-gradient(135deg, rgba(246, 240, 255, 0.9), rgba(255, 255, 255, 0.72));
}

.task-card:nth-child(5) {
  background: linear-gradient(135deg, rgba(255, 241, 246, 0.9), rgba(255, 255, 255, 0.72));
}

.task-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.task-heading span {
  display: grid;
  width: 46px;
  height: 40px;
  place-items: center;
  border-radius: 9px;
  color: #061f58;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.task-card:nth-child(1) .task-heading span {
  background: linear-gradient(135deg, #ffd43b, #f59e0b);
}

.task-card:nth-child(2) .task-heading span {
  background: linear-gradient(135deg, #8be6c6, #42c891);
}

.task-card:nth-child(3) .task-heading span {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}

.task-card:nth-child(4) .task-heading span {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

.task-card:nth-child(5) .task-heading span {
  background: linear-gradient(135deg, #fb7185, #ec4899);
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: stretch;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.9);
  color: #172033;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13), inset 0 1px 3px rgba(15, 23, 42, 0.06);
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  min-height: 58px;
  padding: 0 22px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.17);
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

button:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
  box-shadow: 0 16px 26px rgba(15, 23, 42, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.task-card:nth-child(1) button {
  background: linear-gradient(135deg, #fb923c, #f59e0b);
}

.task-card:nth-child(2) button {
  background: linear-gradient(135deg, #10b981, #059669);
}

.task-card:nth-child(3) button {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
}

.task-card:nth-child(4) button {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.task-card:nth-child(5) button {
  background: linear-gradient(135deg, #ec4899, #db2777);
}

.output {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.65;
  min-height: 68px;
  padding: 20px;
  white-space: pre-wrap;
}

.output:empty {
  display: none;
}

.output h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 18px;
}

.output p {
  margin: 0;
}

.output pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
}

#quizResult {
  white-space: normal;
}

.loading {
  color: var(--muted);
  font-weight: 700;
}

.quiz-item {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.quiz-item:first-child {
  padding-top: 0;
}

.quiz-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.quiz-item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.quiz-item input {
  width: auto;
  margin-top: 4px;
}

.quiz-item button {
  margin-top: 8px;
}

.feedback {
  margin-top: 12px;
  font-weight: 800;
}

.correct {
  color: var(--success);
}

.error {
  color: var(--danger);
  font-weight: 800;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.quiz-progress {
  margin: 0;
  color: var(--primary);
  font-weight: bold;
}

.quiz-card h3 {
  margin: 4px 0 8px;
  font-size: 22px;
  line-height: 1.35;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 12px 18px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: 0.25s ease;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.quiz-option input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
}

.quiz-option span {
  flex: 1;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
}

.quiz-option:has(input:checked) {
  border-color: var(--accent);
  background: #f3e8ff;
}

.result-card {
  align-items: center;
  text-align: center;
}

@media (min-width: 861px) {
  .task-card-wide form {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}

@media (max-width: 980px) {
  h2 {
    font-size: 23px;
  }

  button {
    min-width: 120px;
    font-size: 18px;
  }
}

@media (max-width: 860px) {
  .task-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    width: min(100% - 22px, 1120px);
    padding-top: 24px;
  }

  .hero {
    text-align: center;
  }

  .hero p:last-child {
    font-size: 16px;
  }

  .task-card {
    padding: 18px;
  }

  .task-heading {
    gap: 12px;
  }

  .task-heading span {
    width: 42px;
    height: 36px;
    font-size: 18px;
  }

  form {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
