/* ===== Base ===== */
html, body { overflow: auto; }

/* ===== Quiz ===== */
.quiz-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  margin-top: 55px;
  padding: 20px;
  overflow: visible;
}

.quiz-column {
  width: 45%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.words-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 45px;
  padding: 10px 14px;
  background: #f0f0f0;
  border-radius: 12px;
  border: 2px solid #f5f1cd;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  margin: 0;
  overflow: hidden;
  will-change: transform, height, opacity;
  transition: background-color .05s, box-shadow .12s;
}
.words-item:focus { outline: none; }
.words-item:focus-visible { box-shadow: 0 0 0 3px rgba(157,204,241,.65); }
.words-item:active { transform: scale(.985); box-shadow: 0 0 0 3px rgba(157,204,241,.45); }

.words-item.selected  { background: #d0e8ff; }
.words-item.correct   { background: #90ee90; }
.words-item.incorrect { background: #ffcccb; }

/* ===== Counters ===== */
.card-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  margin-right: 3px;
  padding: 12px;
  border-radius: 12px;
  background: aliceblue;
}
.card-info.correct { background: #c2ffd8; }
.card-info.error   { background: #ffdcc2; }
.card-info.default { background: aliceblue; }

/* ===== Popup ===== */
.finish-popup {
  position: fixed;
  left: 0; right: 0;
  bottom: 8px;
  z-index: 9999;
  display: none;          /* показывайте из JS */
  background: transparent;
  pointer-events: none;   /* кликается только внутр. блоки */
  will-change: transform;
}

.finish-panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 100%;
  overflow: visible;
  background: transparent;
}

/* Главный попап (заголовок + награды + кнопки) */
.finish-header {
  margin: 5px 5px 10px 5px;
  padding: 15px 20px;
  border-radius: 8px;
  background: whitesmoke;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.finish-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #6d6f71;
}

.rewards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

/* Иконка + текст в одну строку */
.reward-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.reward-icon { width: 40px; height: 40px; object-fit: contain; }
.reward-amount { font-size: 18px; font-weight: 700; color: #6d6f71; }
.reward-amount.gold { color: #b8860b; }
.reward-amount.blue { color: #1e40af; }

/* Кнопки — внутри главного попапа, под иконками */
.actions-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.continue-button {
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 12px;
  background: #22c55e;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s, transform .08s;
}
.continue-button:hover { background: #16a34a; }
.continue-button:active { transform: scale(.98); }
.repeat-link {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  font-weight: bold !important;
  text-decoration: underline;
  color: #6d6f71;
  cursor: pointer;
  transition: color .2s;
}
.repeat-link:hover { color: #4a5568; }

/* ===== Results list (ниже попапа) ===== */
/* ===== Results list (ниже попапа) ===== */
.finish-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  padding: 0 0 8px 0;
  margin: 0;

  /* Взаимодействие и скролл */
  pointer-events: auto;                /* важно, т.к. родитель disabled */
  max-height: calc(85vh - 280px);     /* ИЗМЕНЕНО: динамический расчет вместо 45vh */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Для очень высоких экранов ограничиваем максимальную высоту */
@media (min-height: 800px) {
  .finish-list {
    max-height: 520px;  /* Ограничение для планшетов и больших телефонов */
  }
}

.finish-item {
  display: inline-table;
  margin: 0px 5px 0px 5px;
  border-radius: 8px;
  min-height: 65px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  padding: 5px 10px;
  font-size: 20px;
  font-weight: 300;
  color: #6d6f71;
  border-left: 3px solid #bfbfbf;
  z-index: 2;
}
.finish-item.ok  { border-left: 3px solid #22c55e;}
.finish-item.bad { border-left: 3px solid #f79c9c;}

