
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&display=swap');

* {
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at top, #18152b, #0f0c29, #090617);
  font-family: 'Poppins', sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 30px 20px;
  overflow-x: hidden;
}

h1 {
  font-size: 2.4em;
  font-weight: 600;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #b37cff, #8b5cf6, #00c6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(180, 130, 255, 0.5);
}

.game-container {
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 25px;
  backdrop-filter: blur(15px);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 400px;
  max-width: 90%;
}

.menu-container {
  width: 450px;
}

.menu-title {
  font-size: 1.5em;
  margin-bottom: 25px;
  background: linear-gradient(90deg, #ffd89b, #19547b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  margin-bottom: 20px;
}

.menu-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 18px;
  padding: 20px 25px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.menu-btn:hover {
  transform: translateY(-5px);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(59, 130, 246, 0.4));
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

.menu-btn-small {
  background: linear-gradient(90deg, #8e2de2, #4a00e0);
  border: none;
  border-radius: 12px;
  padding: 12px 25px;
  color: white;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
  margin-top: 10px;
}

.menu-btn-small:hover {
  transform: scale(1.05);
  background: linear-gradient(90deg, #a94cf3, #5c10f0);
  box-shadow: 0 0 25px rgba(160, 60, 255, 0.6);
}

.btn-icon {
  font-size: 2.5em;
}

.btn-text {
  font-size: 1.4em;
  font-weight: 600;
}

.btn-desc {
  font-size: 0.9em;
  opacity: 0.8;
}

.footer-text {
  margin-top: 15px;
  font-size: 0.9em;
  opacity: 0.6;
}

.selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.selector label {
  font-size: 1.1em;
}

select {
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 40px 10px 20px;
  font-size: 1em;
  outline: none;
  backdrop-filter: blur(10px);
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), 
                    linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(1em + 2px),
                       calc(100% - 15px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: all 0.3s ease;
}

select:hover {
  background-color: rgba(255,255,255,0.2);
}

select option {
  background-color: #2b2b4a;
  color: white;
}

#board {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}

.cell {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.05);
}

.cell:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.07);
}

.cell.disabled {
  cursor: not-allowed;
}

.cell.X {
  color: #ff5757;
  text-shadow: 0 0 20px rgba(255, 100, 100, 0.9);
}

.cell.O {
  color: #57e3ff;
  text-shadow: 0 0 20px rgba(87, 227, 255, 0.9);
}

.winning-line {
  position: absolute;
  height: 6px;
  background: linear-gradient(90deg, #ff5f6d, #ffc371);
  border-radius: 5px;
  transform-origin: 0 50%;
  animation: glowLine 1s ease-out forwards;
  z-index: 10;
}

@keyframes glowLine {
  from {
    opacity: 0;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
  }
  to {
    opacity: 1;
    box-shadow: 0 0 25px rgba(255,255,255,1);
  }
}

#status {
  font-size: 1.3em;
  margin-top: 10px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
  min-height: 25px;
}

.turn-text {
  font-size: 1.1em;
  margin-bottom: 15px;
  color: #57e3ff;
  text-shadow: 0 0 10px rgba(87, 227, 255, 0.5);
}

button {
  margin-top: 15px;
  padding: 12px 25px;
  font-size: 1.1em;
  background: linear-gradient(90deg, #8e2de2, #4a00e0);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
  transition: 0.3s ease;
}

button:hover {
  transform: scale(1.07);
  background: linear-gradient(90deg, #a94cf3, #5c10f0);
  box-shadow: 0 0 25px rgba(160, 60, 255, 0.6);
}

.btn-secondary {
  background: linear-gradient(90deg, #667eea, #764ba2);
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary:hover {
  background: linear-gradient(90deg, #7c8ff0, #8b5bb8);
  box-shadow: 0 0 25px rgba(102, 126, 234, 0.6);
}

.button-group {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.online-options {
  width: 100%;
  margin: 20px 0;
}

.online-section {
  margin: 20px 0;
  text-align: center;
}

.online-section h3 {
  font-size: 1.2em;
  margin-bottom: 15px;
  color: #b37cff;
}

.divider {
  text-align: center;
  margin: 25px 0;
  font-size: 1.1em;
  opacity: 0.6;
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 1.1em;
  color: white;
  text-align: center;
  outline: none;
  width: 100%;
  max-width: 250px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
  text-transform: none;
  letter-spacing: normal;
}

input[type="text"]:focus {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(255, 255, 255, 0.15);
}

.room-code {
  font-size: 1.8em;
  font-weight: 600;
  color: #00c6ff;
  text-shadow: 0 0 15px rgba(0, 198, 255, 0.5);
  letter-spacing: 3px;
  margin-top: 15px;
}

.room-info {
  margin-bottom: 20px;
  text-align: center;
}

.room-info p {
  margin: 8px 0;
  font-size: 1em;
}

.room-info strong {
  color: #b37cff;
}

.error-text {
  color: #ff5757;
  font-size: 1em;
  margin-top: 15px;
  text-shadow: 0 0 10px rgba(255, 87, 87, 0.5);
}

@media (max-width: 480px) {
  #board {
    grid-template-columns: repeat(3, 80px);
    gap: 8px;
  }
  .cell {
    width: 80px;
    height: 80px;
    font-size: 2em;
  }
  .game-container {
    width: 300px;
    padding: 20px;
  }
  .menu-container {
    width: 320px;
  }
  h1 {
    font-size: 2em;
  }
  .btn-text {
    font-size: 1.2em;
  }
  .btn-icon {
    font-size: 2em;
  }
}

footer {
  margin-top: 40px;
  text-align: center;
  padding: 15px 0;
  width: 100%;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-bottom: 10px;
}

.social-links a {
  color: #fff;
  font-size: 1.8rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  transition: all 0.35s ease;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.social-links a:hover {
  color: #fff;
  transform: scale(1.2);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

.social-links a[aria-label="Telegram"]:hover {
  background: #0088cc;
  box-shadow: 0 0 20px #0088cc;
}

.social-links a[aria-label="Instagram"]:hover {
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  box-shadow: 0 0 20px #fd5949;
}

.social-links a[aria-label="TikTok"]:hover {
  background: linear-gradient(135deg, #69c9d0, #ee1d52, #010101);
  box-shadow: 0 0 20px #ee1d52;
}

.social-links a[aria-label="Snapchat"]:hover {
  background: #fffc00;
  color: #000;
  box-shadow: 0 0 20px #fffc00;
}

footer .copyright {
  font-size: 0.9rem;
  opacity: 0.8;
  color: #ddd;
}
.back-home-btn {
  position: fixed;
  top: 25px;
  left: 25px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  color: #ffffff;
  backdrop-filter: blur(15px);
  transition: all 0.3s ease;
  z-index: 1000;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-home-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(59, 130, 246, 0.4));
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
  color: #00c6ff;
}

.back-btn-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.back-home-btn i {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.back-home-btn:hover i {
  transform: translateX(5px);
}

/* Mobile navigation language controls remain comfortably tappable. */
@media (max-width: 768px) {
  .navbar .nav-actions .lang-switcher > .lang-btn,
  .navbar .mobile-menu .mobile-lang > .lang-btn {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}


/* The compact XO header uses the full viewport at the narrowest width. */
@media (max-width: 340px) {
  .navbar {
    width: calc(100% + 40px) !important;
    margin-inline: -20px !important;
  }

  .navbar .nav-inner {
    padding-inline: 4px !important;
    gap: 0.25rem !important;
  }
}


/* XO play surfaces stay proportionate to their board and controls. The shared
   game theme gives every generic .game-container a 1200px desktop width. */
.xo-game-page .game-container {
  width: min(560px, 100%) !important;
  max-width: 100% !important;
  margin-inline: auto !important;
}

@media (max-width: 480px) {
  .xo-game-page .game-container {
    padding: 20px !important;
  }
}
