/* ===== GLOBAL ===== */
body {
  margin: 0;
  padding: 8px;
  font-family: system-ui, sans-serif;
}

button {
  padding: 10px 12px;
  margin: 4px;
  font-size: 14px;
  border-radius: 6px;
}

.start-clock-btn{
  background-color: #28a745;   /* green */
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
}

.start-clock-btn:hover{
  background-color: #218838;
}

.start-clock-btn:active{
  background-color: #1e7e34;
}
.start-clock-btn:disabled{
  background-color: #999;
  cursor: not-allowed;
}


.stop-clock-btn{
  background-color:#dc3545;   /* RED */
  color:#fff;
  border:none;
  padding:10px 16px;
  border-radius:6px;
  cursor:pointer;
}

.stop-clock-btn:disabled{
  background-color:#999;
  cursor:not-allowed;
}



/* ===== MENU ===== */
.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}


.players-bar {
    display: flex !important;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
    background: #ffeb3b;   /* TEMP: visual check */
	width: 100%;
    max-width: 500px;   /* same as board */
	margin: 0 auto;     /* center it */
}

.players-bar .left {
    flex: 1;
    text-align: left;
}

.players-bar .right {
    flex: 1;
    text-align: right;
}

.players-bar .divider {
    flex: 0;
    padding: 0 10px;
    text-align: center;
}
.blue { color: #2196f3; }   /* Blue */
.red  { color: #e53935; }   /* Red */
.green { color: #4caf50; }







/* Nav Menu */
#navMenu{
  position: relative;
  display: inline-block;
}

/* Menu button */
#menuToggle{
  display: inline-block;
}


/* Dropdown box */
#menuItems{
  display: none;              /* 👈 THIS was missing */
  position: absolute;
  top: 40px;
  left: 0;
  background: #222;
  border-radius: 6px;
  min-width: 200px;
  z-index: 999;
}

/* Menu links */
#menuItems a{
  display: block;
  padding: 10px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #333;
}

#menuItems a:hover{
  background: #444;
}

/* Show dropdown */
#menuItems.show{
  display: block;
}






.white-piece{
  color: #2563eb;
  text-shadow:
    1px 1px 0 #000,
    -1px -1px 0 #aaa;
}

.black-piece{
  color: #dc2626;
  text-shadow:
    1px 1px 0 #000,
    -1px -1px 0 #aaa;
}
.square span {
  font-size: 40px;
  cursor: grab;
}

.square span:active {
  cursor: grabbing;
}

/* ===== SETUP PANEL ===== */
#setupPanel {
  display: none;       /* shown only in setup mode */
  position: fixed;     /* stays in center even if page scrolls */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);  /* center exactly */
  background: #f0f0f0;
  padding: 15px 25px;
  border-radius: 10px;
  box-shadow: 0 0 10px #00000066;
  text-align: center;
  z-index: 1000;       /* above everything */
}

#setupPanel b {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

#setupPanel .pieces {
  margin: 5px 0;
}

#setupPanel button {
  font-size: 20px;
  margin: 2px;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid #888;
  background: #fff;
  transition: 0.2s;
}

#setupPanel button:hover {
  background: #eee;
  transform: scale(1.1);
}


/* ===== BOARD ===== */
/* ===== DESKTOP (default – unchanged behavior) ===== */
#boardWrapper {
    width: max-content;
    margin: auto;
    
}

#board{
  display: grid;
  grid-template-columns: 30px repeat(8, 60px) 30px;
  grid-template-rows: 30px repeat(8, 60px) 30px;
  border: 2px solid #FFFFFF;
  
}

#board, .square {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}


.square{
 width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
}

/* ===== MOBILE ONLY ===== */
@media (max-width: 600px) {

  #boardWrapper{
    width: 100%;
    overflow-x: hidden;
  }

  #board{
    width: 100%;
    max-width: 100vw;
    grid-template-columns: 5vw repeat(8, 10vw) 5vw;
    grid-template-rows: 5vw repeat(8, 10vw) 5vw;
  }

  .square{
    width: 10vw;
    height: 10vw;
    font-size: 6vw;
  }
}


.square.w { background: #F9F0E2; }
.square.b { background: #DDC067; }

.label{
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:bold;
  background:#ddd;
  font-size:14px;
}




.square.selected {
  outline: 3px solid red;
}

/* ===== TIMER ===== */
.timer{
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin: 10px 0;
}

.bottom-timer{
  transform: rotate(180deg);
}

/* ===== GAME OVER BANNER ===== */
#gameOverBanner {
  max-width: 100%;
  box-sizing: border-box;
}

/* ===== LOG ===== */
#log {
  width: 100%;
  height: 160px;
  margin-top: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

/* ===== DESKTOP ENHANCEMENT ===== */
@media (min-width: 768px) {
  #board {
    max-width: 480px;
  }
  .square {
    font-size: 40px;
  }
}
