:root{
  --mj-bg:#0b1020; --mj-panel:#111a33; --mj-text:#e8ecff; --mj-muted:#aab4e6;
  --mj-tile:#f4f6ff; --mj-tile2:#e8ecff; --mj-shadow:rgba(0,0,0,.35);
  --mj-accent:#7aa2ff; --mj-danger:#ff6b8a; --mj-ok:#67e8a2;
}

.mahjong-app *{ box-sizing:border-box; }

.mahjong-app{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
  color:var(--mj-text);
  background:radial-gradient(1200px 700px at 20% 10%, #1a2a66 0%, var(--mj-bg) 55%, #070a14 100%);
  border:1px solid rgba(255,255,255,.09);
  border-radius:18px;
  box-shadow:0 20px 70px var(--mj-shadow);
  overflow:hidden;
  width:min(1100px,100%);
  margin:16px auto;
}

.mahjong-header{
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-bottom:1px solid rgba(255,255,255,.08);
  flex-wrap:wrap;
}

.mahjong-title{
  margin:0;
  font-size:16px;
  letter-spacing:.4px;
  font-weight:800;
  display:flex;
  align-items:center;
  gap:10px;
}

.mj-pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px;
  background:rgba(122,162,255,.14);
  border:1px solid rgba(122,162,255,.25);
  font-weight:800; font-size:12px;
}

.mj-toolbar{
  display:flex; gap:8px; align-items:center; flex-wrap:wrap;
}

.mj-btn{
  appearance:none; border:1px solid rgba(255,255,255,.12);
  background:rgba(17,26,51,.55);
  color:var(--mj-text);
  padding:9px 11px;
  border-radius:12px;
  font-weight:800; font-size:12px;
  cursor:pointer;
  transition:transform .06s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
  user-select:none;
}
.mj-btn:hover{ background:rgba(17,26,51,.75); border-color:rgba(255,255,255,.18) }
.mj-btn:active{ transform:translateY(1px) }
.mj-btn:disabled{ opacity:.45; cursor:not-allowed }
.mj-primary{ background:rgba(122,162,255,.22); border-color:rgba(122,162,255,.35); }
.mj-danger{ background:rgba(255,107,138,.16); border-color:rgba(255,107,138,.28); }
.mj-ok{ background:rgba(103,232,162,.14); border-color:rgba(103,232,162,.28); }

.mahjong-main{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap:14px;
  padding:14px;
}
@media (max-width: 920px){
  .mahjong-main{ grid-template-columns: 1fr; }
}

.mj-board-wrap{
  background:rgba(17,26,51,.35);
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:14px;
  position:relative;
  min-height:540px;
  overflow:auto;
}

.mj-board{
  position:relative;
  width:980px;
  height:600px;
  margin:auto;
  padding:12px;
}

.mj-side{
  background:rgba(17,26,51,.35);
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:540px;
}

.mj-card{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:12px;
}

.mj-row{ display:flex; justify-content:space-between; gap:10px; align-items:center; }
.mj-label{ color:var(--mj-muted); font-weight:800; font-size:12px; }
.mj-value{ font-weight:900; font-size:14px; }

.mj-msg{
  font-size:13px;
  color:var(--mj-text);
  line-height:1.35;
  min-height:44px;
}

.mj-rules{
  font-size:12px;
  color:var(--mj-muted);
  line-height:1.45;
}
.mj-kbd{
  display:inline-block;
  padding:2px 6px;
  border-radius:7px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  font-weight:900;
  font-size:11px;
  color:var(--mj-text);
}

.mj-footer-note{
  margin-top:auto;
  font-size:11px;
  color:rgba(232,236,255,.65);
  line-height:1.35;
}

/* Tiles */
.mj-tile{
  position:absolute;
  width:64px; height:80px;
  border-radius:14px;
  background:linear-gradient(180deg, var(--mj-tile), var(--mj-tile2));
  border:3px solid rgba(40,40,60,.5);
  box-shadow: 0 8px 14px rgba(0,0,0,.22), 0 3px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.4);
  display:flex; align-items:center; justify-content:center;
  font-size:22px;
  color:#17224d;
  font-weight:900;
  cursor:pointer;
  transform: translate(var(--x), var(--y));
  transition: transform .08s ease, box-shadow .15s ease, filter .15s ease, opacity .15s ease, background .15s ease;
  user-select:none;
}
.mj-tile::before{
  content:"";
  position:absolute;
  inset:6px 6px 10px 6px;
  border-radius:12px;
  border:1px solid rgba(23,34,77,.14);
  pointer-events:none;
}
.mj-tile.selected{
  background:linear-gradient(180deg, #e8d4f8, #d8b8f0);
  outline:4px solid rgba(180,100,220,.85);
  box-shadow:0 12px 20px rgba(0,0,0,.22), 0 0 0 8px rgba(180,100,220,.25);
}
.mj-tile.locked{
  opacity:.35;
  cursor:not-allowed;
  filter:grayscale(.2);
}
.mj-tile.hint{
  outline:3px solid rgba(103,232,162,.55);
  box-shadow:0 12px 20px rgba(0,0,0,.22), 0 0 0 6px rgba(103,232,162,.12);
}
.mj-tile.removing{
  animation: mj-pop .18s ease forwards;
}
@keyframes mj-pop{
  to{ transform:translate(var(--x), var(--y)) scale(.88); opacity:0; }
}

/* Layer depth */
.mj-layer-0{ z-index:10; }
.mj-layer-1{ z-index:20; filter:drop-shadow(3px 3px 0 rgba(0,0,0,.22)); }
.mj-layer-2{ z-index:30; filter:drop-shadow(6px 6px 0 rgba(0,0,0,.22)); }

/* Modal */
.mj-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:999999;
}
.mj-modal{
  width:min(520px, 100%);
  background:rgba(17,26,51,.95);
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  box-shadow:0 20px 70px rgba(0,0,0,.45);
  padding:14px;
}
.mj-modal h2{
  margin:0 0 10px 0;
  font-size:16px;
}
.mj-form{
  display:grid;
  gap:10px;
}
.mj-input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--mj-text);
  font-weight:800;
}
.mj-small{
  font-size:12px;
  color:var(--mj-muted);
  line-height:1.4;
}
.mj-score-list{
  margin:0;
  padding-left:18px;
  color:var(--mj-text);
  font-size:12px;
  line-height:1.45;
}
.mj-tile .face-main{
  font-size:58px;
  line-height:1;
}

.mj-tile{ font-size:16px; }

.mj-board{
  position:relative;
  width:980px;
  height:600px;
  margin:auto;
  padding:12px;
  transform-origin: top left;

  /* ✅ smooth zoom + pan */
  transition:
    transform 220ms ease,
    left 220ms ease,
    top 220ms ease;
}
/* ===== Leaderboard readability ===== */
.mj-modal{
  color: #e9ecff;
}

.mj-modal h2{
  color:#ffffff;
}

.mj-modal .mj-table{
  background: rgba(10,14,30,.35);
}

.mj-modal .mj-table thead th{
  color:#ffffff;
  font-weight:900;
  text-shadow: 0 2px 6px rgba(0,0,0,.4);
}

.mj-modal .mj-table tbody td{
  color:#f2f4ff;
}

.mj-modal .mj-table tbody tr:nth-child(odd){
  background: rgba(255,255,255,.03);
}

.mj-modal .mj-table tbody tr:hover{
  background: rgba(122,162,255,.12);
}
.mj-win-score{
  font-size:32px;
  font-weight:900;
  letter-spacing:.4px;
}
/* Suit colors */
.mj-tile.suit-dots, .mj-tutorial-tile.suit-dots{
  background:linear-gradient(180deg, #d4e8f8, #b8d4f0);
}
.mj-tile.suit-bamboo, .mj-tutorial-tile.suit-bamboo{
  background:linear-gradient(180deg, #d4f0d8, #b8e0bc);
}
.mj-tile.suit-characters, .mj-tutorial-tile.suit-characters{
  background:linear-gradient(180deg, #f8e4d4, #f0d0b8);
}
.mj-tile.suit-winds, .mj-tutorial-tile.suit-winds{
  background:linear-gradient(180deg, #f8f4d4, #f0e8b8);
}
.mj-tile.suit-dragons, .mj-tutorial-tile.suit-dragons{
  background:linear-gradient(180deg, #f8d4dc, #f0b8c4);
}
/* Tile-styled buttons */
.mj-tile-btn{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  width:100px;
  height:120px;
  border-radius:14px;
  background:linear-gradient(180deg, #f4f6ff, #e8ecff);
  border:3px solid rgba(40,40,60,.5);
  box-shadow: 0 8px 14px rgba(0,0,0,.22), 0 3px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.6);
  cursor:pointer;
  transition: transform .1s ease, box-shadow .15s ease;
  color:#17224d;
  padding:8px;
}
.mj-tile-btn:hover{
  transform:translateY(-2px);
  box-shadow: 0 12px 20px rgba(0,0,0,.25), 0 4px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.6);
}
.mj-tile-btn:active{
  transform:translateY(1px);
}
.mj-tile-btn-icon{
  font-size:32px;
  line-height:1;
}
.mj-tile-btn-text{
  font-size:16px;
  font-weight:900;
  margin-top:4px;
}
.mj-tile-btn-sub{
  font-size:11px;
  font-weight:600;
  opacity:.7;
  margin-top:2px;
}

/* Smaller tile buttons for level grid */
.mj-tile-btn-sm{
  width:80px;
  height:85px;
  padding:6px;
}
.mj-tile-btn-sm .mj-tile-btn-text{
  font-size:16px;
  white-space: nowrap;
}
/* Level indicator in corner */
.mj-level-indicator {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  text-shadow:
    0 0 8px rgba(100, 180, 255, 0.9),
    0 0 16px rgba(100, 180, 255, 0.6),
    0 0 24px rgba(100, 180, 255, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 100;
  letter-spacing: 1px;
  pointer-events: none;
}

/* Collected suits box: transparent so board shows through */
.mj-suit-stack{
  background: transparent;
  border: none;
  padding: 0;
}

/* Two-column special button grid for Random + Latest Record */
.mj-special-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Make these special buttons adapt to the grid */
.mj-special-grid .mj-tile-btn{
  width: 100%;
}

/* Responsive: stack on smaller screens */
@media (max-width: 600px){
  .mj-special-grid{
    grid-template-columns: 1fr;
  }
}

@keyframes mj-pulse-collect {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
  50% {
    transform: scale(1.1);
    box-shadow:
      0 0 20px rgba(255, 215, 0, 0.8),
      0 0 40px rgba(255, 215, 0, 0.4);
  }
}

.mj-tile.pulse-collect {
  animation: mj-pulse-collect 1.2s ease-in-out infinite;
  z-index: 10 !important;
}
@keyframes mj-pulse-next {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4), 0 0 16px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
  }
}

.mj-btn.mj-next-level {
  background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
  border-color: #d58512;
  color: #fff;
  font-weight: 900;
  animation: mj-pulse-next 1.5s ease-in-out infinite;
}

.mj-btn.mj-next-level:hover {
  background: linear-gradient(135deg, #ec971f 0%, #d58512 100%);
  box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 215, 0, 0.6);
}
/* Pulse animation for 3rd, 7th, 11th, 15th cards in collection */
@keyframes mj-pulse-collect {
  0%, 100% {
    transform: scale(0.45);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
  50% {
    transform: scale(0.52);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
  }
}

.mj-tile.pulse-collect {
  animation: mj-pulse-collect 1.2s ease-in-out infinite;
  z-index: 10 !important;
}

/* Next Level button with pulsing glow */
@keyframes mj-pulse-next {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4), 0 0 16px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
  }
}

.mj-btn.mj-next-level {
  background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
  border-color: #d58512;
  color: #fff;
  font-weight: 900;
  animation: mj-pulse-next 1.5s ease-in-out infinite;
}

.mj-btn.mj-next-level:hover {
  background: linear-gradient(135deg, #ec971f 0%, #d58512 100%);
  box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 215, 0, 0.6);
}
.mj-score-indicator {
  position: absolute;
  left: 20px;
  top: 46px;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0 8px rgba(100, 180, 255, 0.9),
    0 0 16px rgba(100, 180, 255, 0.6),
    0 0 24px rgba(100, 180, 255, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  z-index: 100;
  pointer-events: none;
}


/* ===== PvP ===== */
.mj-btn.mj-pvp{
  border-color: rgba(255, 185, 90, .35);
}
.mj-pvp-card .mj-emotes{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:6px;
}
.mj-btn.mj-emote{
  padding:8px 10px;
  min-width:44px;
  font-size:16px;
}
.mj-pvp-wait{
  position:absolute;
  left:50%;
  top:18px;
  transform:translateX(-50%);
  padding:10px 14px;
  background: rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  font-weight:900;
  z-index:50;
  pointer-events:none;
  backdrop-filter: blur(8px);
}
.mj-board-wrap{ position:relative; }
/* PvP Turn Indicator */
.mj-turn-indicator {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  z-index: 100;
  pointer-events: none;
  text-transform: uppercase;
}

.mj-turn-indicator.your-turn {
  background: rgba(103, 232, 162, 0.25);
  border: 2px solid rgba(103, 232, 162, 0.6);
  color: #67e8a2;
  text-shadow: 0 0 10px rgba(103, 232, 162, 0.8);
  animation: mj-pulse-your-turn 1.5s ease-in-out infinite;
}

.mj-turn-indicator.other-turn {
  background: rgba(255, 170, 100, 0.2);
  border: 2px solid rgba(255, 170, 100, 0.5);
  color: #ffaa64;
  text-shadow: 0 0 10px rgba(255, 170, 100, 0.6);
  animation: mj-pulse-other-turn 2s ease-in-out infinite;
}

@keyframes mj-pulse-your-turn {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(103, 232, 162, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(103, 232, 162, 0.7), 0 0 40px rgba(103, 232, 162, 0.4);
  }
}

@keyframes mj-pulse-other-turn {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(255, 170, 100, 0.3);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(255, 170, 100, 0.5), 0 0 35px rgba(255, 170, 100, 0.3);
  }
}

/* Shake animation for the waiting indicator when board is touched */
.mj-pvp-wait.shake {
  animation: mj-shake-grow 0.5s ease-in-out;
}

@keyframes mj-shake-grow {
  0% { transform: translateX(-50%) scale(1); }
  10% { transform: translateX(-50%) scale(1.15) rotate(-3deg); }
  20% { transform: translateX(-50%) scale(1.2) rotate(3deg); }
  30% { transform: translateX(-50%) scale(1.2) rotate(-3deg); }
  40% { transform: translateX(-50%) scale(1.15) rotate(3deg); }
  50% { transform: translateX(-50%) scale(1.1) rotate(-2deg); }
  60% { transform: translateX(-50%) scale(1.05) rotate(2deg); }
  70% { transform: translateX(-50%) scale(1.02) rotate(-1deg); }
  80% { transform: translateX(-50%) scale(1.01) rotate(1deg); }
  100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}

/* PvP Round Over Modal Styling */
.mj-round-win {
  animation: mj-bounce-in 0.5s ease-out;
}

.mj-round-lose {
  animation: mj-shake-sad 0.5s ease-out;
}

.mj-round-draw {
  animation: mj-pulse-draw 1s ease-in-out infinite;
}

@keyframes mj-bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes mj-shake-sad {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
}

@keyframes mj-pulse-draw {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* PvP remote selection highlight */
.mj-tile.remote-selected {
  outline: 4px solid rgba(255, 170, 100, 0.85);
  box-shadow: 0 12px 20px rgba(0,0,0,.22), 0 0 0 8px rgba(255, 170, 100, 0.25);
  animation: mj-pulse-remote 1.5s ease-in-out infinite;
}

@keyframes mj-pulse-remote {
  0%, 100% {
    outline-color: rgba(255, 170, 100, 0.85);
    box-shadow: 0 12px 20px rgba(0,0,0,.22), 0 0 0 8px rgba(255, 170, 100, 0.25);
  }
  50% {
    outline-color: rgba(255, 200, 100, 1);
    box-shadow: 0 12px 20px rgba(0,0,0,.22), 0 0 0 12px rgba(255, 170, 100, 0.4);
  }
}

/* Match explosion animation */
@keyframes mj-match-explode {
  0% {
    transform: translate(var(--x), var(--y)) scale(1);
    opacity: 1;
    filter: brightness(1);
  }
  40% {
    transform: translate(var(--x), var(--y)) scale(1.5);
    filter: brightness(1.8) saturate(1.5);
  }
  70% {
    transform: translate(var(--x), var(--y)) scale(1.8);
    opacity: 0.6;
    filter: brightness(2.5) saturate(2);
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(2.2);
    opacity: 0;
    filter: brightness(3) saturate(0);
  }
}

.mj-tile.match-exploding {
  animation: mj-match-explode 0.4s ease-out forwards;
  z-index: 9999 !important;
}

.mj-streak-floater{
  position: absolute;
  left: 16px;
  bottom: 50px;
  width:100px;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(17,26,51,.92);
  border: 1px solid rgba(122,162,255,.28);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  backdrop-filter: blur(8px);

  transition: transform 150ms ease, opacity 300ms ease;
  pointer-events: none;
}

.mj-streak-floater .mj-streak-face{
  width:44px;
  height:56px;
  border-radius:10px;
  background:linear-gradient(180deg, var(--mj-tile), var(--mj-tile2));
  border:2px solid rgba(40,40,60,.45);
  box-shadow:0 6px 14px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.55);
  display:grid;
  place-items:center;
  font-size:26px;
  line-height:1;
  position: relative;
}

/* make suit colours actually apply (match tile colours) */
.mj-streak-floater .mj-streak-face.suit-dots{ background:linear-gradient(180deg, #d4e8f8, #b8d4f0); }
.mj-streak-floater .mj-streak-face.suit-bamboo{ background:linear-gradient(180deg, #d4f0d8, #b8e0bc); }
.mj-streak-floater .mj-streak-face.suit-characters{ background:linear-gradient(180deg, #f8e4d4, #f0d0b8); }
.mj-streak-floater .mj-streak-face.suit-winds{ background:linear-gradient(180deg, #f8f4d4, #f0e8b8); }
.mj-streak-floater .mj-streak-face.suit-dragons{ background:linear-gradient(180deg, #f8d4dc, #f0b8c4); }


.mj-streak-floater .mj-streak-badge{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(0, 0, 0, 0.2);
  color: #000000; /* Black text */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.2px;
  text-shadow: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Level indicator in corner */
.mj-level-indicator {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  text-shadow:
    0 0 8px rgba(100, 180, 255, 0.9),
    0 0 16px rgba(100, 180, 255, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 100;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.mj-score-indicator {
  position: absolute;
  left: 20px;
  top: 42px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  z-index: 100;
  pointer-events: none;
}

.mj-score-line {
  font-size: 16px;
  font-weight: 900;
  color: #ffffff;
  text-shadow:
    0 0 8px rgba(100, 180, 255, 0.9),
    0 0 16px rgba(100, 180, 255, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.mj-score-line.mj-opp-score {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.8;
}

/* Moves Dots */
.mj-moves-dots {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mj-move-dot {
  font-size: 24px;
  line-height: 1;
  transition: all 0.3s ease;
}

.mj-move-dot.filled {
  color: #67e8a2;
  text-shadow: 0 0 10px rgba(103, 232, 162, 0.8),
               0 0 20px rgba(103, 232, 162, 0.5);
}

.mj-move-dot.empty {
  color: rgba(255, 255, 255, 0.3);
  text-shadow: none;
}

/* PvP moves-left dots: consistent size */
.mj-move-dot{
  display:inline-block;
  width:14px;
  height:14px;
  border-radius:999px;
  font-size:0;          /* hide the ● / ○ glyph */
  line-height:0;
  vertical-align:middle;
}

.mj-move-dot.empty{
  background: transparent;
  border:2px solid rgba(255,255,255,.35);
  box-shadow:none;
}

.mj-move-dot.filled{
  background:#67e8a2;
  border:2px solid rgba(103,232,162,.65);
  box-shadow:
    0 0 10px rgba(103,232,162,.8),
    0 0 20px rgba(103,232,162,.5);
}


/* PvP Turn Indicator - now positioned below skulls on right side */
.mj-turn-indicator {
  position: absolute;
  top: 60px;
  right: 16px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.5px;
  z-index: 100;
  pointer-events: none;
  text-transform: uppercase;
}

.mj-turn-indicator.your-turn {
  background: rgba(103, 232, 162, 0.25);
  border: 2px solid rgba(103, 232, 162, 0.6);
  color: #67e8a2;
  text-shadow: 0 0 10px rgba(103, 232, 162, 0.8);
  animation: mj-pulse-your-turn 1.5s ease-in-out infinite;
}

.mj-turn-indicator.other-turn {
  background: rgba(255, 170, 100, 0.2);
  border: 2px solid rgba(255, 170, 100, 0.5);
  color: #ffaa64;
  text-shadow: 0 0 10px rgba(255, 170, 100, 0.6);
  animation: mj-pulse-other-turn 2s ease-in-out infinite;
}

/* Level Select Modal - Responsive Grid */
.mj-modal .mj-level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

/* Tablet - 3 columns */
@media (max-width: 600px) {
  .mj-modal .mj-level-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  
  .mj-modal .mj-special-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* Make the tile buttons smaller on mobile */
  .mj-tile-btn-sm {
    width: 100%;
    height: 70px;
    padding: 4px;
  }
  
  .mj-tile-btn-sm .mj-tile-btn-text {
    font-size: 14px;
  }
}

/* Small phones - 2 columns */
@media (max-width: 400px) {
  .mj-modal .mj-level-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .mj-tile-btn-sm {
    height: 65px;
  }
  
  .mj-tile-btn-sm .mj-tile-btn-text {
    font-size: 13px;
  }
}

/* Help button in modal */
.mj-help-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(122,162,255,0.25) 0%, rgba(122,162,255,0.15) 100%);
  border: 2px solid rgba(122,162,255,0.4);
  color: var(--mj-accent);
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.mj-help-btn:hover {
  background: linear-gradient(135deg, rgba(122,162,255,0.35) 0%, rgba(122,162,255,0.25) 100%);
  border-color: rgba(122,162,255,0.6);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(122,162,255,0.3);
}

.mj-help-btn:active {
  transform: translateY(0);
}

/* Tutorial modal styling */
.mj-tutorial-section {
  margin: 20px 0;
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}

.mj-tutorial-section h3 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--mj-accent);
  font-weight: 900;
}

.mj-tutorial-section p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--mj-text);
}

.mj-tutorial-tiles {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  flex-wrap: wrap;
}

.mj-tutorial-tile {
  position: relative;
  width: 64px;
  height: 80px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--mj-tile), var(--mj-tile2));
  border: 3px solid rgba(40,40,60,.5);
  box-shadow: 0 8px 14px rgba(0,0,0,.22), 0 3px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #17224d;
  font-weight: 900;
}

.mj-tutorial-tile::before {
  content: "";
  position: absolute;
  inset: 6px 6px 10px 6px;
  border-radius: 12px;
  border: 1px solid rgba(23,34,77,.14);
  pointer-events: none;
}

.mj-tutorial-tile .face-main {
  font-size: 58px;
  line-height: 1;
}

.mj-tutorial-arrow {
  font-size: 32px;
  color: var(--mj-ok);
  animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.mj-tutorial-equals {
  font-size: 28px;
  font-weight: 900;
  color: var(--mj-text);
}

.mj-tutorial-points {
  font-size: 20px;
  font-weight: 900;
  color: var(--mj-ok);
  padding: 8px 16px;
  background: rgba(103,232,162,0.15);
  border: 2px solid rgba(103,232,162,0.3);
  border-radius: 12px;
}

.mj-tutorial-scoring-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}

.mj-tutorial-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--mj-muted);
  text-align: center;
}

@media (max-width: 600px) {
  .mj-tutorial-tiles {
    gap: 8px;
  }
  
  .mj-tutorial-tile {
    width: 54px;
    height: 68px;
  }
  
  .mj-tutorial-tile .face-main {
    font-size: 48px;
  }
  
  .mj-help-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
    bottom: 12px;
    right: 12px;
  }
}

/* Modal itself needs to be more mobile-friendly */
@media (max-width: 600px) {
  .mj-modal {
    max-width: 95vw !important;
    margin: 10px;
    padding: 12px;
  }
  
  .mj-modal h2 {
    font-size: 14px;
  }
  
  .mj-modal .mj-form {
    gap: 8px;
  }
}

.mj-move-dot.filled-opponent {
  color: #7aa2ff; /* Blue for opponent's turn */
}

.mj-move-dot.empty-opponent {
  color: rgba(122, 162, 255, 0.3); /* Faded blue for empty opponent dots */
}

.mj-move-dot.filled-opponent {
  color: #7aa2ff; /* Blue for opponent's turn */
}

.mj-move-dot.empty-opponent {
  color: rgba(122, 162, 255, 0.3); /* Faded blue for empty opponent dots */
}

.mj-shuffle-btn:hover {
  background: linear-gradient(135deg, rgba(103,232,162,0.25) 0%, rgba(103,232,162,0.15) 100%);
  border-color: rgba(103,232,162,0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(103,232,162,0.3);
}

.mj-shuffle-btn:active {
  transform: translateY(0);
}

.mj-shuffle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.3);
}

.mj-shuffle-btn {
  position: absolute;
  left: 16px;
  bottom: 1px;
  width: 100px;
  height: 48px;
  background: linear-gradient(135deg, rgba(103,232,162,0.15) 0%, rgba(103,232,162,0.05) 100%);
  border: 2px solid rgba(103,232,162,0.3);
  border-radius: 12px;
  color: #67e8a2;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  z-index: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* ===== DRAGON STREAK TRACKER (All Dragon Types) ===== */
.mj-red-streak-tracker {
  position: absolute;
  right: 20px;
  bottom: 60px; /* Above the shuffle button */
  display: none; /* Hidden by default, shown via JS */
  flex-direction: column-reverse; /* Stack upwards from bottom */
  gap: 8px;
  align-items: center;
  z-index: 500; /* Above tiles and other board elements */
  pointer-events: none;
  padding: 12px;
  border-radius: 12px;
}

.mj-red-dragon-icon {
  font-size: 24px; /* Start smaller, will be overridden by JS */
  animation: dragonExplosivePulse 1.5s ease-in-out infinite;
  transform-origin: center;
  line-height: 1;
  display: block;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dragonExplosivePulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 8px currentColor) 
            drop-shadow(0 0 12px currentColor) 
            brightness(1);
  }
  25% {
    transform: scale(1.15) rotate(-5deg);
    filter: drop-shadow(0 0 16px currentColor) 
            drop-shadow(0 0 24px currentColor) 
            brightness(1.4);
  }
  50% {
    transform: scale(1.25) rotate(0deg);
    filter: drop-shadow(0 0 20px currentColor) 
            drop-shadow(0 0 32px currentColor) 
            brightness(1.6) saturate(1.5);
  }
  75% {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 16px currentColor) 
            drop-shadow(0 0 24px currentColor) 
            brightness(1.4);
  }
}

/* Dragon-specific colors for explosive effect - ALL USE FIERY COLORS */
.mj-red-dragon-icon[data-dragon="red"] {
  color: #ff0000;
  text-shadow: 0 0 10px #ff0000, 0 0 20px #ff3333, 0 0 30px #ff6666;
}

.mj-red-dragon-icon[data-dragon="white"] {
  color: #ffaa00;
  text-shadow: 0 0 10px #ffaa00, 0 0 20px #ffcc33, 0 0 30px #ffdd66;
}

.mj-red-dragon-icon[data-dragon="green"] {
  color: #ff6600;
  text-shadow: 0 0 10px #ff6600, 0 0 20px #ff8833, 0 0 30px #ffaa66;
}

.mj-red-streak-badge {
  background: linear-gradient(135deg, #ff6b00 0%, #ffd700 50%, #ff6b00 100%);
  color: white;
  font-weight: 900;
  font-size: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 3px solid #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
              0 0 40px rgba(255, 107, 0, 0.6);
  animation: badgeExplosivePulse 0.6s ease-in-out infinite;
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes badgeExplosivePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                0 0 40px rgba(255, 107, 0, 0.6);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 30px rgba(255, 215, 0, 1),
                0 0 60px rgba(255, 107, 0, 0.8),
                0 0 90px rgba(255, 0, 0, 0.4);
  }
}

/* ===== EXTRA TURN NOTIFICATION ===== */
.mj-extra-turn-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff6b35 100%);
  color: white;
  font-size: 32px;
  font-weight: 900;
  padding: 20px 40px;
  border-radius: 16px;
  border: 4px solid #ffd700;
  box-shadow: 0 0 40px rgba(255, 107, 53, 0.8),
              0 0 80px rgba(255, 107, 53, 0.4);
  z-index: 1000;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  animation: extraTurnGlow 1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes extraTurnGlow {
  0%, 100% {
    box-shadow: 0 0 40px rgba(255, 107, 53, 0.8),
                0 0 80px rgba(255, 107, 53, 0.4);
  }
  50% {
    box-shadow: 0 0 60px rgba(255, 107, 53, 1),
                0 0 120px rgba(255, 107, 53, 0.6);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mj-red-streak-tracker {
    left: 5px;
  }
  
  .mj-red-dragon-icon {
    font-size: 30px;
  }
  
  .mj-red-streak-badge {
    font-size: 14px;
    padding: 3px 10px;
  }
  
  .mj-extra-turn-flash {
    font-size: 24px;
    padding: 15px 30px;
  }
}
