/* =========================================
   1. GLOBAL BACKGROUNDS & GRADIENTS
========================================= */
.bg-app-gradient {
  background-color: #92d9df;
  background-image: url('../images/rollino-background.jpg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
}


/* Selective display font. Keep the rest of the interface on the original sans font. */
.font-poetsen-one {
  font-family: "Poetsen One", sans-serif;
  font-weight: 400;
}


/* =========================================
   2. GAME ART & DOMINO DETAILS
========================================= */
.game-board-art {
  background-image: url('../images/wooden-board.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  padding: 6.3% 7% 8.4% 7%;
  filter: drop-shadow(0 7px 7px rgba(0,0,0,0.18))
          drop-shadow(0 16px 22px rgba(0,0,0,0.24));
}

.counter-art {
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Percentage-based centering keeps placed counters aligned at every board size.
   The small optical lift centres the visible disc on the cream domino face. */
.board-counter-position {
  left: 50%;
  top: 51%;
  width: 82%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -52.5%);
  pointer-events: none;
}

.board-counter-art {
  filter: drop-shadow(0 2px 2.5px rgba(64, 31, 14, 0.30));
}

/* Bonus counters use dedicated artwork and arrive after the short pause. */
.bonus-counter .board-counter-art {
  animation: bonus-counter-bounce 700ms cubic-bezier(0.22, 0.9, 0.28, 1.2) both;
  transform-origin: 50% 50%;
}

@keyframes bonus-counter-bounce {
  0%   { transform: translateY(-12%) scale(0.72); opacity: 0; }
  48%  { transform: translateY(-7%) scale(1.12); opacity: 1; }
  68%  { transform: translateY(3%) scale(0.96); opacity: 1; }
  84%  { transform: translateY(-2%) scale(1.04); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Winning line: a short staggered gold sweep before the winner modal appears. */
.winning-line-highlight {
  border: 0;
  background: radial-gradient(circle, rgba(255, 210, 52, 0.18) 0%, rgba(255, 192, 0, 0.08) 55%, transparent 78%);
  box-shadow:
    inset 0 0 10px rgba(255, 210, 52, 0.78),
    0 0 8px rgba(255, 192, 0, 0.82);
  opacity: 0;
  animation: winning-line-sweep 720ms ease-out var(--win-delay, 0ms) forwards,
             winning-line-breathe 780ms ease-in-out calc(var(--win-delay, 0ms) + 720ms) 2 alternate;
}

.winning-counter .board-counter-art {
  animation: winning-counter-pulse 780ms ease-in-out var(--win-delay, 0ms) 3;
}

@keyframes winning-line-sweep {
  0% { opacity: 0; transform: scale(0.72); }
  55% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes winning-line-breathe {
  from { opacity: 0.78; box-shadow: inset 0 0 8px rgba(255,210,52,0.62), 0 0 6px rgba(255,192,0,0.64); }
  to { opacity: 1; box-shadow: inset 0 0 16px rgba(255,225,92,0.94), 0 0 16px rgba(255,192,0,0.94); }
}

@keyframes winning-counter-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.10); }
}

/* Board pips only. Dice pips intentionally keep their flatter treatment. */
.domino-pip {
  box-shadow:
    inset 1px 1px 2px rgba(0,0,0,0.55);
}

/* A short, rounded, recessed divider between the two halves of a domino. */
.domino-cell-left::after {
  content: '';
  position: absolute;
  z-index: 5;
  right: -2px;
  top: 14%;
  bottom: 14%;
  width: 4px;
  border-radius: 999px;
  background: #d3bca5;
  box-shadow: inset 1px 1px 1px rgba(87, 42, 19, 0.34);
  pointer-events: none;
}


/* Brighter valid-move hint: warm amber with a controlled glow pulse. */
.valid-move-hint {
  border: 3px solid rgb(255, 192, 0);
  background: rgba(255, 192, 0, 0.08);
  box-shadow:
    inset 0 0 12px rgba(255, 192, 0, 0.72),
    0 0 8px rgba(255, 192, 0, 0.58);
  animation: valid-move-pulse 1.25s ease-in-out infinite;
}

@keyframes valid-move-pulse {
  0%, 100% {
    opacity: 0.88;
    box-shadow:
      inset 0 0 10px rgba(255, 192, 0, 0.62),
      0 0 7px rgba(255, 192, 0, 0.48);
  }
  50% {
    opacity: 1;
    box-shadow:
      inset 0 0 16px rgba(255, 192, 0, 0.90),
      0 0 14px rgba(255, 192, 0, 0.78);
  }
}

/* Opaque red/blue player panels with soft glass-like highlights.
   The colour layers are fully opaque so the background cannot shift their hue. */
.player-panel-glass-red,
.player-panel-glass-blue {
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,0.42),
    inset 0 -2px 3px rgba(0,0,0,0.12),
    inset 0 0 24px rgba(255,255,255,0.07);
}

.player-panel-glass-red {
  background: linear-gradient(to bottom, #ff5a63 0%, #ed404c 45%, #d62828 100%);
  border: 3px solid #a81a1a;
}

.player-panel-glass-blue {
  background: linear-gradient(to bottom, #55b8ff 0%, #359de9 45%, #1a7cd8 100%);
  border: 3px solid #0e5091;
}

.player-panel-glass-red::after,
.player-panel-glass-blue::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 19px;
  border: 1px solid rgba(255,255,255,0.22);
  pointer-events: none;
}

/* Mobile game layout: keep the board and controls grouped instead of
   distributing them across the full viewport height. */
.playing-viewport,
.playing-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (max-width: 639px) {
  .setup-view {
    justify-content: flex-start;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .setup-panel {
    margin-top: 0;
  }

  .playing-header {
    padding-top: 1rem;
    padding-bottom: 0.35rem;
  }

  .playing-board-area {
    flex: 0 0 auto;
    align-items: flex-start;
  }

  .playing-controls-area {
    margin-top: 0.85rem;
    padding-top: 0;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* =========================================
   3. 3D DICE & ANIMATIONS
========================================= */
.dice-scene { 
  width: 64px; 
  height: 64px; 
  perspective: 600px; 
}

.dice-cube { 
  width: 100%; 
  height: 100%; 
  position: relative; 
  transform-style: preserve-3d; 
  transition: transform 1.2s cubic-bezier(0.15, 0.85, 0.35, 1); 
}

.dice-face { 
  position: absolute; 
  width: 64px; 
  height: 64px; 
  background: #ffffff; 
  border-radius: 10px; 
  border: 1px solid #e0e0e0;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05); 
}

.dice-face-front  { transform: rotateY(0deg) translateZ(32px); }
.dice-face-back   { transform: rotateY(180deg) translateZ(32px); }
.dice-face-right  { transform: rotateY(90deg) translateZ(32px); }
.dice-face-left   { transform: rotateY(-90deg) translateZ(32px); }
.dice-face-top    { transform: rotateX(90deg) translateZ(32px); }
.dice-face-bottom { transform: rotateX(-90deg) translateZ(32px); }

.dice-jumping {
  animation: dice-bounce 1.2s linear forwards;
}

@keyframes dice-bounce {
  0% { transform: translateY(0) scaleY(1); animation-timing-function: ease-out; }
  20% { transform: translateY(-70px) scaleY(1.1) scaleX(0.9); animation-timing-function: ease-in; }
  40% { transform: translateY(0) scaleY(0.75) scaleX(1.15); animation-timing-function: ease-out; }
  60% { transform: translateY(-30px) scaleY(1.05) scaleX(0.95); animation-timing-function: ease-in; }
  75% { transform: translateY(0) scaleY(0.85) scaleX(1.05); animation-timing-function: ease-out; }
  85% { transform: translateY(-10px) scaleY(1.02); animation-timing-function: ease-in; }
  95% { transform: translateY(0) scaleY(0.95); animation-timing-function: ease-out; }
  100% { transform: translateY(0) scaleY(1) scaleX(1); }
}

/* =========================================
   4. CUSTOM SCROLLBARS
========================================= */
.instructions-scroll::-webkit-scrollbar {
  width: 6px;
}
.instructions-scroll::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}
.instructions-scroll::-webkit-scrollbar-thumb {
  background: rgba(74,143,156,0.5);
  border-radius: 4px;
}
