/* ═══════════════════════════════════════
   BoBail – Poppele | styles.css
   ═══════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  font-family: 'Impact', 'Arial Black', sans-serif;
}

/* ── PORTRAIT BUTTON ── */
#btn-portrait {
  width: 100%;
  max-width: 500px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  display: block;
}

#btn-portrait img {
  width: 100%;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.3s;
}

#btn-portrait:hover img {
  filter: grayscale(60%);
}

/* ── GREEN START BUTTON ── */
#btn-start {
  width: 100%;
  max-width: 500px;
  background: #00FF00;
  border: 4px solid #000;
  padding: 60px 20px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-start:hover  { background: #00e600; transform: scale(1.01); }
#btn-start:active { transform: scale(0.99); }

#btn-start span {
  font-size: clamp(52px, 14vw, 88px);
  font-weight: 900;
  color: #000;
  letter-spacing: 4px;
}

/* ── YELLOW BUTTONS ── */
.btn-yellow {
  width: 100%;
  max-width: 500px;
  background: #FFE600;
  border: 4px solid #000;
  border-top: 2px solid #000;
  padding: 28px 24px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
}

.btn-yellow:hover  { 
  background: #f0d800; 
  transform: translateY(-2px);
}

.btn-yellow:active { 
  transform: translateY(0);
}

#btn-rules {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#btn-rules .rule-title {
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 900;
  color: #000;
  line-height: 1.3;
  font-family: 'Arial Black', sans-serif;
  text-align: center;
}

#btn-rules .rule-stars {
  font-size: clamp(14px, 3.5vw, 20px);
  color: #000;
  font-family: 'Arial Black', sans-serif;
  font-weight: 700;
  text-align: center;
}

#btn-video span {
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 900;
  color: #000;
  font-family: 'Arial Black', sans-serif;
}

/* ══════════════════════════════
   OVERLAYS
   ══════════════════════════════ */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 16px;
}

.overlay.active { display: flex; }

.overlay-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: #FFE600;
  border: none;
  font-size: 28px;
  font-weight: 900;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #000;
  transition: background 0.2s;
}

.overlay-close:hover { background: #f0d800; }

/* ── Galerie ── */
#overlay-gallery .gallery-img {
  max-width: min(700px, 95vw);
  max-height: 78vh;
  object-fit: contain;
  border: 3px solid #FFE600;
  border-radius: 4px;
}

.gallery-nav {
  display: flex;
  gap: 16px;
  margin-top: 14px;
}

.gallery-nav button {
  background: #FFE600;
  border: none;
  font-size: 18px;
  font-weight: 900;
  padding: 10px 28px;
  cursor: pointer;
  border-radius: 4px;
  color: #000;
  font-family: 'Arial Black', sans-serif;
  transition: background 0.2s;
}

.gallery-nav button:hover    { background: #f0d800; }
.gallery-nav button:disabled { opacity: 0.35; cursor: default; }

#gallery-counter {
  color: #FFE600;
  font-size: 15px;
  margin-top: 8px;
  font-family: 'Arial Black', sans-serif;
}

/* ── Spielregeln ── */
#overlay-rules .rules-img {
  max-width: min(820px, 96vw);
  max-height: 85vh;
  object-fit: contain;
  border: 3px solid #00FF00;
  border-radius: 4px;
}

/* ── Video ── */
#overlay-video video {
  max-width: min(700px, 96vw);
  max-height: 80vh;
  border: 3px solid #FFE600;
  border-radius: 4px;
  background: #000;
}

/* ══════════════════════════════
   WINNER OVERLAY
   ══════════════════════════════ */

.winner-box {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border: 4px solid #FFE600;
  border-radius: 12px;
  padding: 40px 30px;
  text-align: center;
  max-width: 400px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(255, 230, 0, 0.3);
  animation: winnerPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes winnerPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.winner-title {
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 900;
  font-family: 'Arial Black', sans-serif;
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.winner-icon {
  font-size: clamp(60px, 15vw, 80px);
  margin: 20px 0;
  animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.winner-stats {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin: 30px 0;
}

.winner-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 14px;
  color: #999;
  font-family: 'Arial Black', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 900;
  color: #FFE600;
  font-family: 'Impact', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.winner-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.winner-buttons .btn-game {
  padding: 14px 28px;
  font-size: 15px;
}

/* ══════════════════════════════
   TABLET OPTIMIZATION
   ══════════════════════════════ */

/* Tablets (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  
  /* ── START SCREEN ── */
  #btn-portrait {
    max-width: 650px;
  }
  
  #btn-start {
    max-width: 650px;
    padding: 80px 30px;
  }
  
  #btn-start span {
    font-size: 100px;
    letter-spacing: 6px;
  }
  
  .btn-yellow {
    max-width: 650px;
    padding: 35px 30px;
  }
  
  #btn-rules .rule-title {
    font-size: 26px;
  }
  
  #btn-rules .rule-stars {
    font-size: 22px;
  }
  
  #btn-video span {
    font-size: 36px;
  }
  
  /* ── GAME SCREEN ── */
  .game-header h1 {
    font-size: 44px;
    margin-bottom: 15px;
  }
  
  .game-info {
    font-size: 22px;
  }
  
  .board-container {
    max-width: 700px;
  }
  
  #game-board {
    max-width: 700px;
    gap: 6px;
    padding: 12px;
    border-width: 6px;
  }
  
  .board-cell {
    border-width: 3px;
    border-radius: 6px;
  }
  
  .piece {
    border-width: 4px;
  }
  
  .game-controls {
    margin-top: 20px;
  }
  
  .btn-game {
    padding: 16px 32px;
    font-size: 18px;
  }
  
  /* ── OVERLAYS ── */
  .overlay-close {
    width: 54px;
    height: 54px;
    font-size: 32px;
    top: 20px;
    right: 24px;
  }
  
  .gallery-nav button {
    font-size: 20px;
    padding: 14px 36px;
  }
  
  .winner-box {
    max-width: 550px;
    padding: 50px 40px;
  }
  
  .winner-title {
    font-size: 42px;
    margin-bottom: 25px;
  }
  
  .winner-icon {
    font-size: 90px;
    margin: 25px 0;
  }
  
  .winner-stats {
    gap: 40px;
    margin: 40px 0;
  }
  
  .stat-value {
    font-size: 48px;
  }
  
  .winner-buttons .btn-game {
    padding: 16px 32px;
    font-size: 18px;
  }
}

/* Large Tablets & Small Desktops (1025px+) */
@media screen and (min-width: 1025px) {
  
  #btn-portrait {
    max-width: 700px;
  }
  
  #btn-start {
    max-width: 700px;
    padding: 90px 40px;
  }
  
  #btn-start span {
    font-size: 110px;
  }
  
  .btn-yellow {
    max-width: 700px;
    padding: 40px 40px;
  }
  
  .board-container {
    max-width: 750px;
  }
  
  #game-board {
    max-width: 750px;
  }
}

/* ══════════════════════════════
   GAME SCREEN
   ══════════════════════════════ */

#screen-start,
#screen-game {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#screen-game {
  display: none;
  padding: 20px 10px;
  min-height: 100vh;
  justify-content: center;
}

#screen-game.active { display: flex; }
#screen-start.hidden { display: none; }

/* ── Game Header ── */
.game-header {
  text-align: center;
  margin-bottom: 20px;
  color: #FFE600;
  font-family: 'Arial Black', sans-serif;
}

.game-header h1 {
  font-size: clamp(24px, 6vw, 36px);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.game-info {
  font-size: clamp(14px, 3.5vw, 18px);
  color: #00FF00;
  font-weight: 700;
}

/* ── Game Board ── */
.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 500px;
  width: 100%;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  background: #222;
  padding: 8px;
  border: 4px solid #FFE600;
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: min(500px, 90vw);
}

.board-cell {
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}

.board-cell:hover {
  background: #252525;
  border-color: #555;
}

.board-cell.selected {
  background: #2a2a2a;
  border-color: #FFE600;
  box-shadow: 0 0 8px #FFE600;
}

.board-cell.selected:has(.piece.poppele) {
  border-color: #ffee44;
  box-shadow: 0 0 12px #ffee44;
}

.board-cell.possible-move {
  background: rgba(0, 255, 0, 0.15);
  border-color: #00FF00;
  cursor: pointer;
  animation: pulseBorder 1s ease-in-out infinite;
}

.board-cell.possible-move:hover {
  background: rgba(0, 255, 0, 0.3);
  border-color: #00FF00;
}

@keyframes pulseBorder {
  0%, 100% { border-color: #00FF00; }
  50% { border-color: #44ff44; }
}

/* ── Spielsteine ── */
.piece {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.4);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transition: transform 0.2s;
  pointer-events: none;
}

.board-cell:has(.piece):hover {
  cursor: pointer;
}

.piece.player1 {
  background: radial-gradient(circle at 35% 35%, #ff4444, #cc0000);
}

.piece.player2 {
  background: radial-gradient(circle at 35% 35%, #44ff44, #00cc00);
}

.piece.poppele {
  background: radial-gradient(circle at 35% 35%, #ffee44, #e6c700);
  animation: poppelePulse 2s ease-in-out infinite;
}

@keyframes poppelePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ── Game Controls ── */
.game-controls {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-game {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 900;
  font-family: 'Arial Black', sans-serif;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-game:hover  { transform: translateY(-2px); }
.btn-game:active { transform: translateY(0); }

.btn-back {
  background: #FFE600;
  color: #000;
}

.btn-back:hover { background: #f0d800; }

.btn-reset {
  background: #ff4444;
  color: #fff;
}

.btn-reset:hover { background: #e63939; }
