/* ============================================================
   NaMuTi — duo.css
   Стилі для режиму "Навчайся з другом"
   ============================================================ */

/* ── НАВБАР ── */
.duo-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  background: var(--nav); border-bottom: 1px solid var(--border);
}
.duo-nav-left { display: flex; align-items: center; gap: 14px; }
.duo-nav-title {
  font-family: 'Unbounded', sans-serif; font-size: 15px; font-weight: 900;
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.duo-nav-back {
  font-size: 13px; color: var(--muted); background: none; border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-family: 'Nunito', sans-serif;
  transition: all .2s;
}
.duo-nav-back:hover { border-color: var(--green); color: var(--green); }

/* ── КОНТЕЙНЕР ── */
.duo-page { padding-top: 80px; max-width: 1100px; margin: 0 auto; padding-left: 24px; padding-right: 24px; padding-bottom: 60px; }

/* ── СТАНИ: НЕМАЄ ПАРИ / Є ПАРА ── */
.duo-state { display: none; }
.duo-state.active { display: block; }

/* ══════════════════════════════════════════
   СТАН: НЕМАЄ ПАРИ (створити / приєднатись)
   ══════════════════════════════════════════ */
.duo-setup {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding-top: 40px;
}
.duo-setup-emoji { font-size: 72px; margin-bottom: 24px; animation: duo-float 3s ease-in-out infinite; }
@keyframes duo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.duo-setup h1 {
  font-family: 'Unbounded', sans-serif; font-size: clamp(24px, 4vw, 36px); font-weight: 900;
  margin-bottom: 12px;
}
.duo-setup h1 span {
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.duo-setup-sub { color: var(--muted); font-size: 15px; max-width: 480px; margin-bottom: 40px; line-height: 1.6; }

.duo-setup-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; max-width: 640px; }

.duo-setup-card {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 20px;
  padding: 32px 24px; text-align: center; cursor: pointer; transition: all .3s;
}
.duo-setup-card:hover { border-color: var(--green); transform: translateY(-4px); box-shadow: 0 20px 60px rgba(46,201,154,.1); }
.duo-setup-card-icon { font-size: 40px; margin-bottom: 16px; }
.duo-setup-card h3 { font-family: 'Unbounded', sans-serif; font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.duo-setup-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ── Список iснуючих пар ── */
.duo-pairs-list { width: 100%; max-width: 640px; margin-bottom: 32px; }
.duo-pairs-title {
  font-family: 'Unbounded', sans-serif; font-size: 15px; font-weight: 800;
  margin-bottom: 14px; text-align: left;
}
.duo-pairs-grid { display: flex; flex-direction: column; gap: 10px; }

.duo-pair-card {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 14px;
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: all .25s;
}
.duo-pair-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 12px 36px rgba(46,201,154,.08); }

.duo-pair-left { display: flex; align-items: center; gap: 14px; }
.duo-pair-avatars { display: flex; align-items: center; }
.duo-pair-av {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; flex-shrink: 0;
}
.duo-pair-av.me { background: var(--green); color: #0A1F16; z-index: 1; }
.duo-pair-av.friend { background: var(--purple); color: white; margin-left: -10px; }
.duo-pair-av.waiting { background: var(--border2); color: var(--muted); margin-left: -10px; font-size: 16px; }

.duo-pair-info h4 { font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.duo-pair-info p { font-size: 12px; color: var(--muted); }

.duo-pair-right { display: flex; align-items: center; gap: 12px; }
.duo-pair-streak {
  font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 800;
  color: var(--yellow); display: flex; align-items: center; gap: 4px;
}
.duo-pair-arrow { color: var(--muted); font-size: 18px; }

/* ── Модалка створення ── */
.duo-modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(8px);
}
.duo-modal-overlay.open { display: flex; }
.duo-modal {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 24px;
  padding: 40px 36px; max-width: 460px; width: 100%; text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,.3); animation: duo-modal-in .3s ease;
}
@keyframes duo-modal-in {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.duo-modal h2 {
  font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 900; margin-bottom: 8px;
}
.duo-modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* Код запрошення */
.duo-code-display {
  background: var(--bg); border: 2px dashed var(--border2); border-radius: 16px;
  padding: 20px; margin-bottom: 20px;
}
.duo-code-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.duo-code-value {
  font-family: 'Unbounded', sans-serif; font-size: 36px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.duo-code-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.duo-code-btn {
  padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--green); background: rgba(46,201,154,.08); color: var(--green);
  cursor: pointer; font-family: 'Nunito', sans-serif; transition: all .2s;
}
.duo-code-btn:hover { background: var(--green); color: #0A1F16; }
.duo-code-btn.outline { border-color: var(--border2); color: var(--muted); background: transparent; }
.duo-code-btn.outline:hover { border-color: var(--text); color: var(--text); }

/* Поле вводу коду */
.duo-join-input {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.duo-join-input input {
  flex: 1; background: var(--input); border: 1.5px solid var(--border2); border-radius: 12px;
  padding: 14px 18px; font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 700;
  color: var(--text); text-align: center; letter-spacing: 6px; outline: none; transition: border .2s;
}
.duo-join-input input::placeholder { letter-spacing: 2px; font-size: 14px; color: var(--muted); font-weight: 400; }
.duo-join-input input:focus { border-color: var(--green); }

/* Статус очікування */
.duo-waiting { margin-top: 20px; }
.duo-waiting-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.duo-waiting-dots span {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green); opacity: .3;
  animation: duo-pulse 1.4s ease-in-out infinite;
}
.duo-waiting-dots span:nth-child(2) { animation-delay: .2s; }
.duo-waiting-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes duo-pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.duo-waiting-text { color: var(--muted); font-size: 13px; }

/* Помилка */
.duo-error { color: var(--red); font-size: 13px; margin-top: 8px; display: none; }
.duo-error.show { display: block; }

/* ══════════════════════════════════════════
   СТАН: Є ПАРА — СПІЛЬНИЙ ДАШБОРД
   ══════════════════════════════════════════ */

/* Кнопка назад до списку */
.duo-back-to-list {
  background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 700;
  cursor: pointer; padding: 0; margin-bottom: 16px; font-family: 'Nunito', sans-serif;
  transition: color .2s; display: flex; align-items: center; gap: 6px;
}
.duo-back-to-list:hover { color: var(--green); }

/* Хедер пари */
.duo-header {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 20px;
  padding: 28px 32px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between;
}
.duo-header-pair { display: flex; align-items: center; gap: 20px; }
.duo-avatar {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-size: 18px; font-weight: 900; color: #0A1F16;
  flex-shrink: 0;
}
.duo-avatar.me { background: var(--green); }
.duo-avatar.friend { background: var(--purple); color: white; }
.duo-vs {
  font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 900; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.duo-vs-line { width: 30px; height: 1.5px; background: var(--border2); }
.duo-header-info { text-align: right; }
.duo-header-names {
  font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 800; margin-bottom: 4px;
}
.duo-header-names .me { color: var(--green); }
.duo-header-names .friend { color: var(--purple); }
.duo-header-status { font-size: 12px; color: var(--muted); }
.duo-header-status .online { color: var(--green); }

/* Спільний стрік */
.duo-streak-banner {
  background: linear-gradient(135deg, rgba(46,201,154,.08), rgba(155,81,224,.08));
  border: 1.5px solid rgba(46,201,154,.15); border-radius: 16px;
  padding: 20px 28px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between;
}
.duo-streak-left { display: flex; align-items: center; gap: 14px; }
.duo-streak-fire { font-size: 36px; }
.duo-streak-num {
  font-family: 'Unbounded', sans-serif; font-size: 28px; font-weight: 900;
  background: linear-gradient(135deg, var(--green), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.duo-streak-lbl { font-size: 13px; color: var(--muted); }
.duo-streak-today { display: flex; gap: 12px; }
.duo-streak-check {
  display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--border);
}
.duo-streak-check.done { border-color: var(--green); color: var(--green); background: rgba(46,201,154,.06); }
.duo-streak-check.waiting { border-color: var(--border); color: var(--muted); }

/* Головна сітка */
.duo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* Картки порівняння */
.duo-compare-card {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 16px; padding: 24px;
}
.duo-compare-title {
  font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 800;
  color: var(--muted); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .5px;
}
.duo-compare-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.duo-compare-row:last-child { margin-bottom: 0; }
.duo-compare-label { width: 100px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.duo-compare-bars { flex: 1; display: flex; gap: 4px; align-items: center; }
.duo-compare-bar {
  height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: flex-end;
  padding: 0 8px; font-size: 11px; font-weight: 800; min-width: 30px; transition: width .6s cubic-bezier(.16,1,.3,1);
}
.duo-compare-bar.me { background: var(--green); color: #0A1F16; border-radius: 6px 0 0 6px; }
.duo-compare-bar.friend { background: var(--purple); color: white; border-radius: 0 6px 6px 0; justify-content: flex-start; }

/* Блок дуелі */
/* Pending duel invite */
.duo-pending-duel {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px;
  background: rgba(46,201,154,.08); border: 1.5px solid rgba(46,201,154,.25);
  border-radius: 16px; padding: 20px 24px;
  animation: duo-pulse 2s ease-in-out infinite;
}
@keyframes duo-pulse { 0%,100%{border-color:rgba(46,201,154,.25)} 50%{border-color:rgba(46,201,154,.6)} }
.duo-pending-emoji { font-size: 32px; flex-shrink: 0; }
.duo-pending-text { flex: 1; }
.duo-pending-title { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.duo-pending-info { font-size: 13px; color: var(--muted); }
.duo-pending-btn {
  padding: 10px 24px; border-radius: 12px; border: none;
  background: var(--green); color: #0A1F16; font-weight: 800;
  font-family: 'Nunito', sans-serif; font-size: 14px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.duo-pending-btn:hover { filter: brightness(1.1); transform: scale(1.03); }

.duo-duel-card {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 16px;
  padding: 28px; text-align: center; grid-column: 1 / -1;
}
.duo-duel-card h3 {
  font-family: 'Unbounded', sans-serif; font-size: 18px; font-weight: 900; margin-bottom: 8px;
}
.duo-duel-desc { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.duo-duel-subjects {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px;
}
.duo-duel-subj {
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--border); background: transparent; color: var(--text);
  cursor: pointer; transition: all .2s; font-family: 'Nunito', sans-serif;
}
.duo-duel-subj:hover { border-color: var(--green); }
.duo-duel-subj.selected { border-color: var(--green); background: rgba(46,201,154,.1); color: var(--green); }

.duo-duel-options { display: flex; gap: 12px; justify-content: center; margin-bottom: 20px; }
.duo-duel-opt {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 10px; border: 1.5px solid var(--border); font-size: 13px;
  color: var(--muted); cursor: pointer; transition: all .2s; font-family: 'Nunito', sans-serif; background: transparent;
}
.duo-duel-opt:hover { border-color: var(--yellow); color: var(--yellow); }
.duo-duel-opt.active { border-color: var(--yellow); color: var(--yellow); background: rgba(245,200,0,.06); }

.duo-start-btn {
  padding: 14px 40px; border-radius: 14px; font-size: 15px; font-weight: 800;
  border: none; background: linear-gradient(135deg, var(--green), #28B780); color: #0A1F16;
  cursor: pointer; font-family: 'Nunito', sans-serif; transition: all .2s;
  box-shadow: 0 8px 30px rgba(46,201,154,.25);
}
.duo-start-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(46,201,154,.35); }
.duo-start-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Результати дуелі */
.duo-results {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 20px;
  padding: 32px; text-align: center; grid-column: 1 / -1; display: none;
}
.duo-results.show { display: block; animation: duo-modal-in .4s ease; }
.duo-results-emoji { font-size: 64px; margin-bottom: 16px; }
.duo-results h2 {
  font-family: 'Unbounded', sans-serif; font-size: 22px; font-weight: 900; margin-bottom: 20px;
}
.duo-results-table {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px 20px;
  max-width: 400px; margin: 0 auto 24px; text-align: center;
}
.duo-results-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 800; }
.duo-results-val { font-family: 'Unbounded', sans-serif; font-size: 24px; font-weight: 900; }
.duo-results-val.me { color: var(--green); }
.duo-results-val.friend { color: var(--purple); }
.duo-results-metric { font-size: 13px; color: var(--muted); }
.duo-results-winner {
  font-size: 13px; color: var(--green); font-weight: 700; display: inline-block;
  background: rgba(46,201,154,.08); padding: 4px 12px; border-radius: 6px;
}

/* Поради */
.duo-tips {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 16px;
  padding: 24px; grid-column: 1 / -1; text-align: left;
}
.duo-tips-title {
  font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 800; margin-bottom: 14px;
}
.duo-tip-item {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.duo-tip-item:last-child { border-bottom: none; }
.duo-tip-for {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; flex-shrink: 0; height: fit-content; margin-top: 2px;
}
.duo-tip-for.me { background: rgba(46,201,154,.12); color: var(--green); }
.duo-tip-for.friend { background: rgba(155,81,224,.12); color: var(--purple); }
.duo-tip-text { font-size: 13px; color: var(--text2); line-height: 1.5; }

/* Історія дуелей */
.duo-history {
  background: var(--bg2); border: 1.5px solid var(--border2); border-radius: 16px;
  padding: 24px; grid-column: 1 / -1;
}
.duo-history-title {
  font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 800; margin-bottom: 14px;
}
.duo-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.duo-history-item:last-child { border-bottom: none; }
.duo-history-subj { font-weight: 700; font-size: 14px; }
.duo-history-date { font-size: 12px; color: var(--muted); }
.duo-history-score { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.duo-history-score .me { color: var(--green); }
.duo-history-score .friend { color: var(--purple); }

/* Кнопка розірвати пару */
.duo-leave-btn {
  margin-top: 20px; padding: 10px 20px; border-radius: 10px; font-size: 13px;
  border: 1.5px solid rgba(224,92,92,.3); background: rgba(224,92,92,.06); color: var(--red);
  cursor: pointer; font-family: 'Nunito', sans-serif; transition: all .2s; font-weight: 700;
}
.duo-leave-btn:hover { background: var(--red); color: white; border-color: var(--red); }

/* Модалка закінчити */
.duo-modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 20px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; border-radius: 8px; transition: all .2s;
}
.duo-modal-close:hover { background: var(--border); color: var(--text); }
.duo-modal { position: relative; }

/* ══════════════════════════════════════════
   РЕЖИМ ДУЕЛІ (під час тесту)
   ══════════════════════════════════════════ */
.duo-live-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  background: var(--bg2); border-top: 1.5px solid var(--border2);
  padding: 12px 24px; display: none; align-items: center; justify-content: space-between;
  backdrop-filter: blur(24px);
}
.duo-live-bar.active { display: flex; }
.duo-live-left, .duo-live-right { display: flex; align-items: center; gap: 10px; }
.duo-live-avatar { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.duo-live-name { font-size: 13px; font-weight: 700; }
.duo-live-progress { font-size: 12px; color: var(--muted); }
.duo-live-vs {
  font-family: 'Unbounded', sans-serif; font-size: 11px; color: var(--muted);
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .duo-nav { padding: 0 14px; height: 56px; }
  .duo-nav-title { font-size: 13px; }
  .duo-page { padding-top: 72px; }
  .duo-setup-cards { grid-template-columns: 1fr; gap: 14px; }
  .duo-grid { grid-template-columns: 1fr; }
  .duo-header { flex-direction: column; gap: 14px; text-align: center; padding: 22px 20px; }
  .duo-header-info { text-align: center; }
  .duo-header-names { font-size: 13px; }
  .duo-avatar { width: 44px; height: 44px; font-size: 16px; }
  .duo-streak-banner { flex-direction: column; gap: 14px; text-align: center; padding: 16px 20px; }
  .duo-streak-num { font-size: 24px; }
  .duo-streak-fire { font-size: 28px; }
  .duo-streak-today { justify-content: center; flex-wrap: wrap; }
  .duo-streak-check { font-size: 12px; padding: 7px 12px; }
  .duo-results-table { grid-template-columns: 1fr; gap: 8px; }
  .duo-results h2 { font-size: 18px; }
  .duo-results-val { font-size: 20px; }
  .duo-modal { padding: 24px 18px; margin: 12px; border-radius: 20px; }
  .duo-modal h2 { font-size: 18px; }
  .duo-duel-options { flex-direction: column; align-items: center; }
  .duo-duel-card h3 { font-size: 16px; }
  .duo-duel-card { padding: 22px 18px; }
  .duo-compare-card { padding: 18px; }
  .duo-compare-title { font-size: 12px; }
  .duo-compare-row { flex-direction: column; gap: 6px; }
  .duo-compare-label { width: auto; font-size: 12px; }
  .duo-live-bar { padding: 10px 14px; }
  .duo-live-name { font-size: 12px; }
  .duo-tips { padding: 18px; }
  .duo-tips-title { font-size: 13px; }
  .duo-history { padding: 18px; }
  .duo-history-title { font-size: 13px; }
  .duo-start-btn { padding: 12px 28px; font-size: 14px; }
  .duo-pair-card { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .duo-page { padding-left: 12px; padding-right: 12px; }
  .duo-code-value { font-size: 24px; letter-spacing: 4px; }
  .duo-code-display { padding: 16px; }
  .duo-setup-card { padding: 20px 16px; }
  .duo-setup-card h3 { font-size: 14px; }
  .duo-setup-card-icon { font-size: 32px; }
  .duo-setup h1 { font-size: clamp(20px, 5vw, 28px); }
  .duo-setup-sub { font-size: 13px; }
  .duo-join-input input { font-size: 16px; padding: 12px 14px; }
  .duo-code-btn { padding: 8px 14px; font-size: 12px; }
  .duo-duel-subj { padding: 7px 12px; font-size: 12px; }
  .duo-leave-btn { font-size: 12px; padding: 8px 16px; }
}
