:root {
  --ink: #ecfbff;
  --muted: #9cb8c1;
  --blue: #65d7ff;
  --cyan: #2fe4ff;
  --magenta: #ff4fb8;
  --amber: #ffd37a;
  --warm: #ffb85d;
  --panel: rgba(7, 16, 22, 0.52);
  --panel-strong: rgba(8, 18, 25, 0.88);
  --line: rgba(140, 238, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #061117;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
}

button,
textarea {
  font: inherit;
}

.game-shell {
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 184, 93, 0.18), transparent 28%),
    radial-gradient(circle at 76% 20%, rgba(255, 79, 184, 0.12), transparent 24%),
    linear-gradient(145deg, #07151d, #101a2a 55%, #1a1020);
}

.game-stage {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: transparent;
}

.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(5, 8, 14, 0.46) 86%),
    linear-gradient(180deg, rgba(11, 28, 37, 0.05), rgba(4, 8, 12, 0.34));
  z-index: 2;
}

.hud,
.prompt-panel,
.ending-panel,
.start-card,
.note-card,
.controls-hint {
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hud {
  position: absolute;
  z-index: 5;
  padding: 12px;
  background: var(--panel);
}

.top-left {
  top: 18px;
  left: 18px;
  width: min(330px, calc(100vw - 36px));
}

.top-right {
  top: 18px;
  right: 18px;
  width: 285px;
}

.kicker {
  margin: 0 0 7px;
  color: var(--amber);
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 32px);
}

.resource-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
}

.resource-row span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 211, 122, 0.28);
  background: rgba(255, 184, 93, 0.08);
  color: #ffe5aa;
}

.mini-action {
  min-height: 32px;
  margin-top: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(101, 215, 255, 0.22);
  background: rgba(101, 215, 255, 0.08);
  color: #d4eef5;
  cursor: pointer;
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trace-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.trace-list li {
  border-left: 2px solid rgba(101, 215, 255, 0.5);
  padding-left: 9px;
}

.trace-kicker {
  margin-top: 16px;
}

.quest-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #b8cbd1;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 13px;
}

.quest-list li {
  position: relative;
  min-height: 28px;
  padding: 6px 9px 6px 28px;
  border: 1px solid rgba(101, 215, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
}

.quest-list li::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 211, 122, 0.7);
  background: rgba(255, 211, 122, 0.08);
}

.quest-list li.done {
  color: #ffe5aa;
  border-color: rgba(255, 211, 122, 0.26);
  background: rgba(255, 184, 93, 0.08);
}

.quest-list li.done::before {
  background: #ffd37a;
  box-shadow: 0 0 16px rgba(255, 211, 122, 0.7);
}

.prompt-panel {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 126px;
  width: min(680px, calc(100vw - 36px));
  transform: translateX(-50%);
  padding: 18px;
  background: var(--panel-strong);
}

.prompt-title {
  margin: 0 0 7px;
  color: #fff7dd;
  font-size: 20px;
}

.prompt-body {
  margin: 0;
  color: #c8dce3;
  line-height: 1.75;
}

.prompt-dismiss {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0 auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 12px;
}

.prompt-dismiss:hover,
.prompt-dismiss:focus-visible {
  color: #fff7dd;
}

.prompt-dismiss kbd {
  padding: 3px 7px;
  border: 1px solid rgba(101, 215, 255, 0.28);
  background: rgba(101, 215, 255, 0.08);
  color: #d4eef5;
  font: inherit;
}

.prompt-actions,
.modal-actions,
.ending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.primary-action,
.ghost-action,
.link-action,
.preset-notes button {
  min-height: 40px;
  border: 1px solid rgba(255, 211, 122, 0.28);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.primary-action {
  background: linear-gradient(135deg, rgba(255, 184, 93, 0.95), rgba(255, 79, 184, 0.78));
  color: #091018;
}

.ghost-action,
.link-action,
.preset-notes button {
  background: rgba(101, 215, 255, 0.08);
}

.prompt-actions button,
.modal-actions button,
.ending-actions button,
.ending-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
}

.start-panel,
.ending-panel,
.note-modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(3, 9, 14, 0.62);
}

.start-panel[hidden],
.ending-panel[hidden],
.note-modal[hidden] {
  display: none;
}

.start-panel {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 184, 93, 0.14), transparent 28%),
    rgba(3, 9, 14, 0.7);
}

.start-card {
  width: min(640px, calc(100vw - 36px));
  padding: 30px;
  background: var(--panel-strong);
}

.start-card h2 {
  font-size: clamp(30px, 5vw, 56px);
}

.start-card p {
  color: #c8dce3;
  line-height: 1.8;
  margin: 16px 0 22px;
}

.ending-panel {
  inset: 50%;
  width: min(560px, calc(100vw - 36px));
  height: max-content;
  transform: translate(-50%, -50%);
  padding: 28px;
  background: var(--panel-strong);
}

.ending-panel p {
  color: #c8dce3;
  line-height: 1.7;
}

.ending-panel ul {
  padding-left: 18px;
  color: #ffe5aa;
  line-height: 1.8;
}

.note-card {
  width: min(620px, calc(100vw - 36px));
  padding: 24px;
  background: var(--panel-strong);
}

textarea {
  width: 100%;
  min-height: 96px;
  margin: 16px 0 10px;
  resize: vertical;
  border: 1px solid rgba(101, 215, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 13px;
  outline: none;
}

.preset-notes {
  display: grid;
  gap: 8px;
}

.preset-notes button {
  padding: 9px 12px;
  text-align: left;
}

.note-warning {
  min-height: 20px;
  color: #ffb0b0;
}

.controls-hint {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: rgba(7, 18, 26, 0.46);
  color: var(--muted);
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 12px;
}

.controls-hint span {
  border: 1px solid rgba(101, 215, 255, 0.18);
  padding: 6px 8px;
}

@media (max-width: 780px) {
  .top-right {
    display: none;
  }

  .top-left {
    padding: 12px;
  }

  .prompt-panel {
    bottom: 118px;
    padding: 14px;
  }

  .controls-hint {
    left: 18px;
    right: 18px;
  }
}

.prompt-actions button.is-selected {
  outline: 2px solid rgba(255, 247, 221, 0.86);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(255, 211, 122, 0.16), 0 0 24px rgba(255, 184, 93, 0.22);
}


.guide-toggle {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 211, 122, 0.32);
  background: rgba(7, 18, 26, 0.62);
  color: #ffe5aa;
  cursor: pointer;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
}

.top-right .guide-content {
  margin-top: 12px;
}

.top-right.is-collapsed {
  width: 112px;
  padding: 8px;
  background: rgba(7, 18, 26, 0.4);
}

.top-right.is-collapsed .guide-content {
  display: none;
}


.lower-left {
  left: 18px;
  bottom: 82px;
  width: min(280px, calc(100vw - 36px));
}

.global-light {
  color: #ffe5aa;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 13px;
}

.light-meter {
  height: 8px;
  margin: 8px 0 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 211, 122, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.light-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(101, 215, 255, 0.8), rgba(255, 211, 122, 0.95));
  box-shadow: 0 0 18px rgba(255, 211, 122, 0.42);
  transition: width 500ms ease;
}

.online-list {
  display: grid;
  gap: 7px;
  max-height: 128px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  color: #c8dce3;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 12px;
}

.online-list li {
  border-left: 2px solid rgba(101, 215, 255, 0.52);
  padding-left: 8px;
}

.identity-panel,
.cutscene-panel {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(3, 9, 14, 0.72);
}

.cutscene-panel {
  place-items: end center;
  padding: 24px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 9, 14, 0.36), transparent 30%),
    linear-gradient(0deg, rgba(3, 9, 14, 0.82), transparent 48%);
}

.cutscene-panel .cutscene-card {
  width: min(900px, calc(100vw - 32px));
  padding: 18px 22px;
  pointer-events: auto;
  background: rgba(5, 13, 18, 0.78);
  animation: cutscene-caption-in 700ms ease-out both;
}

.cutscene-panel .cutscene-card h2 {
  margin: 4px 0 6px;
  font-size: clamp(24px, 3.5vw, 38px);
}

.cutscene-panel .cutscene-card p {
  margin: 0 0 12px;
}

.cutscene-card .primary-action,
.cutscene-card .ghost-action {
  transition: opacity 350ms ease, transform 350ms ease;
}

.cutscene-card .primary-action[hidden],
.cutscene-card .ghost-action[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

@keyframes cutscene-caption-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.identity-panel[hidden],
.cutscene-panel[hidden] {
  display: none;
}

.identity-card,
.cutscene-card,
.story-reward {
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  background: var(--panel-strong);
}

.identity-card,
.cutscene-card {
  width: min(720px, calc(100vw - 36px));
  padding: 28px;
}

.identity-card {
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.identity-card h2,
.cutscene-card h2 {
  font-size: clamp(28px, 4.5vw, 48px);
}

.identity-card p,
.cutscene-card p {
  color: #c8dce3;
  line-height: 1.75;
}

.identity-card label {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: #ffe5aa;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 13px;
}

.identity-card input {
  min-height: 42px;
  border: 1px solid rgba(101, 215, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.identity-fieldset {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.identity-fieldset legend {
  margin-bottom: 8px;
  color: #ffe5aa;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 13px;
}

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

.appearance-card {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(101, 215, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #c8dce3;
  cursor: pointer;
  text-align: center;
}

.appearance-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 211, 122, 0.18);
  background: radial-gradient(circle at 50% 38%, rgba(101, 215, 255, 0.12), rgba(3, 9, 14, 0.7));
  image-rendering: pixelated;
}

.appearance-card strong {
  font-size: 12px;
  font-weight: 500;
}

.appearance-card.is-selected {
  border-color: rgba(255, 211, 122, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 211, 122, 0.12), 0 0 24px rgba(255, 184, 93, 0.2);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.role-card {
  display: grid;
  grid-template-columns: 82px 1fr;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 100px;
  padding: 10px;
  border: 1px solid rgba(101, 215, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #c8dce3;
  cursor: pointer;
  text-align: left;
}

.role-card img {
  grid-row: 1 / span 2;
  width: 82px;
  height: 82px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 211, 122, 0.18);
  image-rendering: pixelated;
}

.role-card strong {
  align-self: end;
}

.role-card span {
  font-size: 11px;
  line-height: 1.45;
}

.role-card.is-selected {
  border-color: rgba(255, 211, 122, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 211, 122, 0.12), 0 0 24px rgba(255, 184, 93, 0.2);
}

.story-reward {
  margin-top: 18px;
  padding: 16px;
}

.story-reward h3 {
  margin: 0 0 8px;
  color: #fff7dd;
  font-weight: 500;
}

.story-reward p {
  margin: 0 0 8px;
}

.light-progress {
  color: #ffe5aa !important;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 13px;
}

@media (max-width: 780px) {
  .lower-left {
    display: none;
  }

  .role-grid {
    grid-template-columns: 1fr;
  }

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


.primary-action:disabled,
.ghost-action:disabled,
.role-card:disabled,
.appearance-card:disabled,
.identity-card button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.45);
}
