* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: black;
    height: 100%;
    position: relative;
    overflow-x: hidden;
}

@font-face {
  font-family: 'TitleFont';
  src: url('../fonts/SixtyfourConvergence-Regular.ttf');
}

/* MAIN CONTAINER - use grid to keep title fixed */
.game-main {
    max-width: 1400px;
    min-width: 832px;
    margin: 0 auto;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.top-container {
    width: 100%;
    height: 40%;
    display: flex;
    justify-content: center;
    align-items: end;
    position: relative;
}

.bottom-container {
    width: 100%;
    height: 60%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lights {
  position: absolute;
  width: 300px;
  height: 300px;
  pointer-events: none;
}

.light {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  filter: blur(120px);
  mix-blend-mode: screen;
  opacity: 30%;
}

.l1 { background: #003cff; }
.l2 { background: #f755c1; }
.l3 { background: #9333ea; }

.l1 {
  animation: move1 4s ease-in-out infinite alternate;
}
.l2 {
  animation: move2 5s ease-in-out infinite alternate;
}
.l3 {
  animation: move3 3s ease-in-out infinite alternate;
}

@keyframes move1 {
  0%   { transform: translate(-120px, -60px) scale(1); }
  50%  { transform: translate(80px, 100px) scale(1.2); }
  100% { transform: translate(-60px, 40px) scale(1.05); }
}

@keyframes move2 {
  0%   { transform: translate(100px, 80px) scale(1.1); }
  50%  { transform: translate(-90px, -100px) scale(1.25); }
  100% { transform: translate(60px, -40px) scale(1.05); }
}

@keyframes move3 {
  0%   { transform: translate(-50px, 120px) scale(1.15); }
  50%  { transform: translate(110px, -70px) scale(1.3); }
  100% { transform: translate(-100px, 60px) scale(1.1); }
}

/* TITLE & IMAGE */
.title-container {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    transform: skewY(8deg);
}

.title-container img {
    display: block;
    width: 300px;
    height: auto;
    margin: 0 auto 1rem auto;
    position: absolute;
    right: 2rem;
    bottom: -0.5rem;
    z-index: 1;

    /* neon glow */
    filter:
        drop-shadow(0 0 6px rgba(255, 0, 200, 0.7))
        drop-shadow(0 0 14px rgba(180, 0, 255, 0.65))
        drop-shadow(0 0 28px rgba(140, 0, 255, 0.55))
        brightness(1.05)
        saturate(1.15);

    transform-origin: center;
    animation: neonFlicker 3.8s infinite;
    will-change: opacity, filter, transform;
}

@keyframes neonFlicker {
    0%, 18%, 22%, 62%, 64%, 100% {
        opacity: 1;
        filter:
            drop-shadow(0 0 6px rgba(255, 0, 200, 0.75))
            drop-shadow(0 0 14px rgba(180, 0, 255, 0.7))
            drop-shadow(0 0 28px rgba(140, 0, 255, 0.6))
            drop-shadow(0 0 48px rgba(140, 0, 255, 0.35))
            brightness(1.08)
            saturate(1.2);
        transform: scale(1);
    }

    19% {
        opacity: 0.55;
        filter:
            drop-shadow(0 0 2px rgba(255, 0, 200, 0.25))
            drop-shadow(0 0 6px rgba(180, 0, 255, 0.2))
            brightness(0.8)
            saturate(0.9);
        transform: scale(0.998);
    }

    20% {
        opacity: 0.9;
        filter:
            drop-shadow(0 0 4px rgba(255, 0, 200, 0.45))
            drop-shadow(0 0 10px rgba(180, 0, 255, 0.35))
            brightness(0.92)
            saturate(1);
    }

    21% {
        opacity: 0.35;
        filter:
            drop-shadow(0 0 1px rgba(255, 0, 200, 0.15))
            drop-shadow(0 0 3px rgba(180, 0, 255, 0.12))
            brightness(0.7)
            saturate(0.8);
    }

    63% {
        opacity: 0.75;
        filter:
            drop-shadow(0 0 3px rgba(255, 0, 200, 0.35))
            drop-shadow(0 0 8px rgba(180, 0, 255, 0.28))
            brightness(0.88)
            saturate(0.95);
    }

    65% {
        opacity: 0.92;
        filter:
            drop-shadow(0 0 5px rgba(255, 0, 200, 0.55))
            drop-shadow(0 0 12px rgba(180, 0, 255, 0.45))
            drop-shadow(0 0 22px rgba(140, 0, 255, 0.35))
            brightness(1)
            saturate(1.08);
    }
}

h1 {
    font-family: 'TitleFont', sans-serif;
    position: relative;
    text-align: left;
    font-size: 5rem;
    z-index: 2;
    margin-top: 0;
    text-shadow: 8px 8px 4px black;
}

/* Background overlay */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.6);
    z-index: -1;
    background-color: rgba(128, 0, 128, 0.260);
}

/* BUTTONS */
.mode-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    width: 100%;
}

.mode-btn {
    background-color: #000000cc;
    color: white;
    font-size: 1.5rem;
    padding: 1rem 2rem;
    cursor: pointer;
    width: 400px;
    height: 350px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

#bot-btn,
#bot-card {
    border-image: linear-gradient(135deg, #fefefe, #00ff73) 1;
}

#web-btn,
#web-card {
    border-image: linear-gradient(135deg, #fefefe, #00eeff) 1;
}

#local-btn,
#local-card {
    border-image: linear-gradient(135deg, #fefefe, #ffcc00) 1;
}

#local-card {
    width: 400px;
    height: 350px;
}

.mode-btn:hover {
    transform: scale(1.05);
}

.mode-btn div {
    width: 100%;
    background-size: 200% 200%;
    width: 200px;
    height: 200px;
    transition: background-position 0.3s;
}

.mode-icon-bot {
    background: linear-gradient(135deg, #fefefe, #00ff55, #00351c);
    mask: url('../img/FilledBot.png') no-repeat center / contain;
    -webkit-mask: url('../img/FilledBot.png') no-repeat center / contain;
}

.mode-icon-web {
    background: linear-gradient(135deg, #fefefe, #00eeff, #4c00ff);
    mask: url('../img/FilledWeb.png') no-repeat center / contain;
    -webkit-mask: url('../img/FilledWeb.png') no-repeat center / contain;
}

.online-action-btn div {
  background: linear-gradient(135deg, #fefefe, #00eeff, #4c00ff);
  mask: url("/static/img/FilledWeb.png") no-repeat center / contain;
  -webkit-mask: url("/static/img/FilledWeb.png") no-repeat center / contain;
}

.mode-icon-local {
    background: linear-gradient(135deg, #fefefe, #ffcc00, #ff6600);
    mask: url('../img/FilledLocal.png') no-repeat center / contain;
    -webkit-mask: url('../img/FilledLocal.png') no-repeat center / contain;
}

.mode-btn:hover div {
    width: 60%;
    background-position: 90% 90%;
}

/* Form container - doesn't move title because .game-main is flex-start */
#formContainer {
    width: 100%;
    margin-top: 1rem;
}

.game-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Players container (cards) */
.players-container {
    width: 100%;
    margin-bottom: 2rem;
}

.players-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
}

.player-card {
    flex: 1;
    min-width: 280px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    padding: 1.8rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    transition: transform 0.2s;
}

.player-card div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%
}

.not-ready-status {
    color: red;
}

.ready-status {
    color: green;
    font-weight: bold;
}

.mode-btn,
.player-card {
    border: 5px solid;
    clip-path: polygon(
      0 8px,
      8px 0,
      calc(100% - 8px) 0,
      100% 8px,
      100% calc(100% - 8px),
      calc(100% - 8px) 100%,
      8px 100%,
      0 calc(100% - 8px)
    );
}

.player-card h3 {
    font-size: 1.2rem;
    color: #ffcc00;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 1rem;
}

.player-card input {
    width: 90%;
    padding: 12px;
    font-size: 0.8rem;
    text-align: center;
    background: rgba(255,255,255,0.9);
    border: 2px solid black;
    margin-bottom: 1rem;
}

.controls-img {
    width: 80%;
    max-width: 280px;
    margin-top: 0.5rem;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.action-btn {
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
    border: none;
    cursor: pointer;
    min-width: 200px;
}

.go-btn {
    background-color: #00aa00;
    color: white;
    border-bottom: 4px solid #006600;
}

.go-btn:hover {
    background-color: #00cc00;
    transform: scale(1.02);
}

.rank-btn {
    background-color: #ff6600;
    color: white;
    border-bottom: 4px solid #aa4400;
}

.rank-btn:hover {
    background-color: #ff8800;
}

/* Back button */
#backBtn {
    margin-top: 1rem;
    background: #333;
    width: 200px;
}

/* Responsive */
@media (max-width: 900px) {
    .game-main {
        padding: 1rem;
    }
    .mode-btn {
        font-size: 0.9rem;
        width: 200px;
    }
    .player-card h3 {
        font-size: 0.9rem;
    }
    .action-btn {
        font-size: 0.9rem;
        min-width: 160px;
    }
}

@media (max-width: 650px) {
    .players-panel {
        flex-direction: column;
        align-items: center;
    }
    .player-card {
        width: 90%;
    }
    .mode-btn {
        width: 180px;
    }
    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}

/* Fixed bottom-left buttons */
.fixed-buttons {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.fixed-btn {
  background: rgba(0,0,0,0.7);
  border: 2px solid white;
  color: white;
  font-family: 'Pixelify', monospace;
  font-size: 1rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  width: 50px;
  height: 50px;
  text-align: center;
}

.fixed-btn:hover {
  background: white;
  color: black;
  transform: scale(1.05);
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #1a1a1a;
  border: 3px solid #ffcc00;
  padding: 2rem;
  max-width: 500px;
  width: 80%;
  text-align: center;
  color: white;
  font-family: 'Pixelify', monospace;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.modal-content h2 {
  color: #ffcc00;
  margin-bottom: 1rem;
}

.modal-content p {
  line-height: 1.6;
  margin: 1rem 0;
}

.modal-close-btn {
  background: #ff6600;
  border: none;
  color: white;
  padding: 8px 20px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
  font-family: 'Pixelify', monospace;
}

.modal-close-btn:hover {
  background: #ff8800;
}

/* Make sure fixed buttons are not blurred */
body.modal-open .fixed-buttons {
  filter: none;
}

.fixed-btn.audio-off {
  opacity: 0.6;
  filter: grayscale(0.3);
}

#stars {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 20rem;
  overflow: hidden;
  left: 0;
  z-index: -1;
  -webkit-animation: stars 20s linear;
          animation: stars 20s linear;
}
#stars .star {
  position: absolute;
  background: white;
  width: 0.15rem;
  height: 0.15rem;
  border-radius: 50%;
  transform: translate(var(--x), var(--y));
  box-shadow: 0 0 0.25rem rgb(255, 177, 255);
}

.startails {
  position: absolute;
  inset: 0;
  mix-blend-mode: lighten;
}

.startail-r {
  position: absolute;
  right: 200px;
  bottom: 0;
  background: linear-gradient(to right, lightBlue 10%, lightBlue 50%, transparent 80%);
  height: 0.2vmin;
  width: 110px;
  border-radius: 50%;
  filter: drop-shadow(0 0 15px white);
  transform: translateY(-32vmin) rotate(-20deg);
}

.startail-l {
  position: absolute;
  left: 300px;
  bottom: 0;
  background: linear-gradient(to right, lightBlue 10%, lightBlue 30%, transparent 60%);
  height: 0.2vmin;
  width: 80px;
  border-radius: 50%;
  filter: drop-shadow(0 0 15px white);
  transform: translateY(-7vmin) rotate(-20deg);
}

.startail-m {
  position: absolute;
  left: 550px;
  bottom: 150px;
  background: linear-gradient(to right,  lightBlue 10%, lightBlue 50%, transparent 80%);
  height: 0.2vmin;
  width: 150px;
  border-radius: 50%;
  filter: drop-shadow(0 0 15px white);
  transform: translateY(-18vmin) rotate(-20deg);
  opacity: 0.5;
}

/* ===== اضافه شده از index.html ===== */

.online-buttons-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  width: 100%;
}

.online-action-btn {
  background-color: #000000cc;
  color: white;
  font-size: 1.5rem;
  padding: 1rem 2rem;
  cursor: pointer;
  width: 400px;
  height: 350px;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  border: 5px solid;
  border-image: linear-gradient(135deg, #fefefe, #00eeff) 1;
  clip-path: polygon(
    0 8px,
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px)
  );
}

.online-action-btn:hover {
  transform: scale(1.05);
}

/* Modals */
.auth-modal,
.roomcode-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1a1a;
  border: 3px solid #ffcc00;
  padding: 2rem;
  z-index: 2000;
  text-align: center;
  color: white;
  min-width: 300px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.auth-modal input,
.roomcode-modal input {
  display: block;
  width: 80%;
  margin: 1rem auto;
  padding: 8px;
  text-align: center;
}

.auth-modal button,
.roomcode-modal button {
  background: #ff6600;
  border: none;
  color: white;
  padding: 8px 20px;
  cursor: pointer;
  margin: 0.5rem;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1999;
}

.copy-btn {
  background: #00aa00;
}

#userStatus {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 4px;
  z-index: 100;
}

.local-card-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  background-color: yellow;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background-color: white;
  height: 100%;
}

#logoutBtn {
  margin-left: 10px;
  background: red;
  border: 3px solid rgb(255, 75, 75);
  border-bottom: 5px solid rgb(160, 0, 0);
  border-radius: 5px;
  color: white;
  padding: 1.0rem 1.0rem;
  cursor: pointer;
}

#logoutBtn:hover {
  border: 3px solid rgb(255, 75, 75);
  border-top: 5px solid rgb(160, 0, 0);
  box-shadow: 0px 0px 50px rgba(255, 0, 0, 0.3);
}

.action-btn {
  font-size: 1.2rem;
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  min-width: 200px;
  color: white;
  height: 100%;
}

.go-btn {
  background-color: #00aa00;
  border: 3px solid #1dda1d;
  border-bottom: 5px solid #006600;
}

.go-btn:hover {
  border: 3px solid #1dda1d;
  border-top: 5px solid #006600;
  background-color: #00cc00;
  box-shadow: 0px 0px 50px rgba(170, 255, 0, 0.3);
}

.loginLocalBtn {
    cursor: pointer;
    padding: 1.2rem 1.5rem;
    background-color: violet;
    border: 3px solid rgb(255, 191, 255);
    border-bottom: 5px solid purple;
    border-radius: 5px;
}

.loginLocalBtn:hover {
  background-color: rgb(222, 101, 222);
  border: 3px solid rgb(255, 191, 255);
  border-top: 5px solid purple;
}