:root {
  color-scheme: light;
  --ink: #22332d;
  --muted: #63726d;
  --paper: #fffdf5;
  --panel: rgba(255, 253, 245, 0.9);
  --line: #d6c8ab;
  --jade: #0e6b61;
  --jade-2: #168a78;
  --coral: #d85c3f;
  --gold: #f1b94b;
  --ivory: #fff9e9;
  --ivory-edge: #d8caa7;
  --tile: 62px;
  --gap: 7px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.48) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.48) 1px, transparent 1px),
    linear-gradient(135deg, #f7ead6 0%, #e6f2ea 47%, #f8f0df 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.game-site-header,
.game-site-footer,
.hero,
.game-shell,
.content-section {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.game-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 8px;
}

.game-site-logo,
.game-site-nav,
.game-site-footer {
  display: flex;
  align-items: center;
}

.game-site-logo {
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
  text-decoration: none;
}

.game-site-logo img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.game-site-nav {
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-site-nav a,
.game-site-footer a,
.related-grid a {
  color: rgba(34, 51, 45, 0.72);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(330px, 0.72fr);
  gap: 28px;
  align-items: center;
  padding: 22px 0 16px;
}

.hero-copy h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(3rem, 8vw, 5.7rem);
  line-height: 0.93;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--jade);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions,
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-link,
.secondary-link,
.controls button,
.win-overlay button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
}

.primary-link,
.controls button:first-child {
  color: white;
  background: linear-gradient(180deg, var(--jade-2), #07584e);
}

.secondary-link {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 253, 245, 0.76);
}

.hero-art {
  display: block;
}

.hero-art img {
  display: block;
  width: 100%;
  border: 1px solid rgba(62, 86, 70, 0.18);
  border-radius: 12px;
  box-shadow: 0 22px 56px rgba(48, 68, 54, 0.18);
}

.game-shell {
  padding: 12px 0 22px;
}

.game-card,
.content-section {
  border: 1px solid rgba(116, 99, 73, 0.2);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(80, 55, 28, 0.14);
  backdrop-filter: blur(14px);
}

.game-card {
  padding: 18px;
}

.game-topbar {
  display: grid;
  grid-template-columns: minmax(190px, 0.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.game-topbar h2,
.content-section h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.stats > span {
  min-width: 0;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 238, 0.92);
  color: var(--muted);
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
}

.stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1;
}

.stats > span > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-frame {
  position: relative;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.46) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.46) 1px, transparent 1px), #efe5d2;
  background-size: 24px 24px;
}

.board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(10, var(--tile));
  gap: var(--gap);
  justify-content: center;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}

.tile {
  position: relative;
  width: var(--tile);
  height: calc(var(--tile) * 1.16);
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(108, 95, 66, 0.32);
  border-radius: calc(var(--tile) * 0.11);
  background:
    radial-gradient(circle at 38% 22%, rgba(255, 255, 255, 0.94), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, var(--ivory) 48%, #eadfc6 100%);
  box-shadow:
    0 2px 0 #b9aa86,
    0 8px 14px rgba(49, 39, 25, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    inset 0 -5px 9px rgba(138, 119, 78, 0.18);
  color: var(--ink);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: calc(var(--tile) * 0.1) calc(var(--tile) * 0.08) calc(var(--tile) * 0.11);
  border: 1px solid rgba(14, 107, 97, 0.14);
  border-radius: calc(var(--tile) * 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.05));
}

.tile:hover {
  transform: translateY(-2px);
}

.tile.selected {
  border-color: var(--coral);
  box-shadow:
    0 0 0 3px rgba(216, 92, 63, 0.28),
    0 12px 22px rgba(49, 39, 25, 0.18);
}

.tile.hint {
  border-color: var(--gold);
  animation: hintPulse 720ms ease-in-out infinite alternate;
}

.tile.removing {
  opacity: 0;
  transform: scale(0.78);
  filter: saturate(1.5) brightness(1.08);
}

.tile-face {
  position: absolute;
  inset: calc(var(--tile) * 0.11) calc(var(--tile) * 0.08) calc(var(--tile) * 0.08);
  display: grid;
  place-items: center;
  font-weight: 950;
  line-height: 1;
  z-index: 1;
}

.tile-symbol {
  font-size: calc(var(--tile) * 0.34);
}

.tile-suit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  color: rgba(34, 51, 45, 0.56);
  font-size: calc(var(--tile) * 0.13);
  font-weight: 900;
}

.wan-face {
  display: grid;
  gap: calc(var(--tile) * 0.04);
  justify-items: center;
  align-content: center;
}

.wan-num {
  color: #111917;
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  font-size: calc(var(--tile) * 0.27);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.wan-mark {
  color: #b94131;
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  font-size: calc(var(--tile) * 0.34);
  text-shadow: 0 1px 0 rgba(90, 0, 0, 0.22);
}

.dot-face,
.bamboo-face {
  position: relative;
  width: 86%;
  height: 88%;
}

.dot-pip,
.bamboo-pip {
  position: absolute;
  transform: translate(-50%, -50%);
}

.dot-pip {
  width: calc(var(--tile) * 0.2);
  height: calc(var(--tile) * 0.2);
  border: calc(var(--tile) * 0.026) solid var(--pip-color, #1d6698);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 23%, transparent 25%),
    radial-gradient(circle, var(--pip-color, #1d6698) 0 36%, transparent 38%),
    #fdf8e8;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 1px 2px rgba(43, 33, 17, 0.24);
}

.dot-one-pip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--tile) * 0.48);
  height: calc(var(--tile) * 0.48);
  border: calc(var(--tile) * 0.025) solid #167a54;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, #b94131 0 9%, #fff7e4 10% 17%, #167a54 18% 30%, #fff7e4 31% 39%, #b94131 40% 49%, #fff7e4 50% 58%, #167a54 59% 72%, #fff7e4 73%);
  box-shadow:
    inset 0 0 0 calc(var(--tile) * 0.018) rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(43, 33, 17, 0.24);
}

.bamboo-pip {
  width: calc(var(--tile) * 0.105);
  height: calc(var(--tile) * 0.34);
  border: 1px solid #064c31;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent 36%),
    linear-gradient(180deg, #0a5e3f, #1b8c5b 48%, #075438);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.25),
    0 1px 2px rgba(43, 33, 17, 0.24);
}

.bamboo-pip::before,
.bamboo-pip::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  height: max(1px, calc(var(--tile) * 0.025));
  border-radius: 999px;
  background: rgba(255, 245, 212, 0.7);
}

.bamboo-pip::before {
  top: 35%;
}

.bamboo-pip::after {
  bottom: 35%;
}

.wind-face,
.dragon-face {
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  font-size: calc(var(--tile) * 0.54);
  line-height: 1;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 2px 2px rgba(35, 25, 10, 0.16);
}

.wind-face {
  color: #172320;
}

.dragon-face.dragon-red {
  color: #b72f23;
}

.dragon-face.dragon-green {
  color: #167346;
}

#path-layer {
  position: absolute;
  inset: 14px;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.link-path {
  fill: none;
  stroke: var(--coral);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.8));
}

.controls {
  justify-content: center;
  margin-top: 14px;
}

.controls button:nth-child(2) {
  color: #30230f;
  background: linear-gradient(180deg, var(--gold), #d99a24);
}

.controls button:nth-child(3),
.win-overlay button {
  color: white;
  background: linear-gradient(180deg, var(--coral), #a73425);
}

.controls button:nth-child(4) {
  color: white;
  background: linear-gradient(180deg, #596575, #354151);
}

.controls button:nth-child(5) {
  color: white;
  background: linear-gradient(180deg, #6d579b, #483774);
}

.controls button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.win-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 245, 0.84);
  backdrop-filter: blur(6px);
}

.win-overlay.hidden {
  display: none;
}

.win-overlay div {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf0;
  text-align: center;
  box-shadow: 0 18px 48px rgba(53, 38, 23, 0.18);
}

#win-title {
  margin: 0 0 16px;
  font-size: 2rem;
  font-weight: 950;
}

.content-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
}

.content-section p,
.content-section li {
  color: var(--muted);
  line-height: 1.76;
}

.content-section ul {
  margin-bottom: 0;
  padding-left: 20px;
}

.related-section {
  grid-template-columns: minmax(210px, 0.6fr) minmax(0, 1.4fr);
}

.related-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.related-grid a,
.faq-grid > div {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.related-grid span {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.faq-section {
  grid-template-columns: minmax(190px, 0.45fr) minmax(0, 1.55fr);
}

.faq-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.faq-grid h3,
.faq-grid p {
  margin: 0;
}

.game-site-footer {
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 0 26px;
  color: rgba(34, 51, 45, 0.62);
  font-size: 14px;
}

@keyframes hintPulse {
  from {
    transform: translateY(-1px) scale(1);
  }
  to {
    transform: translateY(-3px) scale(1.04);
  }
}

@media (max-width: 900px) {
  .hero,
  .game-topbar,
  .content-section,
  .related-section,
  .faq-section {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 14px;
  }

  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --gap: 4px;
  }

  .game-site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-site-nav {
    justify-content: flex-start;
  }

  .game-site-header,
  .game-site-footer,
  .hero,
  .game-shell,
  .content-section {
    width: min(100%, calc(100vw - 16px));
  }

  .hero-copy h1 {
    font-size: clamp(2.5rem, 16vw, 4rem);
  }

  .game-card {
    padding: 8px;
    border-radius: 10px;
  }

  .board-frame {
    padding: 6px;
    border-radius: 10px;
  }

  #path-layer {
    inset: 6px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls button {
    flex: 1 1 30%;
    padding: 0 10px;
  }

  .content-section {
    padding: 18px;
  }

  .related-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .stats > span {
    font-size: 0.68rem;
  }

  .tile-symbol {
    font-size: calc(var(--tile) * 0.31);
  }
}

body.home-page.mahjong-classic-page .game-card,
body.home-page.mahjong-classic-page .content-section {
  border-color: rgba(56, 214, 255, 0.16);
  color: var(--arcade-cream, #e9f3ff);
  background:
    linear-gradient(135deg, rgba(255, 246, 220, 0.08), rgba(255, 246, 220, 0.035)),
    rgba(8, 22, 34, 0.88);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

body.home-page.mahjong-classic-page .game-topbar h2,
body.home-page.mahjong-classic-page .content-section h2 {
  color: var(--arcade-cream, #e9f3ff);
}

body.home-page.mahjong-classic-page .content-section p,
body.home-page.mahjong-classic-page .content-section li {
  color: rgba(255, 246, 220, 0.74);
}

body.home-page.mahjong-classic-page .eyebrow {
  color: rgba(103, 246, 177, 0.86);
}

/* 2026 fit pass: keep the complete playable board visible in desktop browser frames. */
body.home-page.mahjong-classic-page .hero {
  padding: 14px 0 10px;
}

body.home-page.mahjong-classic-page .hero-copy h1 {
  font-size: clamp(2.7rem, 5vw, 4rem);
}

body.home-page.mahjong-classic-page .hero-copy p {
  margin: 12px 0;
}

body.home-page.mahjong-classic-page .hero-art img {
  max-height: 292px;
  object-fit: cover;
}

body.home-page.mahjong-classic-page .game-shell {
  padding-top: 8px;
}

body.home-page.mahjong-classic-page .game-card {
  padding: 14px;
}

body.home-page.mahjong-classic-page .game-topbar {
  grid-template-columns: minmax(160px, 0.28fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 10px;
}

body.home-page.mahjong-classic-page .game-topbar h2 {
  font-size: clamp(1.45rem, 2.5vw, 2.25rem);
}

body.home-page.mahjong-classic-page .board-frame {
  padding: 10px;
}

@media (max-width: 760px) {
  body.home-page.mahjong-classic-page .hero {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 0 8px;
  }

  body.home-page.mahjong-classic-page .hero-copy {
    display: grid;
    gap: 8px;
  }

  body.home-page.mahjong-classic-page .hero-copy h1 {
    font-size: 2.65rem;
    line-height: 0.98;
  }

  body.home-page.mahjong-classic-page .hero-copy p {
    display: none;
  }

  body.home-page.mahjong-classic-page .hero-actions {
    display: none;
  }

  body.home-page.mahjong-classic-page .hero-art img {
    max-height: 210px;
    object-fit: cover;
  }

  body.home-page.mahjong-classic-page .game-shell {
    padding-top: 0;
  }

  body.home-page.mahjong-classic-page .game-topbar {
    grid-template-columns: 1fr;
  }

  body.home-page.mahjong-classic-page .game-topbar h2 {
    font-size: 1.65rem;
  }
}
