:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --text: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #8a9aa9);
  --btn: var(--tg-theme-button-color, #3390ec);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --card: var(--tg-theme-secondary-bg-color, #232e3c);
  --right: #4caf50;
  --wrong: #e05353;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; font-family: -apple-system, system-ui, sans-serif;
  background: var(--bg); color: var(--text);
}
#app { max-width: 520px; margin: 0 auto; padding: 12px; }
header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--hint); margin-bottom: 10px; gap: 8px;
}
#phase-label {
  font-weight: 600; color: var(--btn);
  background: rgba(51,144,236,.12); padding: 3px 10px; border-radius: 20px;
}
#progress { margin-left: auto; }
#score { font-weight: 600; color: var(--text); }

/* плеер + оверлей поверх iframe (перехватывает тапы по видео) */
#player-wrap {
  position: relative; width: 100%; border-radius: 14px; overflow: hidden;
  background: #000; aspect-ratio: 16/9;
}
#player, #player iframe { width: 100%; height: 100%; }
#player-overlay {
  position: absolute; inset: 0; cursor: pointer; background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
/* когда видео не играет — затемняем и показываем ▶, пряча интерфейс YouTube */
#player-overlay.covered { background: rgba(0, 0, 0, .6); }
#player-overlay.covered::after {
  content: "▶"; font-size: 40px; color: rgba(255, 255, 255, .92);
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); display: flex; align-items: center;
  justify-content: center; padding-left: 5px;
}

.ghost {
  width: 100%; margin: 10px 0 4px; padding: 10px;
  background: transparent; color: var(--btn); border: 1px solid var(--btn);
  border-radius: 10px; font-size: 15px; cursor: pointer;
}

/* выражение и перевод */
.phrase-en { font-size: 26px; font-weight: 700; color: var(--text); text-align: center; }
.phrase-ru { font-size: 18px; color: var(--btn); text-align: center; margin-top: 6px; }
.hint-line { font-size: 14px; color: var(--hint); margin-top: 6px; text-align: center; }

/* фаза знакомства */
#learn { margin-top: 16px; text-align: center; }

/* предложение-контекст из подкаста */
.sentence-box {
  background: var(--card); border-radius: 12px; padding: 14px 16px;
  margin: 16px 0; text-align: left;
}
.sentence-en { font-size: 17px; line-height: 1.45; }
.sentence-en b { color: var(--btn); }
.sentence-ru { font-size: 15px; color: var(--hint); margin-top: 8px; line-height: 1.4; }

/* тест */
#test { margin-top: 16px; }
#question { margin-bottom: 14px; }
#options { display: flex; flex-direction: column; gap: 10px; }
.option {
  padding: 15px; font-size: 17px; text-align: left;
  background: var(--card); color: var(--text);
  border: 2px solid transparent; border-radius: 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.option:active { background: #2b3846; }
.option.right { border-color: var(--right); background: rgba(76,175,80,.15); }
.option.wrong { border-color: var(--wrong); background: rgba(224,83,83,.15); }
.option:disabled { cursor: default; }

#reveal { margin-top: 18px; }
#reveal-en { font-size: 22px; font-weight: 700; text-align: center; }
#reveal-ru { font-size: 16px; color: var(--btn); text-align: center; margin-top: 4px; }

/* переход между фазами + финал */
#intermission, #done { text-align: center; padding: 32px 16px; }
#intermission h2, #done h2 { font-size: 24px; }
#intermission p { color: var(--hint); font-size: 16px; margin-bottom: 24px; }
#done-score { font-size: 18px; color: var(--hint); margin-bottom: 24px; }

.primary {
  width: 100%; padding: 15px; font-size: 17px; font-weight: 600;
  background: var(--btn); color: var(--btn-text); border: none;
  border-radius: 12px; cursor: pointer; margin-top: 8px;
}

.hidden { display: none !important; }
