/* 喊牌 · 酒桌规则 */
:root {
  --gold: #f4cb85;
  --gold-deep: #b9823c;
  --red: #ff5340;
  --red-soft: #ff9382;
  --ink: #f8f0e4;
  --muted: rgba(248, 240, 228, .56);
  --faint: rgba(248, 240, 228, .32);
  --line: rgba(244, 203, 133, .18);
  --glass: rgba(255, 255, 255, .045);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #0b0709;
}

body {
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  background:
    radial-gradient(120% 80% at 50% -15%, #401c28 0%, rgba(64, 28, 40, 0) 58%),
    radial-gradient(90% 70% at 105% 105%, #2b1220 0%, rgba(43, 18, 32, 0) 62%),
    linear-gradient(180deg, #150c12 0%, #0b0709 100%);
  background-attachment: fixed;
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 30% at 15% 80%, rgba(244, 203, 133, .07), transparent 70%),
    radial-gradient(40% 28% at 90% 20%, rgba(255, 83, 64, .06), transparent 70%);
  z-index: 0;
}

.hidden { display: none !important; }

#app {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 18px calc(28px + var(--safe-b));
  min-height: 100vh;
}

/* ---------------- 通用 */

.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.panel + .panel { margin-top: 14px; }

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 12px;
}

.btn {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 15px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background .2s ease;
  user-select: none;
}

.btn:active:not(:disabled) { transform: scale(.97); }

.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn-primary {
  color: #2a1608;
  background: linear-gradient(180deg, #f9dca6 0%, #e0b064 100%);
  box-shadow: 0 8px 24px rgba(226, 176, 100, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(244, 203, 133, .32);
  color: var(--gold);
}

.btn-text {
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 1px;
  padding: 10px;
}

.btn-mini {
  width: auto;
  padding: 9px 16px;
  font-size: 14px;
  border-radius: 12px;
  letter-spacing: .5px;
}

.btn + .btn { margin-top: 10px; }

.hint {
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
  margin: 14px 4px 0;
  line-height: 1.6;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid rgba(244, 203, 133, .35);
  color: var(--gold);
  white-space: nowrap;
}

.tag.red { border-color: rgba(255, 83, 64, .5); color: var(--red-soft); }
.tag.dim { border-color: rgba(255, 255, 255, .14); color: var(--faint); }

/* ---------------- 首页 */

.home { padding-top: 26px; }

.masthead { text-align: center; margin-bottom: 26px; }

.suits {
  letter-spacing: 10px;
  font-size: 14px;
  color: rgba(244, 203, 133, .5);
  margin-bottom: 10px;
}

.suits span { color: rgba(255, 83, 64, .55); }
.suits i { color: rgba(255, 83, 64, .55); font-style: normal; }

.masthead h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 62px;
  line-height: 1.1;
  letter-spacing: 14px;
  text-indent: 14px;
  background: linear-gradient(180deg, #fff6e4 10%, #f4cb85 55%, #c08a44 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px rgba(226, 176, 100, .22));
}

.tagline {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--muted);
}

.home-card { margin-top: 8px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .28);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .2s ease;
}

#joinCode {
  letter-spacing: 8px;
  text-transform: uppercase;
  font-weight: 700;
}

.field input::placeholder { color: rgba(248, 240, 228, .26); letter-spacing: 1px; }
.field input:focus { border-color: rgba(244, 203, 133, .55); }

.foot {
  text-align: center;
  font-size: 11.5px;
  color: rgba(248, 240, 228, .26);
  margin-top: 26px;
  letter-spacing: 1px;
}

/* ---------------- 房间头 */

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.room-code {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.room-code small {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--faint);
}

.room-code b {
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--gold);
  font-weight: 800;
}

.head-btn {
  border: 1px solid rgba(255, 255, 255, .12);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

/* ---------------- 二维码 */

.qr-panel { text-align: center; }

.qr-wrap {
  width: min(62vw, 220px);
  margin: 0 auto;
  padding: 12px;
  background: #f7efe4;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}

.qr-wrap img, .qr-wrap .qr-fallback {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.qr-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a1608;
  font-size: 13px;
  word-break: break-all;
  padding: 18px 8px;
  line-height: 1.5;
}

.join-url {
  margin: 14px 0 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
  word-break: break-all;
}

.qr-panel .btn-mini { margin: 6px auto 0; }

/* ---------------- 玩家 */

.players { display: flex; flex-direction: column; gap: 8px; }

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  transition: border-color .2s ease, background .2s ease;
}

.player-row .p-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--gold);
  background: rgba(244, 203, 133, .1);
  border: 1px solid rgba(244, 203, 133, .28);
}

.player-row .p-main { flex: 1; min-width: 0; }

.player-row .p-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-row .p-sub {
  font-size: 11.5px;
  color: var(--faint);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.player-row.is-dealer { border-color: rgba(244, 203, 133, .55); background: rgba(244, 203, 133, .09); }
.player-row.is-me { background: rgba(255, 255, 255, .075); }
.player-row.nominee { border-color: rgba(255, 83, 64, .55); animation: breathe 1.6s ease-in-out infinite; }

.p-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.p-dot { width: 6px; height: 6px; border-radius: 50%; background: #6ad78a; }
.p-dot.off { background: rgba(255, 255, 255, .22); }

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 83, 64, .28); }
  50% { box-shadow: 0 0 0 6px rgba(255, 83, 64, 0); }
}

.banner {
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
  background: linear-gradient(160deg, rgba(255, 83, 64, .16), rgba(255, 83, 64, .05));
  border: 1px solid rgba(255, 83, 64, .38);
  font-size: 14px;
}

.banner .banner-actions { display: flex; gap: 10px; margin-top: 12px; }
.banner .banner-actions .btn { margin: 0; }

/* ---------------- 选号 */

.seats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.seat {
  position: relative;
  border-radius: 16px;
  padding: 14px 8px 12px;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .2);
  cursor: pointer;
  transition: all .18s ease;
}

.seat .s-no { font-size: 24px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; }
.seat .s-name {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat.free { border-style: dashed; }
.seat.free:active { transform: scale(.96); }

.seat.taken {
  cursor: default;
  border-style: solid;
  background: rgba(244, 203, 133, .1);
  border-color: rgba(244, 203, 133, .42);
}
.seat.taken .s-name { color: var(--ink); font-weight: 600; font-size: 12.5px; }

.seat.mine { box-shadow: inset 0 0 0 2px rgba(244, 203, 133, .8); }

.seat.dealer {
  background: linear-gradient(165deg, #59231a 0%, #2c1118 100%);
  border-color: rgba(244, 203, 133, .7);
  border-style: solid;
  cursor: default;
}
.seat.dealer .s-no { color: var(--gold); }

.seat .s-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9.5px;
  letter-spacing: 1px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(244, 203, 133, .18);
  color: var(--gold);
}

.order-line {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 1px;
  margin-top: 14px;
}

/* ---------------- 牌桌 */

.table-wrap { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }

.table {
  position: relative;
  width: min(70vw, 288px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 22%, rgba(244, 203, 133, .18), rgba(244, 203, 133, 0) 62%),
    linear-gradient(180deg, #241119 0%, #150a10 100%);
  border: 1px solid rgba(244, 203, 133, .26);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .78), 0 24px 60px rgba(0, 0, 0, .55);
  transition: box-shadow .5s ease;
}

.table.my-turn { box-shadow: inset 0 0 70px rgba(0, 0, 0, .7), 0 0 0 3px rgba(244, 203, 133, .38), 0 24px 60px rgba(0, 0, 0, .55); }
.table.hit { box-shadow: inset 0 0 70px rgba(0, 0, 0, .6), 0 0 0 3px rgba(255, 83, 64, .6), 0 24px 60px rgba(255, 40, 30, .3); }

.table .t-label { font-size: 11px; letter-spacing: 3px; color: var(--faint); }

.table .t-number {
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff8ea 0%, #f4cb85 60%, #c9903f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 22px rgba(244, 203, 133, .28));
  transition: transform .18s ease;
}

.table .t-number.pop { animation: pop .35s ease; }

@keyframes pop {
  0% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.table .t-sub { font-size: 12px; color: var(--muted); margin-top: 8px; letter-spacing: 1px; text-align: center; padding: 0 20px; }

.table .t-sub b { color: var(--gold); }

/* 暗牌 */
.card-face {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 78px;
  border-radius: 9px;
  background: linear-gradient(160deg, #fff8ec 0%, #efe0c8 100%);
  color: #241018;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.15;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(255, 255, 255, .8);
}

.card-face small { font-size: 10px; color: #8b6a45; font-weight: 600; letter-spacing: 1px; }
.card-face.red { color: #c0122f; }
.card-face.red small { color: #a9405a; }
.card-face.back {
  background:
    repeating-linear-gradient(45deg, #3b1a22 0 6px, #2a1017 6px 12px);
  border: 2px solid rgba(244, 203, 133, .5);
  color: rgba(244, 203, 133, .7);
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.card-face.big { width: 92px; height: 126px; font-size: 30px; border-radius: 13px; }
.card-face.big small { font-size: 13px; }

.dealer-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid var(--line);
}

.dealer-strip .d-title { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.dealer-strip .d-name { font-size: 15px; font-weight: 700; margin-top: 3px; }
.dealer-strip .d-note { font-size: 11.5px; color: var(--faint); margin-top: 4px; line-height: 1.5; }
.dealer-strip .peek-btn {
  margin-top: 8px;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.dealer-strip > div:last-child { flex: 1; min-width: 0; }

/* 接力 */
.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { display: none; }

.rail-chip {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 9px 8px;
  border-radius: 13px;
  text-align: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: all .25s ease;
}

.rail-chip .r-no { font-size: 17px; font-weight: 800; line-height: 1.1; }
.rail-chip .r-name { font-size: 10.5px; color: var(--faint); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62px; }
.rail-chip.active { background: rgba(244, 203, 133, .16); border-color: rgba(244, 203, 133, .6); box-shadow: 0 0 18px rgba(244, 203, 133, .18); }
.rail-chip.active .r-no { color: var(--gold); }
.rail-chip.done { opacity: .45; }
.rail-chip .r-tags { display: flex; gap: 3px; justify-content: center; margin-top: 4px; }
.rail-chip .r-tags span { font-size: 9px; padding: 0 4px; border-radius: 99px; background: rgba(244, 203, 133, .16); color: var(--gold); }
.rail-chip .r-tags span.red { background: rgba(255, 83, 64, .18); color: var(--red-soft); }

/* 操作区 */
.action-panel { margin-top: 14px; }

.shout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }

.shout-btn {
  border-radius: 15px;
  border: 1px solid rgba(244, 203, 133, .38);
  background: linear-gradient(180deg, rgba(244, 203, 133, .16), rgba(244, 203, 133, .05));
  color: var(--ink);
  font: inherit;
  padding: 12px 6px 11px;
  cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}

.shout-btn:active:not(:disabled) { transform: scale(.96); }
.shout-btn:disabled { opacity: .3; cursor: not-allowed; }
.shout-btn .n { display: block; font-size: 15px; font-weight: 800; letter-spacing: .5px; }
.shout-btn .range { display: block; font-size: 11px; color: var(--gold); margin-top: 3px; letter-spacing: .5px; }

.pass-btn {
  margin-top: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
}
.pass-btn:disabled { opacity: .35; }

.wait-box {
  text-align: center;
  padding: 18px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
  font-size: 14px;
  color: var(--muted);
}
.wait-box b { color: var(--gold); }

/* 日志 */
.log { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; max-height: 190px; overflow-y: auto; }
.log-item { color: var(--muted); line-height: 1.5; }
.log-item::before { content: "·"; margin-right: 7px; color: var(--faint); }
.log-item.drink { color: var(--red-soft); font-weight: 600; }
.log-item.system { color: var(--gold); opacity: .8; }
.log-item.pass { color: rgba(248, 240, 228, .4); }

/* ---------------- 遮罩 */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 3, 5, .78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.drink-card {
  width: 100%;
  max-width: 340px;
  border-radius: 26px;
  padding: 30px 24px 24px;
  text-align: center;
  background: linear-gradient(165deg, #4d1316 0%, #25080d 100%);
  border: 1px solid rgba(255, 83, 64, .45);
  box-shadow: 0 0 80px rgba(255, 50, 35, .35), inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: cardIn .35s cubic-bezier(.2, 1.3, .5, 1);
}

@keyframes cardIn {
  from { transform: scale(.86) translateY(14px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.drink-card .kicker { font-size: 11px; letter-spacing: 4px; color: rgba(255, 255, 255, .4); }

.drink-card .who {
  font-size: 40px;
  font-weight: 900;
  line-height: 1.15;
  margin: 10px 0 2px;
  color: #ffd7cf;
  text-shadow: 0 0 40px rgba(255, 70, 50, .55);
}

.drink-card .who-name { font-size: 15px; color: rgba(255, 255, 255, .68); margin-bottom: 20px; }

.drink-card .card-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.drink-card .card-tip { font-size: 11.5px; color: rgba(255, 255, 255, .38); letter-spacing: 1px; }

.drink-card .btn { margin-top: 22px; }

/* 规则抽屉 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 3, 4, .66);
  backdrop-filter: blur(8px);
}

.sheet-body {
  width: 100%;
  max-width: 460px;
  max-height: 82vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(24px + var(--safe-b));
  background: linear-gradient(180deg, #1d1018 0%, #120a10 100%);
  border-top: 1px solid rgba(244, 203, 133, .28);
  animation: sheetUp .3s ease;
}

@keyframes sheetUp { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }

.sheet-body h2 {
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  letter-spacing: 4px;
  margin: 0 0 16px;
  color: var(--gold);
  font-weight: 600;
}

.rule {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.rule .r-idx {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gold);
  background: rgba(244, 203, 133, .12);
}

.rule .r-txt { font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.rule .r-txt b { color: var(--ink); font-weight: 700; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 80;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(20, 10, 14, .94);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toastIn .22s ease;
}

@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 360px) {
  .masthead h1 { font-size: 52px; }
  .table .t-number { font-size: 64px; }
  .shout-btn .n { font-size: 14px; }
}
