* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1226;
  --card: #1a1f3d;
  --card2: #232a55;
  --text: #eef0ff;
  --muted: #9aa3d0;
  --accent: #6c8cff;
  --accent2: #9d6cff;
  --green: #3ddc84;
  --red: #ff5d73;
  --yellow: #ffd166;
}

html, body { height: 100%; }

body {
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  background: var(--bg) url("https://img.magnific.com/premium-photo/aquamarine-shine-shiny-glowing-effects-abstract-background-design_851755-334300.jpg?semt=ais_hybrid&w=740") center / cover fixed no-repeat;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 14px;
  overflow-x: hidden;
}

/* фоновые блобы */
.bg-blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.b1 { width: 380px; height: 380px; background: #6c8cff; top: -120px; left: -100px; animation: float 12s ease-in-out infinite; }
.b2 { width: 320px; height: 320px; background: #9d6cff; bottom: -100px; right: -80px; animation: float 15s ease-in-out infinite reverse; }
.b3 { width: 260px; height: 260px; background: #3ddc84; top: 40%; left: 60%; opacity: .18; animation: float 18s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(30px) } }

.app { position: relative; z-index: 1; width: 100%; max-width: 640px; }

.screen { display: none; animation: pop .35s ease; }
.screen.active { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

.card {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 32px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

/* --- старт --- */
.start-card { text-align: center; }
.logo { font-size: 64px; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
h1 { font-size: 32px; margin: 10px 0 6px; background: linear-gradient(90deg, #8fb2ff, #c89dff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--muted); font-size: 15px; margin-bottom: 20px; }
.features { list-style: none; text-align: left; display: inline-block; margin-bottom: 26px; }
.features li { padding: 8px 0 8px 34px; position: relative; color: #cdd4ff; font-size: 15px; }
.features li::before { content: "✔"; position: absolute; left: 4px; color: var(--green); font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* --- кнопки --- */
.btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700;
  border-radius: 14px; padding: 12px 22px; font-size: 16px; color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: transform .15s, box-shadow .15s, filter .15s;
  box-shadow: 0 8px 24px rgba(108,140,255,.35);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-big { padding: 16px 34px; font-size: 18px; border-radius: 16px; }

/* --- HUD --- */
.hud { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.hud-item { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; }
.hud-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hud-value { font-size: 17px; }
.level-chip {
  font-size: 17px; font-weight: 800; padding: 6px 16px; border-radius: 999px;
  background: linear-gradient(90deg, #ffd166, #ff9f6c); color: #2a1a05;
  box-shadow: 0 4px 16px rgba(255,209,102,.35);
  transition: transform .2s;
}
.level-chip.up { animation: bump .4s ease; }
@keyframes bump { 50% { transform: scale(1.25) } }

.progress { height: 8px; background: rgba(255,255,255,.09); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--green), #6ce0ff); transition: width .4s ease; }

.topic-tag {
  display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgba(157,108,255,.18); color: #cbb4ff; border: 1px solid rgba(157,108,255,.4);
  margin-bottom: 12px;
}

.question { font-size: 21px; line-height: 1.4; margin-bottom: 20px; }

/* --- ответы --- */
.answers { display: grid; gap: 10px; }
.answer {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(255,255,255,.12);
  color: var(--text); font-family: inherit; font-size: 16px;
  padding: 13px 16px; border-radius: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.answer:hover:not(:disabled) { background: rgba(108,140,255,.18); border-color: var(--accent); transform: translateX(4px); }
.answer:disabled { cursor: default; opacity: .75; }
.answer .letter {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.1); display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
}
.answer.correct { background: rgba(61,220,132,.2); border-color: var(--green); opacity: 1; }
.answer.correct .letter { background: var(--green); color: #06341c; }
.answer.wrong { background: rgba(255,93,115,.18); border-color: var(--red); opacity: 1; }
.answer.wrong .letter { background: var(--red); color: #3b0713; }
.pulse-good { animation: good .45s ease; }
.pulse-bad { animation: bad .45s ease; }
@keyframes good { 50% { transform: scale(1.03) } }
@keyframes bad { 20%,60% { transform: translateX(-6px) } 40%,80% { transform: translateX(6px) } }

/* --- фидбек --- */
.feedback { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.feedback[hidden] { display: none; }
.feedback-text { font-size: 15px; line-height: 1.5; background: rgba(255,255,255,.06); padding: 12px 14px; border-radius: 12px; }
.feedback-text .ok { color: var(--green); font-weight: 800; }
.feedback-text .no { color: var(--red); font-weight: 700; }
.feedback .btn { align-self: center; }

/* --- результат --- */
.result-card { text-align: center; }
.trophy { font-size: 58px; animation: bounce 2s ease-in-out infinite; }
.result-label { color: var(--muted); margin-top: 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .1em; }
.result-level {
  font-size: 84px; font-weight: 900; line-height: 1.05; margin: 4px 0;
  background: linear-gradient(90deg, #ffd166, #ff9f6c, #c89dff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-name { color: #cdd4ff; font-size: 17px; margin-bottom: 18px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 10px 4px; }
.stat b { display: block; font-size: 20px; color: #fff; }
.stat span { font-size: 11px; color: var(--muted); }

.breakdown { display: grid; gap: 7px; margin-bottom: 18px; }
.bd-row { display: grid; grid-template-columns: 34px 1fr 40px; align-items: center; gap: 8px; font-size: 13px; }
.bd-level { font-weight: 800; color: var(--muted); text-align: left; }
.bd-bar { height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.bd-fill { height: 100%; border-radius: 999px; }
.bd-fill.good { background: linear-gradient(90deg, var(--green), #6ce0ff); }
.bd-fill.mid { background: linear-gradient(90deg, var(--yellow), #ff9f6c); }
.bd-fill.low { background: linear-gradient(90deg, var(--red), #ff9f6c); }
.bd-pct { color: var(--muted); text-align: right; }

.advice-box {
  text-align: left; background: rgba(108,140,255,.1); border: 1px solid rgba(108,140,255,.35);
  border-radius: 16px; padding: 16px 18px; margin-bottom: 18px;
}
.advice-box h3 { font-size: 17px; margin-bottom: 10px; }
.advice-box ul { list-style: none; display: grid; gap: 9px; }
.advice-box li { font-size: 14px; line-height: 1.5; color: #dbe1ff; padding-left: 20px; position: relative; }
.advice-box li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }

.level-scale { display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.scale-item {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.06); color: var(--muted); border: 1px solid rgba(255,255,255,.1);
}
.scale-item.active { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(108,140,255,.45); }

/* ===== Фоновое затемнение и стартовая кнопка ===== */
.veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(6, 18, 30, 0.55), rgba(4, 12, 24, 0.82)),
    radial-gradient(circle at 50% 35%, rgba(0, 40, 60, 0.15), rgba(2, 8, 18, 0.7));
  pointer-events: none;
}

.glow {
  box-shadow: 0 10px 35px rgba(0, 229, 200, 0.45), 0 0 60px rgba(0, 229, 200, 0.25);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 10px 35px rgba(0, 229, 200, 0.45), 0 0 45px rgba(0, 229, 200, 0.2); }
  50% { transform: translateY(-3px) scale(1.02); box-shadow: 0 16px 45px rgba(0, 229, 200, 0.55), 0 0 75px rgba(0, 229, 200, 0.35); }
}

.lang-title {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 18px;
  color: #fff;
}

.btn-ghost {
  display: block;
  margin: 18px auto 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.65);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Карточки языков */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.lang-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 18px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text);
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.lang-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--accent);
  background: rgba(0, 229, 200, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.lang-flag { font-size: 2rem; }
.lang-name { font-weight: 700; font-size: 1.05rem; }
.lang-sub { font-size: 0.75rem; color: var(--muted); }

/* Теги языка и темы */
.tags {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.lang-tag {
  background: rgba(177, 136, 255, 0.18);
  border: 1px solid rgba(177, 136, 255, 0.45);
  color: #cdbcff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.topic-tag {
  background: rgba(0, 229, 200, 0.14);
  border: 1px solid rgba(0, 229, 200, 0.4);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Listening */
.audio-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 40, 70, 0.45);
  border: 1px solid rgba(0, 229, 200, 0.35);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  animation: fadeUp 0.3s ease;
}

.btn-play {
  background: linear-gradient(135deg, #00e5c8, #17c3f2);
  color: #04121f;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, filter 0.15s;
}

.btn-play:hover { transform: scale(1.05); filter: brightness(1.1); }

.audio-hint { font-size: 0.82rem; color: var(--muted); }

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

@media (max-width: 480px) {
  .card { padding: 24px 16px; }
  h1 { font-size: 26px; }
  .question { font-size: 18px; }
  .result-level { font-size: 66px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
