/* Mahjong Solitaire Styles */
:root {
  --bg: #1a3a1a;
  --felt: #2a5a2a;
  --panel: #1a1a2e;
  --border: #2a2a4a;
  --text: #f0f0f5;
  --muted: #8888aa;
  --accent: #b7ff3c;
  --tile-bg: #f5f0e6;
  --tile-border: #c4b896;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--felt) 100%);
  color: var(--text);
  font-family: 'Chivo', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

nav {
  background: rgba(0,0,0,0.3);
}

.game-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 12px;
}

.game-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stats {
  display: flex;
  gap: 16px;
}

.stat {
  text-align: center;
}

.stat-label {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.controls {
  display: flex;
  gap: 8px;
}

.control-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.5);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Board */
.board-wrapper {
  overflow-x: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
}

#board {
  position: relative;
  margin: 0 auto;
}

/* Tiles */
.tile {
  position: absolute;
  width: 44px;
  height: 56px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.tile-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #fff 0%, var(--tile-bg) 100%);
  border: 2px solid var(--tile-border);
  border-radius: 6px;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3), -1px -1px 2px rgba(255,255,255,0.5) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.tile .symbol {
  font-size: 1.2rem;
  line-height: 1;
}

.tile .label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #333;
}

/* Tile categories */
.tile-inner.dots .symbol { color: #0066cc; }
.tile-inner.bamboo .symbol { color: #228b22; }
.tile-inner.chars .symbol { color: #333; }
.tile-inner.wind .symbol { color: #333; font-size: 1.4rem; }
.tile-inner.dragon.red .symbol { color: #cc0000; }
.tile-inner.dragon.green .symbol { color: #228b22; }
.tile-inner.dragon.white .symbol { color: #333; border: 1px solid #333; border-radius: 2px; padding: 2px; }
.tile-inner.flower .symbol { font-size: 1.4rem; }
.tile-inner.season .symbol { color: #8b4513; font-size: 1.3rem; }

/* Tile states */
.tile.free:hover {
  transform: translateY(-4px);
}

.tile.free:hover .tile-inner {
  box-shadow: 4px 4px 8px rgba(0,0,0,0.4), -1px -1px 2px rgba(255,255,255,0.5) inset;
}

.tile.blocked {
  cursor: not-allowed;
  opacity: 0.85;
}

.tile.selected .tile-inner {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent), 4px 4px 8px rgba(0,0,0,0.4);
}

.tile.hint .tile-inner {
  animation: hintPulse 0.5s ease infinite;
}

@keyframes hintPulse {
  0%, 100% { border-color: #ff6b6b; box-shadow: 0 0 0 3px #ff6b6b; }
  50% { border-color: #feca57; box-shadow: 0 0 0 3px #feca57; }
}

/* Message */
#message {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 12px 24px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 50;
}

#message.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Modal screens */
#win-screen, #lose-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

#win-screen.show, #lose-screen.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 340px;
}

.modal-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
}

.modal-stats {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.8;
}

.modal-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a14;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn:hover {
  transform: scale(1.03);
}

/* Responsive */
@media (max-width: 600px) {
  .game-header {
    flex-direction: column;
    text-align: center;
  }

  .stats { justify-content: center; }
  .controls { justify-content: center; }

  .tile {
    width: 36px;
    height: 46px;
  }

  .tile .symbol { font-size: 1rem; }
  .tile .label { font-size: 0.6rem; }
}

@media (max-width: 400px) {
  .tile {
    width: 30px;
    height: 40px;
  }

  .tile .symbol { font-size: 0.85rem; }
  .tile .label { font-size: 0.5rem; }
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.3);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.breadcrumb {
  display: flex;
  list-style: none;
  gap: 8px;
}

.breadcrumb li::after {
  content: '›';
  margin-left: 8px;
  color: rgba(255,255,255,0.5);
}

.breadcrumb li:last-child::after { display: none; }

.breadcrumb a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.more-link {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}

@media (max-width: 500px) {
  .breadcrumb { display: none; }
}

/* Game Content */
.game-content {
  max-width: 700px;
  margin: 32px auto;
  padding: 0 16px;
}

.game-content section {
  margin-bottom: 32px;
}

.game-content h2 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.game-content p {
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.game-content ol,
.game-content ul {
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
  padding-left: 24px;
  font-size: 0.9rem;
}

.game-content li { margin-bottom: 8px; }
.game-content strong { color: #fff; }

/* Footer */
.bp-footer {
  margin-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 24px 16px;
  background: rgba(0,0,0,0.3);
}

.bp-footer__inner {
  max-width: 700px;
  margin: 0 auto;
}

.bp-footer__social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.bp-footer__social-link {
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.bp-footer__social-link.instagram { background: rgba(225,48,108,0.2); color: #e1306c; }
.bp-footer__social-link.twitter { background: rgba(29,161,242,0.2); color: #1da1f2; }
.bp-footer__social-link.feedback { background: rgba(183,255,60,0.2); color: var(--accent); }
.bp-footer__social-link:hover { transform: translateY(-2px); }

.bp-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

.bp-footer__bottom nav { display: flex; gap: 16px; }
.bp-footer__bottom a { color: rgba(255,255,255,0.5); text-decoration: none; }
.bp-footer__bottom a:hover { color: var(--accent); }
