.traffic-mahjong {
  --mahjong-ink: #122e32;
  --mahjong-accent: #086057;
  color: var(--mahjong-ink);
  max-width: 73rem;
  margin-inline: auto;
  font-family: "DM Sans", system-ui, sans-serif;
}
.mahjong-settings, .mahjong-tools, .mahjong-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
  align-items: center;
}
.mahjong-settings {
  align-items: end;
  margin-bottom: 1rem;
}
.mahjong-settings label {
  display: grid;
  gap: .25rem;
  font-weight: 700;
}
.mahjong-settings select {
  min-height: 44px;
  padding: .45rem .6rem;
  background: #fff;
  border: 1px solid #9eafae;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  max-width: 100%;
}
.mahjong-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.traffic-mahjong .button { min-height: 44px; cursor: pointer; }
.traffic-mahjong .button:disabled { opacity: .5; cursor: default; }
.mahjong-table {
  background: #164648;
  background-image: radial-gradient(ellipse at 50% 40%, #225d5b, #123738);
  color: #f5f9ef;
  border: 1px solid #102f34;
  border-radius: 18px;
  box-shadow: 0 10px 28px #15363824;
  overflow: hidden;
}
.mahjong-stats, .mahjong-tools { padding: .9rem 1rem; background: #102e32; }
.mahjong-stats label { margin-inline-start: auto; cursor: pointer; }
.mahjong-stats input { accent-color: #f7ca56; }
.mahjong-time { font-variant-numeric: tabular-nums; }
.mahjong-scroll { overflow: auto; padding: 1.35rem .85rem 1.4rem; }
.mahjong-board {
  --tile-w: clamp(41px, 7vw, 69px);
  --tile-h: calc(var(--tile-w) * 1.10);
  --layer: 7px;
  width: calc(var(--columns) * var(--tile-w) + 5 * var(--layer));
  height: calc(var(--rows) * var(--tile-h) + 5 * var(--layer) + 6px);
  margin-inline: auto;
  position: relative;
  isolation: isolate;
}
.mahjong-tile {
  position: absolute;
  z-index: var(--z);
  inset-inline-start: calc(var(--x) * var(--tile-w) + var(--z) * var(--layer));
  inset-block-start: calc(var(--y) * var(--tile-h) + (4 - var(--z)) * var(--layer));
  width: var(--tile-w);
  height: var(--tile-h);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  border: 1px solid #a29b80;
  border-radius: 7px;
  padding: 4px 3px 3px;
  color: #123236;
  background: #fff8e7;
  box-shadow: 0 4px 0 #c3aa77, 1px 6px 4px #081f24a0;
  cursor: pointer;
}
.mahjong-tile img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.mahjong-tile small { font: 700 clamp(.54rem, 1.1vw, .72rem)/1.1 system-ui, sans-serif; }
.traffic-mahjong .mahjong-tile:disabled { opacity: 1; background: #c4cfc4; cursor: default; }
.mahjong-tile:disabled img { opacity: .58; }
.mahjong-tile:not(:disabled):hover, .show-free .mahjong-tile:not(:disabled) { background: #fffdf5; }
.show-free .mahjong-tile:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #0d7966;
  pointer-events: none;
}
.mahjong-tile[aria-pressed="true"], .mahjong-tile.is-hint {
  background: #ffe291 !important;
  box-shadow: inset 0 0 0 3px #d58916, 0 4px 0 #a77126;
}
.traffic-mahjong :focus-visible { outline: 3px solid #f8b51c; outline-offset: -3px; }
.mahjong-status { margin-block: .75rem; min-height: 1.6em; }
.mahjong-sign {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem;
  background: #eef5f2;
  border-radius: 8px;
  margin-block: .75rem;
}
.mahjong-sign[hidden] { display: none; }
.mahjong-sign img { object-fit: contain; }
.play-tile-mahjong img { object-fit: contain; padding: .5rem; }
@media (max-width: 480px) {
  .mahjong-board { --tile-w: 37px; --layer: 4px; }
  .mahjong-stats label { margin-inline-start: 0; }
  .mahjong-scroll { padding-inline: .45rem; }
}
