:root {
  --page-bg: url("assets/images/episodes/ep01.png");
  --bg: #1a130d;
  --panel: rgba(32, 23, 15, .72);
  --panel-strong: rgba(34, 24, 16, .9);
  --glass: rgba(255, 236, 197, .12);
  --glass-line: rgba(255, 226, 172, .25);
  --text: #f7fbff;
  --muted: #d4c2a4;
  --soft: #fff4df;
  --gold: #d6ab60;
  --gold-strong: #f4d18c;
  --danger: #9f4e52;
  --blue: #d7b36d;
  --green: #88c9b0;
  --shadow: 0 24px 80px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(38, 25, 12, .18), rgba(18, 11, 5, .62)),
    var(--page-bg) center / cover no-repeat fixed;
  transition: background-image .45s ease;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.stage {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 12%, rgba(244, 209, 140, .26), transparent 28%),
    radial-gradient(circle at 88% 72%, rgba(215, 179, 109, .18), transparent 30%);
}

.phone {
  width: min(430px, 100%);
  height: min(900px, calc(100vh - 36px));
  min-height: 650px;
  position: relative;
  display: grid;
  grid-template-rows: 42px 1fr 74px;
  overflow: hidden;
  border: 10px solid rgba(3, 8, 13, .92);
  border-radius: 38px;
  background:
    linear-gradient(180deg, rgba(244, 209, 140, .08), transparent 18%),
    rgba(18, 12, 8, .84);
  box-shadow: var(--shadow);
}

.phone::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 5;
  width: 104px;
  height: 25px;
  transform: translateX(-50%);
  border-radius: 0 0 18px 18px;
  background: rgba(3, 8, 13, .98);
}

.status-bar {
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 2px;
  color: rgba(255, 255, 255, .86);
  font-size: 12px;
  letter-spacing: 0;
}

.status-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.signal {
  color: var(--gold-strong);
}

#bgmPlayer {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.bgm-toggle {
  min-width: 70px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(244, 209, 140, .38);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 236, 197, .09);
  font-size: 11px;
  line-height: 1;
}

.bgm-toggle.is-playing {
  color: #1b1209;
  border-color: rgba(244, 209, 140, .82);
  background: linear-gradient(135deg, var(--gold-strong), #f9e2ad);
  box-shadow: 0 6px 16px rgba(244, 209, 140, .2);
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 22px;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.phone.video-mode,
.phone:has(.video-stage) {
  grid-template-rows: 1fr;
}

.phone.video-mode .status-bar,
.phone.video-mode .tabbar,
.phone:has(.video-stage) .status-bar,
.phone:has(.video-stage) .tabbar {
  display: none;
}

.phone.video-mode .screen,
.phone:has(.video-stage) .screen {
  padding: 0;
  overflow: hidden;
  z-index: 90;
}

.tabbar {
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  background: rgba(22, 14, 8, .84);
  backdrop-filter: blur(18px);
}

.tabbar button {
  min-width: 0;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.tabbar button.active {
  color: #09111c;
  background: linear-gradient(135deg, var(--gold-strong), #f6e1af);
  box-shadow: 0 8px 20px rgba(217, 183, 119, .2);
}

.hero {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 18px;
  text-align: left;
}

.brand-mark {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--gold-strong);
  background: rgba(255, 255, 255, .08);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 44px;
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: 0;
}

h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  font-weight: 600;
}

.lead {
  color: var(--soft);
  font-size: 15px;
  line-height: 1.7;
}

.panel,
.card,
.choice,
.form-row,
.sms-item,
.meter-card {
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(20px);
}

.panel {
  padding: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.tiny {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.btn,
.choice {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--text);
  background: rgba(255, 255, 255, .1);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.btn {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
}

.btn.primary {
  border-color: rgba(242, 207, 136, .72);
  color: #08111c;
  background: linear-gradient(135deg, var(--gold-strong), #f7e2b0);
  font-weight: 700;
}

.btn.ghost {
  color: var(--gold-strong);
  background: rgba(217, 183, 119, .08);
}

.btn.inline {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

.btn:active,
.choice:active {
  transform: scale(.98);
}

.form-row {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.form-row label {
  color: var(--soft);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  color: var(--text);
  background: rgba(2, 9, 16, .6);
  padding: 0 12px;
  outline: none;
}

select option {
  color: #08111c;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.chip {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, .07);
}

.chip.selected {
  color: #08111c;
  border-color: var(--gold-strong);
  background: linear-gradient(135deg, var(--gold-strong), #f7e2b0);
}

.episode-kicker {
  color: var(--gold-strong);
  font-size: 12px;
  letter-spacing: .08em;
}

.teaser {
  min-height: 220px;
  display: grid;
  align-content: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(242, 207, 136, .24);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(54, 33, 14, .16), rgba(25, 15, 8, .9)),
    radial-gradient(circle at 78% 20%, rgba(244, 209, 140, .32), transparent 34%);
}

.media-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(242, 207, 136, .28);
  border-radius: 24px;
  background: rgba(12, 8, 5, .7);
}

.story-video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 520px;
  object-fit: cover;
  background: rgba(0, 0, 0, .48);
}

.media-fallback {
  display: none;
  gap: 6px;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.media-fallback strong {
  display: block;
  color: var(--gold-strong);
  font-size: 13px;
}

.media-missing .story-video {
  display: none;
}

.media-missing .stage-video {
  display: none;
}

.media-missing .media-fallback {
  display: grid;
}

.video-stage {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(16, 10, 5, .18), rgba(10, 6, 3, .82)),
    var(--page-bg) center / cover no-repeat;
}

.stage-video {
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  background: #000;
  box-shadow: 0 0 80px rgba(0, 0, 0, .45);
}

.skip-video {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 1000;
  min-width: 72px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(244, 209, 140, .64);
  border-radius: 999px;
  color: #1b1209;
  background: linear-gradient(135deg, rgba(244, 209, 140, .94), rgba(255, 235, 184, .9));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  font-size: 13px;
  font-weight: 700;
}

.video-fallback {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 86;
  width: min(360px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 1px solid rgba(255, 226, 172, .28);
  border-radius: 22px;
  background: rgba(18, 12, 8, .82);
  backdrop-filter: blur(18px);
}

.scene-text {
  min-height: 250px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 20px;
  color: var(--soft);
  font-size: 17px;
  line-height: 1.85;
}

.scene-detail {
  display: grid;
  gap: 8px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 226, 172, .18);
  border-radius: 18px;
  color: var(--soft);
  background: rgba(255, 236, 197, .07);
  line-height: 1.75;
}

.scene-detail b {
  color: var(--gold-strong);
  font-size: 13px;
}

.scene-detail p {
  color: var(--soft);
  font-size: 14px;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  min-height: 58px;
  padding: 13px 15px;
  text-align: left;
  line-height: 1.5;
}

.choice:hover {
  border-color: rgba(242, 207, 136, .55);
  background: rgba(217, 183, 119, .1);
}

.choice small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.cast-grid {
  display: grid;
  gap: 10px;
}

.cast-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, .08);
}

button.cast-card {
  width: 100%;
}

button.cast-card:hover {
  border-color: rgba(242, 207, 136, .55);
  background: rgba(217, 183, 119, .1);
}

.avatar {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: #07111c;
  background: linear-gradient(135deg, var(--gold-strong), var(--blue));
  font-weight: 700;
}

.poster-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-thumb span {
  position: relative;
  z-index: 1;
}

.cast-card.locked .avatar {
  color: var(--gold-strong);
  background: rgba(255, 255, 255, .08);
}

.tagline {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cast-detail {
  display: grid;
  gap: 16px;
}

.poster-frame {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid rgba(242, 207, 136, .24);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(244, 209, 140, .14), rgba(22, 14, 8, .82)),
    rgba(255, 255, 255, .06);
}

.poster-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.poster-empty {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  color: var(--gold-strong);
  font-size: 80px;
  font-weight: 700;
}

.poster-frame.is-empty .poster-empty {
  display: grid;
}

.profile-section {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(255, 226, 172, .16);
  border-radius: 16px;
  background: rgba(255, 236, 197, .07);
}

.profile-section b {
  color: var(--gold-strong);
  font-size: 13px;
}

.sms-item {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.sms-item.from-me {
  border-color: rgba(136, 201, 176, .32);
  background: rgba(51, 99, 83, .25);
}

.sms-item.special {
  border-color: rgba(159, 78, 82, .45);
  background: rgba(82, 24, 31, .4);
}

.sms-meta {
  color: var(--gold-strong);
  font-size: 12px;
}

.meter-card {
  padding: 14px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 14px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--gold-strong));
}

.bar.danger span {
  background: linear-gradient(90deg, var(--danger), var(--gold-strong));
}

.summary-line {
  padding: 12px 14px;
  border-left: 3px solid var(--gold-strong);
  border-radius: 14px;
  color: var(--soft);
  background: rgba(255, 255, 255, .08);
  line-height: 1.6;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.report-score,
.report-section {
  border: 1px solid rgba(255, 226, 172, .18);
  border-radius: 16px;
  background: rgba(255, 236, 197, .08);
}

.report-score {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.report-score span {
  color: var(--soft);
  font-size: 13px;
}

.report-score strong {
  color: var(--gold-strong);
  font-size: 14px;
}

.report-score small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.report-section {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.report-section b {
  color: var(--gold-strong);
  font-size: 13px;
}

.ending-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(242, 207, 136, .35);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(217, 183, 119, .16), rgba(9, 24, 38, .88)),
    var(--panel-strong);
}

.final-letter {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-color: rgba(244, 209, 140, .32);
  background:
    linear-gradient(180deg, rgba(255, 244, 223, .12), rgba(32, 23, 15, .86)),
    var(--panel);
}

.final-letter p:not(.episode-kicker) {
  margin: 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.9;
}

@media (max-width: 520px) {
  .stage {
    padding: 0;
  }

  .phone {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .phone::before {
    display: none;
  }

  h1 {
    font-size: 40px;
  }
}
