:root {
  --bg: #f4f0ff;
  --bg-accent: #ffd9f4;
  --bg-deep: #d6f4ff;
  --text: #1b1430;
  --muted: #4a3f6a;
  --brand: #ff5a2f;
  --brand-dark: #cc3f1c;
  --card: #fff7ff;
  --ring: rgba(255, 90, 47, 0.28);
  --shadow: rgba(27, 20, 48, 0.2);
  --accent: #2f6bff;
  --accent-soft: rgba(47, 107, 255, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 40px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(47, 107, 255, 0.26), transparent 60%), radial-gradient(900px 520px at 95% 12%, rgba(255, 90, 47, 0.22), transparent 55%), radial-gradient(700px 520px at 50% 110%, rgba(255, 205, 102, 0.32), transparent 60%), linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 45%, var(--bg-deep) 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--accent-soft);
  filter: blur(2px);
  z-index: 0;
}

body::before {
  top: 6%;
  left: -80px;
}

body::after {
  bottom: 6%;
  right: -90px;
  background: rgba(255, 90, 47, 0.18);
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  background: rgba(255, 247, 255, 0.94);
  padding: 28px 26px 24px;
  border-radius: 24px;
  border: 1px solid rgba(27, 20, 48, 0.08);
  box-shadow:
    0 24px 60px rgba(27, 20, 48, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  animation: card-in 0.6s ease-out;
}

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

h1 {
  font-size: 2rem;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

h2 {
  font-size: 1.2rem;
  margin: 18px 0 12px;
}

p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 26px;
}

.actions--spaced {
  margin-top: 40px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand) 0%, #ff8c5f 45%, #ffd06b 100%);
  border-radius: 16px;
  text-decoration: none;
  border: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
  box-shadow: 0 16px 30px rgba(255, 90, 47, 0.28);
}

.button--small {
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 12px;
}

.button--muted {
  background: linear-gradient(135deg, #6b5f53 0%, #807367 100%);
  box-shadow: 0 16px 30px rgba(90, 79, 98, 0.25);
}

.button--muted:hover,
.button--muted:focus {
  box-shadow: 0 18px 36px rgba(90, 79, 98, 0.3);
}

.button:focus,
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(255, 90, 47, 0.32);
  filter: brightness(0.98);
  outline: none;
}

.button:focus-visible {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 6px var(--ring),
    0 18px 36px rgba(255, 90, 47, 0.32);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
}

.link:focus,
.link:hover {
  text-decoration: underline;
}

.footer {
  margin-top: 18px;
  font-size: 0.92rem;
  color: var(--muted);
}

.joke-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(27, 20, 48, 0.6);
  margin-bottom: 8px;
}

.joke {
  background: linear-gradient(135deg, #ffffff 0%, #fff0f9 100%);
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(27, 20, 48, 0.08);
  margin-bottom: 30px;
  margin-top: 30px;
  box-shadow: 0 12px 24px rgba(27, 20, 48, 0.12);
  font-size: 1.02rem;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
}

.wrap--narrow {
  max-width: 680px;
}

.wrap--medium {
  max-width: 720px;
}

.wrap--wide {
  max-width: 980px;
}

.wrap--full {
  max-width: none;
  width: 100%;
}

.wrap--full .card {
  max-width: none;
}

.card--flat {
  box-shadow: 0 18px 40px rgba(27, 20, 48, 0.12);
}

.section {
  margin-top: 20px;
}

header.card {
  padding: 18px 18px 8px;
  border-radius: 18px 18px 8px 8px;
}

.instructions {
  background: var(--card);
  border: 1px solid rgba(27, 20, 48, 0.12);
  border-top: none;
  padding: 14px 18px 18px;
  border-radius: 0 0 18px 18px;
}

.tasks {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.task {
  background: var(--card);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(27, 20, 48, 0.12);
}

.task h2 {
  font-size: 1rem;
  margin: 0 0 6px;
}

.task-title {
  font-weight: 700;
  margin: 0 0 10px;
}

.de {
  font-weight: 600;
  margin-bottom: 8px;
}

.en {
  color: var(--muted);
  line-height: 1.6;
}

.gap {
  width: 120px;
  max-width: 42vw;
  margin: 0 6px 6px 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(27, 20, 48, 0.2);
  font: inherit;
  background: #ffffff;
  color: var(--text);
}

.message {
  margin: 16px 0 0;
  color: var(--muted);
}

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

label {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(27, 20, 48, 0.18);
  font: inherit;
  background: #ffffff;
}

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

.code-block {
  margin: 12px 0 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  border: 1px solid rgba(27, 20, 48, 0.12);
  font-family: "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.review {
  margin-top: 8px;
}

.review-task {
  padding: 12px 0;
  border-bottom: 1px solid rgba(27, 20, 48, 0.12);
}

.review-task:last-child {
  border-bottom: none;
}

.review-de {
  font-weight: 600;
  margin-bottom: 6px;
}

.review-en {
  color: var(--muted);
  line-height: 1.6;
}

.answer {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  margin: 0 4px 4px 4px;
}

.answer--correct {
  background: rgba(22, 163, 74, 0.16);
  color: #0f7a3e;
}

.answer--incorrect {
  background: rgba(220, 38, 38, 0.16);
  color: #b42318;
}

.answer--expected {
  background: rgba(47, 107, 255, 0.12);
  color: #2f6bff;
}

.result-card {
  position: relative;
  overflow: hidden;
}

.result-score {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.result-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(27, 20, 48, 0.1);
  overflow: hidden;
  margin-bottom: 16px;
}

.result-bar__fill {
  height: 100%;
  background: linear-gradient(135deg, var(--brand) 0%, #ff8c5f 45%, #ffd06b 100%);
  border-radius: inherit;
  animation: bar-fill 0.8s ease-out;
}

.result-message {
  margin-bottom: 6px;
}

.result-card--perfect::before,
.result-card--perfect::after {
  content: "";
  position: absolute;
  inset: -40px;
  background:
    radial-gradient(circle, rgba(255, 90, 47, 0.35) 0 6px, transparent 7px) 0 0 / 40px 40px,
    radial-gradient(circle, rgba(47, 107, 255, 0.35) 0 6px, transparent 7px) 20px 20px / 40px 40px,
    radial-gradient(circle, rgba(255, 205, 102, 0.4) 0 6px, transparent 7px) 10px 30px / 40px 40px;
  opacity: 0.35;
  animation: confetti 3s linear infinite;
  pointer-events: none;
}

.result-card--perfect::after {
  animation-duration: 4.5s;
  opacity: 0.25;
}

.result-card--great {
  box-shadow:
    0 24px 60px rgba(27, 20, 48, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 1px rgba(47, 107, 255, 0.12);
}

.result-card--good {
  box-shadow:
    0 22px 50px rgba(27, 20, 48, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 1px rgba(255, 205, 102, 0.2);
}

.result-card--try {
  box-shadow:
    0 20px 44px rgba(27, 20, 48, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.result-card--great .result-bar__fill {
  background: linear-gradient(135deg, #2f6bff 0%, #7c6bff 100%);
}

.result-card--good .result-bar__fill {
  background: linear-gradient(135deg, #ffb347 0%, #ffd06b 100%);
}

.result-card--try .result-bar__fill {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8c5f 100%);
}

@keyframes bar-fill {
  from {
    transform: scaleX(0.2);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes confetti {
  0% {
    transform: translateY(-10%);
  }
  100% {
    transform: translateY(10%);
  }
}

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

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

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(27, 20, 48, 0.12);
  vertical-align: top;
}

details {
  margin-top: 6px;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 420px) {
  .card {
    padding: 24px 20px 22px;
  }

  h1 {
    font-size: 1.7rem;
  }
}
