:root {
  --bg: #020403;
  --panel: rgba(5, 20, 16, 0.86);
  --panel-strong: rgba(7, 35, 27, 0.94);
  --line: rgba(34, 255, 108, 0.28);
  --line-soft: rgba(122, 255, 194, 0.16);
  --green: #00ff5f;
  --cyan: #24d7ff;
  --red: #ff405d;
  --text: #f4fff6;
  --muted: #8ea89a;
  --shadow: 0 0 48px rgba(0, 255, 95, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 20%, rgba(0, 255, 95, 0.2), transparent 28rem),
    radial-gradient(circle at 92% 82%, rgba(36, 215, 255, 0.12), transparent 24rem),
    var(--bg);
  color: var(--text);
}

.home-page {
  overflow: hidden;
}

.quiz-page {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-fade {
  animation: pageIn 620ms ease both;
}

.home-shell,
.quiz-shell {
  position: relative;
  display: grid;
  min-height: 100svh;
  isolation: isolate;
}

.home-shell {
  place-items: center;
  padding: 32px 32px 64px;
  overflow: hidden;
}

.quiz-shell {
  place-items: center;
  padding: 68px 24px 64px;
  overflow: hidden;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(70, 255, 139, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 255, 139, 0.07) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 0 54%, transparent 78%);
}

.ambient-grid::after {
  position: absolute;
  inset: auto -12% -24% 45%;
  height: 52vh;
  content: "";
  background: radial-gradient(ellipse, rgba(0, 255, 95, 0.28), transparent 65%);
  filter: blur(18px);
}

.home-panel {
  width: min(1040px, 100%);
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(0, 255, 95, 0.1), transparent 42%),
    rgba(0, 0, 0, 0.42);
  box-shadow: var(--shadow);
}

.eyebrow,
.quiz-topline {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 12px 0 12px;
  font-size: clamp(40px, 8vw, 92px);
  line-height: 0.95;
  text-transform: uppercase;
}

.home-subtitle {
  margin: 0 0 42px;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.blog-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.blog-chip {
  min-width: 0;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid rgba(122, 255, 194, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(216, 255, 226, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    border-color 240ms ease,
    color 240ms ease,
    background 240ms ease;
}

.blog-chip:hover,
.blog-chip:focus-visible {
  border-color: rgba(0, 255, 95, 0.42);
  background: rgba(0, 255, 95, 0.08);
  color: var(--green);
  outline: 0;
}

.language-card {
  position: relative;
  display: grid;
  min-height: 150px;
  align-content: center;
  gap: 8px;
  padding: 20px 24px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(145deg, rgba(9, 38, 31, 0.82), rgba(0, 0, 0, 0.78)),
    radial-gradient(circle at 20% 18%, rgba(36, 215, 255, 0.22), transparent 38%);
  transition:
    transform 360ms ease,
    border-color 360ms ease,
    box-shadow 360ms ease;
}

.language-card:hover,
.language-card:focus-visible {
  transform: translateY(-10px);
  border-color: var(--green);
  box-shadow: 0 0 34px rgba(0, 255, 95, 0.32);
  outline: 0;
}

.card-code {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.card-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 900;
}

.card-copy {
  color: var(--muted);
  font-size: 13px;
}

.back-button {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.52);
  color: var(--green);
  font-weight: 800;
}

.quiz-card {
  position: relative;
  width: min(760px, 100%);
  min-height: 360px;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(0, 255, 95, 0.1), transparent 62%),
    var(--panel);
  box-shadow: var(--shadow);
}

.quiz-card::before,
.quiz-card::after {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--cyan);
  content: "";
  opacity: 0.75;
}

.quiz-card::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.quiz-card::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 38px;
}

.topline-rule {
  flex: 1;
  max-width: 210px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green));
  opacity: 0.62;
}

.answer-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.answer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(216, 255, 226, 0.72);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.answer-toggle input {
  width: 34px;
  height: 18px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.answer-toggle input::before {
  display: block;
  width: 12px;
  height: 12px;
  margin: 2px;
  border-radius: 50%;
  background: rgba(216, 255, 226, 0.7);
  content: "";
  transition: transform 220ms ease, background 220ms ease;
}

.answer-toggle input:checked {
  border-color: var(--green);
  background: rgba(0, 255, 95, 0.16);
}

.answer-toggle input:checked::before {
  background: var(--green);
  transform: translateX(16px);
}

.answer-preview {
  max-width: min(180px, 30vw);
  overflow: hidden;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  text-transform: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.translation {
  min-height: 54px;
  margin: 0 0 22px;
  color: #d9ffe3;
  font-size: clamp(17px, 3.5vw, 31px);
  font-weight: 900;
  line-height: 1.16;
}

.prompt-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  min-height: 78px;
  color: #ffffff;
  font-size: clamp(28px, 7vw, 58px);
  font-weight: 900;
  line-height: 1.22;
}

.answer-input {
  width: var(--answer-width, 8ch);
  min-width: 3ch;
  max-width: min(22ch, 78vw);
  border: 0;
  border-bottom: 3px solid var(--green);
  border-radius: 0;
  background: rgba(0, 255, 95, 0.08);
  color: var(--green);
  font: inherit;
  line-height: 1.05;
  text-align: center;
  outline: 0;
}

.submit-button {
  min-height: 44px;
  margin-top: 22px;
  padding: 0 22px;
  border: 1px solid var(--line);
  background: rgba(0, 255, 95, 0.1);
  color: var(--green);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease,
    transform 240ms ease;
}

.submit-button:hover,
.submit-button:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(0, 255, 95, 0.24);
  outline: 0;
  transform: translateY(-1px);
}

.answer-input.wrong {
  border-bottom-color: var(--red);
  color: var(--red);
  animation: shake 360ms ease;
}

.hint-line {
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mobile-hint {
  display: none;
}

.site-footer {
  position: fixed;
  right: 18px;
  bottom: 14px;
  left: 18px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  color: rgba(216, 255, 226, 0.62);
  font-size: 12px;
}

.site-footer a,
.footer-link {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.site-footer a:hover,
.footer-link:hover {
  color: var(--green);
}

.donate-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.donate-modal[hidden] {
  display: none;
}

.donate-panel {
  position: relative;
  width: min(360px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  text-align: center;
}

.donate-panel h2 {
  margin: 0 0 18px;
  font-size: 24px;
}

.donate-panel img {
  width: min(220px, 72vw);
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line-soft);
}

.donate-panel p {
  margin: 18px 0 0;
  color: #d9ffe3;
  font-size: 14px;
  line-height: 1.7;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.38);
  color: var(--text);
  cursor: pointer;
}

.legal-page {
  min-height: 100vh;
  padding: 88px 20px 48px;
  background:
    radial-gradient(circle at 8% 20%, rgba(0, 255, 95, 0.16), transparent 28rem),
    var(--bg);
}

.legal-panel {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.48);
  box-shadow: var(--shadow);
}

.legal-panel h1 {
  margin-top: 28px;
  font-size: clamp(34px, 7vw, 64px);
}

.legal-panel p,
.legal-panel li {
  color: #d9ffe3;
  font-size: 16px;
  line-height: 1.9;
}

.legal-panel h2 {
  margin: 34px 0 10px;
  color: var(--green);
  font-size: clamp(22px, 4vw, 34px);
}

.article-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.article-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.28);
}

.article-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}

.legal-back {
  position: static;
}

.success-mark {
  position: absolute;
  top: 44%;
  left: 50%;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: rgba(0, 255, 95, 0.14);
  color: var(--green);
  font-size: 72px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
  box-shadow:
    0 0 40px rgba(0, 255, 95, 0.42),
    inset 0 0 28px rgba(0, 255, 95, 0.2);
}

.quiz-card.correct {
  animation: flash 620ms ease;
}

.quiz-card.correct .success-mark {
  animation: successPop 620ms ease;
}

.quiz-card.switching {
  animation: cardSwitch 380ms ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

@keyframes flash {
  50% {
    border-color: var(--green);
    box-shadow: 0 0 62px rgba(0, 255, 95, 0.46);
  }
}

@keyframes successPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  36%,
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.14);
  }
}

@keyframes cardSwitch {
  45% {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 767px) {
  .language-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .blog-strip {
    grid-template-columns: 1fr 1fr;
  }

  .language-card {
    min-height: 88px;
    padding: 16px 18px;
  }

  .home-shell {
    padding: 12px;
  }

  .home-panel {
    padding: 18px;
  }

  .home-subtitle {
    margin-bottom: 18px;
  }

  .quiz-shell {
    align-items: start;
    padding: 72px 14px 64px;
  }

  .quiz-card {
    min-height: 320px;
  }

  .back-button {
    top: 14px;
    left: 14px;
  }

  .desktop-hint {
    display: none;
  }

  .mobile-hint {
    display: inline;
  }

  .site-footer {
    gap: 6px 12px;
    font-size: 11px;
  }

  .answer-tools {
    gap: 8px;
  }

  .answer-preview {
    max-width: 24vw;
  }

  .article-list {
    grid-template-columns: 1fr;
  }
}
