/* American Mahjong — Stretchy Elephant games hub (Desarae, Nov 10, 2026).
   Pretty pass (Nov 10): deep-green felt table, ivory tiles with a bamboo
   layer, SVG suit faces, wooden rack bar, walnut wall plaque.
   Phone-first at 390px: tiles wrap, nothing scrolls sideways. */

#mahjongView { max-width: 560px; margin: 6px auto 14px; padding: 12px 8px 16px; box-sizing: border-box;
  background: radial-gradient(130% 95% at 50% 0%, #47855f 0%, #2f6247 48%, #1e4530 100%);
  border-radius: 20px; border: 2px solid #173d27;
  box-shadow: inset 0 0 46px rgba(10, 30, 18, .38), inset 0 2px 0 rgba(255, 255, 255, .18), 0 5px 16px rgba(23, 61, 39, .24); }
#mahjongView *, #mahjongView *::before, #mahjongView *::after { box-sizing: border-box; }
#mahjongView .designs-title { color: #fff7e0; text-shadow: 0 1px 3px rgba(10, 30, 18, .35); }
#mahjongView .pz-intro { color: #fdf3d0; font-weight: 700; text-shadow: 0 1px 2px rgba(10, 30, 18, .38); }

/* ---------- opponents ---------- */
.mj-opps { display: flex; gap: 6px; margin: 8px 0; }
.mj-opp { flex: 1 1 0; min-width: 0; overflow: hidden; background: linear-gradient(180deg, #fffdf6, #f4e8cd);
  border: 2px solid #d9c08a; border-radius: 16px; padding: 6px;
  box-shadow: 0 2px 6px rgba(10, 30, 18, .2), inset 0 1px 0 #ffffff; }
.mj-opp .mj-expset { flex-wrap: wrap; }
.mj-opp .mj-tile-exp { width: 20px; height: 29px; }
.mj-opp .mj-tile-exp .mj-art svg { width: 12px; }
.mj-opp .mj-tile-exp .mj-windglyph { font-size: 11px; }
.mj-opp .mj-tile-exp .mj-idx, .mj-opp .mj-tile-exp .mj-suit { display: none; }
.mj-opp .mj-tile-exp.mj-tile-joker .mj-rank { display: none; }
.mj-opp.mj-active { border-color: #f2b035; background: linear-gradient(180deg, #fffbe9, #fbeecd);
  box-shadow: 0 0 0 2px #f2b035, 0 0 14px rgba(242, 176, 53, .5), 0 2px 6px rgba(10, 30, 18, .2); }
.mj-oppname { font-family: "Baloo 2", cursive; font-weight: 800; font-size: 14px; color: #4a2f1d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mj-oppbacks { margin: 3px 0 2px; line-height: 1; min-height: 15px; }
.mj-back { display: inline-block; width: 10px; height: 14px; margin: 0 1px 1px 0; border-radius: 2.5px; vertical-align: top;
  background: linear-gradient(180deg, #43b364, #1e7a3c);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(0, 0, 0, .13), 0 1px 1px rgba(10, 30, 18, .2); }
.mj-oppn { white-space: nowrap; font-weight: 800; color: #7a4d12; font-size: 13px; margin-left: 2px; vertical-align: -2px; }
.mj-oppexp { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- table / discards ---------- */
.mj-table { background: linear-gradient(180deg, rgba(9, 28, 17, .28), rgba(255, 255, 255, .05));
  border: 1.5px solid rgba(217, 164, 65, .65); border-radius: 16px; padding: 8px; margin: 8px 0;
  box-shadow: inset 0 2px 10px rgba(9, 28, 17, .3); }
.mj-wallrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(180deg, #6b4423, #452a12); border: 2px solid #d9a441; border-radius: 12px; padding: 6px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 235, 200, .4), 0 2px 5px rgba(9, 28, 17, .27); }
.mj-wall { font-weight: 800; color: #ffe9a8; font-size: 15px; }
.mj-turn { font-weight: 800; color: #f7cf6b; font-size: 14px; }
.mj-discards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.mj-dgroup { min-width: 0; }
.mj-dlabel { font-size: 12px; font-weight: 800; color: #ffe9a8; margin-bottom: 2px; text-shadow: 0 1px 2px rgba(9, 28, 17, .45); }
.mj-dtiles { display: flex; flex-wrap: wrap; gap: 2px; min-height: 12px; }
.mj-dtiles .mj-dlabel { text-shadow: none; }

/* ---------- tiles ---------- */
.mj-tile { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(180deg, #fffef9, #fdf6e0 55%, #f1e3c2); border: 1.5px solid #c9b98d; border-radius: 7px;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .95), inset 0 -3px 4px rgba(146, 110, 40, .12), 0 2px 0 #2e8b47, 0 3px 5px rgba(10, 30, 18, .19);
  color: #22384a; font-family: "Nunito", sans-serif; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mj-tile .mj-idx { position: absolute; top: 1px; left: 3px; font-size: 9px; font-weight: 800; color: #6b7683; line-height: 1; }
.mj-tile .mj-rank { max-width: 100%; white-space: nowrap; font-weight: 800; line-height: 1; }
.mj-tile .mj-art { line-height: 0; display: block; }
.mj-tile .mj-art svg { display: block; width: 24px; height: auto; }
.mj-tile .mj-suit { font-size: 8px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; line-height: 1; margin-top: 1px; }
.mj-windglyph { font-family: "Baloo 2", cursive; color: #1f3a93; }

.mj-tile-rack { width: 37px; height: 52px; cursor: pointer; padding: 2px 0; gap: 1px; }
.mj-tile-rack .mj-art svg { width: 24px; }
.mj-tile-rack .mj-windglyph { font-size: 21px; }
.mj-tile-rack .mj-idx { font-size: 10px; }
.mj-tile-rack.mj-selected { transform: translateY(-8px); border-color: #e33e2b;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .95), 0 2px 0 #2e8b47, 0 8px 10px rgba(227, 62, 43, .3); }
.mj-tile-rack.mj-blocked { opacity: .55; }

.mj-tile-mini { width: 24px; height: 33px; border-width: 1px; border-radius: 5px; padding: 1px 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .95), 0 1.5px 0 #2e8b47, 0 2px 3px rgba(10, 30, 18, .17); }
.mj-tile-mini .mj-art svg { width: 15px; }
.mj-tile-mini .mj-windglyph { font-size: 12px; }
.mj-tile-mini .mj-idx { font-size: 7px; top: 0; left: 2px; }
.mj-tile-mini .mj-suit { font-size: 5.5px; }

.mj-tile-exp { width: 26px; height: 36px; border-width: 1px; border-radius: 5px; padding: 1px 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .95), 0 1.5px 0 #2e8b47, 0 2px 3px rgba(10, 30, 18, .17); }
.mj-tile-exp .mj-art svg { width: 17px; }
.mj-tile-exp .mj-windglyph { font-size: 15px; }
.mj-tile-exp .mj-idx { font-size: 8px; }
.mj-tile-exp .mj-suit { font-size: 6px; }
.mj-tile-claimed { border-color: #e33e2b; background: linear-gradient(180deg, #ffffff, #ffe9e4); }
.mj-tile-last { border-color: #e33e2b; box-shadow: 0 0 0 2px #e33e2b, 0 2px 0 #2e8b47; }

.mj-tile-dot .mj-suit { color: #2563eb; }
.mj-tile-bam .mj-suit { color: #1d9e4b; }
.mj-tile-crak .mj-suit { color: #d92c1f; }
.mj-tile-wind .mj-suit { color: #1f3a93; }
.mj-tile-dragon .mj-suit { color: #7a4d12; }
.mj-tile-flower .mj-suit { color: #e75480; }
.mj-tile-joker { background: linear-gradient(180deg, #f6ecff, #e2c8ff); border-color: #7c3aed;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .9), inset 0 -3px 4px rgba(109, 40, 217, .13), 0 2px 0 #5b21b6, 0 3px 5px rgba(10, 30, 18, .19); }
.mj-tile-joker .mj-rank { color: #6d28d9; letter-spacing: .2px; }
.mj-tile-rack.mj-tile-joker .mj-rank { font-size: 10px; }
.mj-tile-mini.mj-tile-joker .mj-rank { font-size: 6px; }
.mj-tile-exp.mj-tile-joker .mj-rank { font-size: 7px; }

/* ---------- claim bar ---------- */
.mj-claimbar { background: linear-gradient(180deg, #fff8ec, #ffe9d2); border: 3px solid #c8402a; border-radius: 16px;
  padding: 10px; margin: 8px 0; text-align: center;
  box-shadow: 0 0 0 2px #d9a441, 0 4px 10px rgba(9, 28, 17, .25); }
.mj-claimtext { margin: 0 0 6px; font-weight: 800; color: #22384a; font-size: 16px; }
.mj-claimbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mj-claim { min-width: 92px; touch-action: manipulation; }
.mj-claim-win { background: linear-gradient(180deg, #ffb020, #e07f00); }
.mj-claim-pass { background: linear-gradient(180deg, #2e9e57, #17703a); }
.mj-claimtimer { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: #b3261e; }

/* ---------- my area ---------- */
.mj-myarea { background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(9, 28, 17, .14));
  border: 1.5px solid rgba(217, 164, 65, .55); border-radius: 16px; padding: 8px; margin: 8px 0;
  box-shadow: inset 0 2px 10px rgba(9, 28, 17, .24); }
.mj-myhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mj-myname { font-family: "Baloo 2", cursive; font-weight: 800; font-size: 16px; color: #fff7e0; text-shadow: 0 1px 2px rgba(9, 28, 17, .38); }
.mj-myexp-label { font-size: 12px; font-weight: 700; color: #ffe9a8; }
.mj-exposures { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.mj-expset { display: inline-flex; gap: 2px; background: rgba(255, 250, 235, .94); border: 1.5px solid #d9c08a; border-radius: 8px; padding: 2px;
  box-shadow: 0 1px 3px rgba(9, 28, 17, .18); }
.mj-rack { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 6px;
  background: linear-gradient(180deg, #b07a3f, #8a5a28 60%, #6f4519); border: 1px solid #5d3a14; border-radius: 10px;
  padding: 10px 6px 12px;
  box-shadow: inset 0 2px 3px rgba(255, 235, 200, .5), inset 0 -4px 6px rgba(0, 0, 0, .24), 0 3px 7px rgba(9, 28, 17, .24); }

.mj-controls .btn { touch-action: manipulation; box-shadow: inset 0 0 0 2px rgba(217, 164, 65, .85), 0 2px 5px rgba(9, 28, 17, .24); }
.mj-controls .btn:disabled { opacity: .55; box-shadow: none; }
.mj-declare { background: linear-gradient(180deg, #ffb020, #e07f00); font-size: 19px; }

/* ---------- panels ---------- */
.mj-panel { background: linear-gradient(180deg, #fffdf6, #fdf3da); border: 2px solid #d9c08a; border-radius: 16px;
  padding: 10px 14px; margin: 10px 0; box-shadow: 0 3px 9px rgba(9, 28, 17, .2); }
.mj-panel h3 { margin: 2px 0 6px; color: #7a4d12; font-family: "Baloo 2", cursive; }
.mj-hands, .mj-how { margin: 6px 0; padding-left: 2px; list-style: none; counter-reset: mjnum; }
.mj-hands li, .mj-how li { margin: 7px 0; font-size: 15px; line-height: 1.4; position: relative; padding-left: 36px; }
/* hand tips shown AS NUMBERS (Desarae, Nov 12, 2026): sparkly
   opalescent number chips by default; the color can be switched
   out from the Hands panel (body[data-numcolor]). */
.mj-hands li::before, .mj-how li::before {
  counter-increment: mjnum; content: counter(mjnum);
  position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Baloo 2", cursive; font-weight: 800; font-size: 14.5px; color: #5b4a8a;
  background: linear-gradient(135deg, #ffffff 0%, #ffe9f6 22%, #e2f3ff 48%, #eafff3 72%, #fff6d9 100%);
  border: 1.5px solid rgba(150, 130, 200, .5);
  box-shadow: 0 0 7px rgba(255, 182, 230, .85), inset 0 0 5px #ffffff, inset 0 0 2px #ffd7f2;
  text-shadow: 0 0 3px #ffffff, 0 0 6px #ffd7f2;
}
body[data-numcolor="pink"] .mj-hands li::before, body[data-numcolor="pink"] .mj-how li::before { background: #ff8fb8; border-color: #d16a93; color: #5c1030; box-shadow: none; text-shadow: none; }
body[data-numcolor="blue"] .mj-hands li::before, body[data-numcolor="blue"] .mj-how li::before { background: #7cc3ff; border-color: #4a90c4; color: #10314f; box-shadow: none; text-shadow: none; }
body[data-numcolor="purple"] .mj-hands li::before, body[data-numcolor="purple"] .mj-how li::before { background: #b79ced; border-color: #8466c9; color: #2c1458; box-shadow: none; text-shadow: none; }
body[data-numcolor="gold"] .mj-hands li::before, body[data-numcolor="gold"] .mj-how li::before { background: #ffd23e; border-color: #c39a12; color: #574200; box-shadow: none; text-shadow: none; }
.mj-numcolor { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.mj-numcolor-label { font-size: 13.5px; font-weight: 700; color: #5b4a8a; }
.mj-numswatch { font-family: inherit; font-size: 13px; font-weight: 700; border-radius: 999px; border: 2px solid #cbb8ea; background: #ffffff; color: #4a3577; padding: 4px 11px; cursor: pointer; min-height: 32px; }
.mj-numswatch[aria-pressed="true"] { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124, 58, 237, .35); }
.mj-numsw-opal { background: linear-gradient(135deg, #ffffff, #ffe9f6, #e2f3ff, #fff6d9); }
.mj-panelnote { font-size: 14px; line-height: 1.45; margin: 6px 0; }

/* ---------- overlay ---------- */
.mj-overlay { position: fixed; inset: 0; background: rgba(15, 38, 24, .68); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 14px; }
.mj-overlay[hidden] { display: none; }
.mj-overlaycard { background-color: #fffdf6;
  background-image: radial-gradient(circle, rgba(217, 164, 65, .35) 1.5px, transparent 1.7px), radial-gradient(circle, rgba(227, 62, 43, .18) 1.2px, transparent 1.4px);
  background-size: 26px 26px, 34px 34px; background-position: 0 0, 9px 13px;
  border-radius: 20px; border: 4px solid #d9a441; max-width: 420px; width: 100%; padding: 18px 14px; text-align: center;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
.mj-overlaycard h3 { margin: 0 0 6px; font-family: "Baloo 2", cursive; font-size: 26px; color: #7a4d12; }
.mj-overlaycard p { margin: 4px 0 10px; font-size: 16px; }
.mj-overlayhand { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 8px 0 14px; }

/* ===== No double-tap zoom / no pink tap flash (Desarae, Nov 10, 2026) =====
   touch-action: manipulation on the page and on everything tappable
   kills the double-tap-to-zoom that fast little fingers trigger
   mid-game, while pinch-zoom and ordinary scrolling keep working.
   Selection and the long-press callout are off on game surfaces, so a
   double-tap can't flash a pink text selection (and zoom to it)
   either; form fields stay selectable and editable. Local rules for
   drawing / drag surfaces (coloring canvas, sorter pieces, swipe
   strips) keep their own touch-action: those selectors are more
   specific than the element selectors below, so they still win. */
html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body, button, a, input, select, textarea, label, [role="button"] { touch-action: manipulation; }
html, body, body *:not(input):not(textarea) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
* { -webkit-tap-highlight-color: transparent; }
input, textarea { -webkit-user-select: text; user-select: text; }

/* win/loss record line (Desarae, Nov 11, 2026) */
.wl-line { text-align: center; font-weight: 800; color: #7a5200; margin: 4px auto 0; min-height: 1.2em; font-size: 15px; font-family: "Nunito", system-ui, sans-serif; }
/* friends mode choice (Desarae, Nov 11, 2026) */
.mj-modeseg { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; margin: 10px auto 0; }
.mj-modeseg button { background: #efe7f7; color: #5b2a86; border: 2px solid #cbb8e8; border-radius: 999px; padding: 10px 18px; font-family: "Baloo 2", cursive; font-weight: 700; font-size: 16px; cursor: pointer; min-height: 48px; }
.mj-modeseg button.mj-mode-on { background: #5b2a86; color: #fff; border-color: #5b2a86; }
