/* =====================================================================
 * HOAN LẠC TRẤN — giao diện prologue (vertical slice)
 * Tone: u tối pha dân gian Việt. Không dùng asset tu tiên cũ.
 * Prefix class: wx-
 * ===================================================================== */

.wx-prologue {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(ellipse at 50% 120%, #2a2118 0%, #14100b 55%, #0a0806 100%);
  color: #e8dcc4;
  font-family: "Noto Serif", "Times New Roman", serif;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
}

/* --- thẻ mở đầu --- */
.wx-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}
.wx-card-title {
  font-size: 15px;
  letter-spacing: 10px;
  color: #a89468;
  margin-bottom: 14px;
}
.wx-card-sub {
  font-size: 26px;
  letter-spacing: 3px;
  color: #f0e4c8;
  margin-bottom: 18px;
}
.wx-card-line {
  font-size: 16px;
  font-style: italic;
  color: #b8a888;
  max-width: 560px;
  line-height: 1.7;
}

/* --- khung thoại --- */
.wx-dialog {
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 6vh;
  width: min(680px, 92vw);
  background: rgba(16, 12, 8, 0.92);
  border: 1px solid #5a4a32;
  border-top: 3px solid #8a6f45;
  border-radius: 4px;
  padding: 18px 22px 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
}
.wx-speaker {
  font-size: 14px;
  letter-spacing: 2px;
  color: #d8b96a;
  margin-bottom: 8px;
}
.wx-text {
  font-size: 17px;
  line-height: 1.75;
  color: #ece0c6;
  min-height: 60px;
  white-space: pre-line;
}
.wx-next-hint {
  text-align: center;
  font-size: 12px;
  color: #7a6a4e;
  margin-top: 10px;
  letter-spacing: 4px;
}

/* --- lựa chọn --- */
.wx-choices {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 32vh;
  width: min(560px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wx-choice {
  background: rgba(24, 18, 12, 0.95);
  border: 1px solid #6a5638;
  border-radius: 4px;
  padding: 12px 18px;
  text-align: left;
  cursor: pointer;
  color: #e8dcc4;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.wx-choice:hover {
  border-color: #d8b96a;
  background: rgba(48, 36, 22, 0.95);
}
.wx-choice-label {
  font-size: 16px;
  color: #f0e4c8;
}
.wx-choice-hint {
  font-size: 13px;
  color: #9a8a68;
  margin-top: 4px;
  font-style: italic;
}

@media (max-width: 600px) {
  .wx-card-sub { font-size: 20px; }
  .wx-text { font-size: 15px; }
  .wx-dialog { bottom: 3vh; padding: 14px 16px 10px; }
}

/* --- nền theo beat (data-bg do wx_prologue_player.js đặt) --- */
.wx-prologue[data-bg="mieu_hoang_dem_mua"] {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(196, 120, 52, 0.22) 0%, rgba(196, 120, 52, 0) 38%),
    linear-gradient(180deg, #0b1316 0%, #121c1f 55%, #0a0d0e 100%);
}
.wx-prologue[data-bg="tieu_cuc_do_nat_sang_som"] {
  background:
    radial-gradient(ellipse at 50% 105%, rgba(150, 70, 30, 0.35) 0%, rgba(150, 70, 30, 0) 55%),
    linear-gradient(180deg, #2a2a2c 0%, #3a3430 48%, #17110d 100%);
}
.wx-prologue[data-bg="mo_kiem_son_xa"] {
  background: linear-gradient(180deg, #0a0d14 0%, #19202c 62%, #0d1016 100%);
}
.wx-prologue[data-bg="mo_kiem_son_xa"]::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 46%;
  background: #07090d;
  clip-path: polygon(0 100%, 0 62%, 14% 38%, 27% 58%, 41% 24%, 55% 52%, 70% 30%, 84% 56%, 100% 40%, 100% 100%);
  opacity: 0.9;
  pointer-events: none;
}
/* mưa rơi chéo nhẹ: bỏ khi người dùng chọn giảm chuyển động */
.wx-prologue[data-bg="mieu_hoang_dem_mua"]::after,
.wx-prologue[data-bg="mo_kiem_son_xa"]::after {
  content: "";
  position: absolute;
  inset: -20% 0 0 0;
  background: repeating-linear-gradient(105deg, rgba(180, 200, 210, 0.07) 0 1px, transparent 1px 22px);
  animation: wx-rain 0.9s linear infinite;
  pointer-events: none;
}
@keyframes wx-rain { to { transform: translate(-22px, 22px); } }
@media (prefers-reduced-motion: reduce) {
  .wx-prologue[data-bg]::after { animation: none; }
}

/* --- chân dung người nói + nút bỏ qua --- */
.wx-dialog.has-portrait { padding-left: 96px; min-height: 96px; }
.wx-portrait {
  position: absolute;
  left: 16px; top: 16px;
  width: 64px; height: 64px;
  image-rendering: pixelated;
  border: 1px solid #5a4a32;
  border-radius: 4px;
  background: #0d0b09;
}
.wx-skip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2;
  background: rgba(16, 12, 8, 0.7);
  border: 1px solid #5a4a32;
  border-radius: 14px;
  color: #b9a888;
  font-size: 13px;
  line-height: 1;
  font-family: inherit;
  padding: 8px 14px;
  cursor: pointer;
}
.wx-skip:hover, .wx-skip:focus-visible { color: #f0e4c8; border-color: #d8b96a; }
@media (max-width: 600px) {
  .wx-dialog.has-portrait { padding-left: 84px; }
  .wx-portrait { width: 56px; height: 56px; left: 14px; top: 14px; }
}
