/* ═══════════════════════════════════════
   Islamic Board Game - Complete CSS
   ═══════════════════════════════════════ */

:root {
  --gold: #d4af37;
  --gold-light: #f0d060;
  --green-dark: #0f2d1a;
  --green-mid: #1a472a;
  --glass: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.15);
  --font: 'Hind Siliguri', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: linear-gradient(135deg, #0f2d1a, #1a472a, #0d3b2e);
  background-attachment: fixed;
  min-height: 100vh;
  color: white;
}

.bg-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 30, 15, 0.75);
  z-index: -1;
}

/* ── Typography ── */
.game-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(212,175,55,0.5);
}
.game-sub  { color: rgba(255,255,255,0.6); font-size: 1rem; }
.bismillah { 
  font-size: 1.3rem; color: var(--gold-light); 
  letter-spacing: 2px; margin-top: 0.3rem; 
}
.text-gold { color: var(--gold) !important; }
.text-muted-light { color: rgba(255,255,255,0.55); }

/* ── Logo ── */
.logo-icon {
  font-size: 5rem;
  display: block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 15px rgba(212,175,55,0.5));
}
.logo-full-img {
    max-width: 380px;
    width: 90%;
    filter: drop-shadow(0 4px 20px rgba(212,175,55,0.5));
    animation: float 3s ease-in-out infinite;
    margin-bottom: 0.5rem;
}

/* ── Glass Card ── */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ── Section Title ── */
.section-title {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Custom Input ── */
.custom-input {
  background: rgba(255,255,255,0.1) !important;
  border: 1px solid var(--border) !important;
  color: white !important;
  border-radius: 10px !important;
  font-family: var(--font) !important;
}
.custom-input:focus {
  background: rgba(255,255,255,0.15) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(212,175,55,0.2) !important;
  color: white !important;
}
.custom-input::placeholder { color: rgba(255,255,255,0.35) !important; }

/* ── Buttons ── */
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b8941f);
  border: none; color: #1a1a1a; font-weight: 700;
  border-radius: 10px; font-family: var(--font);
  transition: all 0.3s;
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(212,175,55,0.5);
  color: #1a1a1a;
}
.btn-gold:disabled {
  opacity: 0.5; transform: none; cursor: not-allowed;
}
.btn-green {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  border: none; color: white; font-weight: 700;
  border-radius: 10px; font-family: var(--font);
  transition: all 0.3s;
}
.btn-green:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39,174,96,0.5);
  color: white;
}

/* ── Mode Buttons ── */
.mode-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 0.8rem;
  background: rgba(255,255,255,0.07);
  border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer;
  transition: all 0.3s;
}
.mode-btn:hover { background: rgba(255,255,255,0.12); }
.mode-btn.active {
  border-color: var(--gold);
  background: rgba(212,175,55,0.15);
  color: var(--gold);
}
.mode-icon { font-size: 1.6rem; }
.mode-label { font-size: 0.9rem; font-weight: 600; margin-top: 4px; }

/* ── Avatar Grid ── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.avatar-item {
  aspect-ratio: 1; border-radius: 10px;
  background: rgba(255,255,255,0.07);
  border: 2px solid transparent;
  display: flex; align-items: center;
  justify-content: center; font-size: 1.4rem;
  cursor: pointer; transition: all 0.2s;
}
.avatar-item:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }
.avatar-item.selected {
  border-color: var(--gold);
  background: rgba(212,175,55,0.2);
  transform: scale(1.1);
}

/* ── Divider ── */
.divider-or {
  display: flex; align-items: center;
  gap: 1rem; color: rgba(255,255,255,0.4);
  margin: 0.8rem 0; width: 100%; max-width: 500px;
}
.divider-or::before,.divider-or::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

/* ── Pulse Animation ── */
.pulse-btn { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 4px 15px rgba(212,175,55,0.4); }
  50% { box-shadow: 0 6px 25px rgba(212,175,55,0.8); transform: scale(1.02); }
}

/* ── Float Animation ── */
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ── Fade Animations ── */
.animate-down { animation: fadeDown 0.6s ease; }
.animate-up { animation: fadeUp 0.6s ease 0.2s both; }
@keyframes fadeDown {
  from { opacity:0; transform: translateY(-20px); }
  to { opacity:1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(20px); }
  to { opacity:1; transform: translateY(0); }
}

/* ══════════════════════════════
   LOBBY STYLES
   ══════════════════════════════ */
   .link-display {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    word-break: break-all;
    text-align: left;
    font-family: monospace;
}
.room-code-box {
  background: rgba(212,175,55,0.08);
  border: 2px solid rgba(212,175,55,0.3);
  border-radius: 12px; padding: 1rem;
}
.room-code-big {
  font-size: 2.2rem; font-weight: 700;
  color: var(--gold); font-family: monospace;
  letter-spacing: 0.5rem;
  background: rgba(212,175,55,0.1);
  padding: 0.4rem 1.2rem; border-radius: 10px;
}
.badge-mode {
  background: rgba(212,175,55,0.15);
  color: var(--gold);
  border: 1px solid rgba(212,175,55,0.3);
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.85rem; font-weight: 600;
}
.player-lobby-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  background: rgba(255,255,255,0.06);
  border-radius: 10px; margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}
.player-avatar-sm {
  width: 42px; height: 42px;
  border-radius: 50%; font-size: 1.4rem;
  display: flex; align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 2px solid;
}
.host-tag {
  background: var(--gold); color: #1a1a1a;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
  margin-left: 6px;
}
.waiting-pulse {
  color: rgba(255,255,255,0.6); font-size: 1rem;
  animation: pulse 2s ease-in-out infinite;
  padding: 1rem;
}

/* ══════════════════════════════
   GAME PAGE STYLES
   ══════════════════════════════ */
.game-page { overflow: hidden; }

.game-wrapper {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.game-topbar {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.game-title-sm { color: var(--gold); font-size: 0.95rem; font-weight: 700; }

.game-main {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  flex: 1; overflow: hidden;
  gap: 0;
}

/* Sidebars */
.game-sidebar-left,
.game-sidebar-right {
  display: flex; flex-direction: column;
  gap: 0.5rem; padding: 0.5rem;
  background: rgba(0,0,0,0.25);
  overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--border);
}
.game-sidebar-left { border-right-color: var(--border); }
.game-sidebar-right { border-left-color: var(--border); }

.panel-box {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-radius: 10px; padding: 0.6rem;
  border: 1px solid var(--border);
}
.panel-title {
  color: var(--gold); font-size: 0.75rem;
  font-weight: 600; margin-bottom: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* Player items in sidebar */
.player-side-item {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px; margin-bottom: 0.3rem;
  border: 1px solid transparent;
  transition: all 0.3s;
}
.player-side-item.active {
  border-color: var(--gold);
  background: rgba(212,175,55,0.1);
}
.player-side-item.disconnected { opacity: 0.5; }

.p-avatar {
  font-size: 1.2rem; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid;
  background: rgba(255,255,255,0.08); flex-shrink: 0;
}
.p-name { font-size: 0.78rem; font-weight: 600; }
.p-money { font-size: 0.72rem; }
.p-pos { font-size: 0.65rem; color: rgba(255,255,255,0.5); }

/* Current turn */
.current-avatar {
  font-size: 2rem; margin-bottom: 0.2rem;
  animation: bounce 1.5s ease-in-out infinite;
}
.current-name { font-weight: 700; color: var(--gold); font-size: 0.9rem; }

/* Timer */
.timer-wrapper {
  position: relative; width: 75px;
  height: 75px; margin: 0 auto;
}
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 7; }
.timer-ring {
  fill: none; stroke: var(--gold); stroke-width: 7;
  stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-num {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 1.2rem; font-weight: 700;
  transition: color 0.3s;
}

/* Center game area */
.game-center {
  display: flex; flex-direction: column;
  padding: 0.5rem; gap: 0.5rem; overflow: hidden;
}

/* Board */
.board-container {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  overflow: hidden;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  width: min(100%, 480px);
  aspect-ratio: 4/5;
  background: rgba(212,175,55,0.1);
  border: 2px solid rgba(212,175,55,0.4);
  border-radius: 12px; padding: 6px;
  align-content: start;
}

.board-cell {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2px; min-height: 44px;
  transition: all 0.3s; position: relative;
}
.cell-start {
  background: rgba(39,174,96,0.25);
  border-color: #27ae60;
}
.cell-end {
  background: rgba(212,175,55,0.25);
  border-color: var(--gold);
}
.cell-num {
  font-size: clamp(0.55rem,1.2vw,0.8rem);
  font-weight: 700; color: rgba(255,255,255,0.8);
  line-height: 1;
}
.cell-label {
  font-size: 0.5rem; color: rgba(255,255,255,0.5);
}
.cell-tokens {
  display: flex; flex-wrap: wrap;
  gap: 1px; justify-content: center;
}
.player-token {
  font-size: clamp(0.7rem,1.5vw,1rem);
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
}

/* Question Box */
.question-box {
  background: var(--glass);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 0.8rem;
  flex-shrink: 0; max-height: 45%;
  overflow-y: auto;
}
.q-header {
  display: flex; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.q-category {
  font-size: 0.75rem; color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  padding: 2px 8px; border-radius: 20px;
}
.q-points { color: var(--gold); font-weight: 700; font-size: 0.85rem; }
.q-text {
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 600; margin-bottom: 0.7rem;
  line-height: 1.5;
}

.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.answer-label {
  display: block; padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.07);
  border: 2px solid var(--border);
  border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; text-align: center;
  transition: all 0.2s; user-select: none;
}
.answer-label:hover {
  background: rgba(255,255,255,0.14);
  border-color: var(--gold);
}
input[type=radio]:checked + .answer-label {
  background: rgba(212,175,55,0.2);
  border-color: var(--gold); color: var(--gold);
}
input[type=radio] { display: none; }

.answer-option.correct .answer-label {
  background: rgba(39,174,96,0.25);
  border-color: #27ae60; color: #2ecc71;
}
.answer-option.wrong .answer-label {
  background: rgba(231,76,60,0.25);
  border-color: #e74c3c; color: #e74c3c;
}

.answer-fb {
  text-align: center; padding: 0.6rem;
  border-radius: 8px; margin-top: 0.5rem;
  font-weight: 600; font-size: 0.9rem;
}
.fb-correct {
  background: rgba(39,174,96,0.2);
  border: 1px solid #27ae60; color: #2ecc71;
}
.fb-wrong {
  background: rgba(231,76,60,0.2);
  border: 1px solid #e74c3c; color: #e74c3c;
}

/* Waiting Box */
.waiting-box {
  flex: 1; display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--glass); border-radius: 12px;
  border: 1px solid var(--border); padding: 2rem;
}
.waiting-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.waiting-text { color: rgba(255,255,255,0.6); font-size: 1rem; text-align: center; }

/* Game Log */
.game-log-list {
  max-height: 180px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.log-item {
  font-size: 0.7rem; padding: 0.25rem 0.4rem;
  border-radius: 5px; border-left: 3px solid;
  background: rgba(255,255,255,0.04);
}
.log-correct { border-color: #27ae60; }
.log-wrong { border-color: #e74c3c; }
.log-info { border-color: #3498db; }
.log-system { border-color: var(--gold); }
.log-time { color: rgba(255,255,255,0.4); font-size: 0.62rem; }

/* Chat */
.chat-box { display: flex; flex-direction: column; }
.chat-list {
  max-height: 120px; overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 0.3rem; margin-bottom: 0.5rem;
}
.chat-msg {
  background: rgba(255,255,255,0.05);
  border-radius: 7px; padding: 0.3rem 0.5rem;
}
.chat-sender { font-size: 0.68rem; color: var(--gold); font-weight: 700; }
.chat-text { font-size: 0.78rem; }
.chat-input-row { display: flex; gap: 0.4rem; }
.chat-input-row .custom-input { font-size: 0.8rem !important; padding: 0.3rem 0.5rem !important; }

/* Winner Modal */
.winner-trophy { font-size: 5rem; animation: bounce 0.8s ease; }
@keyframes bounce {
  0% { transform: scale(0) rotate(-10deg); }
  70% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes bounce { /* for current turn avatar */
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .game-main { grid-template-columns: 1fr; }
  .game-sidebar-left,
  .game-sidebar-right { display: none; }
  .answers-grid { grid-template-columns: 1fr; }
  .game-board { grid-template-columns: repeat(6, 1fr); }
}