/* The suit is repeated in the numeral and a solid badge, even on selected
   and mint work tiles. The existing shape distinguishes suits without color. */
.tile.red   { --suit-ink:#a0182e; }
.tile.blue  { --suit-ink:#1549ac; }
.tile.black { --suit-ink:#171b24; }
.tile.gold  { --suit-ink:#755000; }

.tile:is(.red,.blue,.black,.gold) {
  color:var(--suit-ink);
  font-weight:900;
  -webkit-text-fill-color:currentColor;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
.tile:is(.red,.blue,.black,.gold) > b {
  display:grid;
  place-items:center;
  flex:none;
  width:72%;
  max-width:28px;
  height:clamp(8px,1.25vw,13px);
  border-radius:2px;
  background-color:var(--suit-ink);
  color:#fff;
  line-height:1;
  font-family:system-ui,sans-serif;
  font-variant-emoji:text;
}
.tile.mini:is(.red,.blue,.black,.gold) > b {height:7px;}
#game .seat-discard.is-available .tile > b {flex:none;}

/* Keep both lines within the unchanged 14-column rack on small phones. */
@media(max-width:600px) {
  #game .rack .tile {
    font-size:clamp(12px,3.7vw,20px);
    gap:2px;
  }
  #game .rack .tile > b {font-size:8px;height:9px;}
}
@media(forced-colors:active) {
  .tile:is(.red,.blue,.black,.gold),
  .tile:is(.red,.blue,.black,.gold) > b {
    color:CanvasText;
    background-color:Canvas;
  }
}

/* Glazed face, rounded bevel and darker ceramic foot. All layers scale with
   the tile, so a rack, match, indicator and moving tile share the same skin. */
.tile:is(.red,.blue,.black,.gold),
#game .tile:is(.red,.blue,.black,.gold) {
  --glaze-top:#fffef9;
  --glaze-mid:#f5eedf;
  --glaze-foot:#d8c6a5;
  --rim:#b6a27d;
  --base:#8d7454;
  --bevel:2px;
  border:1px solid var(--rim);
  border-bottom-color:var(--base);
  background:
    radial-gradient(ellipse at 21% 0%,#fff 0%,#ffffff00 69%),
    linear-gradient(145deg,var(--glaze-top) 7%,var(--glaze-mid) 73%,var(--glaze-foot));
  box-shadow:inset 0 1px 0 #fff,inset 0 calc(-1 * var(--bevel)) 0 var(--glaze-foot),
    0 1px 0 var(--base),0 2px 2px #1e130d60;
  text-shadow:0 1px 0 #fff;
  letter-spacing:-.055em;
}
.tile:is(.red,.blue,.black,.gold) > b {
  width:74%;
  background:linear-gradient(180deg,color-mix(in srgb,var(--suit-ink),white 9%),var(--suit-ink));
  border-radius:2px 2px 3px 3px;
  text-shadow:none;
  letter-spacing:0;
  box-shadow:inset 0 1px 1px #0a0a0a35,0 1px 0 #fff9;
}
#game .tile.iswild:not(.is-work) {
  --glaze-top:#fff8e4;--glaze-mid:#f6e4b7;--glaze-foot:#d3b16f;--rim:#b99a5c;
}
#game .tile.fake:not(.is-work) {
  --glaze-top:#f4fff9;--glaze-mid:#d8eee2;--glaze-foot:#a3c5b0;--rim:#84a693;
}
#game .rack .tile.is-work,
.tile-ghost .tile.is-work {
  --glaze-top:#effff8;--glaze-mid:#c9f1df;--glaze-foot:#8ac5b0;
  --rim:#48a58b;--base:#31715d;
  border-color:var(--rim);
  background:
    radial-gradient(ellipse at 21% 0%,#fff 0%,#ffffff00 65%),
    linear-gradient(145deg,var(--glaze-top),var(--glaze-mid) 70%,var(--glaze-foot));
}
#game .rack .tile[aria-pressed="true"] {
  --glaze-top:#fffbed;--glaze-mid:#f8e6b3;--glaze-foot:#ddc082;
  border-color:#e2bd62;
  background:linear-gradient(145deg,var(--glaze-top),var(--glaze-mid) 74%,var(--glaze-foot));
  box-shadow:inset 0 0 0 1px #a57530,inset 0 -2px 0 var(--glaze-foot),0 2px 2px #1e130d78;
  outline:1px solid #ffe39a;outline-offset:0;
}
#game .rack .tile.is-work[aria-pressed="true"] {
  --glaze-top:#effff8;--glaze-mid:#c9f1df;--glaze-foot:#8ac5b0;
  background:linear-gradient(145deg,var(--glaze-top),var(--glaze-mid) 74%,var(--glaze-foot));
}
#game .rack .tile.from-side[aria-pressed="true"]::after {border-color:#fff4db}
#game .rack .tile:focus-visible {outline:2px solid #ffe39a;outline-offset:1px}
.demo-tiles .tile:is(.red,.blue,.black,.gold) {
  --bevel:4px;
  box-shadow:inset 0 1px 0 #fff,inset 0 -4px 0 var(--glaze-foot),0 4px 0 var(--base),0 8px 12px #092a21;
}
#game .tile.mini {--bevel:1px;}
#game .deck-icon {
  border:1px solid #dac49c;
  border-bottom-color:#98784d;
  background:linear-gradient(145deg,#fbefd5,#be9764);
  box-shadow:inset 0 1px 0 #fff6df,2px 2px 0 #a98053,3px 4px 0 #674e32;
}
#game .deck-icon::after {
  border-color:#9b784f;
  background:
    repeating-linear-gradient(45deg,#956a3b91 0 1px,transparent 1px 4px),
    repeating-linear-gradient(-45deg,#956a3b91 0 1px,transparent 1px 4px);
}
@media(forced-colors:active) {
  .tile:is(.red,.blue,.black,.gold),
  .tile:is(.red,.blue,.black,.gold) > b {
    background-image:none;
    text-shadow:none;
    box-shadow:none;
  }
}
