/* Mahjong Mulu design system, "Ink and bone": indigo ink on a bone-ivory ground, like the tiles themselves.
   The look is a score ledger, not a card deck: content sits on the ground between hairline rules, corners are a tile's,
   and the only raised objects are tiles. Rules in words live in /DESIGN.md. Light only for v1. */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Source+Sans+3:wght@400;600;700&family=Noto+Serif+SC:wght@500;700&display=swap");

:root {
  /* Ground and ink */
  --color-bg: #f6f1e6; --color-surface: #ece5d5; --color-raised: #fffdf7; --color-border: #dcd2bf; --color-border-strong: #b9ad95;
  --color-text: #1b2140; --color-text-muted: #5d6078;
  /* Indigo: the brand, the primary action, the selected state, the tile back */
  --color-primary: #27346e; --color-primary-hover: #1e2959; --color-primary-edge: #141b3d; --color-primary-soft: #e3e5f0; --color-on-primary: #ffffff;
  /* The other two inks on a tile: jade for points won, cinnabar for points paid */
  --color-gain: #23704f; --color-loss: #b0322a;
  --color-success: #23704f; --color-warning: #94620a; --color-danger: #b0322a;
  --color-scrim: rgba(20, 24, 48, 0.45);

  --font-sans: "Source Sans 3", system-ui, sans-serif; --font-display: "Fraunces", Georgia, serif;
  --font-cjk: "Noto Serif SC", "Songti SC", serif; --font-mono: ui-monospace, "SF Mono", monospace;
  --text-xs: 13px; --text-sm: 15px; --text-md: 17px; --text-lg: 20px; --text-xl: 26px; --text-2xl: 34px; --text-3xl: 48px;
  --leading: 1.45; --weight-regular: 400; --weight-medium: 600; --weight-bold: 700;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  /* Corners follow the tile: small and square-ish. Nothing is a pill. */
  --radius-sm: 3px; --radius-md: 5px; --radius-lg: 8px; --radius-xl: 18px;
  --tap: 48px;
  --shadow-sm: none; --shadow-md: 0 -8px 28px rgba(27, 33, 64, 0.16); --duration: 160ms;
}

* { box-sizing: border-box; }
html { scrollbar-color: var(--color-border-strong) transparent; }
body { margin: 0; font: var(--weight-regular) var(--text-md) / var(--leading) var(--font-sans); color: var(--color-text); background: var(--color-bg);
  -webkit-tap-highlight-color: transparent; font-variant-numeric: tabular-nums; caret-color: var(--color-primary); accent-color: var(--color-primary); }
::selection { background: var(--color-primary); color: var(--color-on-primary); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: var(--weight-bold); letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--text-xl); margin: 0 0 var(--space-4); }
h2 { font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-3); }
h3 { font-size: var(--text-md); margin: 0 0 var(--space-3); }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-primary); text-underline-offset: 3px; }
.muted { color: var(--color-text-muted); }
.cjk { font-family: var(--font-cjk); }
/* Fraunces is the voice of numbers: scores, totals, stats */
.num { font-family: var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Icon: Phosphor regular, tinted by currentColor (see icons/). */
.icon { display: inline-block; flex: none; width: 22px; height: 22px; background: currentColor; mask: var(--i) center / contain no-repeat; -webkit-mask: var(--i) center / contain no-repeat; }
.icon[data-i="arrow-left"] { --i: url(icons/arrow-left.svg); }
.icon[data-i="plus"] { --i: url(icons/plus.svg); }
.icon[data-i="minus"] { --i: url(icons/minus.svg); }
.icon[data-i="camera"] { --i: url(icons/camera.svg); }
.icon[data-i="x"] { --i: url(icons/x.svg); }
.icon[data-i="dots-three"] { --i: url(icons/dots-three.svg); }
.icon[data-i="gear-six"] { --i: url(icons/gear-six.svg); }
.icon[data-i="pencil-simple"] { --i: url(icons/pencil-simple.svg); }
.icon[data-i="trash"] { --i: url(icons/trash.svg); }
.icon[data-i="share-network"] { --i: url(icons/share-network.svg); }
.icon[data-i="check"] { --i: url(icons/check.svg); }
.icon[data-i="warning"] { --i: url(icons/warning.svg); }
.icon[data-i="caret-right"] { --i: url(icons/caret-right.svg); }
.icon[data-i="caret-down"] { --i: url(icons/caret-down.svg); }
.icon[data-i="users-three"] { --i: url(icons/users-three.svg); }
.icon[data-i="shuffle"] { --i: url(icons/shuffle.svg); }
.icon[data-i="wifi-slash"] { --i: url(icons/wifi-slash.svg); }
.icon[data-i="bell"] { --i: url(icons/bell.svg); }
.icon[data-i="image"] { --i: url(icons/image.svg); }
.icon[data-i="link"] { --i: url(icons/link.svg); }
.icon[data-i="sign-out"] { --i: url(icons/sign-out.svg); }
.icon[data-i="device-rotate"] { --i: url(icons/device-rotate.svg); }
.icon[data-i="google-logo"] { --i: url(icons/google-logo.svg); }
.icon[data-i="envelope-simple"] { --i: url(icons/envelope-simple.svg); }
.icon[data-i="arrows-left-right"] { --i: url(icons/arrows-left-right.svg); }
.icon[data-i="caret-up-down"] { --i: url(icons/caret-up-down.svg); }
.icon[data-i="copy"] { --i: url(icons/copy.svg); }
.icon[data-i="crown-simple"] { --i: url(icons/crown-simple.svg); }
.icon[data-i="star"] { --i: url(icons/star.svg); }
.icon[data-i="star-fill"] { --i: url(icons/star-fill.svg); }
.icon[data-i="magnifying-glass"] { --i: url(icons/magnifying-glass.svg); }
.icon[data-i="lock-simple"] { --i: url(icons/lock-simple.svg); }
.icon[data-i="sparkle"] { --i: url(icons/sparkle.svg); }

/* Button: flat ink, 48px for thumbs at the table. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-5);
  border: 1.5px solid transparent; border-radius: var(--radius-md); font: var(--weight-bold) var(--text-md) var(--font-sans); cursor: pointer;
  text-decoration: none; transition: background var(--duration), color var(--duration); }
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { background: var(--color-primary-edge); }
.btn-secondary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-secondary:active { background: var(--color-primary-soft); }
.btn-ghost { background: transparent; color: var(--color-primary); padding: 0 var(--space-3); }
.btn-ghost:active { background: var(--color-surface); }
.btn-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn:disabled { background: var(--color-surface); border-color: transparent; color: var(--color-text-muted); cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-sm); }
/* A choice: outlined buttons in a two-column grid, the picked one filled. Every pick-one or toggle in the app is this; the pill switch (.seg2) only switches views. */
.btn-secondary[aria-pressed="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.choices-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices .btn { justify-content: flex-start; min-width: 0; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--color-text); cursor: pointer; }
.icon-btn:active { background: var(--color-surface); }

/* Form */
.field { display: grid; gap: var(--space-1); }
.label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.input { min-height: var(--tap); padding: 0 var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  font: inherit; font-size: var(--text-md); background: var(--color-raised); color: var(--color-text); width: 100%; }
.input::placeholder { color: var(--color-text-muted); }
.input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--color-danger); }
.hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.sub { font-size: var(--text-sm); color: var(--color-text-muted); }
.error { font-size: var(--text-sm); color: var(--color-danger); }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); font-size: var(--text-md); }
.check input { width: 22px; height: 22px; }

/* Stepper: fan and flower counts */
.stepper { display: inline-flex; align-items: center; border-block: 1px solid var(--color-border-strong); }
.stepper button { display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--color-primary); cursor: pointer; }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output { min-width: 3ch; text-align: center; font: var(--weight-bold) var(--text-xl) var(--font-display); }

/* Segmented control: switching views of the same data. Text options on a rule, the current one underlined in ink. */
.segmented, .tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--color-border); }
.segmented button, .tab { min-height: 44px; padding: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  font: var(--weight-medium) var(--text-sm) var(--font-sans); color: var(--color-text-muted); cursor: pointer; }
.segmented button[aria-pressed="true"], .tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-primary); }
/* Pill switch: two views of one screen (Hands / Score sheet), as buttons or as links. */
.seg2 { display: flex; gap: 4px; padding: 4px; margin: var(--space-4) var(--space-4) 0; border-radius: 14px; background: var(--color-surface); }
.seg2 > * { flex: 1; display: grid; place-items: center; min-height: 40px; border: 0; border-radius: 10px; background: none; font: var(--weight-medium) var(--text-sm) var(--font-sans); color: var(--color-text-muted); text-decoration: none; cursor: pointer; }
.seg2 > [aria-pressed="true"], .seg2 > [aria-current="page"] { background: var(--color-raised); color: var(--color-text); box-shadow: 0 1px 2px var(--color-border-strong); }

/* Toggle: pick players, win conditions. Square-cornered like a tile, filled in ink when on. */
.chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md); background: transparent; font: var(--weight-medium) var(--text-sm) var(--font-sans); color: var(--color-text); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

/* Surfaces: one panel for things that must read as a unit (a hand, a table, a form). Never nested, never for lists. */
.card { background: var(--color-raised); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-4); }
/* A card that is a link or a button: the whole card is the target, its text stays plain text, never underlined. */
:where(a, button).card { width: 100%; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
/* Any other link wrapped round blocks is a card too, so it never underlines either. */
a:has(div) { color: inherit; text-decoration: none; }
/* Tag: an outlined word, not a tinted pill */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 5px; border: 1px solid currentColor; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1; color: var(--color-text-muted); white-space: nowrap; vertical-align: 2px; }
.badge-success { color: var(--color-gain); }
.badge-warning { color: var(--color-warning); }
.badge-danger { color: var(--color-loss); }
.badge-primary { color: var(--color-primary); }
/* Notice: a state to know before acting. Ruled, with an icon, no fill. */
.banner { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; border-block: 1px solid var(--color-border-strong); font-size: var(--text-sm); }
.banner > .icon { color: var(--color-warning); margin-top: 1px; }
.banner-danger > .icon { color: var(--color-danger); }

/* Points: signed, coloured by direction, never by colour alone (the sign carries it) */
.points { font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.points.up { color: var(--color-gain); }
.points.down { color: var(--color-loss); }
.points.zero { color: var(--color-text-muted); }
.score-big { font: var(--weight-bold) var(--text-3xl) / 1 var(--font-display); letter-spacing: -0.02em; }

/* Player mark: a name tile. Ivory face, the player's initial in ink, the indigo tile back below.
   A guest has no account, so no back: just a dashed outline. */
.avatar { --w: 32px; display: inline-grid; place-items: center; flex: none; width: var(--w); aspect-ratio: 3 / 4; border-radius: calc(var(--w) / 7);
  background: var(--color-raised); box-shadow: inset 0 0 0 1px var(--color-border), 0 calc(var(--w) / 10) 0 var(--color-primary);
  color: var(--color-primary); font: var(--weight-bold) calc(var(--w) * 0.5) / 1 var(--font-display); }
.avatar.guest { background: transparent; box-shadow: none; outline: 1.5px dashed var(--color-border-strong); outline-offset: -1.5px; color: var(--color-text-muted); }
.avatar-sm { --w: 22px; }
.avatar-lg { --w: 52px; }

/* Ledger list: rows between hairline rules on the ground, edge to edge. The default for players, hands and sessions. */
.list { list-style: none; margin: 0; padding: 0; border-block: 1px solid var(--color-border); }
.row-item { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: var(--space-2) var(--space-4); border: 0; border-top: 1px solid var(--color-border);
  color: inherit; text-decoration: none; width: 100%; background: none; font: inherit; text-align: left; }
.list > :first-child, .list > :first-child > .row-item { border-top: 0; }
a.row-item:active, button.row-item:active { background: var(--color-surface); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: var(--text-sm); color: var(--color-text-muted); }
.rank { width: 2ch; text-align: right; font: var(--weight-bold) var(--text-lg) var(--font-display); color: var(--color-text-muted); }

/* Data */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: var(--weight-medium); color: var(--color-text-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border-strong); }
.table td { padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.stat { display: grid; gap: 2px; }
.stat-value { font: var(--weight-bold) var(--text-xl) / 1.1 var(--font-display); }
.stat-label { font-size: var(--text-sm); color: var(--color-text-muted); }

/* Fan breakdown: a scoring ledger. Name, dotted leader, fan; a double rule above the total. */
.fan-line { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) 0; }
.fan-line::after { content: ""; order: 1; flex: 1; min-width: var(--space-4); margin-top: 0.95em; border-bottom: 1.5px dotted var(--color-border-strong); }
.fan-name { order: 0; max-width: 78%; }
.fan-name b { font-weight: var(--weight-medium); }
.fan-name small { display: block; font-size: var(--text-sm); color: var(--color-text-muted); }
.fan-name .cjk { color: var(--color-text); }
.fan-value { order: 2; font: var(--weight-bold) var(--text-lg) / 1.2 var(--font-display); min-width: 2ch; text-align: right; }
.fan-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: var(--space-2); padding-top: var(--space-2);
  border-top: 3px double var(--color-text); font-weight: var(--weight-bold); }
.fan-total .num { font-size: var(--text-xl); }

/* Navigation */
.app-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: var(--space-1); min-height: 56px; padding: 0 var(--space-2);
  background: var(--color-bg); border-bottom: 1px solid var(--color-border); }
.app-bar h1 { flex: 1; margin: 0 var(--space-2); font-size: var(--text-lg); }
/* Tab bar: each section is named by its character and its English word; the current one is ruled in ink above. */
.tab-bar { position: sticky; bottom: 0; z-index: 2; display: flex; background: var(--color-bg); border-top: 1px solid var(--color-border-strong);
  padding-bottom: env(safe-area-inset-bottom); }
.tab-bar a, .tab-bar button { flex: 1; display: grid; place-items: center; align-content: center; gap: 1px; min-height: 58px; border: 0; border-top: 2px solid transparent;
  margin-top: -1px; background: none; font: var(--weight-medium) var(--text-xs) var(--font-sans); color: var(--color-text-muted); text-decoration: none; cursor: pointer; }
.tab-bar [aria-current="page"] { color: var(--color-primary); border-top-color: var(--color-primary); }
.tab-bar .glyph { font: var(--weight-bold) var(--text-lg) / 1 var(--font-cjk); }

/* Overlay: a bottom sheet on phones, the only modal pattern */
.dialog-backdrop { position: fixed; inset: 0; z-index: 10; background: var(--color-scrim); display: grid; align-items: end; }
.dialog, .sheet { width: 100%; max-height: 92vh; overflow: auto; background: var(--color-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-3) var(--space-4) var(--space-5); box-shadow: var(--shadow-md); }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto var(--space-3); border-radius: var(--radius-sm); background: var(--color-border-strong); }
.toast { position: fixed; left: var(--space-4); right: var(--space-4); bottom: 80px; z-index: 20; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--color-text); color: var(--color-bg); font-size: var(--text-sm); }

/* Empty state: left-aligned, a few face-down tiles for a picture, then what goes here and how to start */
.empty { display: grid; justify-items: start; gap: var(--space-3); padding: var(--space-6) var(--space-4); color: var(--color-text-muted); }
.empty h3 { color: var(--color-text); margin: 0; }
.empty p { margin: 0; }

/* Tile: ivory face on an indigo back. Faces come from tiles/ (see tiles/README.md).
   Sizes: .tile-sm in lists, default in hands, .tile-lg in the picker. States: selected, winning, exposed (meld), back (concealed kong). */
.tile { --w: 36px; display: inline-block; flex: none; width: var(--w); aspect-ratio: 3 / 4; border-radius: calc(var(--w) / 7);
  background: var(--face, none) center / 86% no-repeat, var(--color-raised); box-shadow: inset 0 0 0 1px var(--color-border), 0 calc(var(--w) / 10) 0 var(--color-primary);
  border: 0; padding: 0; vertical-align: bottom; }
.tile-sm { --w: 24px; }
.tile-lg { --w: 48px; }
button.tile { cursor: pointer; }
button.tile:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px var(--color-border), 0 1px 0 var(--color-primary); }
.tile[aria-pressed="true"], .tile.selected { box-shadow: inset 0 0 0 3px var(--color-primary), 0 calc(var(--w) / 10) 0 var(--color-primary); }
.tile.winning { box-shadow: inset 0 0 0 3px var(--color-gain), 0 calc(var(--w) / 10) 0 var(--color-gain); }
.tile.back { background: var(--color-primary); }
/* White dragon: a framed blank, so it never reads as an empty slot */
.tile[data-t="P"]:not(.back) { background-image: linear-gradient(var(--color-raised), var(--color-raised)), linear-gradient(var(--color-primary), var(--color-primary));
  background-size: 54% 62%, 66% 74%; background-position: center; }
.tile.dim { opacity: 0.35; }
.tile-row { display: flex; flex-wrap: wrap; gap: 3px; align-items: flex-end; }
.meld { display: inline-flex; gap: 2px; padding-bottom: 3px; border-bottom: 2px solid var(--color-border-strong); }
/* A hand laid out by set: tiles in a set touch, sets stand apart and a set never breaks across lines. */
.hand-tiles { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-2); margin-block: var(--space-3) var(--space-5); }
.set { display: inline-flex; gap: 1px; }

/* Tile faces, by code */
.tile[data-t="1m"] { --face: url(tiles/1m.svg); }
.tile[data-t="1p"] { --face: url(tiles/1p.svg); }
.tile[data-t="1s"] { --face: url(tiles/1s.svg); }
.tile[data-t="2m"] { --face: url(tiles/2m.svg); }
.tile[data-t="2p"] { --face: url(tiles/2p.svg); }
.tile[data-t="2s"] { --face: url(tiles/2s.svg); }
.tile[data-t="3m"] { --face: url(tiles/3m.svg); }
.tile[data-t="3p"] { --face: url(tiles/3p.svg); }
.tile[data-t="3s"] { --face: url(tiles/3s.svg); }
.tile[data-t="4m"] { --face: url(tiles/4m.svg); }
.tile[data-t="4p"] { --face: url(tiles/4p.svg); }
.tile[data-t="4s"] { --face: url(tiles/4s.svg); }
.tile[data-t="5m"] { --face: url(tiles/5m.svg); }
.tile[data-t="5p"] { --face: url(tiles/5p.svg); }
.tile[data-t="5s"] { --face: url(tiles/5s.svg); }
.tile[data-t="6m"] { --face: url(tiles/6m.svg); }
.tile[data-t="6p"] { --face: url(tiles/6p.svg); }
.tile[data-t="6s"] { --face: url(tiles/6s.svg); }
.tile[data-t="7m"] { --face: url(tiles/7m.svg); }
.tile[data-t="7p"] { --face: url(tiles/7p.svg); }
.tile[data-t="7s"] { --face: url(tiles/7s.svg); }
.tile[data-t="8m"] { --face: url(tiles/8m.svg); }
.tile[data-t="8p"] { --face: url(tiles/8p.svg); }
.tile[data-t="8s"] { --face: url(tiles/8s.svg); }
.tile[data-t="9m"] { --face: url(tiles/9m.svg); }
.tile[data-t="9p"] { --face: url(tiles/9p.svg); }
.tile[data-t="9s"] { --face: url(tiles/9s.svg); }
.tile[data-t="E"] { --face: url(tiles/E.svg); }
.tile[data-t="S"] { --face: url(tiles/S.svg); }
.tile[data-t="W"] { --face: url(tiles/W.svg); }
.tile[data-t="N"] { --face: url(tiles/N.svg); }
.tile[data-t="C"] { --face: url(tiles/C.svg); }
.tile[data-t="F"] { --face: url(tiles/F.svg); }
.tile[data-t="P"] { --face: url(tiles/P.svg); }
.tile[data-t="f1"] { --face: url(tiles/f1.svg); }
.tile[data-t="f2"] { --face: url(tiles/f2.svg); }
.tile[data-t="f3"] { --face: url(tiles/f3.svg); }
.tile[data-t="f4"] { --face: url(tiles/f4.svg); }
.tile[data-t="f5"] { --face: url(tiles/f5.svg); }
.tile[data-t="f6"] { --face: url(tiles/f6.svg); }
.tile[data-t="f7"] { --face: url(tiles/f7.svg); }
.tile[data-t="f8"] { --face: url(tiles/f8.svg); }

/* Player picture: their avatar on an ivory tile face, the indigo back below. No picture: their initial, as .avatar.
   Sample pictures in avatars/ (see avatars/README.md). */
.pic { --w: 48px; display: inline-grid; place-items: center; flex: none; width: var(--w); aspect-ratio: 3 / 4; border-radius: calc(var(--w) / 6);
  background: var(--pic, none) center 30% / 128% no-repeat, var(--color-raised); box-shadow: inset 0 0 0 1px var(--color-border), 0 calc(var(--w) / 12) 0 var(--color-primary);
  color: var(--color-primary); font: var(--weight-bold) calc(var(--w) * 0.45) / 1 var(--font-display); }
.pic.guest { box-shadow: inset 0 0 0 1.5px var(--color-border-strong), 0 calc(var(--w) / 12) 0 var(--color-border-strong); }
.pic-sm { --w: 28px; }
.pic-lg { --w: 80px; }
.pic[data-p="mei"] { --pic: url(avatars/mei.svg); }
.pic[data-p="yuki"] { --pic: url(avatars/yuki.svg); }
.pic[data-p="dan"] { --pic: url(avatars/dan.svg); }
.pic[data-p="jun"] { --pic: url(avatars/jun.svg); }
.pic[data-p="ada"] { --pic: url(avatars/ada.svg); }
.pic[data-p="ken"] { --pic: url(avatars/ken.svg); }
.pic[data-p="rosa"] { --pic: url(avatars/rosa.svg); }

/* Toggle: an on/off setting. A button with role="switch" and aria-checked. */
.toggle { position: relative; flex: none; width: 52px; height: 32px; padding: 0; border: 0; border-radius: 16px; background: var(--color-border-strong); cursor: pointer; transition: background 160ms; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--color-raised); transition: transform 160ms; }
.toggle[aria-checked="true"] { background: var(--color-primary); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .toggle, .toggle::after { transition: none; } }
