:root {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #eeeade;
  background: #101b19;
  font-synthesis: none;
  --gold: #d9b66f;
  --muted: #99ada4;
  --line: #ffffff16;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0, #24453a55, transparent 60%), #101b19;
  min-height: 100vh;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  color: inherit;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
.shell {
  max-width: 1180px;
  margin: auto;
  padding: 0 36px;
}
header {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: 5px;
}
.brandmark {
  display: grid;
  place-items: center;
  background: #eae4d4;
  color: #215746;
  border-radius: 7px;
  border-bottom: 4px solid #6f9c7d;
  width: 39px;
  height: 48px;
  font-size: 28px;
  font-family: serif;
}
.account {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}
#points {
  color: var(--gold);
}
.status {
  color: #8db7a1;
  font-size: 12px;
}
.status:before {
  content: "●";
  font-size: 8px;
  margin-right: 6px;
}
.icon {
  border: 1px solid #ffffff30;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  background: transparent;
}
.lobby {
  padding: 45px 0 32px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--gold);
  margin-bottom: 12px;
}
h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: 2px;
  margin: 0 0 10px;
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.lobby-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 22px;
  margin-top: 28px;
}
.featured {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 25%, #36765c, #183e32 65%);
  border: 1px solid #76967735;
  border-radius: 20px;
  min-height: 365px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.featured:after {
  content: "";
  position: absolute;
  width: 370px;
  height: 370px;
  border: 1px solid #d5c38f20;
  border-radius: 50%;
  right: -110px;
  top: -160px;
  pointer-events: none;
}
.tag {
  display: inline-flex;
  border: 1px solid #b9d3b144;
  color: #cedfc9;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  letter-spacing: 2px;
}
.feature-title {
  font-size: 31px;
  letter-spacing: 4px;
  margin: 18px 0 0;
}
.feature-art {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  transform: rotate(-10deg);
  pointer-events: none;
}
.feature-art .tile {
  width: 64px;
  height: 86px;
  font-size: 32px;
  box-shadow: 4px 7px 0 #0b211b55;
}
.feature-art .tile:nth-child(2) {
  transform: translateY(-12px);
}
.feature-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.feature-bottom small {
  color: #b4c9ba;
  line-height: 1.8;
}
.primary {
  background: linear-gradient(130deg, #e6c887, #c6a161);
  color: #242a20;
  padding: 13px 25px;
  border-radius: 8px;
  font-weight: 650;
  white-space: nowrap;
}
.secondary {
  background: #ffffff08;
  border: 1px solid #ffffff24;
  padding: 12px 20px;
  border-radius: 8px;
}
.side-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.action-card {
  background: #1c2a25;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 17px;
  text-align: left;
  width: 100%;
}
.action-card:hover {
  border-color: #d9b66f66;
  background: #22362c;
}
.action-icon {
  height: 48px;
  width: 48px;
  flex-shrink: 0;
  background: #d4b57512;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--gold);
  font-size: 25px;
}
.action-card h3 {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 8px;
}
.action-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.arrow {
  margin-left: auto;
  color: var(--gold);
}
.join-form {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.join-form input {
  min-width: 0;
  flex: 1;
  border: 1px solid #ffffff25;
  background: #101c17;
  color: white;
  padding: 12px;
  border-radius: 8px;
  outline-color: var(--gold);
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-top: 30px;
}
.section-title {
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  margin: 0 0 17px;
}
.section-title span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.info-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.info-panel p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.history-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.empty {
  color: var(--muted);
  padding: 15px 0;
  font-size: 13px;
}
.positive {
  color: #aad6a9;
}
.negative {
  color: #eb9f92;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: #718c7d;
  font-size: 11px;
}
.room-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
}
.room-head h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 5px;
}
.room-head small {
  color: var(--muted);
}
.room-buttons {
  display: flex;
  gap: 8px;
}
.room-buttons button {
  padding: 9px 13px;
  font-size: 12px;
}
.waiting {
  background: radial-gradient(ellipse, #245d49, #15372d);
  border: 8px solid #34493b;
  border-radius: 28px;
  min-height: 440px;
  padding: 36px;
  text-align: center;
}
.waiting h2 {
  font-weight: 500;
  margin: 20px 0 10px;
}
.seats-wait {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 40px 0;
}
.wait-seat {
  width: 115px;
  color: var(--muted);
  font-size: 13px;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #314b3d;
  color: #e9d6a8;
  font-size: 23px;
  border: 1px solid #b8ccaa35;
  margin: auto auto 9px;
}
.wait-seat.empty-seat .avatar {
  background: transparent;
  border: 1px dashed #abbcab70;
}
.waiting .code {
  letter-spacing: 7px;
  color: var(--gold);
  font-size: 28px;
}
.table {
  height: 550px;
  position: relative;
  border: 9px solid #394b3d;
  border-radius: 100px;
  background: radial-gradient(ellipse, #25654f, #133f31);
  box-shadow:
    inset 0 0 0 2px #99b28928,
    inset 0 0 80px #082b2399;
}
.table:before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid #bfd1a521;
  border-radius: 75px;
  pointer-events: none;
}
.seat {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 230px;
  font-size: 12px;
}
.seat .avatar {
  margin: 0;
  width: 38px;
  height: 38px;
  font-size: 18px;
  border-radius: 10px;
}
.seat.active .avatar {
  border: 2px solid var(--gold);
  box-shadow: 0 0 16px #e0bf7344;
}
.seat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.seat-info small {
  color: #bfd0be;
  font-size: 10px;
}
.seat.pos0 {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}
.seat.pos2 {
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
}
.seat.pos1 {
  right: 12px;
  top: 46%;
  flex-direction: column;
}
.seat.pos3 {
  left: 12px;
  top: 46%;
  flex-direction: column;
}
.center {
  position: absolute;
  top: 100px;
  left: 120px;
  right: 120px;
  bottom: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.compass {
  color: #bbcbad;
  letter-spacing: 7px;
  font-size: 20px;
  border: 1px solid #cbd9b930;
  padding: 12px 19px;
  border-radius: 8px;
}
.remaining {
  font-size: 11px;
  color: #adc6ac;
  margin: 10px;
}
.discards {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  max-width: 400px;
  overflow: auto;
  max-height: 130px;
}
.tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 58px;
  border-radius: 5px;
  background: linear-gradient(#fcf9ee, #e9e5d6);
  color: #b33732;
  border: 1px solid #b8c3a7;
  border-bottom: 5px solid #80a184;
  font-weight: 700;
  line-height: 1;
  font-family: serif;
  font-size: 24px;
  flex-shrink: 0;
  user-select: none;
}
.tile small {
  font-size: 14px;
  margin-top: 4px;
}
.tile.s1 {
  color: #3157a0;
}
.tile.s2 {
  color: #24663f;
}
.tile.mini {
  width: 24px;
  height: 33px;
  font-size: 15px;
  border-bottom-width: 3px;
  border-radius: 3px;
}
.tile.mini small {
  font-size: 9px;
  margin-top: 1px;
}
.hand {
  position: absolute;
  bottom: 80px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.hand button.tile {
  transition: transform 0.12s;
}
.hand button.tile:hover {
  transform: translateY(-5px);
}
.hand button.selected {
  transform: translateY(-14px);
  outline: 2px solid var(--gold);
}
.hand button.missing {
  background: #f6dfce;
}
.melds {
  display: flex;
  gap: 7px;
  justify-content: center;
}
.meld-group {
  display: flex;
  gap: 1px;
}
.seat .melds {
  margin-top: 3px;
}
.seat .melds .tile {
  width: 15px;
  height: 23px;
  font-size: 11px;
}
.seat .melds .tile small {
  font-size: 7px;
}
.game-message {
  text-align: center;
  margin: 18px 0 10px;
  color: #ddc58b;
  font-size: 14px;
  min-height: 21px;
}
.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 47px;
  margin-bottom: 20px;
}
.timer {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.log {
  background: #15251e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  max-height: 115px;
  overflow: auto;
  margin-bottom: 20px;
  color: #9eb59f;
  font-size: 12px;
  line-height: 1.9;
}
.result {
  padding: 28px;
  background: #1c3127;
  border: 1px solid #b99d6344;
  border-radius: 18px;
  text-align: center;
  margin: 25px auto;
  max-width: 580px;
}
.result h2 {
  font-weight: 500;
  color: var(--gold);
}
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.result .primary {
  margin-top: 25px;
}
.loading {
  padding: 100px;
  text-align: center;
  color: var(--muted);
}
dialog {
  background: #1c3027;
  color: #ede9dd;
  border: 1px solid #657155;
  border-radius: 18px;
  max-width: 600px;
  width: 90%;
  padding: 28px;
  line-height: 1.9;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(5px);
}
dialog p {
  font-size: 14px;
  color: #c0cdbd;
}
dialog h3 {
  font-size: 16px;
  color: var(--gold);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-head h2 {
  margin: 0;
  font-size: 22px;
}
.notice {
  border-left: 2px solid var(--gold);
  padding-left: 14px;
}
#toast {
  position: fixed;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  background: #e6d6b4;
  color: #243629;
  padding: 13px 22px;
  border-radius: 10px;
  box-shadow: 0 8px 40px #0005;
  display: none;
  z-index: 10;
  max-width: 90%;
  font-size: 14px;
}
.dev-badge {
  font-size: 11px;
  color: #c4aa75;
}
.login-error {
  padding: 65px 20px;
  text-align: center;
  line-height: 2;
}
.login-error h2 {
  font-weight: 500;
}
@media (max-width: 700px) {
  .shell {
    padding: 0 16px;
  }
  header {
    height: 77px;
  }
  .brand {
    font-size: 17px;
    gap: 9px;
  }
  .brand small {
    font-size: 8px;
  }
  .brandmark {
    width: 31px;
    height: 40px;
    font-size: 24px;
  }
  .account {
    gap: 10px;
    font-size: 12px;
  }
  .status {
    font-size: 0;
  }
  .status:before {
    font-size: 8px;
  }
  .lobby {
    padding-top: 26px;
  }
  h1 {
    font-size: 28px;
  }
  .lobby-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 20px;
  }
  .featured {
    min-height: 290px;
    padding: 24px;
  }
  .feature-art .tile {
    width: 53px;
    height: 72px;
  }
  .feature-art {
    padding: 4px 15px;
  }
  .side-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .action-card {
    padding: 16px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .action-card h3 {
    font-size: 15px;
  }
  .action-card p {
    font-size: 11px;
  }
  .action-icon {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
  .arrow {
    display: none;
  }
  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 22px;
  }
  .feature-title {
    font-size: 27px;
  }
  .waiting {
    padding: 22px 12px;
    min-height: 400px;
  }
  .seats-wait {
    gap: 10px;
    margin: 35px 0;
  }
  .wait-seat {
    width: 68px;
    font-size: 11px;
  }
  .avatar {
    width: 43px;
    height: 43px;
  }
  .table {
    height: 510px;
    border-width: 6px;
    border-radius: 45px;
  }
  .table:before {
    inset: 12px;
    border-radius: 34px;
  }
  .center {
    top: 100px;
    left: 55px;
    right: 55px;
    bottom: 160px;
  }
  .compass {
    font-size: 17px;
    padding: 8px 11px;
  }
  .discards {
    max-height: 145px;
    gap: 2px;
  }
  .tile.mini {
    width: 21px;
    height: 29px;
    font-size: 13px;
  }
  .hand {
    gap: 2px;
    left: 4px;
    right: 4px;
    bottom: 82px;
  }
  .hand .tile {
    width: calc((100vw - 84px) / 14);
    max-width: 37px;
    height: 46px;
    font-size: 19px;
    border-bottom-width: 4px;
  }
  .hand .tile small {
    font-size: 11px;
  }
  .seat {
    font-size: 11px;
    gap: 5px;
  }
  .seat.pos1 {
    right: 4px;
    top: 40%;
  }
  .seat.pos3 {
    left: 4px;
    top: 40%;
  }
  .seat.pos1 .seat-info,
  .seat.pos3 .seat-info {
    max-width: 65px;
    text-align: center;
    overflow-wrap: anywhere;
  }
  .seat .avatar {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .seat.pos0 {
    bottom: 22px;
  }
  .seat .melds {
    flex-wrap: wrap;
    max-width: 95px;
  }
  .room-head h2 {
    font-size: 17px;
  }
  .room-buttons {
    flex-direction: column;
    gap: 5px;
  }
  .room-buttons button {
    padding: 6px 10px;
  }
  .controls {
    gap: 7px;
  }
  .controls button {
    padding: 11px 17px;
  }
  .game-message {
    font-size: 12px;
  }
  .primary {
    padding: 12px 20px;
  }
  .feature-bottom small {
    font-size: 11px;
  }
  .result {
    padding: 18px;
  }
  footer {
    font-size: 10px;
  }
  .log {
    font-size: 11px;
  }
  .room-head {
    padding: 17px 0;
  }
}

/* Chinese tile artwork is shared by hand, discards, melds and lobby. */
.tile {
  padding: 3px;
  overflow: hidden;
}
.tile-face {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.tile.mini {
  padding: 1px;
}
.seat .melds .tile {
  padding: 0;
}
.feature-art .tile {
  padding: 5px;
}
.hand .tile {
  padding: 2px;
}

.base-score-label{display:flex;flex-direction:column;gap:8px;color:#e7d5a2;font-size:14px;margin:12px 0}.base-score-label select{width:100%;padding:12px;border:1px solid #78958a;border-radius:8px;background:#173e42;color:#fff;font:inherit}
