/* --- Mahjong Game Specific Styles --- */

.mahjong-game-panel {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Header Bar */
.mj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
  gap: 1rem;
}

.mj-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mj-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
}

.mj-timer-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-md);
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.mj-timer-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mj-timer-val {
  font-family: 'Inter', monospace;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

/* Feedback Banners */
.mj-feedback {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideDown 0.25s ease-out;
}

.mj-feedback.hidden {
  display: none;
}

.error-banner {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid rgba(255, 82, 82, 0.4);
  color: #ff5252;
}

.success-banner {
  background: rgba(0, 230, 118, 0.18);
  border: 1px solid rgba(0, 230, 118, 0.5);
  color: #00e676;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Wrapper */
.mj-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.mj-section-header {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mj-hint-tag, .selected-count {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Hand Container */
.mj-hand-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 90px;
  align-items: center;
}

/* --- Mahjong Tile Graphic Styling --- */
.mj-tile {
  width: 44px;
  height: 62px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f4ea 100%);
  border-radius: 6px;
  box-shadow: 
    0 4px 0 #bfae8b,
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  position: relative;
  user-select: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.mj-tile-body {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* SVG Patterns */
.mj-svg-pattern {
  width: 86%;
  height: 86%;
  display: block;
}

/* Wan Tiles Calligraphy */
.mj-tile-wan-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mj-wan-num {
  font-size: 1.3rem;
  font-weight: 900;
  color: #d32f2f;
  font-family: 'Noto Sans TC', serif;
}

.mj-wan-char {
  font-size: 0.75rem;
  font-weight: 800;
  color: #d32f2f;
  margin-top: 2px;
}

/* Zi Tiles (Honours) */
.mj-tile-zi-face {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mj-zi-char {
  font-size: 1.4rem;
  font-weight: 900;
  color: #263238;
}

.mj-tile-zi-face.color-red .mj-zi-char { color: #d32f2f; }
.mj-tile-zi-face.color-green .mj-zi-char { color: #1b5e20; }
.mj-tile-zi-face.color-white .mj-zi-char {
  color: #0288d1;
  border: 2px solid #0288d1;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 1.15rem;
}

/* Selectable Tile State */
.mj-tile.is-selectable {
  cursor: pointer;
}

.mj-tile.is-selectable:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 7px 0 #bfae8b,
    0 10px 16px rgba(0, 0, 0, 0.5);
}

.mj-tile.is-selected {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 
    0 8px 0 #764ba2,
    0 0 20px rgba(0, 242, 254, 0.8);
  outline: 3px solid var(--accent-cyan);
}

.mj-tile.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Option Grid */
.mj-options-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-row-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 45px;
}

.option-row-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  flex: 1;
}

/* Actions & Buttons */
.mj-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn-submit {
  width: 100%;
  max-width: 250px;
  font-size: 1.1rem;
  padding: 1rem;
}

/* Shake Animation */
.shake {
  animation: shakeAnim 0.4s ease-in-out;
}

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

/* Confetti Wrapper */
.confetti-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 2.2s linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(600px) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive Mahjong Layout */
@media (max-width: 600px) {
  .mj-tile {
    width: 36px;
    height: 52px;
  }

  .mj-wan-num {
    font-size: 1.1rem;
  }

  .mj-wan-char {
    font-size: 0.65rem;
  }

  .option-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .option-row-label {
    width: auto;
  }
}
