/* =============================================================
   LGG BATTLE MODE — CSS
   ============================================================= */

/* ── Online Users Panel ──────────────────────────────────────── */
#lgc-battle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: .9rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #c94a10;
  transition: transform .1s, box-shadow .1s;
  position: relative;
}
#lgc-battle-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c94a10; }
#lgc-battle-online-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #7fff00;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,.4);
  animation: lgcBlink 1.5s infinite;
}
@keyframes lgcBlink { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Battle Modal Overlay ────────────────────────────────────── */
#lgc-battle-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 9998;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#lgc-battle-overlay.open { display: flex; }

#lgc-battle-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  position: relative;
  animation: lgcSlideUp .25s ease;
}
@keyframes lgcSlideUp { from{transform:translateY(30px);opacity:0} to{transform:none;opacity:1} }

.lgc-bm-header {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: #fff;
  padding: 20px 24px 16px;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lgc-bm-header h2 { margin: 0; font-size: 1.2rem; font-weight: 900; }
.lgc-bm-close {
  background: rgba(255,255,255,.25);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.lgc-bm-body { padding: 20px 24px 24px; }

/* Online list */
.lgc-online-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lgc-online-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f7f8fa;
  border-radius: 12px;
  font-size: .95rem;
}
.lgc-online-item.me { background: #fff8e1; }
.lgc-online-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #58cc02, #1cb0f6);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lgc-online-name { flex: 1; font-weight: 600; }
.lgc-online-me-tag {
  font-size: .75rem;
  background: #ffe082;
  color: #5d4037;
  border-radius: 6px;
  padding: 1px 7px;
  font-weight: 700;
}
.lgc-challenge-btn {
  background: #ff6b35;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .1s;
}
.lgc-challenge-btn:hover { transform: scale(1.05); }

/* ── Tabs inside modal ───────────────────────────────────────── */
.lgc-bm-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.lgc-bm-tab {
  flex: 1;
  padding: 9px 0;
  border: 2px solid #e5e7eb;
  background: #f7f8fa;
  border-radius: 10px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}
.lgc-bm-tab.active {
  background: #ff6b35;
  color: #fff;
  border-color: #ff6b35;
}

/* ── Setup form ──────────────────────────────────────────────── */
.lgc-bm-form-row {
  margin-bottom: 14px;
}
.lgc-bm-form-row label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  color: #444;
  margin-bottom: 5px;
}
.lgc-bm-select, .lgc-bm-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: .95rem;
  appearance: auto;
  box-sizing: border-box;
}
.lgc-bm-select:focus, .lgc-bm-input:focus {
  outline: none;
  border-color: #ff6b35;
}
.lgc-bm-num-btns {
  display: flex;
  gap: 8px;
}
.lgc-bm-num-btn {
  flex: 1;
  padding: 9px 0;
  border: 2px solid #e5e7eb;
  background: #f7f8fa;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
  transition: all .15s;
}
.lgc-bm-num-btn.selected {
  background: #ff6b35;
  color: #fff;
  border-color: #ff6b35;
}

.lgc-bm-primary-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #c94a10;
  transition: transform .1s, box-shadow .1s;
  margin-top: 6px;
}
.lgc-bm-primary-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c94a10; }
.lgc-bm-primary-btn:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }

/* ── Lobby ───────────────────────────────────────────────────── */
.lgc-bm-code-box {
  text-align: center;
  background: #fff8f0;
  border: 2px dashed #ff6b35;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.lgc-bm-code-box .code-label { font-size: .8rem; color: #888; font-weight: 600; }
.lgc-bm-code-val {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ff6b35;
  letter-spacing: 8px;
}
.lgc-bm-player-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 14px;
}
.lgc-bm-player-item {
  display: flex; align-items: center; gap: 9px;
  background: #f7f8fa; border-radius: 10px; padding: 9px 12px;
  font-weight: 600; font-size: .93rem;
}
.lgc-bm-player-item .host-crown { color: #f7c800; }

/* ── In-game screen ──────────────────────────────────────────── */
#lgc-battle-game {
  display: none;
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  z-index: 9999;
  flex-direction: column;
  overflow: hidden;
}
#lgc-battle-game.open { display: flex; }

.lgc-bg-top {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  padding: 14px 18px 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.lgc-bg-title { font-weight: 900; font-size: 1rem; }
.lgc-bg-qcount { font-size: .82rem; opacity: .9; font-weight: 600; }

.lgc-bg-scoreboard {
  background: rgba(255,255,255,.07);
  padding: 10px 18px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  flex-shrink: 0;
}
.lgc-bg-score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
  font-size: .82rem;
  color: #fff;
  font-weight: 700;
}
.lgc-bg-score-pill.me { background: rgba(255,214,0,.25); }
.lgc-bg-score-pill .score-num { font-weight: 900; font-size: 1rem; color: #ffd600; }

.lgc-bg-progress {
  height: 6px;
  background: rgba(255,255,255,.15);
  flex-shrink: 0;
}
.lgc-bg-progress-fill {
  height: 100%;
  background: #7fff00;
  transition: width .4s ease;
}

.lgc-bg-question-area {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lgc-bg-q-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.lgc-bg-q-type-tag {
  display: inline-block;
  background: #fff3e0;
  color: #e65100;
  font-size: .72rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.lgc-bg-q-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 18px;
  line-height: 1.4;
}
.lgc-bg-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lgc-bg-choice-btn {
  width: 100%;
  padding: 13px 16px;
  border: 2.5px solid #e5e7eb;
  border-radius: 12px;
  background: #f7f8fa;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.lgc-bg-choice-btn:hover:not(:disabled) {
  background: #fff3e0;
  border-color: #ff6b35;
  color: #e65100;
}
.lgc-bg-choice-btn.correct {
  background: #e8f5e9;
  border-color: #43a047;
  color: #2e7d32;
}
.lgc-bg-choice-btn.wrong {
  background: #fce4ec;
  border-color: #e91e63;
  color: #880e4f;
}
.lgc-bg-choice-btn:disabled { cursor: not-allowed; }

.lgc-bg-text-input-wrap {
  display: flex; gap: 8px;
}
.lgc-bg-text-input {
  flex: 1;
  padding: 12px 14px;
  border: 2.5px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
}
.lgc-bg-text-input:focus { outline: none; border-color: #ff6b35; }
.lgc-bg-submit-btn {
  padding: 12px 18px;
  background: #ff6b35;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lgc-bg-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
}
.lgc-bg-feedback.ok  { background: #e8f5e9; color: #2e7d32; }
.lgc-bg-feedback.bad { background: #fce4ec; color: #880e4f; }

/* ── Results screen ──────────────────────────────────────────── */
.lgc-bg-results {
  padding: 28px 20px;
  text-align: center;
  color: #fff;
}
.lgc-bg-winner-banner {
  font-size: 3rem;
  margin-bottom: 8px;
}
.lgc-bg-winner-name {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 4px;
}
.lgc-bg-winner-sub {
  font-size: .9rem;
  opacity: .8;
  margin-bottom: 22px;
}
.lgc-bg-final-list {
  list-style: none; margin: 0 auto 22px; padding: 0;
  max-width: 320px;
  display: flex; flex-direction: column; gap: 9px;
  text-align: left;
}
.lgc-bg-final-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
}
.lgc-bg-final-item.winner { background: rgba(255,214,0,.2); }
.lgc-bg-final-rank { font-size: 1.2rem; width: 28px; }
.lgc-bg-final-name { flex: 1; font-size: .95rem; }
.lgc-bg-final-score { font-size: 1.1rem; font-weight: 900; color: #ffd600; }

.lgc-bg-leave-btn {
  padding: 13px 32px;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

/* ── Waiting / pulse ─────────────────────────────────────────── */
.lgc-bg-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  font-weight: 600;
  gap: 14px;
}
.lgc-bg-pulse {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #ff6b35;
  animation: lgcPulse 1s infinite;
}
@keyframes lgcPulse {
  0%   { transform: scale(.9); box-shadow: 0 0 0 0 rgba(255,107,53,.7); }
  70%  { transform: scale(1);  box-shadow: 0 0 0 16px rgba(255,107,53,0); }
  100% { transform: scale(.9); box-shadow: 0 0 0 0 rgba(255,107,53,0); }
}

/* ── Notification toast ──────────────────────────────────────── */
#lgc-battle-notif {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  z-index: 10000;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  white-space: nowrap;
}
#lgc-battle-notif.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Entering room code ──────────────────────────────────────── */
.lgc-code-input-row {
  display: flex; gap: 8px;
}
.lgc-code-input-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}

/* ── Mobile tweaks ───────────────────────────────────────────── */
@media (max-width: 420px) {
  .lgc-bg-q-card { padding: 18px 14px; }
  .lgc-bg-q-title { font-size: 1rem; }
}

/* ── Multi-topic selector ─────────────────────────────────────── */
.lgc-bm-topic-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 4px;
  background: #fafafa;
  margin-top: 4px;
}
.lgc-bm-topic-group {
  font-size: .7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #ff6b35;
  padding: 6px 10px 2px;
}
.lgc-bm-topic-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: .88rem;
  color: #333;
  cursor: pointer;
  border-radius: 6px;
  transition: background .1s;
}
.lgc-bm-topic-check:hover { background: #fff3ee; }
.lgc-bm-topic-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #ff6b35;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Desktop nav Battle tab ───────────────────────────────────── */
/* Hide the old floating battle button — nav tab replaces it */
#lgc-battle-btn { display: none !important; }

/* Online dot inside desktop nav tab */
#ntab-battle-dot {
  display: none;
  width: 8px; height: 8px;
  background: #7fff00;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,.15);
  vertical-align: middle;
  margin-left: 4px;
  animation: lgcBlink 1.5s infinite;
}

/* ── Multi-player selection in Online tab ─────────────────────── */
.lgc-select-hint {
  font-size: .8rem;
  color: #888;
  font-weight: 600;
  margin: 0 0 10px;
}
.lgc-online-item.lgc-selectable {
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  user-select: none;
}
.lgc-online-item.lgc-selectable:hover { background: #fff3ee; }
.lgc-online-item.lgc-selectable.selected {
  background: #fff3e0;
  box-shadow: 0 0 0 2px #ff6b35;
}
.lgc-sel-check {
  display: none;
  font-size: 1.1rem;
  font-weight: 900;
  color: #ff6b35;
  margin-left: auto;
}
.lgc-online-item.selected .lgc-sel-check { display: block; }
#lgc-challenge-bar { margin-top: 14px; }

/* Challenge who banner in New Game tab */
.lgc-bm-challenge-who {
  background: #fff3e0;
  border-left: 4px solid #ff6b35;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .88rem;
  color: #5d2a00;
  margin-bottom: 14px;
}

/* ── Incoming challenge pop-up ────────────────────────────────── */
.lgc-challenge-popup {
  position: fixed;
  bottom: 90px;
  right: 18px;
  z-index: 10001;
  animation: lgcChPopIn .35s cubic-bezier(.175,.885,.32,1.275);
  max-width: 300px;
  width: calc(100vw - 36px);
}
@keyframes lgcChPopIn {
  from { transform: translateY(40px) scale(.9); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.lgc-challenge-popup.lgc-ch-pop-out {
  animation: lgcChPopOut .3s ease forwards;
}
@keyframes lgcChPopOut {
  to { transform: translateY(20px) scale(.95); opacity: 0; }
}
.lgc-ch-pop-inner {
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25), 0 0 0 3px #ff6b35;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.lgc-ch-pop-icon { font-size: 2.2rem; line-height: 1; margin-bottom: 2px; }
.lgc-ch-pop-msg { font-size: .95rem; font-weight: 700; color: #1a1a2e; }
.lgc-ch-pop-topic { font-size: .78rem; color: #888; font-weight: 600; }
.lgc-ch-pop-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}
.lgc-ch-pop-accept {
  flex: 1;
  padding: 10px 0;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: .9rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #c94a10;
  transition: transform .1s;
}
.lgc-ch-pop-accept:active { transform: translateY(2px); box-shadow: none; }
.lgc-ch-pop-decline {
  padding: 10px 16px;
  background: #f3f4f6;
  color: #555;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.lgc-ch-pop-decline:hover { background: #e5e7eb; }

/* ── Battle Type Selector ─────────────────────────────────────── */
.lgc-bm-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.lgc-bm-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 6px 10px;
  border: 2.5px solid #e5e7eb;
  background: #f7f8fa;
  border-radius: 14px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  line-height: 1.2;
}
.lgc-bm-type-btn:hover:not(.selected) {
  border-color: #ffb89a;
  background: #fff8f4;
}
.lgc-bm-type-btn.selected {
  border-color: #ff6b35;
  background: #fff3e0;
  box-shadow: 0 0 0 1px #ff6b35;
}
.lgc-bm-type-icon { font-size: 1.5rem; line-height: 1; }
.lgc-bm-type-name {
  font-size: .82rem;
  font-weight: 800;
  color: #1a1a2e;
}
.lgc-bm-type-desc {
  font-size: .68rem;
  color: #888;
  font-weight: 500;
}
.lgc-bm-type-btn.selected .lgc-bm-type-name { color: #e65100; }

@media (max-width: 420px) {
  .lgc-bm-type-desc { display: none; }
  .lgc-bm-type-btn { padding: 10px 4px 8px; }
}

/* ── Scoreboard score-bump animation ─────────────────────────── */
@keyframes lgcScoreBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); background: #ffe082; }
  100% { transform: scale(1); }
}
.lgc-bg-score-pill.score-bump { animation: lgcScoreBump .35s ease; }
.lgc-bg-score-pill.done .lgc-sb-flag { opacity: .7; font-size: .8rem; }
