/* Mahjong: ivory tiles with a visible thickness, higher layers up and to the left. */
.sp-board--mahjong { padding: 14px; }
.mj-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; }
.mj-tools .sp-button[hidden] { display: none; }
.mj-shuffle { min-width: 120px; }
.mj-status { flex: 1; min-width: 12em; margin: 0; font-size: 17px; line-height: 1.35; color: #4b5563; }
.mj-status.is-note { color: #1f2937; font-weight: 600; }
.mj-tools .sp-button { -webkit-tap-highlight-color: transparent; }
.mj-fit { width: 100%; }
.mj-field { position: relative; margin: 0 auto; }
.mj-turn { margin: 12px 0 0; font-size: 16px; color: #4b5563; text-align: center; }

.mj-tile {
  position: absolute;
  left: calc(var(--x) * var(--w) / 2 + (var(--layers) - var(--z)) * var(--lift));
  top: calc(var(--y) * var(--h) / 2 + (var(--layers) - var(--z)) * var(--lift));
  width: var(--w);
  height: var(--h);
  padding: 0;
  border: 1px solid #b9a984;
  border-radius: calc(var(--w) * .13);
  background: linear-gradient(145deg, #fffdf6, #f5efdf);
  box-shadow: var(--edge) var(--edge) 0 #d2c297, calc(var(--edge) + 1px) calc(var(--edge) + 1px) 0 #a8966c, calc(var(--edge) + 1px) calc(var(--edge) + 3px) 6px rgba(31, 41, 55, .35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .2s ease, visibility 0s linear 0s;
}
.mj-face { display: block; width: 100%; height: 100%; padding: 4%; box-sizing: border-box; pointer-events: none; }
.mj-field--dim .mj-tile.is-blocked { background: linear-gradient(145deg, #ebe4d1, #ddd4bd); }
.mj-field--dim .mj-tile.is-blocked .mj-face { opacity: .82; }
.mj-tile.is-picked { background: #ffe9a6; border-color: #b8860b; box-shadow: inset 0 0 0 3px #d99a00, var(--edge) var(--edge) 0 #d9b24a, calc(var(--edge) + 1px) calc(var(--edge) + 1px) 0 #a8966c, calc(var(--edge) + 1px) calc(var(--edge) + 3px) 6px rgba(31, 41, 55, .35); }
.mj-tile.is-hint { animation: mj-glow 1.2s ease-in-out infinite; background: #cfe9d7; border-color: #2f8a4f; box-shadow: inset 0 0 0 3px #2f8a4f, var(--edge) var(--edge) 0 #9cc8a9, calc(var(--edge) + 1px) calc(var(--edge) + 1px) 0 #a8966c; }
.mj-tile.is-gone { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
.mj-tile.is-shaking { animation: mj-shake .4s ease; }
.mj-tile:focus-visible { outline: 3px solid #f2b705; outline-offset: 1px; }

@keyframes mj-glow { 50% { background: #eaf6ee; } }
@keyframes mj-shake { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) {
  .mj-tile, .mj-tile.is-gone { transition: none; }
  .mj-tile.is-shaking { animation: none; outline: 3px solid #c8412f; }
  .mj-tile.is-hint { animation: none; box-shadow: inset 0 0 0 3px #2f8a4f; }
}
/* Larger: the line above the tiles grows (the tiles themselves grow in mahjong.js). */
.sp--large .mj-status { font-size: 19px; }
/* More contrast: darker tile edges, whiter faces; where a level greys the tiles that are not free, a deeper grey. */
.sp--contrast .mj-tile { border-color: #5b4a24; background: #fffef9; }
.sp--contrast .mj-field--dim .mj-tile.is-blocked { background: linear-gradient(145deg, #e2dccb, #d3c9ae); }
.sp--contrast .mj-field--dim .mj-tile.is-blocked .mj-face { opacity: .7; }
.sp--contrast .mj-tile.is-picked { background: #ffe9a6; border-color: #7a5a00; box-shadow: inset 0 0 0 4px #b07d00, var(--edge) var(--edge) 0 #d9b24a, calc(var(--edge) + 1px) calc(var(--edge) + 1px) 0 #5b4a24; }
.sp--contrast .mj-tile.is-hint { background: #cfe9d7; border-color: #173427; box-shadow: inset 0 0 0 4px #1f6b3a, var(--edge) var(--edge) 0 #9cc8a9, calc(var(--edge) + 1px) calc(var(--edge) + 1px) 0 #5b4a24; }
.sp--contrast .mj-status { color: #111; }

@media (max-width: 760px) {
  .sp-board--mahjong { padding: 8px 4px; }
  .mj-tools { gap: 8px; margin-bottom: 10px; }
  .mj-shuffle { flex: 1; }
  .mj-status { flex-basis: 100%; min-height: 2.7em; text-align: center; font-size: 16px; }
  .sp--large .mj-status { font-size: 18px; }
}
