:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f1e7d0;
  background: #30271f;
  font-synthesis: none;
  --gold: #dfbe76;
  --ink: #382d21;
  --felt: #235548;
  --wood-grain: repeating-linear-gradient(3deg, transparent 0 5px, #4d250d17 6px, transparent 8px 14px), repeating-linear-gradient(178deg, #ffe3a508 0 2px, transparent 3px 19px);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 0 max(32px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 0, #81654630, transparent 75%), repeating-linear-gradient(91deg, #100b0609 0 1px, transparent 2px 5px), repeating-linear-gradient(89deg, #90704b08 0 2px, transparent 3px 38px), #30271f;
}
button, a { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  color: inherit;
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 17px;
  background: transparent;
}
button:focus-visible, a:focus-visible { outline: 3px solid #f3ce7a; outline-offset: 5px; }
button:disabled { cursor: default; }
button:not(.tile):disabled { opacity: .55; }
header, main { max-width: 1220px; margin: auto; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  border-bottom: 1px solid #d7b4772b;
  box-shadow: 0 1px #130f0b66;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: #f5e6c7; font: 25px Georgia, serif; text-shadow: 0 2px 2px #0006; }
.brand small { display: block; font: 9px system-ui; color: #c7ae83; letter-spacing: 2px; margin-top: 8px; }
.brand-mark {
  display: grid; place-content: center; position: relative;
  width: 39px; height: 49px; padding-bottom: 6px;
  background: linear-gradient(120deg, #fffbed, #dfd0b4);
  color: #a6382c; border: 1px solid #f8eacc; border-radius: 5px;
  box-shadow: inset 0 0 0 2px #fff7e9, 0 3px 0 #aa8e69, 0 5px 6px #0006;
  font: bold 29px Georgia; text-shadow: 0 1px white;
  transform: rotate(-8deg);
}
.brand-mark span { position: absolute; bottom: 1px; left: 17px; font: 12px Georgia; }
nav { display: flex; align-items: center; gap: 16px; font-size: 13px; }
nav>button:first-child { color: #d3c3a7; }
.outline, .primary, .dialog-actions button {
  border: 1px solid #c8a96f;
  background: linear-gradient(#ead5aa, #cfac72);
  color: #42311d;
  box-shadow: inset 0 1px #fff3d4, 0 3px 0 #86633f, 0 5px 8px #0003;
  text-shadow: 0 1px #fff4;
}
.primary { background: linear-gradient(#416e56, #28523c); border-color: #6b8e67; color: #fff2d5; box-shadow: inset 0 1px #9db38355, 0 3px 0 #1c3528, 0 5px 8px #0003; }
.table-heading { display: flex; justify-content: space-between; align-items: center; padding: 27px 0 26px; }
.eyebrow { font-size: 10px; letter-spacing: 2.5px; font-weight: 600; color: #bd9d68; }
h1 { font: 32px Georgia, serif; margin: 9px 0 0; color: #f1e4c9; text-shadow: 0 2px 4px #0003; font-weight: 400; }
.quiet { color: #c5b496; font-size: 12px; }
.quiet i { display: inline-block; width: 6px; height: 6px; background: #9bbb88; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 7px #b7d98755; }
.table {
  height: 390px; position: relative; isolation: isolate;
  color: #f0e9d3; border: 18px solid #80522f; border-radius: 135px;
  background: repeating-linear-gradient(0deg, #ffffff04 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #001d160a 0 1px, transparent 1px 3px), radial-gradient(ellipse at 50% 35%, #356e5a, #1a493d 75%, #163c32);
  box-shadow: 0 0 0 1px #d4a56a, 0 0 0 4px #4b301e, 0 5px 0 5px #21180f, 0 22px 35px #100d0980, inset 0 0 0 3px #142f26, inset 0 0 0 5px #bca26e66, inset 0 8px 25px #0c241d99, inset 0 -2px 6px #94ae7b33;
}
.table::before {
  content: ''; position: absolute; inset: -17px; z-index: -1; pointer-events: none;
  border: 10px solid #c9995721; border-radius: 120px;
  box-shadow: inset 0 1px 2px #f9d28b80, 0 1px #2b1a0e;
}
.table::after { content: ''; position: absolute; inset: 15px; border: 1px dashed #e0d29933; border-radius: 100px; pointer-events: none; }
.opponent { position: absolute; display: flex; align-items: center; gap: 11px; font-size: 15px; z-index: 2; text-shadow: 0 1px #0007; }
.north { top: 18px; left: 50%; transform: translateX(-50%); }
.west { top: 43%; left: 28px; flex-direction: column; text-align: center; }
.east { top: 43%; right: 28px; flex-direction: column; text-align: center; }
.avatar {
  display: grid; place-content: center; flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid #c7a268;
  background: radial-gradient(circle at 35% 25%, #f0dfb8, #c2a677 80%);
  color: #59452d; font: 22px Georgia; text-shadow: 0 1px #fff7;
  box-shadow: inset 0 1px 2px #fff9, inset 0 -2px 3px #89663f, 0 3px 7px #10291f88;
}
.opponent.active .avatar { box-shadow: 0 0 0 3px #e4c47b44, 0 0 0 4px #e4c47b, 0 0 24px #d7c38b44; }
.opponent small { display: block; font-size: 10px; color: #bfcebc; margin-top: 5px; }
.mini-rack { display: flex; gap: 3px; margin-top: 10px; padding: 0 4px 3px; border-bottom: 4px solid #956f43; border-radius: 2px; box-shadow: 0 3px 3px #112b2466; }
.mini-rack i { display: block; width: 11px; height: 18px; border: 1px solid #e0cea9; border-radius: 2px; background: linear-gradient(110deg, #dfd0ad, #bca47e); box-shadow: 1px 1px #856f4c; }
.table-center { position: absolute; top: 97px; left: 50%; transform: translateX(-50%); width: 350px; text-align: center; }
.table-label { font: 11px Georgia; letter-spacing: 4px; color: #d4c292; text-shadow: 0 1px 2px #001b15; }
.table-label span { display: block; font: italic 13px Georgia; letter-spacing: .2px; color: #b3c1a8; margin-top: 8px; }
.draw-area { display: flex; justify-content: center; align-items: center; gap: 31px; margin-top: 21px; }
.draw-item { display: flex; flex-direction: column; align-items: center; gap: 9px; min-width: 72px; }
.draw-item>span { font-size: 9px; letter-spacing: 1.5px; color: #c0c8af; }
.draw-item small, .stock small { font-size: 12px; color: #d4d8bd; text-shadow: 0 1px #102b22; }
.tile {
  width: 57px; height: 81px; position: relative; display: inline-flex;
  flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
  padding: 0 0 5px; border: 1px solid #f3e6cc; border-radius: 7px;
  color: #b2372f;
  background: radial-gradient(ellipse at 25% 10%, #fffef9, #f5efdf 55%, #e6dac0);
  box-shadow: inset 2px 2px 2px #fff, inset -2px -2px 2px #d7c7a7, 0 2px 0 #d9c9a8, 0 5px 0 #b7a17b, 0 6px 0 #7f6445, 2px 9px 9px #20180d55;
  font: bold 39px Georgia, serif; user-select: none;
  text-shadow: 0 1px 0 #fff, 0 -1px 1px #0003;
}
.tile-number { pointer-events: none; }
.tile.blue { color: #28648b; }
.tile.black { color: #313634; }
.tile.gold { color: #b48213; }
.tile small { position: absolute; top: 4px; right: 4px; font: 7px system-ui; letter-spacing: .5px; color: #7a683e; border-bottom: 1px solid #c8b77c; }
.tile.wild { background: radial-gradient(ellipse at 25% 10%, #fffef9, #f8edce 65%, #e0c88d); }
.tile:disabled { opacity: 1; }
.tile-back {
  display: grid; place-content: center; width: 57px; height: 81px;
  border: 5px double #e5cf99; border-radius: 6px;
  color: #cbb474;
  background: repeating-linear-gradient(45deg, #b8c4a615 0 2px, transparent 2px 5px), linear-gradient(120deg, #476855, #264c3a);
  box-shadow: inset 0 0 0 2px #173f2c, 0 4px 0 #d6c5a0, 0 5px 0 #9e885e, 4px 8px 0 #d6c5a0, 4px 9px 0 #9e885e, 8px 13px 0 #dac6a0, 8px 14px 0 #806c49, 9px 19px 13px #0b281f77;
  font: 32px Georgia;
}
.stock { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0; gap: 21px; border-radius: 0; }
.stock strong { position: absolute; right: -18px; top: -11px; display: grid; place-content: center; width: 29px; height: 29px; background: linear-gradient(#f0d596, #c49c55); color: #4f391f; border: 1px solid #e5c889; border-radius: 50%; font-size: 12px; box-shadow: 0 2px 3px #17372b; }
.stock:disabled { opacity: 1 !important; }
.stock:disabled small { opacity: .65; }
.discard-slot { padding: 0; width: 57px; height: 85px; border: 1px dashed #c1d0ac55; border-radius: 7px; background: #102e2522; box-shadow: inset 0 2px 7px #09281c33; }
.discard-slot:empty::after { content: '◇'; font: 25px Georgia; color: #b6c4a15c; }
.discard-slot:disabled { opacity: 1 !important; }
.stock.available .tile-back, .discard-slot.available { outline: 2px solid #e7cc87; outline-offset: 6px; }
.joker-label { display: inline-block; padding: 7px 13px; border: 1px solid #d4c48f33; border-radius: 30px; background: #14362933; font-size: 11px; color: #bcccac; margin-top: 16px; }
.joker-label span { margin-left: 6px; font-weight: 600; color: #ecd395; }
.table-discard { width: 48px; height: 68px; position: absolute; border: 1px solid #d4c4951c; border-radius: 6px; box-shadow: inset 0 1px 6px #11342733; }
.table-discard .tile { width: 48px; height: 68px; font-size: 32px; }
.discard-south { bottom: 24px; left: calc(50% + 130px); transform: rotate(6deg); }
.discard-east { top: 43%; right: 165px; transform: rotate(-7deg); }
.discard-north { top: 24px; right: calc(50% + 130px); transform: rotate(-4deg); }
.tea { position: absolute; bottom: 20px; left: 70px; width: 82px; height: 37px; border-radius: 50%; background: radial-gradient(ellipse, #eee3c7 0 48%, #b1b9a5 50%, #f7ebcb 55%, #d7c4a1 63%, #9b8d70 66%, transparent 68%); transform: rotate(-13deg); filter: drop-shadow(4px 6px 3px #0c241b66); }
.tea-glass { position: absolute; width: 31px; height: 47px; left: 25px; bottom: 14px; border-radius: 8px 8px 11px 11px / 4px 4px 10px 10px; border: 2px solid #f5e1b999; background: linear-gradient(90deg, #fff5 0 5%, #ffff 6% 8%, transparent 16% 70%, #fff8 90%), linear-gradient(#cfa95a55 12%, #6e2113 15%, #a33b16 55%, #74210e 90%); box-shadow: inset 0 2px #efcc86, 1px 1px #573c25; transform: perspective(100px) rotateX(-12deg); }
.tea-spoon { position: absolute; right: 12px; bottom: 11px; width: 4px; height: 43px; border-radius: 100%; background: linear-gradient(90deg, #7e877e, #f8f1d5 60%, #9da397); transform: rotate(55deg); }
.rack-section { padding-top: 28px; }
.rack-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.rack-toolbar>div { display: flex; align-items: center; gap: 12px; }
#hand-count { color: #d5c6aa; font-size: 12px; }
.rack {
  --rack-tile-height: 85px;
  --rack-padding: 24px;
  position: relative; min-width: 680px; max-width: 1000px; margin: 0 auto; padding: 22px var(--rack-padding) 0;
  background: var(--wood-grain), linear-gradient(0deg, #bd8b4c 0%, #a4743b 10%, #c49456 14%, #b98545 40%, #a7773f 96%, #d2aa70);
  border: 1px solid #dfa962; border-radius: 11px 11px 6px 6px;
  box-shadow: inset 0 2px #f4d49b77, inset 0 10px 12px #6a3f2422, 0 4px 0 #48301b, 0 12px 23px #140e0866;
}
#tiles {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  grid-template-rows: repeat(2, var(--rack-tile-height));
  justify-content: center; align-items: end; justify-items: stretch;
  column-gap: 6px; row-gap: 28px; padding: 0 0 9px;
}
/* The upper row rests on its own continuous wooden shelf. */
#tiles::before {
  content: ''; position: absolute; z-index: 2; pointer-events: none;
  left: calc(-1 * var(--rack-padding)); right: calc(-1 * var(--rack-padding));
  top: calc(var(--rack-tile-height) + 6px); height: 12px;
  border-top: 2px solid #f4d299; border-bottom: 1px solid #79512d;
  background: var(--wood-grain), linear-gradient(#dbb27a, #b98b50 55%, #946536);
  box-shadow: inset 0 1px #ffe5af88, 0 4px 5px #54301955;
}
#tiles>.tile { width: 100%; min-width: 0; max-width: none; height: var(--rack-tile-height); z-index: 1; touch-action: none; cursor: grab; }
#tiles>.tile:disabled { cursor: default; }
.rack-lip { position: relative; z-index: 2; height: 20px; margin: 0 -24px; border-top: 2px solid #f4d299; border-bottom: 1px solid #76502e; border-radius: 0 0 5px 5px; background: var(--wood-grain), linear-gradient(#dab279, #b4874e 45%, #986d39 92%, #74502e); box-shadow: inset 0 2px 1px #fff3, 0 4px 0 #694523; }
.rack-lip::after { content: 'ANNEMİN OKEYİ'; position: absolute; left: 50%; transform: translateX(-50%); top: 4px; color: #704a26; font: 8px Georgia; letter-spacing: 3px; text-shadow: 0 1px #eac389; }
footer { display: flex; justify-content: space-between; gap: 15px; color: #ae9c7d; font-size: 11px; letter-spacing: .2px; margin-top: 23px; line-height: 1.5; }
dialog { border: 1px solid #d5b77f; border-radius: 15px; padding: 36px; max-width: 590px; width: calc(100% - 36px); color: #413a2d; background: radial-gradient(ellipse at top, #fffdf4, #eee4cf); box-shadow: inset 0 0 0 5px #ede2cc, inset 0 0 0 6px #c4ac7c66, 0 25px 80px #0c100c88; max-height: 85dvh; overflow: auto; }
dialog::backdrop { background: #0d1a16aa; backdrop-filter: blur(5px); }
dialog h2 { font: 29px Georgia; margin: 15px 0; }
dialog p, dialog li { font-size: 14px; line-height: 1.8; }
dialog li { margin-bottom: 10px; }
dialog h3 { font: 22px Georgia; }
dialog .eyebrow { color: #8d713d; }
dialog hr { border: 0; border-top: 1px solid #cdbd9a; margin-top: 23px; }
.close { position: absolute; top: 10px; right: 12px; font-size: 25px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 25px; }
#winning-hand { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0; }
#winning-hand .tile { width: 35px; height: 50px; font-size: 25px; }
.winning-group { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 8px 4px 0; }
#update { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 12px 20px; background: #f9edcb; color: #41361f; border: 1px solid #b29d69; border-radius: 12px; box-shadow: 0 4px 25px #0005; z-index: 5; font-size: 13px; width: max-content; max-width: 95%; }
.flying-tile { will-change: transform; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #tiles.ready>.tile:hover { transform: translateY(-13px) rotate(-2deg); filter: brightness(1.04); }
  nav button:hover, .dialog-actions button:hover { filter: brightness(1.12); }
  .stock.available:hover { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: no-preference) {
  #tiles>.tile { transition: filter 150ms; }
  .stock { transition: transform 180ms; }
  .opponent.active .avatar { animation: thinking 2s ease-in-out infinite; }
  @keyframes thinking { 50% { box-shadow: 0 0 0 3px #e4c47b22, 0 0 0 4px #e4c47b99, 0 0 22px #d7c38b66; } }
}
@media (min-width: 1100px) {
  #tiles { column-gap: 6px; }
  .table { height: 410px; }
  .table-center { top: 105px; }
}
@media (max-width: 1000px) {
  body { padding-left: 24px; padding-right: 24px; }
  .table { height: 370px; border-width: 15px; border-radius: 110px; }
  .table::before { inset: -14px; border-radius: 100px; }
  .table-center { top: 86px; }
  .tile { height: 73px; font-size: 34px; }
  #tiles { column-gap: 6px; }
  .rack { --rack-padding: 17px; padding: 22px var(--rack-padding) 0; }
  .rack-lip { margin: 0 -17px; }
  .discard-east { right: 135px; }
}
@media (max-width: 760px) {
  h1 { font-size: 27px; }
  .quiet { display: none; }
  .table { height: 375px; border-radius: 80px; }
  .table::before { border-radius: 70px; }
  .table::after { border-radius: 55px; }
  .west { left: 18px; }
  .east { right: 18px; }
  .discard-east { right: 105px; top: 59%; }
  .discard-south { left: calc(50% + 98px); }
  .discard-north { right: calc(50% + 98px); }
  .opponent { font-size: 14px; }
  .mini-rack i { width: 8px; }
  .table-center { width: 290px; }
  .draw-area { gap: 23px; }
  .tile { font-size: 31px; }
  .tea { left: 25px; }
  .rack-toolbar { gap: 15px; }
}
@media (max-width: 600px) {
  body { padding-left: 16px; padding-right: 16px; }
  header { padding: 18px 0; }
  .brand { font-size: 20px; gap: 9px; }
  .brand small { font-size: 7px; letter-spacing: 1px; }
  .brand-mark { width: 30px; height: 40px; font-size: 25px; }
  .brand-mark span { left: 13px; bottom: 0; }
  nav { gap: 3px; }
  nav button { font-size: 11px; padding: 8px; }
  nav>button:first-child { max-width: 65px; line-height: 1.4; }
  .table-heading { padding: 23px 0; }
  h1 { font-size: 25px; }
  .eyebrow { font-size: 9px; letter-spacing: 2px; }
  .table { height: 374px; border-width: 11px; border-radius: 64px; }
  .table::before { inset: -10px; border-width: 7px; border-radius: 57px; }
  .table::after { inset: 10px; border-radius: 42px; }
  .north { top: 15px; }
  .west, .east { top: 23%; gap: 5px; }
  .west { left: 14px; }
  .east { right: 14px; }
  .opponent { font-size: 12px; }
  .opponent .avatar { width: 33px; height: 33px; font-size: 17px; }
  .opponent small { font-size: 8px; }
  .mini-rack { display: none; }
  .table-center { width: 244px; top: 127px; }
  .table-label { font-size: 8px; letter-spacing: 3px; }
  .table-label span { display: none; }
  .draw-area { margin-top: 17px; gap: 16px; }
  .draw-item { gap: 8px; min-width: 57px; }
  .draw-item>span { font-size: 8px; letter-spacing: 1px; }
  .tile, .tile-back { width: 47px; height: 68px; font-size: 32px; }
  .stock { gap: 18px; }
  .stock strong { width: 25px; height: 25px; right: -12px; font-size: 10px; }
  .discard-slot { width: 47px; height: 72px; }
  .draw-item small, .stock small { font-size: 11px; }
  .joker-label { margin-top: 13px; font-size: 10px; padding: 6px 11px; }
  .table-discard { width: 35px; height: 49px; }
  .table-discard .tile { width: 35px; height: 49px; font-size: 25px; border-radius: 4px; }
  .discard-north { top: 23px; right: auto; left: 28px; }
  .discard-east { right: 22px; top: auto; bottom: 105px; }
  .discard-south { bottom: 18px; left: auto; right: 37px; }
  .tea { left: 16px; bottom: 20px; transform: rotate(-13deg) scale(.75); transform-origin: left bottom; }
  .rack-section { padding-top: 24px; }
  .rack-toolbar { margin-bottom: 16px; }
  .rack-toolbar>div { gap: 8px; }
  #hand-count { font-size: 10px; }
  .rack { --rack-padding: 12px; --rack-tile-height: 65px; padding: 22px var(--rack-padding) 0; }
  #tiles { padding-bottom: 12px; }
  #tiles>.tile { font-size: 29px; }
  .rack-lip { margin: 0 -12px; }
  footer { font-size: 9px; margin-top: 20px; }
  dialog { padding: 28px; }
}
@media (max-width: 370px) {
  .brand-mark { display: none; }
  h1 { font-size: 22px; }
  .rack { --rack-tile-height: 57px; }
  #tiles { column-gap: 6px; }
  #tiles>.tile { font-size: 25px; }
  .table-center { width: 224px; }
  .draw-area { gap: 12px; }
  .discard-east { right: 16px; }
}
/* Keep the rack in reach on landscape iPads and shorter laptop displays. */
@media (min-width: 761px) and (max-height: 850px) {
  body { padding-bottom: 14px; }
  header { padding-top: 10px; padding-bottom: 10px; }
  .brand-mark { height: 38px; width: 31px; font-size: 24px; }
  .brand-mark span { left: 13px; bottom: 0; }
  .brand { font-size: 23px; }
  .brand small { margin-top: 5px; font-size: 8px; }
  .table-heading { padding: 10px 0 13px; }
  .table-heading .eyebrow { font-size: 8px; }
  h1 { font-size: 24px; margin-top: 5px; }
  .table { height: 290px; border-width: 13px; border-radius: 100px; }
  .table::before { inset: -12px; border-radius: 90px; }
  .table-center { top: 58px; }
  .table-label { display: none; }
  .draw-area { margin-top: 0; gap: 30px; }
  .draw-item { gap: 7px; }
  .draw-item .tile, .tile-back { width: 47px; height: 66px; font-size: 31px; }
  .discard-slot { width: 47px; height: 70px; }
  .stock { gap: 18px; }
  .joker-label { margin-top: 9px; padding: 5px 12px; font-size: 10px; }
  .north { top: 12px; }
  .mini-rack { display: none; }
  .avatar { width: 34px; height: 34px; font-size: 19px; }
  .table-discard, .table-discard .tile { width: 39px; height: 55px; }
  .table-discard .tile { font-size: 27px; }
  .discard-south { bottom: 16px; }
  .discard-north { top: 16px; }
  .tea { bottom: 14px; transform: rotate(-13deg) scale(.85); }
  .rack-section { padding-top: 16px; }
  .rack-toolbar { margin-bottom: 12px; }
  .rack { --rack-tile-height: 66px; padding-top: 18px; }
  #tiles { padding-bottom: 7px; }
  #tiles>.tile { font-size: 33px; }
  .rack-lip { height: 16px; }
  .rack-lip::after { top: 2px; }
  footer { margin-top: 15px; font-size: 10px; }
}

.rack-viewport { overflow-x: auto; padding: 8px 6px 14px; scrollbar-color: #c5a374 #241c14; scrollbar-width: thin; overscroll-behavior-x: contain; }
.rack-viewport:focus-visible { outline: 2px solid #e3c17b; outline-offset: 3px; border-radius: 8px; }
.rack-instructions { color: #cbb897; font-size: 12px; }
.rack-slot { position: relative; align-self: stretch; border-radius: 6px; border: 1px solid #6740191c; box-shadow: inset 0 1px 4px #56300e12; }
.rack-slot.drop-target { background: #f9dc9144; border: 2px dashed #ffedb0; box-shadow: inset 0 0 10px #fff2; }
#tiles>.tile.being-dragged { opacity: .2; cursor: grabbing; }
.drag-ghost { cursor: grabbing; opacity: .98; will-change: transform; }
#tiles.dragging>.tile:hover { transform: none; }
@media (max-width: 760px) {
  #tiles>.tile { font-size: 29px; }
  .rack-instructions { font-size: 10px; }
}
/* Large pictures and short labels for the primary player. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon { display: inline-block; width: 32px; height: 32px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; pointer-events: none; }
header { gap: 20px; }
.brand { font-size: 26px; }
nav { gap: 12px; }
button.control, nav>button.control:first-child { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 78px; min-width: 84px; max-width: none; padding: 10px 14px; font-size: 18px; font-weight: 600; line-height: 1.1; color: #ffefd0; }
button.control .icon { width: 34px; height: 34px; }
nav .outline.control { color: #38270f; }
nav .control[aria-pressed='true'] { outline: 3px solid #f4d58b; background: #5b452c; }
.table { height: 390px; }
.table-center { top: 105px; width: 340px; }
.draw-area { gap: 18px; align-items: flex-start; margin: 0; }
.draw-item { gap: 10px; min-width: 74px; padding-top: 5px; }
.draw-item>span { display: flex; align-items: center; gap: 5px; font-size: 18px; letter-spacing: 0; color: #fff0ce; }
.draw-item>span .icon { width: 18px; height: 18px; }
.draw-item .tile, .discard-slot>.tile { width: 64px; height: 90px; font-size: 42px; }
.stock, .take-discard { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; gap: 16px; width: 106px; min-height: 162px; border: 3px solid transparent; border-radius: 14px; padding: 12px; background: #102f26; }
.stock .tile-back { width: 64px; height: 90px; }
.stock strong { top: -10px; right: -10px; width: 34px; height: 34px; font-size: 18px; }
.stock:disabled, .take-discard:disabled { opacity: 1 !important; border-color: #73928066; }
.stock:disabled .action-caption, .take-discard:disabled .action-caption { opacity: .65; }
.stock.available, .take-discard.available { border-color: #ffe095; box-shadow: 0 0 0 3px #133c2b, 0 0 0 5px #ffe095; }
.stock.available .tile-back { outline: none; }
.action-caption { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 24px; font-weight: 700; color: #fff3cf; line-height: 1; }
.action-caption .icon { width: 32px; height: 32px; }
.discard-slot { display: block; width: 64px; height: 94px; min-height: 94px; padding: 0; }
.avatar, .opponent .avatar { width: 46px; height: 46px; }
.avatar .icon { width: 28px; height: 28px; }
.opponent { font-size: 20px; }
.opponent small { font-size: 18px; color: #f0e5c9; }
.opponent small .icon { width: 22px; height: 22px; }
.mini-rack { display: none; }
.rack { --rack-tile-height: 96px; min-width: 880px; max-width: 1120px; }
#tiles>.tile { font-size: 42px; font-family: Georgia, serif; }
.tile.gold { color: #8b5c00; }
.rack-toolbar { min-height: 64px; gap: 16px; }
.rack-count { color: #fff0ce; }
#hand-count { font-size: 24px; font-weight: 600; color: #fff0ce; }
.gesture-hints { display: flex; align-items: center; gap: 26px; margin-left: auto; color: #fff0ce; }
.gesture-hints>span { display: flex; align-items: center; gap: 7px; font-size: 20px; }
.gesture-hints .icon { width: 44px; height: 44px; }
.large-tiles .rack { --rack-tile-height: 116px; min-width: 1120px; max-width: 1320px; }
.large-tiles #tiles>.tile { font-size: 52px; }
footer { justify-content: flex-end; margin-top: 12px; }
dialog { text-align: center; }
dialog h2 { font: 700 32px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
dialog p { font-size: 22px; }
dialog .close.control { min-width: 56px; min-height: 56px; padding: 8px; color: #40331e; top: 10px; right: 10px; }
.dialog-picture .icon { width: 88px; height: 88px; color: #376344; }
.dialog-actions { justify-content: center; gap: 24px; }
.dialog-actions button.control { min-width: 120px; min-height: 100px; font-size: 22px; color: #3d2b16; }
.dialog-actions button.primary { color: #fff3d2; }
#winning-hand .tile { width: 48px; height: 68px; font-size: 32px; }
#update { padding: 8px; }
#update .control { min-width: 120px; color: #fff1cd; }
/* Each pile is to its owner's right, viewed from that player's seat. */
.incoming-discard { position: absolute; left: 18%; bottom: 18px; z-index: 3; }
.discard-east { right: 16%; top: 22px; bottom: auto; }
.discard-north { right: calc(50% + 130px); top: 22px; }
.discard-south { left: calc(50% + 130px); bottom: 24px; }
@media (max-width: 760px) {
  .table { height: 410px; }
  .table-center { top: 112px; width: 318px; }
  .draw-area { gap: 12px; }
  .incoming-discard { left: 22px; bottom: 20px; }
  .discard-east { right: 24px; top: 22px; bottom: auto; }
  .tea { display: none; }
  .opponent { font-size: 18px; }
  .west { left: 20px; }
  .east { right: 20px; }
}
@media (max-width: 600px) {
  header { flex-direction: column; gap: 14px; padding: 16px 0; }
  .brand { font-size: 24px; }
  nav { width: 100%; justify-content: center; gap: 12px; }
  button.control, nav>button.control:first-child { min-width: 84px; min-height: 76px; font-size: 18px; }
  .table { height: 420px; }
  .table-center { top: 125px; width: 260px; }
  .draw-area { gap: 10px; }
  .draw-item { min-width: 60px; gap: 10px; }
  .draw-item>span { font-size: 16px; }
  .draw-item .tile { width: 52px; height: 78px; font-size: 37px; }
  .stock, .take-discard { width: 90px; min-height: 150px; padding: 10px; gap: 14px; }
  .stock .tile-back, .discard-slot>.tile { width: 58px; height: 82px; font-size: 38px; }
  .discard-slot { width: 58px; height: 86px; min-height: 86px; }
  .action-caption { gap: 5px; font-size: 22px; }
  .action-caption .icon { width: 28px; height: 28px; }
  .incoming-discard { bottom: 16px; left: 16px; }
  .opponent .avatar { width: 40px; height: 40px; }
  .opponent { font-size: 16px; }
  .opponent small { font-size: 16px; }
  .discard-north { left: 24px; right: auto; top: 20px; }
  .discard-south { left: auto; right: 30px; bottom: 25px; }
  .rack-toolbar { flex-wrap: wrap; gap: 12px; }
  .gesture-hints { gap: 12px; }
  .gesture-hints .icon { width: 36px; height: 36px; }
  .gesture-hints>span { font-size: 18px; }
}
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .west, .east { top: 78px; flex-direction: row; gap: 8px; text-align: left; }
}
@media (max-width: 600px) {
  .table { height: 440px; }
  .table-center { top: 140px; }
}
.tile.red { color: #9e2922; }
.tile.gold { color: #795000; }

/* Turn guidance lives on the objects she can act on, not in a text banner. */
.table { margin-top: 24px; }
.stock.available, .take-discard.available { border-width: 4px; border-color: #ffe3a0; box-shadow: 0 0 0 3px #133c2b, 0 0 0 6px #ffe3a0, 0 0 24px #ffdc7c66; }
.stock.available::after, .take-discard.available::after { content: '▼'; position: absolute; top: -33px; left: 50%; transform: translateX(-50%); font-size: 25px; color: #ffe3a0; text-shadow: 0 2px 3px #132b20; pointer-events: none; }
/* A compact, almost-square table, with a seat outside each edge. */
.table-scene {
  display: grid;
  grid-template-columns: 88px minmax(0, 680px) 88px;
  grid-template-rows: auto auto auto;
  gap: 22px 18px;
  align-items: center;
  justify-content: center;
  max-width: 900px;
  margin: 28px auto 0;
}
.table-scene .table {
  grid-area: 2 / 2;
  width: 100%; min-width: 0;
  height: auto; min-height: 440px; aspect-ratio: 1.1;
  margin: 0;
  border-radius: 44px;
}
.table-scene .table::before { border-radius: 34px; }
.table-scene .table::after { border-radius: 26px; }
.table-scene>.opponent {
  position: relative;
  inset: auto;
  transform: none;
  justify-self: center;
  text-align: center;
}
.table-scene>.north { grid-area: 1 / 2; flex-direction: row; }
.table-scene>.west { grid-area: 2 / 1; flex-direction: column; }
.table-scene>.east { grid-area: 2 / 3; flex-direction: column; }
.table-scene .table-center { top: 24%; width: min(340px, calc(100% - 24px)); }
.table-scene .incoming-discard { left: 24px; bottom: 24px; }
.table-scene .discard-north { left: 24px; right: auto; top: 24px; }
.table-scene .discard-east { right: 24px; top: 24px; bottom: auto; }
.table-scene .discard-south { left: auto; right: 24px; bottom: 24px; }
.table-scene .tea { left: 50%; bottom: 32px; transform: translateX(-50%) rotate(-13deg); }
@media (max-width: 1000px) {
  .table-scene { grid-template-columns: 70px minmax(0, 1fr) 70px; column-gap: 14px; }
  .table-scene .table { border-radius: 36px; }
  .table-scene .table::before { border-radius: 28px; }
}
@media (max-width: 600px) {
  .table-scene { grid-template-columns: 46px minmax(0, 1fr) 46px; gap: 20px 8px; margin-top: 22px; }
  .table-scene .table { aspect-ratio: 1; min-height: 440px; border-width: 10px; border-radius: 28px; }
  .table-scene .table::before { inset: -9px; border-radius: 22px; }
  .table-scene .table::after { inset: 10px; border-radius: 17px; }
  .table-scene>.opponent { font-size: 14px; gap: 8px; }
  .table-scene>.opponent .avatar { width: 38px; height: 38px; }
  .table-scene .table-center { top: 92px; width: calc(100% - 12px); }
  .table-scene .draw-area { gap: 7px; }
  .table-scene .draw-item { min-width: 47px; }
  .table-scene .draw-item>span { font-size: 14px; }
  .table-scene .draw-item .tile { width: 44px; height: 68px; font-size: 32px; }
  .table-scene .stock { width: 78px; min-height: 144px; padding: 8px; }
  .table-scene .stock .tile-back { width: 50px; height: 75px; }
  .table-scene .incoming-discard { left: 12px; bottom: 14px; }
  .table-scene .discard-north { left: 12px; top: 18px; }
  .table-scene .discard-east { right: 12px; top: 18px; }
  .table-scene .discard-south { right: 12px; bottom: 18px; }
  .table-scene .table-discard .tile { width: 35px; height: 49px; font-size: 25px; }
}

/* The foreground rack masks the far end of the full, square table. */
.play-area { --table-peek: clamp(246px, calc(100vh - 500px), 440px); }
.large-tiles .play-area { --table-peek: clamp(246px, calc(100vh - 540px), 440px); }
.table-scene { grid-template-rows: auto auto; margin-top: 12px; row-gap: 14px; }
.table-crop { grid-area: 2 / 2; height: var(--table-peek); overflow: hidden; padding: 4px 4px 0; }
.table-scene .table { grid-area: auto; }
.table-scene .table-center { top: clamp(52px, calc((var(--table-peek) - 240px) / 2), 100px); }
.table-scene .incoming-discard { top: calc(var(--table-peek) - 166px); bottom: auto; width: 96px; min-height: 142px; height: 142px; padding: 8px; gap: 5px; }
.table-scene .incoming-discard .discard-slot { width: 58px; height: 86px; min-height: 86px; }
.table-scene .incoming-discard .tile { width: 58px; height: 82px; font-size: 38px; }
.table-scene .incoming-discard .action-caption { font-size: 22px; }
.table-scene .incoming-discard.available::after { content: '◀'; top: 50%; left: auto; right: -30px; transform: translateY(-50%); }
.table-scene .discard-north, .table-scene .discard-east { top: 4px; }
.table-scene .discard-south { top: calc(var(--table-peek) - 100px); bottom: auto; }
.table-scene .tea { display: none; }
.play-area>.rack-section { position: relative; z-index: 5; padding-top: 0; margin-top: -82px; }
.rack-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 64px; height: 64px; margin-bottom: 0; padding: 0 6px; gap: 12px; }
.rack-toolbar>.rack-count { grid-column: 1; grid-row: 1; justify-self: start; }
.rack-toolbar>.gesture-hints { display: none; }
.rack-viewport { position: relative; }
@media (max-width: 600px) {
  .play-area { --table-peek: 280px; }
  .large-tiles .play-area { --table-peek: 280px; }
  .table-scene .table-center { top: clamp(52px, calc((var(--table-peek) - 240px) / 2), 100px); }
  .rack-toolbar { gap: 6px; }
  .rack-toolbar>.rack-count .icon { display: none; }
}
/* Keep the exposed piles clickable through the transparent rack toolbar. */
.play-area>.rack-section { pointer-events: none; }
.play-area .rack-viewport { pointer-events: auto; }

@supports (height: 100dvh) {
  .play-area { --table-peek: clamp(246px, calc(100dvh - 500px), 440px); }
  .large-tiles .play-area { --table-peek: clamp(246px, calc(100dvh - 540px), 440px); }
  @media (max-width: 600px) {
    .play-area, .large-tiles .play-area { --table-peek: 280px; }
  }
}
/* Stack tiles can be pulled into an empty rack position as well as tapped. */
.stock, .take-discard { touch-action: none; user-select: none; -webkit-user-select: none; }
.stock.available, .take-discard.available { cursor: grab; }
.stock.source-dragging, .take-discard.source-dragging { cursor: grabbing; }
.source-dragging .tile-back, .source-dragging .discard-slot { opacity: .4; }
.rack-slot.draw-vacant { border: 2px dashed #f9df9b88; background: #f9df9b18; }
.rack-slot.draw-vacant.drop-target { border-color: #fff2ba; background: #ffe6a066; box-shadow: inset 0 0 12px #fff5; }
.draw-ghost.tile-back { box-shadow: inset 0 0 0 2px #173f2c, 0 3px 0 #d6c5a0, 0 5px 0 #9e885e, 2px 8px 10px #0b281f77; }
/* A rack tile can be thrown onto the exposed felt during the discard phase. */
.table-crop.discard-ready { outline: 3px dashed #ffe3a0; outline-offset: -8px; }
.table-crop.discard-hover { outline: 5px solid #fff0b8; outline-offset: -8px; filter: brightness(1.12); }
/* CPU characters have recognizable portraits and persistent, selectable seats. */
button.cpu-avatar {
  display: block; width: 64px; height: 64px; min-width: 64px; min-height: 64px;
  padding: 0; overflow: hidden; border-radius: 13px; border: 3px solid #dfbd7b;
  background: #eee1bc; cursor: pointer; position: relative;
  box-shadow: 0 3px 0 #71532e, 0 6px 9px #0005;
}
.cpu-portrait { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; pointer-events: none; }
button.cpu-avatar:hover { border-color: #fff0b8; }
button.cpu-avatar:focus-visible { outline: 4px solid #fff3bd; outline-offset: 5px; }
.opponent-name { display: block; font-size: 19px; font-weight: 600; }
.skill-stars { display: flex; align-items: center; justify-content: center; gap: 3px; color: #ffe2a0; margin: 7px 0 0; }
.skill-stars .icon { width: 17px; height: 17px; }
.skill-stars .dim-star { opacity: .22; }
.opponent small { margin-top: 6px; }
#opponent-dialog { max-width: 650px; }
#opponent-dialog .close { min-height: 56px; min-width: 56px; color: #40331e; }
.opponent-current { width: 68px; height: 68px; border-radius: 12px; overflow: hidden; margin: 0 auto; border: 3px solid #a98245; }
.opponent-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0 6px; }
.opponent-choice { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 210px; padding: 14px 10px; background: linear-gradient(#f9efd8, #ddc99e); border: 2px solid #b3945e; box-shadow: inset 0 1px #fff, 0 3px 0 #a18452; color: #352817; border-radius: 12px; }
.opponent-choice>.cpu-portrait { width: 104px; height: 104px; border-radius: 8px; border: 2px solid #8b6a3e; }
.opponent-choice strong { font-size: 23px; }
.opponent-choice .skill-stars { color: #795000; margin: 0; }
.opponent-choice .skill-stars .icon { width: 21px; height: 21px; }
.opponent-choice:hover { border-color: #315d40; background: #fff5d9; }
.skill-label { font-size: 18px; color: #554126; }
@media (max-width: 1000px) {
  .table-scene { grid-template-columns: 76px minmax(0, 1fr) 76px; column-gap: 10px; }
  .opponent-name { font-size: 17px; }
}
@media (max-width: 600px) {
  .table-scene { grid-template-columns: 52px minmax(0, 1fr) 52px; column-gap: 6px; }
  .table-scene>.opponent button.cpu-avatar { width: 50px; height: 50px; min-width: 50px; min-height: 50px; border-width: 2px; }
  .opponent-name { font-size: 14px; }
  .skill-stars { gap: 1px; }
  .skill-stars .icon { width: 14px; height: 14px; }
  #opponent-dialog { padding: 28px 18px; }
  .opponent-options { gap: 8px; }
  .opponent-choice { padding: 12px 5px; min-height: 180px; }
  .opponent-choice>.cpu-portrait { width: 70px; height: 70px; }
  .opponent-choice strong { font-size: 19px; }
  .skill-label { font-size: 16px; }
  .opponent-choice .skill-stars .icon { width: 16px; height: 16px; }
}

/* Traditional ivory Okey faces: stamped numbers and a matching-color heart. */
.tile {
  background: radial-gradient(ellipse at 25% 12%, #fffef5, #f5efd8 60%, #e7ddbf);
  border-color: #f5ebd0;
  box-shadow: inset 2px 2px 2px #fffff3, inset -2px -2px 2px #d9ccaa, 0 2px 0 #e3d7b7, 0 5px 0 #c4b48f, 0 6px 0 #8b7754, 2px 9px 9px #20180d55;
  font-family: 'Arial Rounded MT Bold', 'Arial Black', -apple-system, sans-serif;
  font-weight: 900;
}
#tiles>.tile { font-family: 'Arial Rounded MT Bold', 'Arial Black', -apple-system, sans-serif; }
.tile-number { transform: translateY(-9%); line-height: 1; letter-spacing: -.055em; margin-right: .055em; }
.tile.red { color: #ad2028; }
.tile.black { color: #1c2220; }
.tile.blue { color: #14677f; }
.tile.gold { color: #925000; }

/* Counts and the thinking clock share one fixed slot; no baseline-driven reflow. */
.opponent .opponent-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  min-height: 22px;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.opponent .opponent-state .icon { display: block; width: 22px; height: 22px; }

/* Available draw tiles glow against the felt without framed cards or arrows. */
.stock, .take-discard, .stock.available, .take-discard.available,
.stock:disabled, .take-discard:disabled {
  background: transparent; border: 0; outline: 0; box-shadow: none;
}
.stock.available::after, .take-discard.available::after { content: none; display: none; }
.table-scene .stock { width: 90px; height: 128px; min-height: 128px; padding: 10px; gap: 0; }
.table-scene .incoming-discard { top: calc(var(--table-peek) - 134px); width: 84px; height: 112px; min-height: 112px; padding: 10px; gap: 0; }
.stock .tile-back, .take-discard .discard-slot, .take-discard .tile { outline: 0; }
.take-discard .discard-slot { border: 0; background: transparent; box-shadow: none; }
.stock.available .tile-back,
.take-discard.available .tile {
  outline: 0;
  filter: drop-shadow(0 0 6px #fff0b8bb) drop-shadow(0 0 18px #f1cf7d99);
}
.stock:focus-visible, .take-discard:focus-visible { outline: 3px solid #fff0b8; outline-offset: 5px; }

/* A fresh hand: one bold restart arrow and a short label. */
#new-game {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 88px; width: 88px; min-height: 92px; height: 92px;
  padding: 7px 10px 9px; gap: 3px; border-radius: 18px; color: #294c38;
  background: linear-gradient(160deg, #fffaf0, #eee2c8);
  border: 1px solid #d4c19a;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #958265, 0 5px 12px #0003;
}
#new-game .icon { width: 54px; height: 54px; }
#new-game span { font-size: 18px; font-weight: 700; line-height: 1; white-space: nowrap; }
#new-game:focus-visible { outline: 3px solid #fff0b8; outline-offset: 5px; }
#new-game:active { transform: translateY(2px); box-shadow: inset 0 1px 3px #99703f22, 0 1px 0 #958265; }

/* Winner portrait above a small felt tray of the completed groups. */
#result-dialog { width: min(760px, calc(100% - 28px)); max-width: 760px; padding: 0; border: 3px solid #caa66c; border-radius: 24px; background: #f5edda; box-shadow: inset 0 0 0 1px #fff5db, 0 24px 90px #091810aa; }
.result-hero { position: relative; padding: 30px 24px 24px; background: radial-gradient(ellipse at 50% 0, #527452, #224b39 78%); border-bottom: 4px solid #c6a267; }
.result-hero::before { content: ''; position: absolute; inset: 10px; border: 1px solid #e5c78655; border-radius: 15px; pointer-events: none; }
.winner-medallion { position: relative; width: 132px; margin: 0 auto 17px; }
.winner-portrait { display: grid; place-items: center; width: 132px; height: 132px; border: 5px solid #e6c585; border-radius: 24px; overflow: hidden; color: #705128; background: radial-gradient(circle at 30% 20%, #fff8dc, #d4b479); box-shadow: 0 0 0 4px #132f2244, 0 0 34px #ffe5a52b, 0 8px 15px #102c2280; }
.winner-portrait>.icon { width: 76px; height: 76px; }
.winner-portrait>.cpu-portrait { width: 100%; height: 100%; }
#result-dialog h2 { color: #fff1ca; font: 700 29px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; line-height: 1.25; text-shadow: 0 2px 2px #10271a66; }
#result-dialog .result-kind { display: inline-block; margin: 14px 0 0; padding: 5px 14px; border-radius: 20px; background: #e8ce8c; color: #453218; font-size: 19px; font-weight: 600; }
#result-dialog .result-kind:empty { display: none; }
.result-body { padding: 24px; }
#result-dialog #winning-hand { justify-content: center; align-items: center; gap: 20px 14px; padding: 22px 14px 26px; border: 1px solid #102b20; border-radius: 14px; background: repeating-linear-gradient(90deg, #ffffff03 0 1px, transparent 1px 3px), #315744; box-shadow: inset 0 3px 12px #142b2366, 0 2px #fff9; }
#result-dialog #winning-hand:empty { display: none; }
#result-dialog .winning-group { display: flex; justify-content: center; gap: 5px; margin: 0; padding: 0 3px 4px; }
#result-dialog #winning-hand .tile { width: 46px; height: 67px; font-size: 33px; }
#result-dialog .result-actions { gap: 20px; margin-top: 24px; }
#result-dialog .result-actions button { min-width: 88px; width: 88px; min-height: 72px; height: 72px; padding: 10px; border-radius: 13px; color: #4a351b; }
#result-dialog .result-actions .icon { width: 42px; height: 42px; }
#result-dialog #play-again { background: linear-gradient(145deg, #f6e4b7, #d4b274); border-color: #eed09a; }
#result-dialog #play-again .icon { width: 54px; height: 54px; }
@media (max-width: 600px) {
  .result-hero { padding: 24px 18px 20px; }
  .winner-medallion, .winner-portrait { width: 106px; }
  .winner-portrait { height: 106px; border-radius: 19px; }
  #result-dialog h2 { font-size: 25px; }
  .result-body { padding: 18px 12px; }
  #result-dialog #winning-hand { padding: 16px 8px 22px; gap: 18px 10px; }
  #result-dialog #winning-hand .tile { width: 38px; height: 57px; font-size: 28px; }
  #result-dialog .winning-group { gap: 4px; }
}

/* Large, separate suit marks make wild Okeys immediately distinct. */
.tile .tile-number {
  position: absolute; top: 12%; left: 0; width: 100%;
  font-size: .86em; line-height: 1.05; text-align: center;
  transform: none; margin: 0; letter-spacing: -.055em;
}
.tile .tile-mark {
  position: absolute; bottom: 10%; width: 38%; height: 28%;
  min-width: 12px; max-height: none; fill: currentColor; stroke: none;
  filter: drop-shadow(0 1px 0 #fff8);
}

.game-speed { display: grid; gap: 4px; width: clamp(150px, 25vw, 240px); color: #f5e6c7; font-size: 18px; font-weight: 600; }
.game-speed input { width: 100%; height: 44px; margin: 0; accent-color: #e8cf91; cursor: pointer; }
.game-speed input:focus-visible { outline: 3px solid #f3ce7a; outline-offset: 3px; border-radius: 8px; }
.speed-ends { display: flex; justify-content: space-between; font-size: 14px; font-weight: 400; }
.thinking-bubble { position: absolute; top: -16px; left: calc(50% + 22px); display: flex; align-items: center; justify-content: center; gap: 5px; width: 55px; height: 35px; border-radius: 22px; background: #fff8e8; box-shadow: 0 2px 6px #0004; pointer-events: none; z-index: 3; }
.thinking-bubble[hidden] { display: none; }
.thinking-bubble::before, .thinking-bubble::after { content: ''; position: absolute; background: #fff8e8; border-radius: 50%; }
.thinking-bubble::before { width: 9px; height: 9px; bottom: -5px; left: 8px; }
.thinking-bubble::after { width: 5px; height: 5px; bottom: -12px; left: 2px; }
.thinking-bubble i { width: 7px; height: 7px; border-radius: 50%; background: #315b43; }
.east .thinking-bubble { left: auto; right: calc(50% + 22px); }
.east .thinking-bubble::before { left: auto; right: 8px; }
.east .thinking-bubble::after { left: auto; right: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .thinking-bubble i { animation: thought-dot 1.2s ease-in-out infinite; }
  .thinking-bubble i:nth-child(2) { animation-delay: .16s; }
  .thinking-bubble i:nth-child(3) { animation-delay: .32s; }
  @keyframes thought-dot { 0%, 60%, 100% { opacity: .4; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
}
.north .thinking-bubble, .west .thinking-bubble { left: auto; right: calc(100% + 14px); top: 0; }
.north .thinking-bubble::before, .west .thinking-bubble::before { left: auto; right: -5px; bottom: 4px; }
.north .thinking-bubble::after, .west .thinking-bubble::after { left: auto; right: -12px; bottom: 0; }
/* Equal outer columns keep the team score at the true center. */
header { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; }
header > #new-game { justify-self: start; }
header > .game-speed { justify-self: end; }
.scoreboard { display: flex; align-items: center; gap: 14px; color: #fff1cf; }
.team-score { display: grid; justify-items: center; gap: 4px; min-width: 64px; }
.team-score > span { font-size: 17px; font-weight: 600; }
.team-score > strong { font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-divider { color: #c8ae79; font-size: 30px; padding-top: 20px; }
@media (max-width: 600px) {
  header { column-gap: 8px; }
  header > .game-speed { width: clamp(90px, 23vw, 150px); }
  .scoreboard { gap: 5px; }
  .team-score { min-width: 40px; }
  .team-score > span { font-size: 14px; }
  .team-score > strong { font-size: 30px; }
}

/* Distinct team colors keep ownership clear at a glance. */
.team-score { padding: 8px 14px; border: 2px solid; border-radius: 14px; }
.team-score:first-child { color: #e2f7df; background: #284b39; border-color: #91bc8b; }
.team-score:last-child { color: #fff0cc; background: #65451f; border-color: #d6ab60; }
.score-divider { padding-top: 0; }
@media (max-width: 600px) {
  .team-score { padding: 7px 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  #tiles.dragging > .tile { transition: translate 160ms ease-out; }
}

/* Victory effects stay behind the portrait and settle after the entrance. */
#victory-sparkles { position: absolute; inset: 12px; overflow: hidden; pointer-events: none; border-radius: 15px; }
#victory-sparkles i { position: absolute; left: var(--x); top: -16px; width: 8px; height: 13px; border-radius: 2px; background: #f5d281; opacity: 0; }
#victory-sparkles i:nth-child(3n) { background: #c4e4bd; }
#victory-sparkles i:nth-child(3n + 1) { background: #fff1c9; width: 6px; height: 6px; }
@media (prefers-reduced-motion: no-preference) {
  #result-dialog[open] { animation: result-enter 280ms ease-out both; }
  #result-dialog[open]:not(.draw-result) .winner-medallion { animation: winner-enter 650ms cubic-bezier(.2,.8,.3,1.2) both; }
  #result-dialog[open] #victory-sparkles i { animation: victory-confetti 1800ms var(--delay) ease-out both; }
  #result-dialog[open] .winning-group { animation: group-enter 420ms 180ms ease-out both; }
  @keyframes result-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes winner-enter { 0% { opacity: 0; transform: scale(.78) translateY(10px); } 65% { opacity: 1; transform: scale(1.05); } 100% { transform: scale(1); } }
  @keyframes victory-confetti { 0% { opacity: 0; transform: translateY(0) rotate(0); } 15% { opacity: .85; } 100% { opacity: 0; transform: translateY(260px) rotate(var(--turn)); } }
  @keyframes group-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
