html[data-social-game="mahjong"] { --accent: #267759; --accent-strong: #19533f; --accent-soft: #e5f0e7; --accent-contrast: #fff; --page-a: #f2f5e9; --page-b: #e8f1ec; --glow-a: #9bbb8e29; --glow-b: #2e7d6817; }
html[data-social-game="mahjong"][data-theme="dark"] { --accent: #84cbaa; --accent-strong: #a1debe; --accent-soft: #203a2e; --accent-contrast: #14291e; --page-a: #111d18; --page-b: #1b211a; --glow-a: #57937417; --glow-b: #8277370f; }
.mahjong-table .table-banner { background: linear-gradient(125deg, #174f3d, #337d65); }
.mahjong-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.mahjong-stage { min-width: 0; overflow: hidden; padding: 22px; }
.mahjong-status { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.mahjong-status h2 { margin: 5px 0 0; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.4; }
.mahjong-wall { display: grid; flex-shrink: 0; text-align: center; border: 1px solid var(--line, #d9dfd9); border-radius: 12px; padding: 9px 12px; }
.mahjong-wall strong { font: 750 1.5rem/1.1 var(--font-mono, monospace); }
.mahjong-wall span { font-size: .65rem; opacity: .65; margin-top: 4px; }
.mahjong-opponents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mahjong-opponents.is-spectator { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mahjong-player { min-width: 0; padding: 12px; border: 1px solid var(--line, #d9dfd9); border-radius: 12px; background: var(--panel-solid, #fff); }
.mahjong-player.is-current { box-shadow: inset 0 0 0 2px #25846b; }
.mahjong-player header { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: .8rem; }
.mahjong-player-identity { display: flex; flex: 1; align-items: center; gap: 4px; min-width: 0; }
.mahjong-player-identity > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mahjong-presence { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 12px; width: 12px; height: 12px; font: 700 10px/12px sans-serif; color: #27815d; }
.mahjong-presence.is-reconnecting, .mahjong-presence.is-bot-playing { color: #a56317; }
.mahjong-presence.is-bot { color: #3a70ac; }
html[data-theme="dark"] .mahjong-presence.is-connected { color: #84cbaa; }
html[data-theme="dark"] .mahjong-presence.is-reconnecting, html[data-theme="dark"] .mahjong-presence.is-bot-playing { color: #e2b66f; }
html[data-theme="dark"] .mahjong-presence.is-bot { color: #91baf0; }
.mahjong-player header b { margin-left: auto; white-space: nowrap; }
.mahjong-player header b small { font-size: .62rem; font-weight: 500; }
.mahjong-wind { display: inline-flex; flex-shrink: 0; border-radius: 5px; background: #e9eee8; color: #285242; padding: 3px 5px; font-size: .63rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.mahjong-hidden-hand { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 12px; min-height: 28px; }
.mahjong-hand-count { display: none; }
.mahjong-tile-back { display: inline-block; flex-shrink: 0; width: 13px; height: 25px; border: 1px solid #21624c; border-radius: 3px; background: repeating-linear-gradient(45deg, #338667 0 3px, #368c6c 3px 6px); box-shadow: 0 2px 0 #18543e; }
.mahjong-center { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 18px; padding: 20px 0; }
.mahjong-pending, .mahjong-table-mark { display: flex; flex-direction: column; gap: 9px; align-items: center; justify-content: center; padding: 18px 10px; border-radius: 14px; color: #f5f4df; background: radial-gradient(ellipse at 50% 30%, #367b64, #174e3b); text-align: center; }
:root body .mahjong-pending .eyebrow { color: #f5f4df; font-size: 11px; }
.mahjong-pending > span:last-child { font-size: .75rem; overflow-wrap: anywhere; }
.mahjong-table-mark > span { font-size: 2.5rem; opacity: .45; }
.mahjong-table-mark strong { font-size: .8rem; }
.mahjong-table-mark small { font-size: .58rem; opacity: .7; }
.mahjong-rivers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; }
.mahjong-river { min-width: 0; }
.mahjong-river h3 { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 0 0 6px; font-size: .68rem; font-weight: 650; }
.mahjong-river h3 small { color: var(--muted, #747d75); font-weight: 450; }
.mahjong-river > div { display: flex; flex-wrap: wrap; gap: 3px; min-height: 37px; align-content: start; }
.mahjong-empty-river { font-size: .65rem; opacity: .5; align-self: center; }
.mahjong-tile { box-sizing: border-box; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; gap: 2px; width: 45px; height: 65px; border: 1px solid #b9b7a5; border-bottom: 4px solid #3c7056; border-radius: 6px; padding: 4px 1px; background: linear-gradient(140deg, #fffff7, #e9e7d6); color: #9d3b37; box-shadow: 0 2px 3px #1c302f12; vertical-align: middle; }
button.mahjong-tile { cursor: pointer; font-family: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.mahjong-tile strong { font-size: 1.55rem; font-weight: 700; line-height: 1.15; }
.mahjong-tile small { font-size: .45rem; font-weight: 650; line-height: 1.1; text-align: center; }
.mahjong-tile-bamboo { color: #226447; }
.mahjong-tile-dots { color: #245b96; }
.mahjong-tile-wind { color: #2c4b58; }
.mahjong-tile-dragon { color: #a53636; }
.mahjong-tile.is-small { width: 27px; height: 37px; border-radius: 4px; border-bottom-width: 3px; gap: 0; padding: 2px 0; }
.mahjong-tile.is-small strong { font-size: 1rem; }
.mahjong-tile.is-small small { font-size: .31rem; }
.mahjong-tile.is-claimed { opacity: .32; }
.mahjong-tile.is-selected { transform: translateY(-7px); outline: 2px solid #1d7358; outline-offset: 2px; box-shadow: 0 6px 8px #173b3126; }
button.mahjong-tile:hover:not(:disabled) { transform: translateY(-4px); }
button.mahjong-tile:focus-visible { outline: 3px solid #2f75a7; outline-offset: 2px; }
button.mahjong-tile:disabled { cursor: wait; }
.mahjong-own-hand { border-top: 1px solid var(--line, #d9dfd9); padding-top: 18px; }
.mahjong-own-hand > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; font-size: .83rem; }
.mahjong-own-hand > header > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mahjong-own-hand > header small { color: var(--muted, #747d75); font-size: .68rem; }
.mahjong-own-hand > header > b { white-space: nowrap; font-size: .75rem; }
.mahjong-hand-tiles { display: flex; flex-wrap: wrap; gap: 5px; padding: 3px 2px; }
.mahjong-meld-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mahjong-meld { display: inline-flex; flex-direction: column; gap: 3px; margin-top: 9px; }
.mahjong-meld > div { display: flex; gap: 1px; }
.mahjong-meld > small { font-size: .55rem; color: var(--muted, #747d75); text-transform: capitalize; }
.mahjong-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.mahjong-controls .button { min-height: 44px; font-size: .77rem; }
.mahjong-controls p, .mahjong-spectating { margin: 0; color: var(--muted, #747d75); font-size: .76rem; line-height: 1.5; }
.mahjong-controls:empty { margin: 0; }
.mahjong-guide { padding: 22px; font-size: .78rem; line-height: 1.6; }
.mahjong-guide h2 { font-size: 1rem; line-height: 1.3; margin: 8px 0 12px; }
.mahjong-guide p { color: var(--muted, #657167); }
.mahjong-guide-example { display: flex; gap: 3px; align-items: center; margin: 16px 0; }
.mahjong-guide-example > span:last-child { margin-left: 10px; color: var(--muted, #747d75); font-size: .7rem; }
.mahjong-guide details { border-top: 1px solid var(--line, #d9dfd9); padding-top: 14px; }
.mahjong-guide summary { cursor: pointer; font-weight: 650; min-height: 44px; }
.mahjong-guide ul { padding-left: 18px; }
.mahjong-guide li + li { margin-top: 10px; }
.mahjong-scoreboard { border-top: 1px solid var(--line, #d9dfd9); margin-top: 18px; padding-top: 14px; }
.mahjong-scoreboard h3 { margin: 0 0 8px; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.mahjong-scoreboard > div { display: flex; justify-content: space-between; gap: 15px; padding: 7px 0; }
.mahjong-scoreboard > div > span { overflow-wrap: anywhere; }
.mahjong-hand-result { padding: 16px; background: #edf3e9; color: #294d32; border: 1px solid #ccd9c2; border-radius: 12px; margin: 0 0 18px; font-size: .85rem; }
.mahjong-hand-result p { margin: 5px 0 0; font-size: .74rem; }
.mahjong-winning-hand { display: flex; align-items: start; flex-wrap: wrap; gap: 3px; margin-top: 12px; }
.mahjong-winning-hand .mahjong-meld { margin: 0 0 0 6px; }
@media (max-width: 1080px) {
  .mahjong-layout { grid-template-columns: minmax(0, 1fr); }
  .mahjong-guide > p, .mahjong-guide-example, .mahjong-scoreboard { display: none; }
  .mahjong-guide h2 { font-size: .85rem; margin-bottom: 12px; }
}
@media (max-width: 680px) {
  .mahjong-stage { display: flex; flex-direction: column; padding: 14px; }
  .mahjong-status { gap: 10px; margin-bottom: 14px; }
  .mahjong-status h2 { font-size: 1rem; }
  .mahjong-opponents { order: 1; gap: 5px; }
  .mahjong-player { padding: 8px 6px; border-radius: 9px; }
  .mahjong-player header { flex-wrap: wrap; gap: 4px; font-size: .65rem; }
  .mahjong-player-identity { order: -1; flex-basis: 100%; }
  .mahjong-player header b { font-size: .63rem; }
  .mahjong-wind { font-size: .54rem; padding: 2px 4px; }
  .mahjong-hidden-hand { display: none; }
  .mahjong-hand-count { display: block; margin-top: 6px; font-size: .58rem; color: var(--muted); }
  .mahjong-tile-back { width: 9px; height: 19px; }
  .mahjong-player .mahjong-tile.is-small { width: 16px; height: 27px; }
  .mahjong-player .mahjong-tile.is-small strong { font-size: .75rem; }
  .mahjong-player .mahjong-tile.is-small small { font-size: .23rem; }
  .mahjong-player .mahjong-meld > small { font-size: .5rem; }
  .mahjong-player .mahjong-meld-row { max-height: 51px; overflow-y: auto; scrollbar-width: thin; }
  .mahjong-center { display: contents; }
  .mahjong-table-mark { display: none; }
  .mahjong-pending { order: 2; flex-direction: row; padding: 9px; gap: 10px; margin-top: 14px; }
  .mahjong-pending .mahjong-tile { width: 34px; height: 46px; }
  .mahjong-pending .mahjong-tile strong { font-size: 1.15rem; }
  .mahjong-pending .mahjong-tile small { font-size: .35rem; }
  .mahjong-rivers { order: 5; gap: 10px; max-height: 158px; overflow-y: auto; scrollbar-width: thin; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
  .mahjong-river > div { gap: 2px; }
  .mahjong-river .mahjong-tile.is-small { width: 23px; height: 33px; }
  .mahjong-own-hand { order: 3; margin-top: 16px; padding-top: 14px; }
  .mahjong-own-hand > header { margin-bottom: 12px; }
  .mahjong-own-hand > header small { display: none; }
  .mahjong-hand-tiles { gap: 5px; }
  .mahjong-hand-tiles .mahjong-tile { width: 44px; height: 57px; }
  .mahjong-controls { order: 4; margin-top: 12px; }
  .mahjong-hand-result { order: 2; margin-top: 14px; margin-bottom: 0; }
  .mahjong-spectating { order: 4; margin-top: 14px; }
  .mahjong-controls .button { flex: 1 1 auto; }
  .mahjong-discard { flex-basis: 100% !important; }
  .mahjong-guide { display: block; padding: 18px; }
  .mahjong-guide > p, .mahjong-guide-example, .mahjong-scoreboard { display: none; }
  .mahjong-guide h2 { font-size: .85rem; margin-bottom: 12px; }
}
