.bingo-main-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 1200px) {
  .bingo-main-grid {
    flex-direction: row;
    align-items: flex-start;
  }
  .bingo-layout {
    flex: 3;
  }
  .side-area {
    flex: 1;
    position: sticky;
    top: 2rem;
  }
}

.bingo-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 900px) {
  .bingo-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.draw-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: linear-gradient(145deg, var(--card-bg), var(--bg-muted));
}

.current-draw-container {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-dark);
  color: #fff;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  padding: 1rem;
}

.current-draw-text {
  font-size: 6rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  word-break: break-word;
  transition: transform 0.1s;
}

.rolling {
  animation: blur-shake 0.1s infinite;
  color: var(--accent);
}

@keyframes blur-shake {
  0% {
    transform: translateY(0) scale(1.05);
    filter: blur(2px);
  }

  50% {
    transform: translateY(-5px) scale(1.05);
    filter: blur(4px);
  }

  100% {
    transform: translateY(5px) scale(1.05);
    filter: blur(2px);
  }
}

.history-area {
  flex: 1;
  max-width: 100%;
}

@media (min-width: 900px) {
  .history-area {
    flex: 1.5;
  }
}

.number-board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.25rem;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .number-board {
    grid-template-columns: repeat(5, 1fr);
  }
}

.board-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.3s;
}

.board-cell.drawn {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 800;
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}

.board-cell.just-drawn {
  background-color: var(--secondary);
  animation: pop 0.5s ease;
}

@keyframes pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1.05);
  }
}

.custom-history {
  margin-top: 1rem;
}

.custom-history ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.custom-history li {
  padding: 0.5rem 1rem;
  background-color: var(--primary);
  color: white;
  border-radius: 999px;
  font-weight: bold;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fullscreen handling */
.main-content:fullscreen {
  background-color: var(--bg-color) !important;
  padding: 2rem !important;
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
}

:fullscreen .tool-header, 
:fullscreen app-header, 
:fullscreen app-footer,
:fullscreen .qr-card {
  display: none !important;
}

:fullscreen .bingo-main-grid {
  flex: 1 !important;
  width: 100% !important;
  height: auto !important;
  display: flex !important;
  margin: 0 !important;
}

:fullscreen .bingo-layout {
  flex-direction: row !important;
  gap: 2rem !important;
}

:fullscreen .draw-area {
  flex: 2 !important;
}

:fullscreen .history-area {
  flex: 1 !important;
}

:fullscreen .current-draw-container {
  height: 70vh !important;
  max-width: 100% !important;
  aspect-ratio: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

:fullscreen .current-draw-text {
  font-size: 18vw !important;
  white-space: nowrap !important;
  word-break: normal !important;
}

/* Side Area & Rankings */
.side-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.ranking-list {
    margin: 1rem 0;
    list-style: none; /* remove default numbers */
}
.ranking-list li {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.rank-label {
    min-width: 4.5rem;
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}
.ranking-list li.winner {
    background: rgba(250, 176, 5, 0.1);
    border: 1px solid #fab005;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.ranking-list li.winner .rank-label {
    background: #fab005;
    color: #fff;
    font-weight: 900;
}
.ranking-list li.winner {
    color: var(--text-main);
    font-weight: bold;
}
.participant-chips {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.participant-chips li {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
}
.empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    margin: 1rem 0;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider { background-color: var(--primary); }
input:focus + .slider { box-shadow: 0 0 1px var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }