/* ========== 妖怪夜市 · 像素舞台剧 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --wood-dark: #3a1f1f;
  --curtain: #7a1024;
  --gold: #ffd77a;
  --ink: #17102b;
}

html, body {
  height: 100%;
  background: radial-gradient(ellipse at 50% 30%, #1b1030 0%, #0a0616 70%);
  font-family: "Zpix", "DotGothic16", "SimSun", "MS Gothic", monospace;
  overflow: hidden;
  color: #f5ead0;
}

#theater {
  position: relative;
  width: min(96vw, calc(96vh * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ink);
  border: 6px solid var(--wood-dark);
  border-radius: 8px;
  box-shadow: 0 0 0 3px #12091f, 0 0 60px rgba(255, 120, 60, .15), inset 0 0 80px rgba(0,0,0,.6);
  overflow: hidden;
}

/* ---------- 像素舞台 ---------- */
#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- 幕布 ---------- */
.curtain {
  position: absolute;
  top: 0; bottom: 0;
  width: 52%;
  z-index: 30;
  background:
    repeating-linear-gradient(90deg,
      #8e1630 0 26px, #6b0f24 26px 52px);
  border-bottom: 10px solid #5c0c1e;
  transition: transform 2.2s cubic-bezier(.7, 0, .3, 1);
  box-shadow: inset 0 -40px 60px rgba(0,0,0,.5);
}
#curtain-left  { left: 0;  border-right: 4px solid #4a0a18; }
#curtain-right { right: 0; border-left:  4px solid #4a0a18; }
.theater-open #curtain-left  { transform: translateX(-105%); }
.theater-open #curtain-right { transform: translateX(105%); }

/* ---------- 字幕 ---------- */
#subtitle {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  width: 78%;
  min-height: 13%;
  z-index: 20;
  background: rgba(16, 8, 30, .88);
  border: 3px solid #c9a24f;
  border-radius: 6px;
  padding: 1.1% 2% 1.6%;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  animation: subIn .25s ease-out;
}
@keyframes subIn {
  from { transform: translateX(-50%) translateY(14px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
#speaker {
  display: inline-block;
  position: relative;
  top: -1.6em;
  background: var(--gold);
  color: #4a2800;
  font-weight: bold;
  font-size: clamp(10px, 1.6vw, 16px);
  padding: 2px 12px;
  border-radius: 4px;
  letter-spacing: 2px;
}
#line {
  font-size: clamp(12px, 2.1vw, 22px);
  line-height: 1.7;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(0,0,0,.6);
  white-space: pre-wrap;
}
#next-hint {
  position: absolute;
  right: 12px;
  bottom: 6px;
  font-size: clamp(8px, 1.2vw, 12px);
  color: #c9a24f;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 幕标题 ---------- */
#act-title {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(8, 4, 18, .55);
  pointer-events: none;
  animation: actFade 2.8s ease forwards;
}
@keyframes actFade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
#act-title-text {
  font-size: clamp(22px, 4.6vw, 52px);
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 200, 90, .55), 0 3px 0 #000;
}
#act-sub-text {
  margin-top: 12px;
  font-size: clamp(10px, 1.6vw, 18px);
  letter-spacing: 4px;
  color: #d8c9a8;
  opacity: .85;
}

/* ---------- 开演遮罩 ---------- */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(60, 20, 60, .88), rgba(8, 4, 16, .97));
  transition: opacity .8s ease;
}
#overlay.gone { opacity: 0; pointer-events: none; }
.overlay-inner { text-align: center; }
.overlay-inner h1 {
  font-size: clamp(28px, 6vw, 68px);
  letter-spacing: .35em;
  text-indent: .35em;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 160, 60, .6), 0 4px 0 #5a2a00;
  animation: glow 2.4s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { text-shadow: 0 0 18px rgba(255,160,60,.35), 0 4px 0 #5a2a00; }
  50%      { text-shadow: 0 0 42px rgba(255,180,80,.8),  0 4px 0 #5a2a00; }
}
.overlay-inner .en { margin-top: 10px; letter-spacing: 6px; color: #b99ad0; font-size: clamp(9px, 1.4vw, 15px); }
.overlay-inner .intro { margin: 22px 0; line-height: 2; color: #d8c9a8; font-size: clamp(10px, 1.6vw, 17px); }
#start-btn {
  font-family: inherit;
  font-size: clamp(14px, 2.2vw, 24px);
  letter-spacing: 8px;
  padding: 12px 44px;
  color: #2a1400;
  background: linear-gradient(#ffd77a, #e8a33d);
  border: 3px solid #8a5a10;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 5px 0 #6b430c, 0 10px 24px rgba(0,0,0,.5);
  transition: transform .1s, box-shadow .1s;
}
#start-btn:hover { transform: translateY(-2px); }
#start-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #6b430c; }
.overlay-inner .tip { margin-top: 18px; font-size: clamp(8px, 1.2vw, 13px); color: #8a7a9c; }

/* ---------- 控制条 ---------- */
#controls {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 22;
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: clamp(8px, 1.3vw, 13px);
  color: #d8c9a8;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
#act-indicator { color: var(--gold); letter-spacing: 2px; }

.hidden { display: none !important; }
