.mjtile {
  position: relative;
  width: 30px;
  height: 42px;
  border: none;
  border-radius: 7px;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 26%),
    linear-gradient(180deg, #fffaf0 0%, #f2e7cf 62%, #d9c8a1 100%);
  border: 1px solid rgba(167, 133, 81, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -2px 3px rgba(122, 90, 43, 0.18),
    0 3px 8px rgba(0, 0, 0, 0.28);
  color: #31261c;
  overflow: hidden;
}

.mjtile::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.08) 20%, transparent 42%);
}

.mjtile--compact {
  width: 22px;
  height: 31px;
  border-radius: 5px;
}

.mjtile--interactive {
  cursor: pointer;
}

.mjtile--selected {
  transform: translateY(-11px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 9px 16px rgba(0, 0, 0, 0.38),
    0 0 0 2px rgba(244, 210, 122, 0.58);
}

.mjtile--rotated {
  transform: rotate(90deg);
}

.mjtile--rotated.mjtile--selected {
  transform: translateY(-11px) rotate(90deg);
}

.mjtile--back {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.18), transparent 18%),
    linear-gradient(180deg, #0f725a 0%, #0b5946 54%, #083c31 100%);
  border-color: rgba(248, 227, 181, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 3px rgba(0, 0, 0, 0.26),
    0 3px 8px rgba(0, 0, 0, 0.34);
}

.mjtile--back::after {
  content: '';
  position: absolute;
  inset: 1px 2px auto 2px;
  height: 24%;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, #f7efdc 0%, #e1d0ad 100%);
  box-shadow: inset 0 -1px 0 rgba(95, 72, 32, 0.18);
}

.mjtile--back::before {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35) 0%, transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.15));
}

.mjtile__backmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(255, 246, 216, 0.76);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.42);
  z-index: 1;
}

.mjtile__face {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mjtile__label {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: rgba(104, 76, 39, 0.96);
  z-index: 2;
}

.mjtile__face--wan .mjtile__label {
  color: #8a5430;
}

.mjtile__face--dragon .mjtile__label {
  color: #a8472d;
}

.mjtile__wan-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.mjtile__wan-text--red {
  color: #cc2430;
}

.mjtile__wan-text--black {
  color: #241f1e;
}

.mjtile__wan-text--ghost {
  bottom: 3px;
  font-size: 8px;
  opacity: 0.42;
}

.mjtile__wan-char {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 900;
  color: #8a4f22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.mjtile__dragon {
  font-size: 19px;
  font-weight: 900;
  color: #cf2028;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mjtile__pip-grid {
  position: absolute;
  inset: 10px 5px 6px;
  display: grid;
  gap: 3px;
  align-items: center;
  justify-items: center;
}

.mjtile__pip-grid--tong {
  grid-template-columns: repeat(3, 1fr);
}

.mjtile__pip-grid--tiao {
  grid-template-columns: repeat(3, 1fr);
}

.mjtile__pip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mjtile__pip--circle {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #fef5d8 0%, #f3aa4a 26%, #c75b15 68%, #8a3d0a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0.4px 0.8px rgba(0, 0, 0, 0.2);
}

.mjtile__pip--circle::after {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 240, 205, 0.78);
}

.mjtile__pip--bamboo {
  width: 5px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a8db79 0%, #4bb94b 42%, #1f7d34 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 0.5px 0.8px rgba(0, 0, 0, 0.18);
}

.mjtile__pip--bamboo::before,
.mjtile__pip--bamboo::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 9px;
  height: 1px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.28);
}

.mjtile__pip--bamboo::before {
  top: 3px;
}

.mjtile__pip--bamboo::after {
  bottom: 3px;
}

.mjtile--compact .mjtile__label {
  top: 2px;
  font-size: 5px;
}

.mjtile--compact .mjtile__wan-char {
  top: 8px;
  font-size: 13px;
}

.mjtile--compact .mjtile__dragon {
  font-size: 14px;
}

.mjtile--compact .mjtile__pip-grid {
  inset: 8px 4px 4px;
  gap: 2px;
}

.mjtile--compact .mjtile__pip--circle {
  width: 5px;
  height: 5px;
}

.mjtile--compact .mjtile__pip--bamboo {
  width: 4px;
  height: 9px;
}
