:root {
  --bg: #f4f7fb;
  --bg-2: #eaf1f7;
  --ink: #172027;
  --muted: #6a7684;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --line: rgba(25, 35, 44, 0.12);
  --cyan: #0b92a6;
  --cyan-dark: #076b78;
  --coral: #ef604b;
  --yellow: #f6c744;
  --green: #139368;
  --red: #d9463e;
  --shadow: 0 24px 80px rgba(23, 32, 39, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.theme-dark {
  --bg: #090d12;
  --bg-2: #121a22;
  --ink: #edf4f8;
  --muted: #ffffff;
  --panel: rgba(14, 20, 27, 0.84);
  --panel-solid: #111923;
  --line: rgba(231, 241, 247, 0.14);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 18%, rgba(239, 96, 75, 0.2), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(11, 146, 166, 0.2), transparent 30%),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  transition: background 360ms ease, color 360ms ease;
}

button,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  top: -18px;
  width: var(--size);
  height: var(--size);
  left: var(--left);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.72);
  animation: fall var(--duration) linear var(--delay) infinite;
  opacity: var(--opacity);
}

.theme-light .particle {
  background: rgba(37, 58, 70, 0.28);
  box-shadow: 0 0 10px rgba(11, 146, 166, 0.12);
}

@keyframes fall {
  from {
    transform: translate3d(0, -20px, 0);
  }
  to {
    transform: translate3d(var(--drift), 110vh, 0);
  }
}

.shell,
.start-screen {
  position: relative;
  z-index: 1;
}

.shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 18px 0 20px;
  opacity: 1;
  transform: translateY(0);
  animation: pageIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: opacity 360ms ease, transform 360ms ease;
}

.is-menu .shell {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
}

.start-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  transition: opacity 420ms ease, transform 420ms ease, visibility 420ms ease;
}

.is-playing .start-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.02);
}

.start-card,
.character-panel,
.quiz-panel,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.start-card {
  width: min(620px, 100%);
  padding: clamp(24px, 5vw, 46px);
  text-align: center;
  animation: liftIn 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--cyan-dark);
  background: rgba(11, 146, 166, 0.14);
  font-weight: 800;
}

.theme-dark .brand-pill {
  color: #90ecf7;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.start-card h1 {
  margin-top: 18px;
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.start-card p {
  width: min(48ch, 100%);
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.start-actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--ink);
  color: var(--panel-solid);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 7px 7px 0 var(--yellow);
}

.theme-dark .brand-mark {
  color: #0c1117;
}

.topbar h1 {
  font-size: clamp(1.3rem, 2.8vw, 2.25rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.brand p {
  margin-top: 5px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.stats div {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}

.theme-dark .stats div {
  background: rgba(255, 255, 255, 0.04);
}

.stats span,
.eyebrow,
.identity span,
.answer-item span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats strong {
  display: block;
  margin-top: 2px;
  font-size: 1.55rem;
  line-height: 1;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(310px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.character-panel {
  min-height: 650px;
  display: grid;
  grid-template-rows: auto minmax(330px, 1fr) auto auto;
  overflow: hidden;
  animation: liftIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.quiz-panel {
  animation: liftIn 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.panel-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.tag {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  background: rgba(11, 146, 166, 0.1);
}

.poster {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(246, 199, 68, 0.2), transparent 45%),
    linear-gradient(315deg, rgba(11, 146, 166, 0.2), transparent 48%),
    rgba(255, 255, 255, 0.4);
  overflow: hidden;
}

.poster::after {
  content: "XENNY";
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.image-glow {
  position: absolute;
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.54), transparent 68%);
  filter: blur(6px);
  transform: translateY(18%);
}

.character-img {
  position: relative;
  z-index: 1;
  width: min(86%, 340px);
  height: 330px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.24));
  animation: floatCharacter 3.8s ease-in-out infinite;
  transition: opacity 180ms ease, transform 180ms ease;
}

.character-img.is-changing {
  opacity: 0;
  transform: translateY(10px) scale(0.97);
}

.character-img.is-hidden {
  display: none;
}

.character-fallback {
  position: relative;
  z-index: 1;
  width: min(72%, 260px);
  aspect-ratio: 1;
  display: none;
  place-items: center;
  border-radius: 32px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(135deg, var(--cyan), var(--coral));
  font-size: clamp(2.7rem, 12vw, 5.6rem);
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.22);
  animation: floatCharacter 3.8s ease-in-out infinite;
}

.character-fallback.is-visible {
  display: grid;
}

@keyframes floatCharacter {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.identity {
  padding: 16px;
}

.identity h2 {
  margin-top: 4px;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.answer-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
}

.answer-item {
  min-height: 86px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 9px;
  align-content: center;
}

.answer-item:nth-child(2n) {
  border-right: 0;
}

.answer-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.answer-item i {
  grid-row: span 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(23, 32, 39, 0.24);
  background: var(--dot);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 900;
}

.answer-item i.text-dot {
  background: linear-gradient(135deg, var(--cyan), var(--coral));
  border-color: transparent;
}

.answer-item strong {
  margin-top: 2px;
  font-size: 0.96rem;
  line-height: 1.12;
}

.quiz-panel {
  min-height: 650px;
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 16px;
}

.quiz-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: start;
}

.quiz-top h3 {
  margin-top: 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
  max-width: 12ch;
}

.progress {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress div {
  height: 9px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(120, 137, 150, 0.24);
}

.progress i {
  display: block;
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--coral), var(--yellow));
  transition: width 240ms ease;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
}

.choice {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  text-align: left;
  animation: choiceIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.theme-dark .choice,
.theme-dark .icon-btn,
.theme-dark .tag,
.theme-dark select,
.theme-dark .ghost-btn {
  background: rgba(255, 255, 255, 0.07);
}

.choice:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: 0 16px 26px rgba(11, 146, 166, 0.18);
}

.choice:disabled {
  cursor: default;
}

.choice.correct {
  border-color: rgba(19, 147, 104, 0.8);
  background: rgba(19, 147, 104, 0.14);
}

.choice.wrong {
  border-color: rgba(217, 70, 62, 0.78);
  background: rgba(217, 70, 62, 0.13);
}

.choice-chip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(23, 32, 39, 0.24);
  background: var(--chip);
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.32);
  display: grid;
  place-items: center;
  color: #fff;
  font-style: normal;
  font-weight: 900;
}

.text-chip {
  background: linear-gradient(135deg, var(--cyan), var(--coral));
  border-color: transparent;
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.18);
}

.choice strong {
  display: block;
  font-size: 1.14rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.choice span:last-child {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.feedback {
  min-height: 60px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

.feedback.good {
  color: var(--green);
  border-color: rgba(19, 147, 104, 0.52);
  background: rgba(19, 147, 104, 0.1);
}

.feedback.bad {
  color: var(--red);
  border-color: rgba(217, 70, 62, 0.5);
  background: rgba(217, 70, 62, 0.1);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.48);
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 9px 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: rgba(11, 146, 166, 0.15);
  color: var(--cyan-dark);
  font-weight: 800;
}

.theme-dark .segmented button.active {
  color: #90ecf7;
}

.round-actions {
  display: flex;
  gap: 10px;
}

.primary-btn,
.ghost-btn {
  min-height: 44px;
  border-radius: 14px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-btn {
  border: 1px solid var(--cyan);
  color: #fff;
  background: var(--cyan);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
}

.primary-btn:hover {
  border-color: var(--cyan-dark);
  background: var(--cyan-dark);
}

.ghost-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.ghost-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.big {
  min-width: 150px;
  min-height: 52px;
  font-size: 1.05rem;
}

.full {
  width: 100%;
}

.answers-hidden .answer-strip {
  display: none;
}

.settings-modal {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  color-scheme: light;
}

.theme-dark .settings-modal {
  color-scheme: dark;
}

.theme-dark .settings-card {
  background: rgba(14, 20, 27, 0.96);
  color: var(--ink);
  border-color: rgba(231, 241, 247, 0.16);
}

.theme-dark .settings-modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.settings-modal[open] .settings-card {
  animation: modalIn 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.settings-modal::backdrop {
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(4px);
}

.settings-card {
  padding: 0 18px 18px;
}

.modal-head {
  padding-left: 0;
  padding-right: 0;
}

.modal-head h2 {
  margin-top: 4px;
  font-size: 1.6rem;
}

.setting-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.theme-dark select {
  color: var(--ink);
  background: #141e29;
}

.easter-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.easter-layer span {
  position: absolute;
  color: rgba(11, 146, 166, 0.08);
  font-size: clamp(3rem, 12vw, 9rem);
  font-weight: 950;
  letter-spacing: 0;
  animation: easterFloat 12s ease-in-out infinite;
}

.theme-dark .easter-layer span {
  color: rgba(144, 236, 247, 0.08);
}

.easter-layer span:nth-child(1) {
  left: 3%;
  top: 12%;
}

.easter-layer span:nth-child(2) {
  right: 2%;
  top: 48%;
  animation-delay: -4s;
}

.easter-layer span:nth-child(3) {
  left: 22%;
  bottom: 6%;
  animation-delay: -8s;
}

.creator-badge {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 4;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(23, 32, 39, 0.14);
  backdrop-filter: blur(14px);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 900;
  transition: transform 180ms ease, border-color 180ms ease;
}

.creator-badge:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.creator-badge svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.zeyn-line {
  position: fixed;
  left: 50%;
  bottom: 18px;
  margin: 0;
  transform: translateX(-50%);
  font-size: clamp(1rem, 3vw, 1.6rem);
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
}

.footer-zeyn {
  position: static;
  transform: none;
  text-align: center;
  padding: 4px 0 0;
}

.zeyn-line span {
  display: inline-block;
  color: hsl(calc(var(--i, 0) * 28), 86%, 56%);
  animation: zeynWave 1.35s ease-in-out infinite, zeynHue 3.8s linear infinite;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes zeynWave {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(-4deg);
  }
}

@keyframes zeynHue {
  to {
    filter: hue-rotate(360deg);
  }
}

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

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}

@keyframes choiceIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@keyframes easterFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-4deg);
  }
  50% {
    transform: translate3d(20px, -18px, 0) rotate(4deg);
  }
}

@media (max-width: 940px) {
  .topbar,
  .game-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    align-items: stretch;
  }

  .stats {
    width: 100%;
  }

  .character-panel,
  .quiz-panel {
    min-height: auto;
  }

  .quiz-top {
    grid-template-columns: 1fr;
  }

  .quiz-top h3 {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 18px, 1220px);
    padding-top: 10px;
  }

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

  .brand-mark {
    width: 46px;
    height: 46px;
    box-shadow: 5px 5px 0 var(--yellow);
  }

  .top-actions,
  .stats,
  .choices,
  .answer-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .answer-item,
  .answer-item:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .toolbar,
  .round-actions,
  .segmented,
  .setting-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segmented button:last-child {
    border-bottom: 0;
  }

  .choice {
    min-height: 92px;
  }

  .character-img {
    height: 280px;
  }
}
