/* ============================================================
   Modern UI for backgammonjs — pure CSS overrides, no JS changes.
   Loaded after backgammon.css; everything here wins by order.
   ============================================================ */

/* ---------- Page background ---------- */
body,
#page-index {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
  background-attachment: fixed;
  background-image: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
}

/* ---------- Landing page ---------- */
#index-view td {
  padding: 24px;
}

#index-view td > .container-fluid {
  max-width: 680px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 48px 40px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

#index-view h1 {
  font-size: 44px !important;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-right: 0 !important;
  margin-bottom: 4px;
}

#index-view h1 small {
  font-size: 17px !important;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55) !important;
  padding-left: 0 !important;
  display: block;
  margin-top: 8px;
}

#rule-selector {
  margin: 20px 0 28px;
}

#rule-selector .btn {
  border-radius: 999px;
  padding: 9px 22px;
  margin: 4px 4px 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}

#rule-selector .btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

#rule-selector .btn.active {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.35);
}

#rule-selector input[type="radio"] {
  position: absolute;
  clip: rect(0, 0, 0, 0);
}

#index-view .btn-lg {
  border-radius: 14px;
  padding: 14px 30px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
  transition: all 0.2s ease;
}

#btn-play-random {
  background: linear-gradient(135deg, #f472b6 0%, #e11d48 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
}

#btn-play-random:hover,
#btn-play-random:focus {
  background: linear-gradient(135deg, #e11d48 0%, #f472b6 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(225, 29, 72, 0.5);
}

#btn-challenge-friend {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

#btn-challenge-friend:hover,
#btn-challenge-friend:focus {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

/* ---------- Board: wood frame + felt surface ---------- */
.board {
  background: linear-gradient(180deg, #f6efe1 0%, #efe4cf 100%) !important;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.frame {
  background: linear-gradient(90deg, #4a3421 0%, #6b4a2e 25%, #4a3421 50%, #6b4a2e 75%, #4a3421 100%) !important;
  height: 0.8% !important;
}

.bar {
  background: linear-gradient(90deg, #3d2b1b 0%, #5b3e26 45%, #3d2b1b 55%, #3d2b1b 100%) !important;
  box-shadow: inset 1px 0 4px rgba(0, 0, 0, 0.5);
}

/* Triangles: replace gif images with clipped gradients.
   row0 = top half (points down), row1 = bottom half (points up). */
.row0 .point.odd,
.row0 .point.even,
.row1 .point.odd,
.row1 .point.even {
  background-image: none !important;
}

.row0 .point::before,
.row1 .point::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.row0 .point::before {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.row1 .point::before {
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
}

.row0 .point.odd::before,
.row1 .point.odd::before {
  background: linear-gradient(180deg, #47796a 0%, #356859 100%);
}

.row0 .point.even::before,
.row1 .point.even::before {
  background: linear-gradient(180deg, #b0413e 0%, #8c2f31 100%);
}

.row1 .point.odd::before,
.row1 .point.even::before {
  background: linear-gradient(0deg, #47796a 0%, #356859 100%);
}

.row1 .point.even::before {
  background: linear-gradient(0deg, #b0413e 0%, #8c2f31 100%);
}

/* ---------- Pieces: CSS circles instead of PNGs ---------- */
.piece .image {
  background-image: none !important;
  border-radius: 50%;
}

.piece.white .image {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f0f0f0 55%, #d4d4d4 100%) !important;
  color: #1a1a1a !important;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.18),
              inset 0 2px 3px rgba(255, 255, 255, 0.9),
              0 3px 7px rgba(0, 0, 0, 0.35);
}

.piece.black .image {
  background: radial-gradient(circle at 35% 30%, #555b63 0%, #262a30 55%, #101215 100%) !important;
  color: #f5f5f5 !important;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.5),
              inset 0 2px 3px rgba(255, 255, 255, 0.25),
              0 3px 7px rgba(0, 0, 0, 0.45);
}

/* ---------- Dice: keep original PNG digits (glyph fonts unreliable) ---------- */
.die {
  text-indent: 0 !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.dice-panel {
  background: rgba(15, 23, 42, 0.75) !important;
  backdrop-filter: blur(8px);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  padding: 6px;
}

.dice .played {
  opacity: 0.35;
  filter: grayscale(0.5);
}

/* ---------- Action buttons (Roll / Confirm / Undo) ---------- */
div.action-panel .btn {
  border-radius: 12px;
  border: none;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.08em;
  transition: all 0.15s ease;
}

div.action-panel #btn-roll,
div.action-panel #btn-confirm {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
}

div.action-panel #btn-roll:hover,
div.action-panel #btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.55);
}

div.action-panel #btn-undo {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---------- Game navbar (menu) ---------- */
.navbar-default {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(14px);
  border: none !important;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  margin: 0 auto;
  max-width: 980px;
}

.navbar-brand {
  font-weight: 700;
  color: #0f172a !important;
}

.navbar .badge {
  background: linear-gradient(135deg, #f472b6 0%, #e11d48 100%) !important;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.navbar .btn {
  border-radius: 999px;
}

.navbar-toggle {
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.navbar-nav > li > a {
  color: #334155 !important;
  font-weight: 600;
}

/* ---------- Overlays ---------- */
#game-result-overlay {
  background: rgba(2, 6, 23, 0.88) !important;
  backdrop-filter: blur(8px);
}

#game-result-overlay .message,
#game-result-overlay .score {
  text-shadow: none !important;
}

#game-result-overlay .message {
  background: linear-gradient(135deg, #f472b6 0%, #e11d48 60%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#game-result-overlay .score {
  color: #e2e8f0;
}

#waiting-overlay {
  background: rgba(2, 6, 23, 0.85) !important;
  backdrop-filter: blur(6px);
}

#waiting-overlay .loader {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

#waiting-overlay span {
  color: #e2e8f0 !important;
  font-weight: 600;
}

#waiting-overlay .loader img {
  display: none;
}

#waiting-overlay .loader .inner::after {
  content: '';
  display: block;
  width: 44px;
  height: 44px;
  margin: 18px auto 0;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: bg-spin 0.9s linear infinite;
}

@keyframes bg-spin {
  to { transform: rotate(360deg); }
}

#challenge-link {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #e11d48 !important;
  border-radius: 14px 0 0 14px;
}

.btn-copy {
  background: linear-gradient(135deg, #f472b6 0%, #e11d48 100%) !important;
  border: none !important;
  color: #fff !important;
  border-radius: 0 14px 14px 0 !important;
}

/* ---------- Toast alerts (ohSnap) ---------- */
.alert {
  border: none !important;
  border-radius: 14px !important;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- Small refinements ---------- */
.dice-panel .dice {
  line-height: 1.4;
}

#game-view td {
  padding: 6px 10px;
}
