.domino-page {
  display: grid;
  gap: 22px;
}

.domino-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
  background: #badc58;
  border: 4px solid var(--line);
  border-radius: 26px;
  box-shadow: 7px 7px 0 var(--line);
  padding: 24px;
}

.domino-kicker {
  display: inline-flex;
  background: #ffd32a;
  border: 3px solid var(--line);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--line);
  padding: 7px 12px;
  font-weight: 950;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.domino-hero h2 {
  margin: 0 0 10px;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  text-transform: uppercase;
  line-height: .9;
  font-weight: 950;
}

.domino-hero p {
  margin: 0;
  font-weight: 850;
  line-height: 1.5;
}

.domino-status-card,
.domino-scoreline > div,
.domino-board-card,
.domino-hand-card,
.domino-log-card {
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--line);
  padding: 18px;
}

.domino-status-card {
  display: grid;
  align-content: center;
  gap: 8px;
}

.domino-status-card strong {
  font-size: 1.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.domino-status-card span {
  font-weight: 850;
}

.domino-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.domino-toolbar button,
.domino-board-head button {
  border: 3px solid var(--line);
  border-radius: 16px;
  background: #ffd32a;
  color: #111;
  box-shadow: 4px 4px 0 var(--line);
  padding: 10px 14px;
  font-weight: 950;
  cursor: pointer;
  text-transform: uppercase;
}

.domino-toolbar button:hover,
.domino-board-head button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--line);
}

.domino-toolbar button:disabled,
.domino-board-head button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

#dmnRotateBtn {
  background: #7ed6df;
}

.domino-scoreline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.domino-scoreline span {
  display: block;
  font-size: .75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.domino-scoreline strong {
  display: block;
  margin-top: 4px;
  font-size: 1.8rem;
  font-weight: 950;
}

.domino-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.domino-board-head strong,
.domino-hand-card h3,
.domino-log-card h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 950;
  text-transform: uppercase;
}

.domino-help-line {
  margin: 6px 0 14px;
  font-weight: 850;
  color: #333;
}

.domino-board {
  min-height: 150px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px;
  background: #fff8e7;
  border: 3px dashed var(--line);
  border-radius: 18px;
}

.domino-hand {
  min-height: 140px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
}

.domino-hand-tile {
  display: inline-flex;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.domino-hand-tile:disabled {
  cursor: not-allowed;
}

.domino-hand-tile.selected .domino-tile {
  outline: 5px solid #ec4899;
  transform: translateY(-5px);
}

.domino-hand-tile.playable .domino-tile {
  background: #dfffe9;
}

.domino-hand-tile.locked .domino-tile {
  opacity: .55;
}

.domino-tile {
  display: inline-grid;
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--line);
  color: #111827;
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
}

.domino-tile.is-double {
  background: #fff7d6;
}

.domino-tile.is-vertical {
  width: 58px;
  height: 106px;
  grid-template-rows: 1fr 4px 1fr;
}

.domino-tile.is-horizontal {
  width: 106px;
  height: 58px;
  grid-template-columns: 1fr 4px 1fr;
}

.domino-tile.is-turned {
  background: #e0f2fe;
}

.domino-half {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  grid-template-rows: repeat(3, 7px);
  gap: 3px;
  place-content: center;
  padding: 6px;
}

.domino-half span {
  display: block;
  width: 7px;
  height: 7px;
  background: #111827;
  border-radius: 50%;
}

.domino-separator {
  display: block;
  background: #111827;
}

.domino-tile.is-vertical .domino-separator {
  width: 80%;
  height: 4px;
  justify-self: center;
}

.domino-tile.is-horizontal .domino-separator {
  width: 4px;
  height: 80%;
  align-self: center;
}

.domino-empty {
  width: 100%;
  text-align: center;
  border: 3px dashed var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  font-weight: 900;
}

.domino-drop-zone.can-drop {
  background: #2ed573;
}

.domino-drop-zone.cannot-drop {
  background: #ffd32a;
}

.domino-drop-zone.drop-bad {
  background: #ff4757 !important;
  color: #fff;
}

.domino-log {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.domino-log div {
  background: #fff8e7;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 850;
}

@media(max-width: 850px) {
  .domino-hero {
    grid-template-columns: 1fr;
  }

  .domino-scoreline {
    grid-template-columns: 1fr;
  }

  .domino-board-head {
    align-items: stretch;
  }

  .domino-board-head button {
    width: 100%;
  }

  .domino-board {
    padding: 12px;
  }
}

/* Domino drag & drop stable */
.domino-hand-tile {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.domino-hand-tile.is-dragging {
  opacity: .35;
}

.domino-drag-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.95);
  opacity: .96;
  filter: drop-shadow(8px 8px 0 rgba(17, 24, 39, .45));
}

.domino-drag-ghost .domino-tile {
  outline: 4px solid #ec4899;
}

.domino-drop-zone.drag-over {
  background: #ec4899 !important;
  color: #ffffff !important;
  transform: translate(2px, 2px) scale(1.04);
  box-shadow: 2px 2px 0 var(--line) !important;
}

.domino-board.drag-left,
.domino-board.drag-right {
  outline: 5px dashed #ec4899;
  outline-offset: 6px;
}

.domino-board.drag-left::before,
.domino-board.drag-right::before {
  content: "";
  position: absolute;
}

.domino-board-card {
  position: relative;
}

.domino-board {
  position: relative;
}

.domino-board.drag-left {
  background:
    linear-gradient(90deg, rgba(236,72,153,.25) 0 50%, transparent 50% 100%),
    #fff8e7 !important;
}

.domino-board.drag-right {
  background:
    linear-gradient(90deg, transparent 0 50%, rgba(236,72,153,.25) 50% 100%),
    #fff8e7 !important;
}


/* Domino : grand plateau réaliste */
.domino-board-card {
  padding: 22px !important;
}

.domino-board {
  min-height: 360px !important;
  align-content: flex-start !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
  padding: 26px !important;
  overflow: auto !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.55) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(225deg, rgba(255,255,255,.55) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(315deg, rgba(255,255,255,.55) 25%, transparent 25%) 0 0/20px 20px,
    linear-gradient(45deg, rgba(255,255,255,.55) 25%, #fff8e7 25%) 0 0/20px 20px;
  border: 4px dashed var(--line) !important;
  border-radius: 24px !important;
}

/* Plateau : vraie alternance horizontal / vertical */
.domino-board .domino-tile.is-horizontal {
  width: 106px !important;
  height: 58px !important;
  min-width: 106px !important;
  min-height: 58px !important;
  grid-template-columns: 1fr 4px 1fr !important;
  grid-template-rows: none !important;
}

.domino-board .domino-tile.is-vertical {
  width: 58px !important;
  height: 106px !important;
  min-width: 58px !important;
  min-height: 106px !important;
  grid-template-rows: 1fr 4px 1fr !important;
  grid-template-columns: none !important;
}

.domino-board .domino-tile.is-horizontal .domino-separator {
  width: 4px !important;
  height: 80% !important;
  align-self: center !important;
  justify-self: center !important;
}

.domino-board .domino-tile.is-vertical .domino-separator {
  width: 80% !important;
  height: 4px !important;
  align-self: center !important;
  justify-self: center !important;
}

/* Main : le bouton tourner montre aussi visuellement l'orientation */
.domino-hand .domino-tile.is-horizontal {
  width: 106px !important;
  height: 58px !important;
  min-width: 106px !important;
  min-height: 58px !important;
  grid-template-columns: 1fr 4px 1fr !important;
  grid-template-rows: none !important;
}

.domino-hand .domino-tile.is-horizontal .domino-separator {
  width: 4px !important;
  height: 80% !important;
  align-self: center !important;
  justify-self: center !important;
}

.domino-hand .domino-tile.is-vertical {
  width: 58px !important;
  height: 106px !important;
  min-width: 58px !important;
  min-height: 106px !important;
  grid-template-rows: 1fr 4px 1fr !important;
  grid-template-columns: none !important;
}

.domino-hand .domino-tile.is-vertical .domino-separator {
  width: 80% !important;
  height: 4px !important;
  align-self: center !important;
  justify-self: center !important;
}

/* Zone de main plus confortable */
.domino-hand {
  min-height: 170px !important;
  gap: 18px !important;
  align-items: center !important;
}

/* Les zones de dépôt doivent rester visibles */
.domino-drop-zone.can-drop {
  background: #2ed573 !important;
}

.domino-drop-zone.cannot-drop {
  background: #ffd32a !important;
}

.domino-board.drag-left,
.domino-board.drag-right {
  outline: 6px dashed #ec4899 !important;
  outline-offset: 8px !important;
}

@media(max-width: 850px) {
  .domino-board {
    min-height: 300px !important;
    padding: 18px !important;
    gap: 12px !important;
  }

  .domino-hand {
    min-height: 150px !important;
  }
}


/* Domino : bouton piocher placé entre gauche et droite */
.domino-board-center {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.domino-board-center strong {
  margin: 0;
}

.domino-draw-center {
  background: #7ed6df !important;
}

.domino-draw-center:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media(max-width: 850px) {
  .domino-board-center {
    width: 100%;
  }

  .domino-draw-center {
    width: 100%;
  }
}

/* Domino : actions centrales du plateau */
.domino-board-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.domino-board-actions button {
  min-width: 110px;
}

.domino-rotate-center {
  background: #ec4899 !important;
  color: #ffffff !important;
}

.domino-rotate-center:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media(max-width: 850px) {
  .domino-board-actions {
    width: 100%;
  }

  .domino-board-actions button {
    width: 100%;
  }
}
