:root {
  --gold: #f3c87a;
  --gold-deep: #c9893a;
  --rose: #e8a39b;
  --ink: #1a1014;
  --paper: #fff6e8;
  --glass: rgba(28, 16, 20, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: "Noto Serif SC", "Songti SC", serif;
  color: var(--paper);
  background: #140b10;
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% 18%, #ff7a4a 0%, transparent 55%),
    linear-gradient(180deg, #3a1520 0%, #7a2a28 18%, #d45a32 42%, #f0a35a 62%, #1c1018 100%);
}

.sun {
  position: absolute;
  left: 50%;
  top: 16%;
  width: 180px;
  height: 180px;
  margin-left: -90px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff3c4, #ffb14a 45%, #ff6a2a 80%);
  box-shadow: 0 0 80px 30px rgba(255, 140, 60, 0.45);
  animation: pulse 6s ease-in-out infinite;
}

.city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(10, 6, 10, 0.85) 70%),
    repeating-linear-gradient(90deg, #120c12 0 18px, #1b1218 18px 42px, #0e0a10 42px 70px);
  clip-path: polygon(
    0 100%, 0 48%, 4% 48%, 4% 28%, 9% 28%, 9% 52%, 14% 52%, 14% 18%, 22% 18%, 22% 44%,
    28% 44%, 28% 22%, 36% 22%, 36% 50%, 44% 50%, 44% 14%, 53% 14%, 53% 40%, 61% 40%,
    61% 20%, 70% 20%, 70% 46%, 78% 46%, 78% 12%, 88% 12%, 88% 38%, 100% 38%, 100% 100%
  );
  opacity: 0.92;
}

.city::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 10px,
    rgba(255, 210, 120, 0.18) 10px 12px,
    transparent 12px 22px
  );
  mask-image: linear-gradient(180deg, transparent 10%, #000 40%);
}

.haze {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20, 8, 12, 0.7) 100%);
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.92; }
}

.title-block {
  text-align: center;
  padding: 42px 20px 18px;
}

.eyebrow {
  letter-spacing: 0.42em;
  font-size: 11px;
  color: var(--gold);
  opacity: 0.85;
}

h1 {
  font-family: "Ma Shan Zheng", "ZCOOL XiaoWei", cursive;
  font-size: clamp(56px, 10vw, 108px);
  font-weight: 400;
  line-height: 1;
  margin: 10px 0 6px;
  background: linear-gradient(180deg, #fff8e4 0%, #f3c87a 45%, #c75a3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(255, 120, 50, 0.25);
  filter: drop-shadow(0 8px 18px rgba(80, 20, 10, 0.45));
}

.subtitle {
  font-size: 18px;
  letter-spacing: 0.48em;
  color: #ffd9b0;
}

.rule {
  margin-top: 14px;
  font-size: 13px;
  color: rgba(255, 236, 210, 0.78);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px 80px;
}

.stage {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 12px;
}

.card {
  position: relative;
  min-height: 340px;
  border-radius: 18px;
  padding: 22px 18px 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 214, 150, 0.28);
  background: linear-gradient(180deg, rgba(40, 16, 18, 0.72), rgba(16, 8, 12, 0.88));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  backdrop-filter: blur(8px);
}

.card:hover:not(.drawn):not(.busy):not(.locked) {
  transform: translateY(-8px) rotate(-0.4deg);
  box-shadow: 0 24px 50px rgba(200, 80, 30, 0.28);
}

.card.drawn,
.card.locked {
  cursor: default;
}

.card.mine {
  border-color: rgba(255, 226, 160, 0.7);
  box-shadow: 0 18px 44px rgba(243, 200, 122, 0.22);
}

.card.locked {
  opacity: 0.78;
}

.card.busy {
  pointer-events: none;
  opacity: 0.75;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0.45;
}

.seal {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255, 210, 140, 0.7);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Ma Shan Zheng", cursive;
  font-size: 22px;
  color: var(--gold);
  transform: rotate(12deg);
  background: rgba(80, 20, 20, 0.35);
}

.avatar {
  width: 92px;
  height: 92px;
  margin: 18px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-family: "Ma Shan Zheng", cursive;
  color: #2a1210;
  background: var(--face);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.card h3 {
  text-align: center;
  font-size: 30px;
  position: relative;
  z-index: 1;
}

.role {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin: 4px 0 16px;
  position: relative;
  z-index: 1;
}

.quote {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 236, 214, 0.82);
  text-align: center;
  min-height: 66px;
  position: relative;
  z-index: 1;
}

.time-chip {
  margin-top: 16px;
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.08em;
  color: #fff4d6;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.cta {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3c87a, #e8894a);
  color: #3a160e;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.2em;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.card.drawn .cta,
.card.locked .cta {
  background: rgba(255, 255, 255, 0.08);
  color: #f6ddb2;
  cursor: default;
}

.p-li { --glow: #ffb14a; --face: linear-gradient(160deg, #ffe7a8, #e8894a); }
.p-qin { --glow: #e07ad4; --face: linear-gradient(160deg, #f7c4ea, #b45aa0); }
.p-liu { --glow: #7ad4ff; --face: linear-gradient(160deg, #c9f0ff, #5aa8d4); }
.p-wang { --glow: #9dff8a; --face: linear-gradient(160deg, #d8ffc8, #6cbf5a); }

.board {
  margin-top: 36px;
  padding: 24px;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid rgba(255, 214, 150, 0.2);
  backdrop-filter: blur(12px);
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}

.board h2 {
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 28px;
}

#boardHint {
  color: #ffd9b0;
  font-size: 14px;
}

.timeline {
  list-style: none;
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.timeline li {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.rank {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 22px;
  color: var(--gold);
}

.who {
  font-size: 18px;
}

.when {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  font-size: 22px;
}

footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(16, 8, 10, 0.92));
  font-size: 13px;
  color: #f4d7b4;
}

.ghost, .primary {
  font-family: inherit;
  cursor: pointer;
}

.ghost {
  border: 1px solid rgba(255, 214, 150, 0.4);
  background: transparent;
  color: var(--gold);
  padding: 8px 16px;
  border-radius: 999px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 4, 8, 0.72);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 36px 28px 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, #4a1c1c, #1a0c10);
  border: 1px solid rgba(243, 200, 122, 0.5);
  box-shadow: 0 30px 80px rgba(255, 90, 30, 0.25);
}

.modal-kicker {
  letter-spacing: 0.4em;
  font-size: 12px;
  color: var(--gold);
}

.clock {
  font-size: 72px;
  font-weight: 900;
  margin: 18px 0 8px;
  letter-spacing: 0.04em;
  color: #fff4d2;
  font-variant-numeric: tabular-nums;
}

.modal-name {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 36px;
}

.modal-line {
  margin: 10px 0 22px;
  color: #ffd9b0;
  line-height: 1.7;
}

.primary {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 0;
  background: linear-gradient(90deg, #f3c87a, #e07040);
  color: #3a160e;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.identity-bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  color: #ffd9b0;
  font-size: 14px;
}

.identity-bar strong {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 22px;
  color: var(--gold);
  margin-left: 4px;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 4, 8, 0.82);
  backdrop-filter: blur(10px);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(760px, 100%);
  text-align: center;
  padding: 36px 28px 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, #4a1c1c, #1a0c10);
  border: 1px solid rgba(243, 200, 122, 0.5);
  box-shadow: 0 30px 80px rgba(255, 90, 30, 0.25);
}

.gate-card h2 {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 48px;
  margin: 10px 0 8px;
}

.gate-copy {
  color: #ffd9b0;
  margin-bottom: 22px;
}

.role-today {
  margin-top: 16px;
  letter-spacing: 0.28em;
  color: #ffd9b0;
  font-size: 14px;
}

.hidden-role {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 56px;
  line-height: 1.1;
  margin: 6px 0 10px;
  background: linear-gradient(180deg, #fff8e4 0%, #f3c87a 55%, #e07040 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.role-avatar {
  margin: 18px auto 8px;
}

.role-reveal {
  animation: revealPop 0.45s ease;
}

@keyframes revealPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.cast {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.cast-btn {
  border: 1px solid rgba(255, 214, 150, 0.28);
  background: linear-gradient(180deg, rgba(40, 16, 18, 0.72), rgba(16, 8, 12, 0.88));
  color: var(--paper);
  border-radius: 16px;
  padding: 18px 10px;
  cursor: pointer;
  font-family: inherit;
}

.cast-btn:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}

.cast-btn .avatar {
  width: 72px;
  height: 72px;
  font-size: 34px;
  margin: 0 auto 8px;
}

.cast-btn h3 {
  font-size: 24px;
}

.spinning .clock {
  animation: flicker 0.08s linear infinite;
}

@keyframes flicker {
  50% { opacity: 0.55; }
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .cast {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .stage {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 56px;
  }
  .clock {
    font-size: 52px;
  }
  footer {
    flex-direction: column;
  }
}
