*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  --bg: #07080e;
  --panel: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #eef0f7;
  --muted: #8d92a8;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --accent: #8b7cf6;
  --accent-2: #f472b6;
  --radius: 22px;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 0%, rgba(139, 124, 246, 0.22), transparent 70%),
    radial-gradient(50% 42% at 92% 8%, rgba(244, 114, 182, 0.13), transparent 72%),
    radial-gradient(70% 55% at 50% 112%, rgba(74, 222, 128, 0.11), transparent 70%);
}

.fx-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(65% 55% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(65% 55% at 50% 0%, #000 25%, transparent 78%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 30px 20px 64px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand .mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -10px rgba(139, 124, 246, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.streak {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.streak.alive {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.09);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.progress {
  flex: 1;
  display: flex;
  gap: 6px;
}

.progress span {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.35s ease;
}

.progress span.filled {
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.progress-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.games {
  display: grid;
  gap: 18px;
}

.card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.026));
  box-shadow: 0 24px 60px -40px rgba(0, 0, 0, 0.95);
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.card:nth-child(2) {
  animation-delay: 0.06s;
}

.card:nth-child(3) {
  animation-delay: 0.12s;
}

.card.is-done {
  border-color: rgba(74, 222, 128, 0.2);
}

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(139, 124, 246, 0.8);
}

.card-word .dot {
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

.card-fermi .dot {
  background: var(--green);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}

.status {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status.done {
  color: var(--green);
}

.card-title {
  margin: 6px 0 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-word {
  margin: 2px 0 12px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ffffff 15%, #c7c2ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-q {
  margin: 2px 0 12px;
  font-size: 17px;
  font-weight: 550;
  line-height: 1.4;
}

.card-body {
  display: grid;
  gap: 8px;
}

.chrono-list {
  display: grid;
  gap: 8px;
}

.card-body.options-grid {
  grid-template-columns: 1fr 1fr;
}

.event,
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.event:hover:not(:disabled),
.option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.event:focus-visible,
.option:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.event:disabled,
.option:disabled {
  cursor: default;
}

.num {
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.text,
.opt-text {
  flex: 1;
  min-width: 0;
}

.year {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.event.ok {
  background: rgba(74, 222, 128, 0.09);
  border-color: rgba(74, 222, 128, 0.4);
}

.event.ok .num {
  border-color: transparent;
  background: var(--green);
  color: #052e16;
}

.event.miss {
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.42);
}

.option .mark {
  flex: none;
  width: 18px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.option.is-correct {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.45);
}

.option.is-correct .mark {
  color: var(--green);
}

.option.is-wrong {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.45);
}

.option.is-wrong .mark {
  color: var(--red);
}

.option.is-wrong .opt-text {
  color: #fecaca;
}

.option.is-dim {
  opacity: 0.45;
}

.hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.note {
  margin: 14px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  color: #b9bed1;
  font-size: 13.5px;
  line-height: 1.55;
  animation: noteIn 0.3s ease both;
}

@keyframes noteIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.shake {
  animation: shake 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translateX(-2px);
  }
  20%, 80% {
    transform: translateX(3px);
  }
  30%, 50%, 70% {
    transform: translateX(-5px);
  }
  40%, 60% {
    transform: translateX(5px);
  }
}

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px -16px rgba(139, 124, 246, 0.95);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -16px rgba(139, 124, 246, 1);
}

.btn.ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 21, 34, 0.96);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  color: var(--text);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  top: -24px;
  z-index: 55;
  border-radius: 2px;
  pointer-events: none;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes fall {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(0, 112vh, 0) rotate(760deg);
  }
}

@media (max-width: 560px) {
  .app {
    padding: 22px 14px 52px;
  }

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

  .brand-text p {
    display: none;
  }

  .hero-word {
    font-size: 24px;
  }

  .card-body.options-grid {
    grid-template-columns: 1fr;
  }

  .event,
  .option {
    font-size: 14px;
    padding: 11px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
