/* ============================================================
   Four-Player Mahjong — professional table + 6-variant hub
   Shares the Mahjong Hub rainbow/cream brand, but the table
   itself uses a real felt look for a pro battle feel.
   ============================================================ */
:root {
  color-scheme: light;
  --ink: #202635;
  --muted: #6b7183;
  --pink: #f472b6;
  --purple: #a78bfa;
  --mint: #5eead4;
  --yellow: #fcd34d;
  --cream: #fff9f0;
  --card: #ffffff;
  --line: rgba(120, 90, 130, 0.14);
  --shadow: 0 22px 60px rgba(125, 83, 111, 0.14);
  /* Felt table */
  --felt-1: #1f7a54;
  --felt-2: #14603f;
  --felt-edge: #0c3f29;
  /* Tile ivory */
  --tile-face: #fbf7ee;
  --tile-face-2: #f1e9d6;
  --tile-edge: #cdbf9f;
  --tile-side: #d8cbab;
  --ink-char: #23324a;
  --ink-red: #c8354a;
  --ink-green: #1f8a5b;
  --ink-blue: #2f6bd6;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }

/* ---------- Shared site header ---------- */
.fp-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 66px;
  padding: 0.6rem max(1rem, calc((100% - 1200px) / 2));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.fp-brand { display: inline-flex; align-items: center; gap: 0.65rem; min-width: max-content; }
.fp-brand-mark {
  display: grid; width: 42px; height: 42px; place-items: center;
  border-radius: 14px; color: #fff; font-weight: 800; letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--pink), var(--purple));
}
.fp-brand strong { display: block; font-size: 1.02rem; }
.fp-brand small { color: var(--muted); font-size: 0.76rem; }
.fp-nav { margin-left: auto; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.fp-nav a {
  padding: 0.42rem 0.8rem; border-radius: 999px; font-size: 0.9rem; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.fp-nav a:hover, .fp-nav a.active { background: var(--pink); color: #fff; }

/* ============================================================
   HUB (lobby) — 6 variant cards
   ============================================================ */
.hub-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem max(1rem, 4vw) 4rem;
}
.hub-body {
  background:
    radial-gradient(circle at 12% 4%, rgba(244, 114, 182, 0.14), transparent 24rem),
    radial-gradient(circle at 88% 8%, rgba(94, 234, 212, 0.16), transparent 22rem),
    var(--cream);
}
.hub-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 2.4rem;
}
.hub-pill {
  display: inline-block; padding: 0.3rem 0.85rem; border-radius: 999px;
  background: linear-gradient(90deg, #fde7f3, #efe7ff);
  color: #9a4d84; font-size: 0.78rem; font-weight: 600; margin-bottom: 0.9rem;
}
.hub-hero h1 { margin: 0 0 0.7rem; font-size: clamp(1.7rem, 3.5vw, 2.5rem); line-height: 1.15; }
.hub-hero p { margin: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.65; }
.hub-hero-stats { display: flex; gap: 1.6rem; margin-top: 1.4rem; }
.hub-hero-stats div strong { display: block; font-size: 1.5rem; color: var(--pink); }
.hub-hero-stats div span { font-size: 0.82rem; color: var(--muted); }
.hub-hero-art {
  position: relative; aspect-ratio: 1 / 1; border-radius: 24px;
  background: linear-gradient(135deg, var(--felt-1), var(--felt-2));
  box-shadow: inset 0 0 60px rgba(0,0,0,0.28);
  display: grid; place-items: center;
}
.hub-hero-art .seat-chip {
  position: absolute; width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 16px; background: rgba(255,255,255,0.92); color: var(--ink);
  font-weight: 800; font-size: 1.3rem; box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}
.hub-hero-art .c-n { top: 10%; left: 50%; transform: translateX(-50%); }
.hub-hero-art .c-s { bottom: 10%; left: 50%; transform: translateX(-50%); }
.hub-hero-art .c-e { left: 10%; top: 50%; transform: translateY(-50%); }
.hub-hero-art .c-w { right: 10%; top: 50%; transform: translateY(-50%); }
.hub-hero-art .c-mid { color: #fff; font-family: "PingFang SC", serif; font-size: 2.6rem; opacity: 0.9; }

.hub-section-head { margin: 0 0 1.2rem; }
.hub-section-head .eyebrow { color: var(--pink); font-weight: 700; letter-spacing: 0.08em; font-size: 0.8rem; text-transform: uppercase; }
.hub-section-head h2 { margin: 0.3rem 0 0.4rem; font-size: 1.6rem; }
.hub-section-head p { margin: 0; color: var(--muted); }

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}
.variant-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px -18px rgba(60, 40, 70, 0.4);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), box-shadow 0.25s;
}
.variant-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 6px;
  background: var(--accent, var(--pink));
}
.variant-card:hover { transform: translateY(-8px); box-shadow: 0 26px 50px -22px rgba(60, 40, 70, 0.45); }
.variant-emblem {
  width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center;
  font-size: 2rem; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--accent, var(--pink)) 16%, #fff);
  color: var(--accent, var(--pink));
}
.variant-card h3 { margin: 0 0 0.2rem; font-size: 1.35rem; }
.variant-card .v-en { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; }
.variant-card .v-tag { margin: 0.7rem 0 0.9rem; color: var(--muted); font-size: 0.95rem; min-height: 2.6em; }
.variant-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.2rem; }
.variant-meta span {
  padding: 0.24rem 0.62rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
  background: color-mix(in srgb, var(--accent, var(--pink)) 12%, #fff);
  color: color-mix(in srgb, var(--accent, var(--pink)) 70%, #333);
}
.variant-go {
  margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.5rem; border-radius: 999px; font-weight: 700; color: #fff;
  background: var(--accent, var(--pink));
  box-shadow: 0 8px 20px -8px var(--accent, var(--pink));
  transition: transform 0.2s, filter 0.2s;
}
.variant-go:hover { transform: translateX(3px); filter: brightness(1.05); }

.hub-note {
  margin-top: 2.4rem; padding: 1.2rem 1.5rem; border-radius: 18px;
  background: rgba(255,255,255,0.7); border: 1px dashed var(--line); color: var(--muted);
  font-size: 0.92rem; line-height: 1.6;
}
.hub-footer { text-align: center; padding: 2rem 1rem 3rem; color: var(--muted); font-size: 0.9rem; }
.hub-footer a { color: var(--pink); font-weight: 600; }

/* ============================================================
   TABLE (game) — professional felt board
   ============================================================ */
.table-body {
  background: radial-gradient(circle at 50% 0%, #16324a, #0c1a28 70%);
  color: #eaf2ee;
}
.table-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem max(0.8rem, 2vw) 2rem;
}

.table-topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem 1.2rem;
  padding: 0.9rem 1.2rem; margin-bottom: 1rem;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
}
.table-topbar .tb-title { display: flex; align-items: center; gap: 0.7rem; }
.table-topbar .tb-emblem {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.4rem;
  background: color-mix(in srgb, var(--accent, var(--pink)) 26%, #12303f); color: #fff;
}
.table-topbar h1 { margin: 0; font-size: 1.2rem; }
.table-topbar h1 small { display: block; font-size: 0.72rem; color: #9fb4c4; font-weight: 400; letter-spacing: 0.05em; }
.table-metrics { margin-left: auto; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.table-metrics div { text-align: center; }
.table-metrics strong { display: block; font-size: 1.15rem; color: #fff; font-variant-numeric: tabular-nums; }
.table-metrics span { font-size: 0.72rem; color: #9fb4c4; }
.tb-back { padding: 0.42rem 0.9rem; border-radius: 999px; background: rgba(255,255,255,0.12); color: #eaf2ee; font-size: 0.85rem; }
.tb-back:hover { background: rgba(255,255,255,0.22); }

/* The felt board: 3x3 grid, seats around a center pond */
.board {
  position: relative;
  height: clamp(360px, 54vh, 540px);
  border-radius: 26px;
  padding: clamp(0.6rem, 2vw, 1.4rem);
  background:
    radial-gradient(ellipse at 50% 45%, var(--felt-1), var(--felt-2) 62%, var(--felt-edge) 100%);
  border: 6px solid #0a2f1f;
  box-shadow: inset 0 0 70px rgba(0,0,0,0.45), 0 24px 60px rgba(0,0,0,0.5);
  display: grid;
  grid-template-columns: 1fr 2.1fr 1fr;
  grid-template-rows: 1fr 1.7fr 1fr;
  gap: 0.4rem;
  overflow: hidden;
}
.board::after {
  content: "";
  position: absolute; inset: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  pointer-events: none;
}

/* Seat placement on the grid */
.seat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.seat-north { grid-column: 2; grid-row: 1; align-items: center; justify-content: flex-start; }
.seat-south { grid-column: 2; grid-row: 3; align-items: center; justify-content: flex-end; }
.seat-east  { grid-column: 3; grid-row: 2; align-items: flex-end; justify-content: center; }
.seat-west  { grid-column: 1; grid-row: 2; align-items: flex-start; justify-content: center; }
.center-zone { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; min-width: 0; }

/* Player name plate */
.plate {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem; border-radius: 999px;
  background: rgba(6, 22, 16, 0.55); border: 1px solid rgba(255,255,255,0.12);
  color: #eaf2ee; max-width: 100%;
}
.plate.is-turn { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(252,211,77,0.35), 0 0 18px rgba(252,211,77,0.35); }
.plate.is-winner { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(94,234,212,0.4); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.05rem; flex: none;
  background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff;
}
.plate .who { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.plate .who b { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .who small { font-size: 0.68rem; color: #a9c0cf; }
.wind-badge {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 800; flex: none;
  background: #f4ead0; color: #7a2b2b;
}
.dealer-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.6rem; font-weight: 800; background: var(--yellow); color: #6b4a00; flex: none; }
.void-badge { font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 6px; background: rgba(200,53,74,0.85); color: #fff; flex: none; }
.score-badge { font-size: 0.72rem; font-weight: 800; padding: 0.05rem 0.4rem; border-radius: 6px; flex: none; font-variant-numeric: tabular-nums; }
.score-badge.pos { background: rgba(94,234,212,0.2); color: #9ff0dc; }
.score-badge.neg { background: rgba(255,120,120,0.2); color: #ffb0b0; }

/* Opponent concealed hands (tile backs) */
.hand-backs { display: flex; gap: 2px; margin-top: 0.3rem; flex-wrap: nowrap; }
.hand-backs.vertical { flex-direction: column; }
.tile-back {
  border-radius: 4px;
  background: linear-gradient(135deg, #2f8f6b, #1c6b4c);
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  overflow: hidden;
  position: relative;
}
.tile-back svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* pastel character back skins */
.tile-back.back-capybara { background: linear-gradient(160deg, #fdeecf, #f6dfb8); border-color: #ecd3a8; }
.tile-back.back-kitty { background: linear-gradient(160deg, #fdeef4, #f8dced); border-color: #f0cfe0; }
.tile-back.back-bunny { background: linear-gradient(160deg, #f1ecfb, #e4dbf6); border-color: #d8ccee; }
.tile-back.back-puppy { background: linear-gradient(160deg, #eef4fb, #dde9f6); border-color: #cddef0; }
.tile-back.back-blossom { background: linear-gradient(160deg, #fdf0f5, #f8dfea); border-color: #f2cfdf; }
.hand-backs .tile-back { width: 19px; height: 25px; }
.hand-backs.vertical .tile-back { width: 25px; height: 18px; }
body[data-tileset="omm"] .hand-backs .tile-back { width: 21px; height: 27px; }
body[data-tileset="omm"] .hand-backs.vertical .tile-back { width: 27px; height: 20px; }

/* Melds (exposed sets) */
.melds { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 0.25rem; }
.meld { display: flex; gap: 1px; }

/* Center pond */
.center-info {
  text-align: center; color: #eaf2ee;
  background: rgba(6, 22, 16, 0.45); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; padding: 0.5rem 0.9rem; max-width: 100%;
}
.center-info .round-line { font-size: 0.78rem; color: #a9c0cf; }
.center-info .msg { font-size: 0.98rem; font-weight: 700; margin: 0.15rem 0; }
.center-info .hint { font-size: 0.76rem; color: #b9cdd9; }
.dice { display: flex; gap: 6px; justify-content: center; margin-top: 0.35rem; }
.die {
  width: 26px; height: 26px; border-radius: 6px; background: #fbf7ee; color: #c8354a;
  display: grid; place-items: center; font-size: 1rem; font-weight: 800;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}
.pond {
  display: grid; grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 3px; width: 100%;
}
.discard-pond { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; max-width: min(96%, 520px); }

/* Human seat: full hand + actions */
.human-tray {
  margin-top: 1rem;
  padding: 0.9rem 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}
.action-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-bottom: 0.9rem; min-height: 2.4rem; }
.act-btn {
  padding: 0.5rem 1.15rem; border-radius: 999px; font-weight: 800; font-size: 0.95rem;
  color: #12303f; background: #f4ead0;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25); transition: transform 0.12s, filter 0.15s;
}
.act-btn:hover { filter: brightness(1.05); }
.act-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.act-btn.primary { background: var(--yellow); }
.act-btn.hu { background: linear-gradient(135deg, #ff6f91, #ff9770); color: #fff; }
.act-btn.ghost { background: rgba(255,255,255,0.14); color: #eaf2ee; box-shadow: none; border: 1px solid rgba(255,255,255,0.2); }
.act-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.human-hand { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: flex-end; }

.tray-controls { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.9rem; flex-wrap: wrap; }
.tray-controls button {
  padding: 0.42rem 1rem; border-radius: 999px; font-size: 0.85rem; color: #eaf2ee;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.16);
}
.tray-controls button:hover { background: rgba(255,255,255,0.2); }

/* ---------- The mahjong tile face ---------- */
.tile {
  --w: 46px;
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.36);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--tile-face), var(--tile-face-2));
  border: 1px solid var(--tile-edge);
  box-shadow: 0 3px 0 var(--tile-side), 0 6px 10px rgba(0,0,0,0.3);
  display: grid;
  place-items: center;
  padding: 3px;
  user-select: none;
  flex: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tile.sm { --w: 26px; border-radius: 5px; box-shadow: 0 2px 0 var(--tile-side), 0 3px 5px rgba(0,0,0,0.28); }
.tile.xs { --w: 20px; border-radius: 4px; box-shadow: 0 1px 0 var(--tile-side); padding: 2px; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { transform: translateY(-10px); box-shadow: 0 12px 0 var(--tile-side), 0 16px 20px rgba(0,0,0,0.35); }
.tile.selected { transform: translateY(-14px); box-shadow: 0 0 0 3px var(--yellow), 0 16px 20px rgba(0,0,0,0.4); }
.tile.drawn { box-shadow: 0 3px 0 var(--tile-side), 0 6px 10px rgba(0,0,0,0.3), 0 0 0 2px var(--mint); }
.tile.dim { opacity: 0.5; }
.tile.hint-tile { animation: tilePulse 1s ease-in-out infinite; }
@keyframes tilePulse { 0%,100% { box-shadow: 0 3px 0 var(--tile-side), 0 0 0 2px var(--mint); } 50% { box-shadow: 0 3px 0 var(--tile-side), 0 0 0 4px var(--yellow); } }

.tile-face { width: 100%; height: 100%; display: grid; place-items: center; position: relative; }

/* Character (万) tiles: numeral + 萬 */
.face-char { flex-direction: column; display: flex; align-items: center; justify-content: center; gap: 0; line-height: 0.9; }
.face-char .num { font-family: "PingFang SC","Microsoft YaHei",serif; font-weight: 700; color: var(--ink-char); }
.face-char .wan { font-family: "PingFang SC","Microsoft YaHei",serif; font-weight: 700; color: var(--ink-red); }
.tile .face-char .num { font-size: calc(var(--w) * 0.5); }
.tile .face-char .wan { font-size: calc(var(--w) * 0.34); }

/* Honor / flower tiles: one big glyph */
.face-glyph { font-family: "PingFang SC","Microsoft YaHei",serif; font-weight: 800; }
.tile .face-glyph { font-size: calc(var(--w) * 0.62); }
.face-glyph.red { color: var(--ink-red); }
.face-glyph.green { color: var(--ink-green); }
.face-glyph.blue { color: var(--ink-blue); }
.face-glyph.ink { color: var(--ink-char); }
.face-glyph.gold { color: #c98a1a; }
/* White dragon: a framed blank */
.face-frame { width: 62%; height: 66%; border: 2px solid var(--ink-blue); border-radius: 3px; }

/* Pip grids for dots (筒) and bamboo (条) */
.pips { display: flex; flex-direction: column; gap: 12%; align-items: center; justify-content: center; width: 100%; height: 100%; }
.pip-row { display: flex; gap: 14%; align-items: center; justify-content: center; }
.dot { border-radius: 50%; }
.tile .dot { width: calc(var(--w) * 0.2); height: calc(var(--w) * 0.2); }
.dot.blue { background: radial-gradient(circle at 35% 30%, #6fa8ff, var(--ink-blue)); }
.dot.red { background: radial-gradient(circle at 35% 30%, #ff7a8a, var(--ink-red)); }
.dot.green { background: radial-gradient(circle at 35% 30%, #63d3a0, var(--ink-green)); }
.bam { border-radius: 2px; }
.tile .bam { width: calc(var(--w) * 0.11); height: calc(var(--w) * 0.3); }
.bam.green { background: linear-gradient(180deg, #58c98c, var(--ink-green)); }
.bam.red { background: linear-gradient(180deg, #ff8a97, var(--ink-red)); }
.bird { color: var(--ink-green); }
.tile .bird { font-size: calc(var(--w) * 0.6); }

/* ---------- OMM pastel-illustrated tileset ---------- */
body[data-tileset="omm"] .tile {
  background: linear-gradient(180deg, #ffffff, #fdf7fb);
  border-color: #efdcec;
  box-shadow: 0 3px 0 #ecd9e6, 0 6px 10px rgba(120, 80, 110, 0.22);
}
body[data-tileset="omm"] .tile.clickable:hover { box-shadow: 0 12px 0 #ecd9e6, 0 16px 20px rgba(120, 80, 110, 0.3); }
.omm-face { position: relative; width: 100%; height: 100%; }
.omm-face svg { width: 100%; height: 100%; display: block; }
.omm-mini { position: absolute; top: 0; left: 2px; font-weight: 800; color: #c07fa0; line-height: 1; z-index: 1; }
.tile .omm-mini { font-size: calc(var(--w) * 0.2); }
/* 万 — big pastel-pink Chinese numeral */
.omm-wan { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 0.85; }
.omm-wan .omm-corner { position: absolute; top: 1px; left: 3px; font-weight: 800; color: #cf9ab8; }
.tile .omm-wan .omm-corner { font-size: calc(var(--w) * 0.2); }
.omm-wan .omm-cn { font-family: "PingFang SC", "Microsoft YaHei", serif; font-weight: 700; color: #d47aa6; }
.tile .omm-wan .omm-cn { font-size: calc(var(--w) * 0.72); }
.omm-wan .omm-wanlabel { font-family: "PingFang SC", serif; font-weight: 700; color: #e6a9c6; }
.tile .omm-wan .omm-wanlabel { font-size: calc(var(--w) * 0.22); }
/* winds N/E/W/S */
.omm-wind { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 0.9; }
.omm-wind .omm-wl { font-family: Inter, system-ui, sans-serif; font-weight: 800; color: #82c0e6; }
.tile .omm-wind .omm-wl { font-size: calc(var(--w) * 0.56); }
.omm-wind .omm-wc { font-family: "PingFang SC", serif; font-weight: 600; color: #aed6ef; }
.tile .omm-wind .omm-wc { font-size: calc(var(--w) * 0.26); }
/* dragons */
.omm-dragon { width: 100%; height: 100%; display: grid; place-items: center; font-family: "PingFang SC", serif; font-weight: 800; }
.tile .omm-dragon { font-size: calc(var(--w) * 0.62); }
.omm-dragon.dr { color: #e58bb0; }
.omm-dragon.dg { color: #5ec6ad; }
.omm-dragon.dw .omm-frame { display: block; width: 58%; height: 64%; border: 2px solid #b0d2e8; border-radius: 5px; }
/* joker */
.omm-face.joker { display: grid; place-items: center; }
.omm-joker { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-family: Inter, sans-serif; font-weight: 800; color: #9a7ad6; letter-spacing: 0.03em; }
.tile .omm-joker { font-size: calc(var(--w) * 0.18); }

/* ---------- Oversea tileset (big Arabic numerals + color coding) ---------- */
.os-face { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 0.9; }
.os-face .os-num { font-weight: 800; font-family: "Arial Rounded MT Bold", Inter, system-ui, sans-serif; }
.os-face .os-suit { font-family: "PingFang SC", "Microsoft YaHei", serif; font-weight: 700; opacity: 0.72; }
.tile .os-face .os-num { font-size: calc(var(--w) * 0.62); }
.tile .os-face .os-suit { font-size: calc(var(--w) * 0.3); margin-top: 1px; }
/* suit color coding: 万=red / 条=green / 筒=blue */
.os-face.suit-m .os-num, .os-face.suit-m .os-suit { color: var(--ink-red); }
.os-face.suit-s .os-num, .os-face.suit-s .os-suit { color: var(--ink-green); }
.os-face.suit-p .os-num, .os-face.suit-p .os-suit { color: var(--ink-blue); }
/* honor tiles: big glyph + English corner */
.os-honor { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.os-honor .os-glyph { font-family: "PingFang SC", "Microsoft YaHei", serif; font-weight: 800; }
.tile .os-honor .os-glyph { font-size: calc(var(--w) * 0.6); }
.os-honor .os-glyph.red { color: var(--ink-red); }
.os-honor .os-glyph.green { color: var(--ink-green); }
.os-honor .os-glyph.blue { color: var(--ink-blue); }
.os-honor .os-corner { position: absolute; right: 2px; bottom: 1px; font-weight: 800; font-family: Inter, system-ui, sans-serif; color: var(--muted); line-height: 1; }
.tile .os-honor .os-corner { font-size: calc(var(--w) * 0.26); }
.os-honor .os-corner.red { color: var(--ink-red); }
.os-honor .os-corner.green { color: var(--ink-green); }
.os-honor .os-corner.blue { color: var(--ink-blue); }

/* ---------- bilingual action buttons ---------- */
.act-btn { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05; }
.act-btn .cn { font-size: 0.95rem; }
.act-btn .en { font-size: 0.66rem; font-weight: 600; opacity: 0.8; letter-spacing: 0.02em; }

/* ---------- waiting (听牌) strip ---------- */
.waiting-strip { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; margin: 0.35rem 0 0.1rem; }
.waiting-strip .w-label { font-size: 0.72rem; font-weight: 700; color: var(--yellow); margin-right: 0.2rem; }

/* result overlay */
.result-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  place-items: center; background: rgba(6, 16, 24, 0.7); backdrop-filter: blur(4px);
}
.result-overlay.show { display: grid; }
.result-card {
  width: min(92vw, 440px); border-radius: 24px; padding: 1.8rem; text-align: center;
  background: var(--cream); color: var(--ink); box-shadow: var(--shadow);
}
.result-card .big { font-size: 3rem; margin: 0; }
.result-card h2 { margin: 0.3rem 0 0.2rem; font-size: 1.5rem; }
.result-card p { color: var(--muted); margin: 0.3rem 0 1.2rem; }
.result-card .result-hand { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin-bottom: 1.3rem; }
.fan-list { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; align-items: center; margin-bottom: 1rem; }
.fan-chip { font-size: 0.78rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: color-mix(in srgb, var(--accent, var(--pink)) 14%, #fff); color: color-mix(in srgb, var(--accent, var(--pink)) 72%, #333); font-weight: 600; }
.fan-total { width: 100%; text-align: center; margin-top: 0.3rem; color: var(--ink); font-size: 1.05rem; }
.scoreboard { background: rgba(0,0,0,0.04); border-radius: 14px; padding: 0.8rem 1rem; margin-bottom: 1.1rem; }
.sb-title { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.score-row { display: flex; justify-content: space-between; padding: 0.15rem 0; font-size: 0.95rem; }
.score-row b.pos { color: #1f9d6b; } .score-row b.neg { color: #d64545; }
.score-row b { font-variant-numeric: tabular-nums; }
.result-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.result-actions button { padding: 0.6rem 1.4rem; border-radius: 999px; font-weight: 700; }
.result-actions .again { background: var(--pink); color: #fff; }
.result-actions .lobby { background: rgba(0,0,0,0.06); color: var(--ink); }

/* rules drawer */
.rules-drawer { margin-top: 1.2rem; border-radius: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); }
.rules-drawer summary { list-style: none; cursor: pointer; padding: 0.9rem 1.2rem; font-weight: 700; color: #eaf2ee; }
.rules-drawer summary::-webkit-details-marker { display: none; }
.rules-drawer summary::after { content: "▾"; float: right; }
.rules-drawer[open] summary::after { content: "▴"; }
.rules-body { padding: 0 1.2rem 1.2rem; color: #c6d6e0; font-size: 0.9rem; line-height: 1.7; }
.rules-body ul { margin: 0.4rem 0; padding-left: 1.2rem; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: rgba(12, 28, 20, 0.95); color: #eaf2ee; padding: 0.65rem 1.3rem; border-radius: 999px;
  font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 90;
  border: 1px solid rgba(255,255,255,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Score calculator tool
   ============================================================ */
.scorer-body {
  background:
    radial-gradient(circle at 12% 4%, rgba(244, 114, 182, 0.14), transparent 24rem),
    radial-gradient(circle at 88% 8%, rgba(94, 234, 212, 0.16), transparent 22rem),
    var(--cream);
  color: var(--ink);
}
.scorer-main { max-width: 960px; margin: 0 auto; padding: 1.6rem max(1rem, 4vw) 4rem; }
.scorer-head h1 { margin: 0 0 0.3rem; font-size: clamp(1.5rem, 3vw, 2rem); }
.scorer-head p { margin: 0 0 1.4rem; color: var(--muted); }
.variant-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }
.variant-tab {
  padding: 0.5rem 1rem; border-radius: 999px; font-weight: 700; font-size: 0.92rem;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  transition: all 0.2s;
}
.variant-tab.active { background: var(--accent, var(--pink)); color: #fff; border-color: transparent; }
.scorer-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 1.4rem; margin-bottom: 1.4rem; }
.scorer-card h2 { margin: 0 0 0.2rem; font-size: 1.1rem; }
.scorer-card .sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.86rem; }
.hand-slots {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 70px;
  padding: 0.7rem; border-radius: 14px; background: #faf5ec; border: 1px dashed var(--line); margin-bottom: 0.6rem;
}
.hand-slots .tile { --w: 40px; cursor: pointer; }
.hand-count { font-size: 0.9rem; color: var(--muted); }
.hand-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hand-count.ok b { color: #1f9d6b; }
.palette { display: flex; flex-direction: column; gap: 0.7rem; }
.palette-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.palette-row .lbl { width: 2.6rem; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.palette .tile { --w: 38px; cursor: pointer; }
.palette .tile:hover { transform: translateY(-4px); }
.scorer-options { display: flex; flex-wrap: wrap; gap: 1rem 1.4rem; align-items: center; margin-top: 0.4rem; }
.scorer-options label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; }
.scorer-options input[type="number"] { width: 3.4rem; padding: 0.3rem 0.4rem; border-radius: 8px; border: 1px solid var(--line); }
.scorer-actions { display: flex; gap: 0.6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.scorer-actions button { padding: 0.6rem 1.4rem; border-radius: 999px; font-weight: 700; }
.btn-calc { background: var(--accent, var(--pink)); color: #fff; }
.btn-clear { background: rgba(0,0,0,0.05); color: var(--ink); }
.btn-sample { background: rgba(0,0,0,0.05); color: var(--ink); }
.result-box { display: none; }
.result-box.show { display: block; }
.result-box .verdict { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.6rem; }
.result-box .verdict.ok { color: #1f9d6b; }
.result-box .verdict.no { color: #d64545; }
.result-box .total-line { font-size: 1.4rem; font-weight: 800; margin: 0.4rem 0 0.8rem; color: var(--accent, var(--pink)); }
.result-box .note { color: var(--muted); font-size: 0.85rem; line-height: 1.6; }
.result-box .fan-list { justify-content: flex-start; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hub-hero { grid-template-columns: 1fr; }
  .hub-hero-art { max-width: 320px; margin: 0 auto; width: 100%; }
  .board { min-height: 360px; }
  .tile { --w: 34px; }
  .table-metrics { gap: 0.9rem; }
}
/* ---------- portrait mobile HUD ---------- */
@media (max-width: 640px) {
  .table-main { padding: 0.6rem 0.5rem 0; }
  .fp-nav { flex-wrap: wrap; justify-content: center; }

  /* compact top status bar */
  .table-topbar { padding: 0.55rem 0.7rem; margin-bottom: 0.6rem; gap: 0.5rem 0.8rem; border-radius: 14px; }
  .table-topbar .tb-emblem { width: 34px; height: 34px; font-size: 1.1rem; }
  .table-topbar h1 { font-size: 0.98rem; }
  .table-topbar h1 small { display: none; }
  .table-metrics { gap: 0.9rem; margin-left: auto; }
  .table-metrics strong { font-size: 0.98rem; }
  .table-metrics span { font-size: 0.62rem; }
  .table-metrics div:nth-child(2) { display: none; } /* hide 起手张数 to save room */
  .tb-back { padding: 0.36rem 0.7rem; font-size: 0.78rem; }

  /* board reflows to: opponents row / center / your seat */
  .board {
    height: auto;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto minmax(120px, 1fr) auto;
    grid-template-areas:
      "west north east"
      "center center center"
      "south south south";
    gap: 0.3rem;
    padding: 0.6rem 0.5rem;
    border-width: 4px;
  }
  .board::after { inset: 6px; border-radius: 12px; }
  .seat-north, .seat-west, .seat-east { grid-area: north; align-items: center; min-width: 0; overflow: hidden; }
  .seat-west { grid-area: west; }
  .seat-east { grid-area: east; }
  .center-zone { grid-area: center; }
  .seat-south { grid-area: south; }

  /* compact opponents: small plate + a short face-down cluster (not full hand) */
  .board .plate { padding: 0.2rem 0.45rem 0.2rem 0.22rem; gap: 0.3rem; max-width: 100%; }
  .board .avatar { width: 24px; height: 24px; font-size: 0.8rem; }
  .plate .who b { font-size: 0.7rem; }
  .plate .who small { font-size: 0.56rem; }
  .wind-badge { width: 18px; height: 18px; font-size: 0.68rem; }
  .board .hand-backs { flex-wrap: nowrap; flex-direction: row; justify-content: center; max-width: 100%; }
  .seat-north .hand-backs .tile-back:nth-child(n+5),
  .seat-east .hand-backs .tile-back:nth-child(n+5),
  .seat-west .hand-backs .tile-back:nth-child(n+5) { display: none; }
  body[data-tileset="omm"] .board .hand-backs .tile-back,
  .board .hand-backs .tile-back { width: 14px; height: 19px; }
  .seat-north .discard-pond, .seat-east .discard-pond, .seat-west .discard-pond {
    max-height: 40px; overflow: hidden; justify-content: center;
  }
  .board .discard-pond .tile.sm { --w: 17px; }
  .melds .tile.xs { --w: 14px; }

  /* center pond emphasised */
  .center-info { padding: 0.4rem 0.6rem; }
  .center-info .msg { font-size: 0.9rem; }
  .center-info .round-line { font-size: 0.68rem; }
  .center-info .hint { font-size: 0.68rem; }

  /* your hand + actions become a pinned bottom deck (thumb zone) */
  .human-tray {
    position: sticky; bottom: 0; z-index: 6;
    margin: 0.5rem -0.5rem 0; border-radius: 16px 16px 0 0;
    padding: 0.6rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom));
    background: rgba(14, 30, 24, 0.96);
    box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.6);
  }
  .human-hand { gap: 3px; }
  .human-hand .tile { --w: 32px; }
  .action-bar { gap: 0.4rem; margin-bottom: 0.6rem; min-height: 0; }
  .act-btn { padding: 0.5rem 0.95rem; }
  .act-btn .cn { font-size: 0.9rem; }
  .act-btn .en { font-size: 0.6rem; }
  .tray-controls { margin-top: 0.6rem; gap: 0.35rem; }
  .tray-controls button { padding: 0.36rem 0.7rem; font-size: 0.76rem; }

  /* the human seat inside the board stays minimal (plate + river) */
  .seat-south .plate { align-self: center; }
}

/* very narrow phones */
@media (max-width: 380px) {
  .human-hand .tile { --w: 28px; }
  .snav-tab { padding: 0.5rem 0.5rem; }
}
