:root {
  --paper: #f5e9cf;
  --metal: #bca779;
  --rim: #9c885d;
  --line: #e7d5b22d;
  --pale: #efd197;
  --bg: #141c22;
}
body {
  background:
    radial-gradient(ellipse at 15% 10%, #33302b 0, transparent 37%),
    radial-gradient(ellipse at 85% 54%, #253b3d 0, transparent 53%), #141b20;
  color: var(--paper);
  min-height: 100svh;
}
header {
  height: 62px;
}
.bar-actions,
.tools,
.rack-head,
.bench-top {
  display: flex;
  gap: 9px;
  align-items: center;
}
.quiet,
.tools button,
.text-button {
  touch-action: manipulation;
}
.quiet {
  border-color: #b8a47b70;
}
.home {
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.05em;
}
.bar-actions i {
  font-size: 19px;
  font-style: normal;
  vertical-align: middle;
}
.entry-panel,
dialog {
  background: linear-gradient(145deg, #32362f, #222d2c);
  box-shadow:
    0 18px 54px #040a1038,
    inset 0 1px #e4c78f24;
}
.entry-panel input {
  background: #172221;
}
.primary {
  color: #322a1d;
  background: linear-gradient(125deg, #f6dfab, #cfad71);
  box-shadow:
    inset 0 1px #fff1c4,
    0 3px 5px #080d0b33;
}
.primary:not(:disabled):hover {
  background: #f3dba6;
}
.overline {
  font: 500 11px/1.3 monospace;
  letter-spacing: 0.16em;
  color: #c9ae77;
}
.room-head h1 {
  font-size: clamp(23px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: 0.015em;
}
#room {
  padding-top: 19px;
}
.players {
  gap: 6px;
  margin: 11px 0;
}
.players li {
  font-size: 12px;
}
.players li.active {
  background: #dbc18d;
}
.table-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: clamp(250px, 37vh, 420px);
  border: 1px solid #a791643f;
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 33% 20%, #a979461f, transparent 47%),
    radial-gradient(ellipse at 60% 57%, #354944 0, #293734 31%, #222c2c 58%, #1e2629 85%);
  box-shadow:
    inset 0 1px 0 #e4cca51a,
    0 16px 40px #090e1224;
}
.table-stage::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid #e3c89313;
  border-radius: 14px;
  pointer-events: none;
}
.stage-halo {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 18% 24%, #ebb5731c, transparent 34%),
    radial-gradient(ellipse at 82% 40%, #7aa6b51c, transparent 33%);
  z-index: -1;
}
#studio,
#studio > canvas,
.seat-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.seat-labels {
  pointer-events: none;
}
.seat-labels span {
  position: absolute;
  transform: translate(-50%, -90%);
  white-space: nowrap;
  max-width: 98px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 7px;
  border-radius: 4px;
  font:
    500 11px/1.65 system-ui,
    sans-serif;
  color: #e3d8bd;
  background: #1d2424b5;
}
.seat-labels span.current {
  color: #f5deaf;
  box-shadow: inset 0 -1px #d2ac68;
}
#uno-stage-actions {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
}
.piles {
  gap: clamp(12px, 2vw, 34px);
  align-items: center;
}
.stock,
.discard {
  width: clamp(45px, 5.6vw, 79px);
}
.stock .card-back,
.discard .card {
  border-radius: 7px;
}
.stock .card-back {
  transform: rotate(-7deg);
  box-shadow:
    1px 2px #d9c8a5,
    2px 4px #40423b,
    3px 6px #c2af8b,
    4px 8px #383c34,
    5px 10px 7px #1724219c;
}
.stock:disabled {
  opacity: 0.9;
}
.discard .card {
  transform: rotate(7deg);
  box-shadow:
    1px 2px #d4c7a4,
    2px 4px #625c47,
    4px 8px 5px #17242191;
}
.piles small {
  display: block;
  white-space: nowrap;
  color: #fff3d6;
  text-shadow: 0 1px 3px #132626;
}
.piles .card small {
  color: #21312b;
  text-shadow: none;
}
.card,
.card-back {
  border-color: #f4e8ce;
  box-shadow:
    inset 0 1px 2px #fff5db9c,
    inset 0 -3px 2px #162c2440,
    1px 3px 0 #a89c7c,
    2px 6px 7px #060a0c55;
}
.card:before {
  border-color: #f6e8cc9e;
  background: linear-gradient(120deg, #fff5db61, #fff0c21a);
}
.card-back {
  background: repeating-linear-gradient(42deg, #1c3940 0 2px, #315158 2px 4px, #203b42 4px 7px);
  color: #e8ce94;
}
.card-back:before,
.card-back:after {
  border-color: #d5bb80;
}
.card-back b {
  color: #eddaa6;
}
.felt {
  min-height: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.table-status {
  margin: 0;
}
.table-status small {
  width: auto;
}
.hand {
  padding: 13px 13px 17px;
  gap: 9px;
  background: linear-gradient(180deg, #39413b6b, #2633327d);
  border-bottom: 3px solid #70584a;
  border-radius: 9px;
}
.hand .card:disabled {
  filter: saturate(0.85) brightness(0.87);
}
.hand-title {
  margin-top: 12px;
}
.waiting {
  border: 0;
  padding: 18px;
}
.waiting > .card-back {
  display: none;
}
.room-tools button {
  white-space: nowrap;
}
.immersive body,
html:fullscreen body {
  min-height: 100dvh;
}
.immersive header {
  height: 46px;
}
.immersive #room {
  padding-top: 9px;
}
.immersive .table-stage {
  height: clamp(216px, 47dvh, 630px);
}
.immersive .room-head h1 {
  font-size: 24px;
}
.immersive header,
.immersive main {
  width: min(1540px, calc(100% - 40px));
}
.immersive {
  background: #141b20;
  scroll-padding-top: 12px;
}
.workbench {
  margin: 16px 0;
  background: linear-gradient(145deg, #273a37, #1f302e);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: clamp(13px, 2vw, 24px);
}
.bench-top,
.rack-head {
  justify-content: space-between;
}
.bench-top h2,
.rack-head h3 {
  font-size: 18px;
  margin: 0;
}
.bench-top > span,
.bench-top > strong,
.move-note {
  color: #c6c1ac;
  font-size: 13px;
}
.move-note {
  margin: 5px 0 10px;
  min-height: 1.5em;
}
.groups,
.rack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.groups {
  min-height: 70px;
  border: 1px dashed #e3d6ba3d;
  border-radius: 7px;
  padding: 7px;
  background: #182e2a;
}
.empty-board {
  margin: auto;
  color: #a9b5a7;
  font-size: 13px;
}
.meld {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #b29e6744;
}
.meld.invalid {
  border-color: #ea9477;
}
.tile {
  position: relative;
  width: 34px;
  height: 44px;
  background: linear-gradient(145deg, #fff3d7, #ebe0c2 63%, #d9c8a6);
  color: var(--pigment);
  border: 1px solid #fceecf;
  border-radius: 5px;
  box-shadow:
    inset 0 -3px #a4916b8c,
    0 2px 3px #0c1516a8;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: transform 0.16s;
}
.tile b {
  font:
    700 23px/0.99 Georgia,
    serif;
}
.tile small {
  font-size: 8px;
  margin-top: 2px;
}
.tint-red {
  --pigment: #b5443b;
}
.tint-blue {
  --pigment: #34628a;
}
.tint-black {
  --pigment: #303438;
}
.tint-orange {
  --pigment: #9a5917;
}
.tint-joker {
  --pigment: #875385;
}
.tile[aria-pressed='true'] {
  transform: translateY(-5px);
  outline: 2px solid #f1c777;
  outline-offset: 1px;
}
.rack {
  margin: 7px 0;
  padding: 12px 10px 15px;
  border-bottom: 5px solid #8d6c4c;
  border-radius: 6px;
  background: linear-gradient(180deg, #574839, #3b342b);
}
.rack-head {
  margin-top: 13px;
}
.rack .tile {
  width: 40px;
  height: 52px;
}
.add-to,
.tools button {
  background: #394a42;
  border: 1px solid #c7bd9a65;
  color: var(--ink);
  border-radius: 5px;
  padding: 6px 11px;
  font-size: 13px;
}
.tools {
  margin-top: 9px;
  flex-wrap: wrap;
}
.tools button:disabled,
.add-to:disabled {
  opacity: 0.45;
}
.tools .primary {
  background: #e3c38d;
  color: #2c2921;
}
.tools span {
  font-size: 12px;
  color: #d9c392;
  margin-right: auto;
}
body[data-game='reversi'] #disc-panel {
  display: grid;
  grid-template-columns: 1fr minmax(235px, 440px) 1fr;
  align-items: start;
  gap: 15px;
}
#disc-panel .bench-top {
  display: grid;
  align-content: start;
}
.checkerboard {
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 8px solid #715440;
  box-shadow:
    inset 0 0 0 1px #c7b486,
    0 8px 15px #162320;
  border-radius: 4px;
  background: #40634e;
}
.square {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-right: 1px solid #243c31aa;
  border-bottom: 1px solid #243c31aa;
}
.square.legal::before {
  content: '';
  width: 21%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #cbd8aa9c;
  background: #cedbad35;
}
.square:enabled:hover {
  background: #d6dfa82e;
}
.disc {
  display: block;
  position: relative;
  width: 79%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 1px 3px 3px #18231cb3;
}
.onyx {
  background: radial-gradient(circle at 33% 22%, #62676b, #292c30 48%, #141a1c 83%);
}
.ivory {
  background: radial-gradient(circle at 32% 20%, #fff9e9, #e7dbc0 55%, #b1a78b 98%);
}
.disc.latest::after {
  content: '';
  position: absolute;
  inset: 38%;
  border: 1px solid #b6975a;
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .disc.turned {
    animation: turn-over 340ms var(--delay, 0ms) ease-in-out both;
  }
  .disc.turned::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: old-face 340ms var(--delay, 0ms) steps(1, end) both;
  }
  .ivory.turned::before {
    background: radial-gradient(circle at 33% 22%, #62676b, #292c30 48%, #141a1c 83%);
  }
  .onyx.turned::before {
    background: radial-gradient(circle at 32% 20%, #fff9e9, #e7dbc0 55%, #b1a78b 98%);
  }
  .set-down {
    animation: land 180ms ease-out;
  }
  @keyframes turn-over {
    0%,
    100% {
      transform: none;
    }
    50% {
      transform: translateY(-2px) scaleX(0.09);
    }
  }
  @keyframes old-face {
    0% {
      opacity: 1;
    }
    50%,
    100% {
      opacity: 0;
    }
  }
  @keyframes land {
    from {
      transform: translateY(-4px) scale(1.045);
    }
    to {
      transform: none;
    }
  }
}
.silhouettes {
  position: absolute;
  inset: 12% 12% 20%;
  border-radius: 50%;
  background: radial-gradient(ellipse, #3b5147, #29423a 58%, #70543d 60%, #4c3e34 65%, transparent 66%);
  display: flex;
  align-items: start;
  justify-content: space-around;
}
.ready .silhouettes {
  display: none;
}
.figurine {
  display: grid;
  justify-items: center;
  transform: translateY(-8%);
}
.figurine i {
  width: 36px;
  height: 49px;
  border-radius: 47% 47% 35% 35%;
  background:
    radial-gradient(ellipse at 50% 26%, #c99b7a 0 26%, transparent 28%),
    linear-gradient(var(--coat), #415358);
}
.figurine b {
  font-size: 10px;
  font-weight: 500;
}
.table-stage.my-turn {
  border-color: #c9ae7255;
}
@media (min-width: 850px) {
  body[data-game='reversi'] #room[data-phase='playing'],
  body[data-game='rummikub'] #room[data-phase='playing'] {
    display: grid;
    grid-template-columns: minmax(310px, 0.83fr) minmax(470px, 1.17fr);
    column-gap: 18px;
    align-items: start;
  }
  #room .room-head,
  #room .players,
  #room .lobby-code {
    grid-column: 1/-1;
  }
  body:not([data-game='uno']) #room[data-phase='playing'] .table-stage {
    height: min(43vh, 400px);
  }
  body:not([data-game='uno']) #room[data-phase='playing'] .workbench {
    margin: 0;
  }
  body[data-game='reversi'] #disc-panel {
    display: block;
  }
  #disc-panel .bench-top {
    display: flex;
    margin-bottom: 10px;
  }
  .checkerboard {
    max-width: 440px;
    margin: auto;
  }
}
@media (max-width: 700px) {
  header {
    height: 50px;
  }
  .bar-actions {
    gap: 6px;
  }
  .bar-actions button {
    padding: 5px 11px;
  }
  .table-stage {
    height: clamp(195px, 28svh, 290px);
    border-radius: 12px;
  }
  .stock,
  .discard {
    width: 45px;
  }
  .piles .card b {
    font-size: 28px;
  }
  .card-back b {
    font-size: 16px;
  }
  .piles small,
  #active-color {
    font-size: 9px;
  }
  .players li {
    padding: 3px 7px;
  }
  .players {
    gap: 4px;
  }
  .seat-labels span {
    font-size: 9px;
    padding: 0 4px;
  }
  .room-head h1 {
    font-size: 22px;
  }
  .table-status strong {
    font-size: 14px;
  }
  .table-status small {
    font-size: 11px;
  }
  .hand {
    padding: 9px 6px 12px;
    gap: 6px;
  }
  .hand .card {
    width: clamp(42px, 12.8vw, 64px);
  }
  .room-head {
    align-items: center;
  }
  body[data-game='reversi'] #disc-panel {
    display: block;
  }
  #disc-panel .bench-top {
    display: flex;
    margin-bottom: 10px;
  }
  .workbench {
    margin-top: 10px;
  }
  body:not([data-game='uno']) .table-stage {
    height: 145px;
  }
  .immersive body:not([data-game='uno']) .table-stage {
    height: 150px;
  }
  .rack .tile {
    width: 33px;
    height: 44px;
  }
  .rack {
    gap: 4px;
  }
  .tile {
    width: 28px;
    height: 37px;
  }
  .tile b {
    font-size: 19px;
  }
  .bench-top h2 {
    font-size: 16px;
  }
  .add-to,
  .tools button {
    padding: 6px 8px;
  }
  .rack-head h3 {
    font-size: 15px;
  }
  .immersive header,
  .immersive main {
    width: calc(100% - 22px);
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  .immersive #room[data-phase='playing'] {
    display: grid;
    grid-template-columns: minmax(210px, 0.88fr) minmax(260px, 1.12fr);
    gap: 5px 12px;
  }
  .immersive #room[data-phase='playing'] .table-stage {
    height: clamp(160px, 48dvh, 230px);
  }
  .immersive #room .room-head,
  .immersive #room .players {
    grid-column: 1/-1;
  }
  .immersive #room .workbench {
    margin: 0;
  }
  .immersive .hand .card {
    width: 40px;
  }
  .immersive .hand .card b {
    font-size: 24px;
  }
  .immersive .checkerboard {
    max-width: 230px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .turned {
    animation: none;
  }
  .tile {
    transition: none;
  }
}

.hall main {
  padding: clamp(40px, 8vh, 100px) 0;
}
.hall main > h1 {
  font:
    550 clamp(40px, 6vw, 87px) / 1.05 'Songti SC',
    'Noto Serif SC',
    serif;
  margin: 0 0 35px;
}
.hall h1 span {
  color: var(--pale);
}
.tables {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.table-link {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid #b69d713f;
  background: linear-gradient(155deg, #35423a, #1d2928 80%);
  box-shadow:
    inset 0 1px #dfc39125,
    0 11px 33px #11191852;
}
.table-link:nth-child(2) {
  background: linear-gradient(155deg, #4c4036, #2a2927 80%);
}
.table-link:nth-child(3) {
  background: linear-gradient(155deg, #374041, #20272b 80%);
}
.table-link:hover {
  border-color: #ccb88799;
}
.table-link h2 {
  margin: 0;
  font-size: 27px;
}
.table-link p {
  color: #bcbba8;
  font-size: 13px;
  margin: 4px 0;
}
.table-link strong {
  font-size: 23px;
  font-weight: 400;
}
.specimen {
  grid-column: 1/-1;
  display: grid;
  place-items: center;
  height: clamp(160px, 23vw, 275px);
  overflow: hidden;
}
.specimen .fan {
  transform: scale(0.72);
  margin-top: -10px;
}
.tile-art,
.disc-art {
  margin: 20px auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.tile-art {
  transform: perspective(440px) rotateX(15deg) rotate(-9deg);
  width: max-content;
  border-bottom: 13px solid #8b654a;
  background: linear-gradient(90deg, #513b2e, #71543b);
  padding: 9px 7px 6px;
  border-radius: 5px;
  box-shadow: 2px 13px 12px #15191468;
}
.tile-art i {
  display: grid;
  place-items: center;
  margin: 0 2px;
  width: 49px;
  height: 72px;
  color: #9b4f2c;
  background: linear-gradient(135deg, #fff0cf, #dcc6a3);
  box-shadow:
    inset -2px -4px #b19b78,
    1px 2px 3px #352b24;
  border-radius: 5px;
  font:
    700 32px Georgia,
    serif;
}
.disc-art {
  display: grid;
  grid-template-columns: repeat(2, 40px);
  grid-template-rows: repeat(2, 40px);
  gap: 3px;
  padding: 22px;
  background:
    repeating-linear-gradient(0deg, transparent 0 41px, #243f31aa 42px 43px),
    repeating-linear-gradient(90deg, #556d54 0 41px, #344b38 42px 43px);
  border: 5px solid #755841;
  border-radius: 5px;
  transform: perspective(400px) rotateX(28deg) rotate(-14deg);
  box-shadow:
    2px 6px #483c2f,
    3px 18px 15px #1d231c88;
}
.disc-art i {
  margin: 2px;
  border-radius: 50%;
  box-shadow: 2px 4px 2px #16221da6;
  background: radial-gradient(circle at 32% 20%, #fff4dc, #e1d3b5 65%, #ae9d7e);
}
.disc-art i:nth-child(2),
.disc-art i:nth-child(3) {
  background: radial-gradient(circle at 33% 22%, #5e6263, #2a2d2e 55%, #171c1d);
}
body:not([data-game='uno']) .intro h1 {
  font:
    550 clamp(48px, 7vw, 94px) / 1.15 'Noto Serif SC',
    'Songti SC',
    serif;
  letter-spacing: 0.02em;
}
@media (max-width: 700px) {
  .hall main {
    padding: 30px 0;
  }
  .hall main > h1 {
    margin-bottom: 18px;
  }
  .tables {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .table-link {
    grid-template-columns: 105px 1fr auto;
    padding: 10px 16px;
    gap: 10px;
  }
  .specimen {
    grid-column: 1;
    height: 93px;
    position: relative;
    overflow: visible;
  }
  .specimen > * {
    position: absolute;
  }
  .specimen .fan {
    transform: scale(0.51);
    margin: 0;
  }
  .specimen .tile-art {
    transform: scale(0.53) rotate(-10deg);
  }
  .specimen .disc-art {
    transform: scale(0.66) rotate(-12deg);
  }
  .table-link h2 {
    font-size: 21px;
  }
  .tile-art i {
    width: 41px;
    height: 60px;
  }
  .hall .specimen .tile-art i {
    width: 49px;
    height: 72px;
  }
}
.wave-button {
  position: absolute;
  bottom: 11px;
  right: 13px;
  z-index: 2;
  padding: 6px 14px;
  border: 1px solid #ccba8d59;
  border-radius: 99px;
  background: #192a27c9;
  color: #e5d6b8;
  font-size: 12px;
}
.wave-button:active {
  transform: translateY(1px);
}
.seat-labels span.waving::after {
  content: ' · 挥手';
  color: #efcc88;
}
.immersive header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #192126f5;
}
@media (max-width: 700px) {
  .wave-button {
    bottom: 6px;
    right: 7px;
    padding: 4px 9px;
  }
}

@media (min-width: 850px) {
  body:not([data-game='uno']) #room[data-phase='playing'] {
    grid-template-columns: minmax(380px, 1.04fr) minmax(400px, 0.96fr);
  }
  .immersive body:not([data-game='uno']) #room[data-phase='playing'] .table-stage,
  .immersive body:not([data-game='uno']) #room[data-phase='playing'] .workbench {
    min-height: clamp(350px, calc(100dvh - 195px), 930px);
  }
  .immersive #rummy-panel {
    display: flex;
    flex-direction: column;
  }
  .immersive #rummy-panel .groups {
    flex: 1;
    align-content: start;
    align-items: start;
    min-height: 120px;
  }
  .immersive #disc-panel .checkerboard {
    width: min(100%, calc(100dvh - 315px));
    max-width: 560px;
    margin: 18px auto;
  }
}
