.mj-game { width:100%; margin:0 auto; color:#202844; }
.mj-sprite { position:absolute; width:0; height:0; overflow:hidden; }
.mj-summary { display:flex; justify-content:space-between; flex-wrap:wrap; gap:.3rem .75rem; margin:0 0 .55rem; font-size:.84rem; color:#4d5366; }
.mj-summary b { color:#283957; font-variant-numeric:tabular-nums; margin-left:.2em; }
.mj-tray { padding:clamp(.5rem,2.2%,1.05rem); background:radial-gradient(ellipse at 45% 30%,#465a82,#2e4164 78%); border:2px solid #273857; border-radius:16px; box-shadow:inset 0 0 0 2px #ffffff18; }
.mj-field { position:relative; width:100%; }
.mj-game .mj-tile { position:absolute; display:grid; place-items:center; box-sizing:border-box; min-width:0; min-height:0; padding:0; overflow:hidden; background:var(--mj-face); border:1px solid #776e59; border-radius:clamp(3px,.42vw,7px); color:#202844; box-shadow:inset -1px -3px 0 var(--mj-edge),inset 1px 1px 0 #ffffffb3,1px 2px 1px #19243a75; }
.mj-game .mj-free { --mj-face:#fff9e6; --mj-edge:#d8bd82; cursor:pointer; }
.mj-game .mj-blocked { --mj-face:#d3cdbd; --mj-edge:#aea285; cursor:default; }
.mj-blocked .mj-emblem { opacity:.71; }
.mj-free::before { content:''; position:absolute; top:5%; left:5%; right:5%; height:9%; border-top:1px solid #ffffffdc; border-radius:5px; }
.mj-tile .mj-emblem { display:block; height:92%; width:90%; }
.mj-game .mj-tile.mj-picked,.mj-game .mj-pick.mj-picked { background:#ffdd74; box-shadow:inset 0 0 0 3px #96450e,inset 0 -4px #dca52c; }
.mj-game .mj-tile:focus-visible { outline:3px solid #122945; outline-offset:-4px; }
@media(hover:hover) { .mj-game .mj-free:hover { background:#fff1bd; } }
.mj-picks { margin:.8rem 0 0; }
.mj-picks summary { display:list-item; min-height:44px; padding:.55rem 0; cursor:pointer; color:#324b84; font-weight:700; font-size:.89rem; }
.mj-picks p { font-size:.82rem; margin:.1rem 0 .55rem; color:#555668; }
.mj-pick-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(112px,1fr)); gap:6px; }
.mj-game .mj-pick { display:flex; align-items:center; gap:4px; min-height:44px; padding:3px 7px; text-align:left; line-height:1.25; background:#fff9e6; border:1px solid #c5b995; border-radius:8px; }
.mj-pick span { font-size:.77rem; font-weight:650; }
.mj-pick small { display:block; font-size:.72rem; color:#555668; font-weight:400; }
.mj-pick .mj-emblem { width:26px; height:34px; flex:none; }
.mj-stuck { background:#fff0c2; padding:10px 13px; margin-top:.7rem; border:1px solid #ddbe64; border-radius:9px; font-size:.9rem; }
.mj-stuck button { margin:.25rem 0; }
@media(forced-colors:active) { .mj-game .mj-tile { background:Canvas; forced-color-adjust:none; } .mj-game .mj-tile.mj-picked { outline:2px solid Highlight; } .mj-game .mj-blocked { background:#ddd; } }

/* Fit is the default. Native details keeps the chosen magnification through
   session redraws, without recording a game move or changing the puzzle. */
.mj-summary { align-items:center; }
.mj-summary .mj-zoom { margin-left:auto; }
.mj-zoom summary { display:flex; align-items:center; justify-content:center; gap:.35rem; min-height:44px; padding:4px 9px; color:#2d4679; font-weight:700; font-size:.8rem; text-decoration:underline; text-underline-offset:.18em; cursor:pointer; }
.mj-zoom summary::-webkit-details-marker { display:none; }
.mj-zoom summary::before { content:'+'; font-size:1.05em; text-decoration:none; }
.mj-zoom[open] summary::before { content:'−'; }
.mj-zoom:not([open]) summary span:last-child,.mj-zoom[open] summary span:first-child { display:none; }
.mj-tray { overflow:auto; overscroll-behavior:contain; }
.mj-field { margin-inline:auto; }
.mj-game:has(.mj-zoom[open]) .mj-field { width:max(var(--mj-zoom-width),100%); max-width:none; }
@media (max-width:899px) {
  .mj-game:has(.mj-zoom[open]) .mj-tray { max-height:72svh; }
}
@media (max-width:410px) {
  .mj-summary { column-gap:.45rem; }
  .mj-zoom summary { padding-inline:2px; }
}

/* Place the game controls beside the tiles on laptops. Size the playing
   surface from the available height as well as the width of the left column. */
@media (min-width:900px) {
  body:has([data-classic="mahjong"]) .head { min-height:62px; }
  body:has([data-classic="mahjong"]) .head .brand-logo { width:154px; }
  .game-spread:has([data-classic="mahjong"]) .game-mast { margin-bottom:9px; }
  .game-spread:has([data-classic="mahjong"]) .game-mast>div:first-child { display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
  .game-spread:has([data-classic="mahjong"]) .game-mast h1 { font-size:clamp(32px,3.05vw,44px); }
  .game-spread:has([data-classic="mahjong"]) .mast-detail { height:43px; width:96px; }

  [data-classic="mahjong"] .classic-panel:has(.classic-table) { display:grid; grid-template-columns:minmax(0,1fr) minmax(195px,24%); grid-template-areas:"table top" "table tools" "table notice" "table result" "table links" "table ."; grid-template-rows:auto auto auto auto auto 1fr; gap:0 20px; align-items:start; padding:12px 16px; }
  [data-classic="mahjong"] .classic-table { grid-area:table; }
  [data-classic="mahjong"] .classic-top { grid-area:top; display:grid; gap:10px; margin-bottom:12px; }
  [data-classic="mahjong"] .classic-top label { flex-direction:column; gap:4px; align-items:stretch; }
  [data-classic="mahjong"] .classic-clock { justify-content:space-between; }
  [data-classic="mahjong"] .classic-tools { grid-area:tools; display:grid; grid-template-columns:1fr 1fr; }
  [data-classic="mahjong"] .classic-tools .classic-menu { grid-column:1/-1; margin:0; }
  [data-classic="mahjong"] .classic-notice { grid-area:notice; }
  [data-classic="mahjong"] .classic-result { grid-area:result; }
  [data-classic="mahjong"] .classic-day-links { grid-area:links; align-items:flex-start; }
  [data-classic="mahjong"] .classic-day-links a { min-height:37px; }
  [data-classic="mahjong"] .classic-panel:has(.lesson-tip) { grid-template-areas:"table lesson" "table notice" "table ."; grid-template-rows:auto auto 1fr; }
  [data-classic="mahjong"] .lesson-tip { grid-area:lesson; display:block; padding:10px; }
  [data-classic="mahjong"] .lesson-tip p { font-size:.88rem; }
  [data-classic="mahjong"] .lesson-buttons { margin-top:.55rem; }
  .mj-summary { margin-bottom:3px; }
  .mj-tray { --mj-max-height:clamp(230px,calc(100svh - 310px),630px); width:min(100%,calc(var(--mj-max-height) * var(--mj-ratio) + 20px)); padding:8px; margin-inline:auto; }
  .mj-game:has(.mj-zoom[open]) .mj-tray { width:100%; max-height:calc(var(--mj-max-height) + 20px); }
  .mj-picks { margin-top:2px; }
}

/* A lacquered jade table, with quiet bamboo engraving in the side margins. */
.mj-game {
  --mj-jade:#244e44; --mj-light:#e9ecda;
  padding:0 clamp(7px,1.2vw,15px); color:var(--mj-light); border:1px solid #183e34; border-radius:10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 270' fill='none' stroke='%23c8d8b2' opacity='.2' stroke-linecap='round'%3E%3Cpath d='M-3 259Q32 222 38 178T51 103Q59 66 83 16M5 258q34-50 32-98t13-80M31 204q18-14 34-46M47 122q18-8 33-27M64 60q-4-17 0-36' stroke-width='1.7'/%3E%3Cpath d='m30 212 9 1m-5-37 8 1m1-37 8 1m5-34 7 2m5-34 6 1'/%3E%3Cg fill='%23c8d8b2' stroke='none'%3E%3Cpath d='M64 158q3-17 17-32-3 23-17 32zm-7 12q-3-14 4-30 3 18-4 30zm-3 5q12-10 30-13-12 12-30 13zM75 103q8-19 25-30-9 19-25 30zm-4 1q-2-17 7-33 3 14-7 33zM64 37q-11-11-14-26 13 9 14 26zm5 6q4-18 17-29-3 16-17 29zM39 181q-12-9-16-24 12 8 16 24zm6-34q-15-13-18-32 15 12 18 32z'/%3E%3C/g%3E%3C/svg%3E") left bottom/auto min(74%,270px) no-repeat,
    repeating-linear-gradient(29deg,#f0f5cf03 0 1px,transparent 1px 4px),
    radial-gradient(ellipse at 52% 26%,#42695a 0%,#2a564a 45%,#20463d 94%);
  box-shadow:inset 0 0 0 1px #b9c9ab33;
}
.mj-summary { color:#e0e8d3; align-items:baseline; column-gap:17px; padding:0 2px; margin:0 0 4px; }
.mj-summary>span { display:inline-flex; align-items:baseline; gap:.34em; font-size:.805rem; }
.mj-summary b { color:#fff7dc; font:700 1.13rem/1.1 Portal,system-ui,sans-serif; font-variant-numeric:tabular-nums; margin:0; }
.mj-zoom summary { color:#f4f2db; text-decoration:none; font-size:.82rem; padding-inline:6px; }
.mj-zoom summary:hover,.mj-picks summary:hover { text-decoration:underline; }
.mj-game .mj-tray {
  background:radial-gradient(ellipse at 50% 28%,#395d4e,#264c40);
  border-color:#b3ad83; box-shadow:inset 0 0 0 2px #233e34,0 0 0 1px #162f29,0 2px 5px #142c2738;
  border-radius:10px;
}
.mj-game .mj-tile { border-color:#877e64; box-shadow:inset -1px -3px 0 var(--mj-edge),inset 1px 1px 0 #fffdf1bb,1px 2px 1px #1c302b80; }
.mj-game .mj-free { --mj-face:#fff9e7; --mj-edge:#d6c291; }
.mj-game .mj-blocked { --mj-face:#c6c7b6; --mj-edge:#9e9e86; }
.mj-game .mj-picked { outline:2px solid #6c400a; outline-offset:-3px; }
.mj-game .mj-tile:focus-visible { outline:3px solid #123f45; outline-offset:-4px; }
.mj-picks { margin:3px 2px 0; }
.mj-picks summary { color:#f3eed9; font-size:.84rem; }
.mj-picks p { color:#dde4d6; }
.mj-picks[open] { padding-bottom:10px; }
.mj-pick-grid { color:#26372f; }
.mj-stuck { color:#413323; }
@media(max-width:480px) {
  .mj-game { padding-inline:5px; }
  .mj-summary { column-gap:7px; row-gap:0; }
  .mj-summary>span,.mj-zoom summary { font-size:.72rem; }
  .mj-summary b { font-size:.95rem; }
  .mj-zoom summary { padding-inline:0; }
}
@media(forced-colors:active) {
  .mj-game .mj-tile { border:1px solid ButtonText; }
  .mj-zoom summary,.mj-picks summary,.mj-summary span,.mj-summary b,.mj-picks p { color:CanvasText; }
}
