:root {
  color-scheme: dark;
  --ink: #f7f3ec;
  --muted: #bcc5cf;
  --panel: rgba(7, 10, 14, 0.72);
  --panel-strong: rgba(8, 11, 16, 0.94);
  --line: rgba(255, 255, 255, 0.18);
  --gold: #d8b46a;
  --red: #b9454f;
  --blue: #87b6ff;
  --green: #67d0ba;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #06080b;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
}

.app,
.stage {
  min-height: 100vh;
}

.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.stage > img {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background:
    radial-gradient(circle at 55% 35%, rgba(255, 255, 255, 0.08), transparent 44%),
    linear-gradient(135deg, #0d131a, #05070a 62%, #15110f);
}

.shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 40%, rgba(0, 0, 0, 0.38)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.26), transparent 38%, rgba(0, 0, 0, 0.22));
}

.hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.kicker,
.label {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 5vw, 64px);
  line-height: 0.96;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.62);
}

.brand-title {
  display: inline-flex;
  max-width: min(920px, 92vw);
  align-items: baseline;
  gap: 0.16em;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif CJK SC", "SimSun", serif;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-wrap: balance;
}

.brand-title span:last-child {
  background: linear-gradient(180deg, #ffffff 0%, #f7e7bd 42%, #cfa65d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.72));
}

.plane-mark {
  color: var(--gold);
  font-size: 0.62em;
  line-height: 1;
  transform: translateY(-0.14em) rotate(-12deg);
  filter: drop-shadow(0 4px 14px rgba(216, 180, 106, 0.48));
}

.hud-title {
  font-size: clamp(28px, 4.1vw, 56px);
}

.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background: #05070a;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.cover-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-screen > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cover-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 34% 86%, rgba(255, 206, 132, 0.1), transparent 22%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04), transparent 50%, rgba(0, 0, 0, 0.42)),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.08) 68%, rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

.cover-copy {
  position: absolute;
  right: clamp(20px, 5vw, 78px);
  bottom: clamp(28px, 8vh, 90px);
  width: min(520px, calc(100vw - 40px));
  padding: 18px 18px 20px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.28) 28%, rgba(0, 0, 0, 0.48));
  text-align: right;
}

.cover-copy .brand-title {
  justify-content: flex-end;
  margin: 0 0 14px;
  font-size: clamp(38px, 6.6vw, 86px);
  line-height: 0.95;
}

.cover-line {
  max-width: 520px;
  margin: 0 0 22px;
  margin-left: auto;
  color: rgba(255, 248, 236, 0.88);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.7;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.9);
}

.start-btn {
  min-width: 156px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(216, 180, 106, 0.78);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(216, 180, 106, 0.34), rgba(128, 40, 47, 0.35));
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.start-btn:hover {
  border-color: #fff1c2;
  color: #fff1c2;
}

.actions {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.62);
  backdrop-filter: blur(12px);
}

.actions button,
.actions a,
.drawer-head button,
.next-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 800;
}

.actions button {
  min-width: 48px;
  padding: 0 10px;
}

.actions a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  text-decoration: none;
}

.actions button:hover,
.actions a:hover,
.drawer-head button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.scene-badge {
  position: absolute;
  left: 22px;
  top: 124px;
  z-index: 4;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(7, 10, 15, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.dialogue {
  position: absolute;
  left: clamp(14px, 4vw, 56px);
  right: clamp(14px, 4vw, 56px);
  bottom: clamp(10px, 2vw, 22px);
  z-index: 6;
  width: min(820px, calc(100% - 28px));
  min-height: 118px;
  max-height: 31vh;
  margin: 0 auto;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.dialogue::before {
  content: "";
  display: block;
  height: 2px;
  margin: 0 8px 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.dialogue-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.cg-hint {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.dialogue h2 {
  width: fit-content;
  margin: 6px 0 8px;
  padding: 5px 10px;
  border-left: 4px solid var(--gold);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: clamp(17px, 1.5vw, 22px);
}

.speaker-line {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

#sceneText {
  margin-bottom: 0;
  color: #fff8ec;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.58;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.next-btn {
  min-width: 118px;
  margin-top: 10px;
  border-color: rgba(216, 180, 106, 0.48);
  background: rgba(216, 180, 106, 0.2);
}

.next-btn:hover {
  border-color: var(--gold);
}

.choices {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(760px, calc(100% - 30px));
  display: grid;
  gap: 12px;
  transform: translate(-50%, -50%);
}

.choices:empty { display: none; }

.choice {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.7);
  color: #fff;
  text-align: left;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}

.choice:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.choice b {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--gold);
  color: #17110a;
}

.choice strong,
.choice span {
  display: block;
}

.choice span {
  color: var(--muted);
  line-height: 1.5;
}

.outcome {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(216, 180, 106, 0.35);
  border-radius: 8px;
  background: rgba(216, 180, 106, 0.1);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(440px, 100%);
  height: 100vh;
  padding: 18px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: -22px 0 60px rgba(0, 0, 0, 0.46);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.drawer.open { transform: translateX(0); }

.log-drawer {
  left: 0;
  right: auto;
  border-left: 0;
  border-right: 1px solid var(--line);
  transform: translateX(-102%);
}

.gallery-drawer {
  width: min(760px, 100%);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.cards,
.gallery {
  display: grid;
  gap: 10px;
}

.character-card,
.profile-card,
.meter,
.gallery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.character-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  color: #fff;
  text-align: left;
}

.character-card.active,
.character-card:hover {
  border-color: var(--gold);
}

.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f2837, var(--red));
  color: #fff;
  font-weight: 900;
}

.character-card strong,
.character-card span {
  display: block;
}

.character-card span,
.profile-card p,
#logList {
  color: var(--muted);
  line-height: 1.55;
}

.profile-card {
  margin-top: 14px;
  padding: 14px;
}

.fit {
  padding: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #edf1f5 !important;
}

.meters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.meter {
  padding: 12px;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meter strong {
  display: block;
  margin: 4px 0 8px;
  font-size: 24px;
}

.meter i {
  display: block;
  width: 0%;
  height: 7px;
  border-radius: 99px;
  background: var(--blue);
}

.meter:nth-child(2) i { background: var(--green); }
.meter:nth-child(3) i { background: var(--gold); }
.meter:nth-child(4) i { background: var(--red); }

.rank {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(216, 180, 106, 0.16);
  color: var(--gold);
  font-weight: 900;
}

#logList {
  margin: 16px 0 0;
  padding-left: 20px;
}

#logList li { margin-bottom: 12px; }

.gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-card {
  overflow: hidden;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.gallery-card p {
  margin: 0;
  padding: 10px;
  color: #fff;
  font-weight: 800;
}

.settings-card input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.volume-control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  color: #fff;
  font-weight: 900;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.settings-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(216, 180, 106, 0.45);
  border-radius: 6px;
  background: rgba(216, 180, 106, 0.18);
  color: #fff;
  font-weight: 900;
}

.settings-note,
.credit-card p,
.credit-card li {
  color: var(--muted);
  line-height: 1.55;
}

.credits-list {
  display: grid;
  gap: 12px;
}

.credit-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.credit-card h3 {
  margin: 0 0 6px;
  color: #fff;
}

.credit-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.credit-meta {
  margin-bottom: 6px;
  color: var(--gold) !important;
  font-weight: 800;
}

body.hide-ui .hud,
body.hide-ui .scene-badge,
body.hide-ui .dialogue,
body.hide-ui .choices {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .cover-copy {
    right: 18px;
    left: 18px;
    bottom: 28px;
    width: auto;
    text-align: left;
  }
  .cover-copy .brand-title {
    justify-content: flex-start;
    font-size: clamp(34px, 12vw, 54px);
  }
  .cover-line {
    margin-left: 0;
  }
  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
    flex-direction: column;
  }
  .actions {
    width: 100%;
    overflow-x: auto;
  }
  .scene-badge {
    top: 148px;
    left: 10px;
  }
  .dialogue {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-height: 38vh;
  }
  .choices { top: 44%; }
  .gallery,
  .meters {
    grid-template-columns: 1fr;
  }
}
