:root {
  --bg: #071028;
  --card: #0f1724;
  --panel: #071827;
  --accent: #2563eb;
  --text: #e6eef8;
  --muted: #9fb3d6;
  --xcolor: #ff5252;
  --letter-cross: #ffdd57;
  --gap: 14px;
  --card-min: 260px;
  --card-max: 420px;
  --base-h1: 18px;
  --base-title: 20px;
  --base-cell: 18px;
  --h1-size: calc(var(--base-h1) * 1.5);
  --title-size: calc(var(--base-title) * 1.5);
  --cell-size: calc(var(--base-cell) * 1.5);
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #071829 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased
}

body {
  padding: 18px
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px
}

h1 {
  font-size: var(--h1-size);
  margin: 0;
  color: #ffffff
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap
}

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700
}

button.alt {
  background: #374151
}

button[disabled] {
  opacity: .45;
  cursor: not-allowed
}

.fa-menu-btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1
}

.layout {
  display: grid;
  grid-template-columns: 1fr minmax(var(--card-min), var(--card-max));
  gap: var(--gap);
  align-items: start
}

.boards {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  align-items: flex-start
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  min-width: var(--card-min);
  max-width: var(--card-max);
  width: 100%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6)
}

.title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px
}

.title>div>strong {
  font-size: var(--title-size);
  color: #ffffff;
  line-height: 1
}

.letters-top {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px
}

.letter-top {
  text-align: center;
  color: #ffffff;
  font-weight: 900;
  padding: 8px 0;
  border-radius: 6px;
  position: relative;
  font-size: calc(var(--title-size) * 0.9)
}

.letter-top.crossed {
  color: var(--letter-cross);
  text-decoration: line-through;
  opacity: .95
}

.panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 6px;
  min-height: 80px;
}

.status {
  margin-top: 10px;
  font-weight: 800
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px
}

.grid {
  display: grid;
  gap: 8px
}

.cell {
  aspect-ratio: 1/1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0;
  font-weight: 800;
  user-select: none;
  border: 2px solid rgba(255, 255, 255, 0.03);
  position: relative;
  font-size: var(--cell-size);
  color: #ffffff;
}

.cell.empty {
  background: #0b1220;
  color: #ffffff;
  cursor: pointer
}

.cell.hidden {
  background: #0b1724;
  color: transparent;
  cursor: default
}

.cell.x {
  background: transparent;
  color: var(--xcolor)
}

.cell.x::after {
  content: "";
  position: absolute;
  left: 12%;
  top: 12%;
  width: 76%;
  height: 76%;
  background: linear-gradient(135deg, transparent 46%, var(--xcolor)46%, var(--xcolor)54%, transparent 54%), linear-gradient(45deg, transparent 46%, var(--xcolor)46%, var(--xcolor)54%, transparent 54%);
  border-radius: 8px;
  opacity: 0.95;
  pointer-events: none
}

.cell.win-highlight {
  box-shadow: 0 0 0 3px rgba(255, 221, 87, 0.12) inset
}

.small {
  font-size: 20px;
  color: #ffe02e;
}

.available {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px
}

.avail-badge {
  background: #0c1b2a;
  padding: 6px 8px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  min-width: 34px;
  text-align: center
}

.avail-badge.taken {
  opacity: .35;
  text-decoration: line-through;
  cursor: not-allowed
}

.picker {
  position: absolute;
  z-index: 999;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #0b2030;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  width: 240px;
  max-width: 90vw;
  box-sizing: border-box;
}


.picker input[type="number"] {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: none;
  background: #071827;
  color: var(--text);
  margin-top: 6px;
  font-size: 16px;
}

.picker .pbtn {
  background: #0b1220;
  padding: 6px;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}

.picker .pbtn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}


.bingo-btn {
  display: block;
  margin: 12px auto 0;
  background: #ffdd57;
  color: #062d26;
  padding: 12px 16px;
  font-weight: 900;
  border-radius: 10px;
  border: none;
  cursor: pointer
}

.bingo-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed
}

.hidden-card {
  display: none !important
}

/* HIDE the Available numbers block at the bottom of player's card */
.available,
.available-label {
  display: none !important;
}

@media (max-width:980px) {
  :root {
    --card-max: 720px
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 12px
  }

  .boards {
    flex-direction: column
  }

  .panel {
    order: 2
  }
}

@media (max-width:600px) {
  .layout {
    display: flex;
    flex-direction: column;
  }

  .panel {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 3px;
    order: -1;
    /* Moves panel above boards */
  }


  .boards {
    order: 0;
  }


  body {
    padding: 12px
  }

  header {
    flex-direction: column;
    align-items: flex-start
  }

  h1 {
    font-size: calc(var(--h1-size) * 0.9)
  }

  .header-left {
    width: 100%;
    justify-content: flex-start
  }

  .controls {
    width: 100%;
    justify-content: flex-start
  }

  button {
    padding: 10px;
    border-radius: 10px;
    font-size: 14px
  }

  .card {
    padding: 10px;
    border-radius: 10px;
  }

  .grid {
    gap: 6px
  }

  .cell {
    font-size: calc(var(--cell-size) * 0.9);
    border-radius: 6px
  }

  .letter-top {
    font-size: calc(var(--title-size) * 0.8)
  }

  .picker {
    width: 180px;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr))
  }

  .avail-badge {
    padding: 6px 7px;
    font-size: 13px;
    min-width: 30px
  }

  .bingo-btn {
    padding: 10px 12px
  }
}

#playerGrid,
#botGrid {
  grid-auto-rows: 1fr
}
