* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: #0a5c36;
  background-image: radial-gradient(ellipse at center, #0e7a46 0%, #084d2c 75%);
  color: #fff;
  min-height: 100vh;
}
button {
  font-size: 16px; padding: 10px 18px; border: none; border-radius: 10px;
  background: #e8e8e8; color: #222; cursor: pointer;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; }
button.primary { background: #ffb300; color: #3a2703; font-weight: 700; }
button.big { width: 100%; padding: 14px; font-size: 18px; }
button.ghost { background: transparent; color: #cfe9d8; border: 1px solid #5da87f; width: 100%; margin-top: 10px; }
input {
  font-size: 16px; padding: 11px; border-radius: 10px; border: 1px solid #bcd;
  width: 100%; background: #fff; color: #222;
}

/* ---------- lobby ---------- */
#lobby { max-width: 420px; margin: 0 auto; padding: 32px 20px; }
#lobby h1 { text-align: center; font-size: 44px; margin: 8px 0 2px; }
#lobby .sub { text-align: center; color: #bfe3cd; margin: 0 0 22px; }
#lobby .field { display: block; margin-bottom: 14px; font-size: 14px; color: #cfe9d8; }
#lobby .field input { margin-top: 6px; }
.joinRow { display: flex; gap: 10px; margin-top: 12px; }
.joinRow input { flex: 1; text-transform: uppercase; }
.joinRow button { white-space: nowrap; }
.msg { min-height: 20px; color: #ffd54f; text-align: center; }
.rules {
  margin-top: 22px; background: rgba(0,0,0,0.22); border-radius: 12px; padding: 12px 16px;
  font-size: 14px; line-height: 1.7; color: #dcefe2;
}
.rules h3 { margin: 4px 0; color: #fff; }

/* ---------- game layout ---------- */
#game { max-width: 560px; margin: 0 auto; padding: 8px 10px 14px; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,0.28); border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
#topbar .lvl { color: #ffd54f; font-size: 20px; }
#banner {
  text-align: center; min-height: 26px; margin-top: 8px; font-size: 16px;
  color: #ffe082; font-weight: 600;
}
#table {
  position: relative; flex: 1; min-height: 0; margin-top: 4px;
}
.seat { position: absolute; width: 46%; }
.seat-top { top: 0; left: 27%; text-align: center; }
.seat-left { top: 38%; left: 0; }
.seat-right { top: 38%; right: 0; text-align: right; }
.seat-bottom { position: static; width: 100%; text-align: center; margin-bottom: 4px; }
.center {
  position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; color: #bfe3cd; font-size: 14px; width: 60%;
}
.seat .sname { font-size: 14px; font-weight: 600; }
.seat .stag { font-size: 11px; background: #ffb300; color: #3a2703; border-radius: 6px; padding: 1px 6px; margin-left: 5px; }
.seat .stag.partner { background: #64b5f6; color: #0d2c47; }
.seat .stag.turn { background: #ef5350; color: #fff; }
.seat .scount { font-size: 12px; color: #bfe3cd; margin-left: 6px; white-space: nowrap; }
.seat .splay { min-height: 44px; margin-top: 4px; display: flex; gap: 0; flex-wrap: wrap; }
.seat-left .splay, .seat-top .splay { justify-content: flex-start; }
.seat-right .splay { justify-content: flex-end; }
.seat-top .splay { justify-content: center; }
.seat .passLabel { font-size: 15px; color: #90a4ae; line-height: 44px; }
.seat .finishBadge { font-size: 13px; color: #ffd54f; font-weight: 700; }

#tributeInfo { text-align: center; font-size: 13px; color: #ffccbc; min-height: 18px; }

/* ---------- cards ---------- */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start;
  width: 34px; height: 48px; background: #fff; color: #222; border-radius: 6px;
  border: 1px solid #9e9e9e; font-size: 15px; font-weight: 700; line-height: 1.05;
  padding-top: 3px; position: relative; user-select: none; flex: none;
}
.card .suit { font-size: 13px; font-weight: 400; }
.card.red { color: #d32f2f; }
.card.jokerBig { color: #d32f2f; font-size: 12px; }
.card.jokerSmall { color: #555; font-size: 12px; }
.card.wild { border: 2px solid #ffb300; box-shadow: 0 0 6px #ffb300; }
.card.wild::after {
  content: "配"; position: absolute; bottom: 1px; right: 2px; font-size: 9px; color: #e65100;
}
.card.mini { width: 26px; height: 37px; font-size: 12px; padding-top: 2px; margin-right: -8px; }
.card.mini .suit { font-size: 10px; }

/* ---------- own hand ---------- */
#hand {
  display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start;
  min-height: 110px; padding: 10px 2px 2px; overflow-y: auto;
}
#hand .card { margin: 0 -13px 5px 0; cursor: pointer; transition: transform 0.08s; width: 36px; height: 52px; font-size: 15px; }
#hand .card.sel { transform: translateY(-12px); border-color: #ffb300; box-shadow: 0 4px 10px rgba(0,0,0,0.45); }
#actions { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
#actions button { min-width: 84px; }
#hostBtns { text-align: center; margin: 8px 0 2px; }
#hostBtns button { background: #ffb300; color: #3a2703; font-size: 18px; font-weight: 700; padding: 13px 26px; border-radius: 12px; box-shadow: 0 3px 10px rgba(0,0,0,0.35); }

#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(20,20,20,0.92); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 50;
  max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; }
