:root {
  --ink: #152033;
  --paper: #f4f7fc;
  --muted: #5a6a80;
  --accent: #5b9dff;
  --accent-deep: #3d6fbf;
  --pink: #ff8fb8;
  --teal: #5ec4b2;
  --night: #0b1a33;
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-b);
  color: var(--ink);
  font-size: 20px;
  line-height: 1.6;
  background: #081422;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 560px) {
  body { font-size: 21px; }
}

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 50% 40% at 20% 0%, rgba(91, 157, 255, 0.28), transparent 55%),
    radial-gradient(ellipse 45% 35% at 90% 15%, rgba(255, 143, 184, 0.2), transparent 50%),
    linear-gradient(165deg, #122848 0%, #0b1a33 55%, #07101f 100%);
}

.topbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: #eef3fa;
}

.back { color: #9ec8ff; text-decoration: none; font-weight: 700; }

.brand { display: flex; gap: 0.7rem; align-items: center; flex: 1; }

.mark-img {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255, 143, 184, 0.55);
  box-shadow: 0 8px 24px rgba(91, 157, 255, 0.35);
}

.brand h1 { margin: 0; font-family: var(--font-d); font-size: 1.55rem; }
.brand p { margin: 0; font-size: 0.95rem; opacity: 0.75; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1rem 3.5rem;
}

@media (max-width: 560px) {
  .topbar { padding: 0.85rem 0.85rem 0.35rem; }
  main { padding: 0.35rem 0.75rem 3.5rem; }
  .brand h1 { font-size: 1.4rem; }
}

.panel {
  background: var(--paper);
  border-radius: 18px;
  padding: 1.4rem 1.35rem;
  max-width: 640px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.setup-cover-wrap {
  margin: -1.4rem -1.35rem 1rem;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  max-height: 200px;
}
.setup-cover {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center 30%;
}

.setup-hero {
  display: grid;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
@media (min-width: 560px) {
  .setup-hero { grid-template-columns: 140px 1fr; }
}

.setup-portrait {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(91, 157, 255, 0.35);
  box-shadow: 0 10px 28px rgba(11, 26, 51, 0.25);
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-d);
  font-size: 1.95rem;
  color: var(--accent-deep);
}

.lede { margin: 0 0 0.8rem; color: var(--muted); }
.setup-points {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.setup-points li { margin-bottom: 0.35rem; }

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 14px;
  padding: 0.75rem 1.3rem;
}
.btn.primary {
  background: linear-gradient(145deg, #7eb6ff, #5b9dff);
  color: #061018;
}
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid #d0d8e6;
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #eef3fa;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.layout { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 300px; }
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef3fa;
}
.chap { font-family: var(--font-d); color: #ffb3d0; font-size: 1.2rem; }

.scene-frame {
  margin: 0.75rem 0 0;
  border-radius: 18px;
  overflow: hidden;
  background: #0a1424;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  position: relative;
}
.scene-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0a1424;
}
.scene-frame .kicker {
  position: absolute;
  left: 0.85rem;
  bottom: 0.7rem;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(8, 16, 28, 0.72);
  color: #9ec8ff;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.story-card {
  margin-top: 0.75rem;
  padding: 1.25rem 1.2rem 1.4rem;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  animation: rise 0.35s ease;
}

@media (max-width: 560px) {
  .story-card { padding: 1.15rem 1rem 1.3rem; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.kicker {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--teal);
}
.kicker.light { color: #9ec8ff; }

.story-text {
  font-size: 1.2rem;
  line-height: 1.85;
  color: var(--ink);
  max-height: min(58vh, 620px);
  overflow-y: auto;
  padding-right: 0.35rem;
}
.result-text {
  margin: 0 0 0.9rem;
  font-size: 1.12rem;
  line-height: 1.8;
  color: #dce4ef;
  max-height: min(42vh, 420px);
  overflow-y: auto;
}

@media (max-width: 560px) {
  .story-text {
    font-size: 1.22rem;
    line-height: 1.9;
    max-height: min(48vh, 520px);
  }
  .result-text { font-size: 1.15rem; }
}

.choice-box, .check-box, .end-box, .result-box {
  margin-top: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(10, 20, 36, 0.9);
  border: 1px solid rgba(126, 182, 255, 0.28);
  color: #eef3fa;
}

.result-img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0.4rem 0 0.75rem;
  background: #0a1424;
}

.choices { display: grid; gap: 0.65rem; margin-top: 0.55rem; }

.choice-btn {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.55rem 0.8rem;
  align-items: center;
  text-align: left;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eef3fa;
  border-radius: 14px;
  padding: 1rem 1rem;
  font: inherit;
  font-size: 1.08rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 3.4rem;
}
.choice-btn:hover {
  border-color: #ff8fb8;
  background: rgba(91, 157, 255, 0.18);
}
.choice-btn .num {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-d);
  font-size: 1.2rem;
  background: linear-gradient(145deg, #ff8fb8, #5b9dff);
  color: #061018;
}
.choice-btn .lab {
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .choice-btn {
    font-size: 1.12rem;
    padding: 1.05rem 0.95rem;
    min-height: 3.6rem;
  }
}

.check-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-d);
  font-size: 1.45rem;
  color: #ffb3d0;
}
.check-detail {
  margin: 0.65rem 0 0.9rem;
  color: #c5d0de;
  font-size: 1.02rem;
  line-height: 1.55;
}
.check-detail .phase { color: #9ec8ff; }
.check-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.check-actions .btn {
  font-size: 1.05rem;
  padding: 0.85rem 1.2rem;
  min-height: 3rem;
}

.dice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.2rem;
  padding: 0.85rem 0.5rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
}
.dice-face {
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  font-family: var(--font-d);
  font-size: 2.4rem;
  font-weight: 700;
  color: #061018;
  background: linear-gradient(145deg, #ffe08a, #f0c36a);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s linear, background 0.2s ease, color 0.2s ease;
}
.dice-face.rolling {
  animation: dice-shake 0.12s linear infinite;
  background: linear-gradient(145deg, #9ec8ff, #5b9dff);
}
.dice-face.ok {
  background: linear-gradient(145deg, #8ef0c8, #5ec4b2);
}
.dice-face.fail {
  background: linear-gradient(145deg, #ffb3c9, #ff8fb8);
}
.dice-eq {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #eef3fa;
  line-height: 1.4;
  min-height: 1.4em;
}
@keyframes dice-shake {
  0% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-3px) rotate(3deg); }
  100% { transform: translateY(0) rotate(-2deg); }
}

@media (max-width: 560px) {
  .dice-face {
    width: 5rem;
    height: 5rem;
    font-size: 2.7rem;
  }
  .dice-eq { font-size: 1.08rem; }
}

.end-banner {
  margin: 0 0 0.5rem;
  font-family: var(--font-d);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: #ffb3d0;
}
.end-summary { margin: 0 0 1rem; line-height: 1.65; color: #dce4ef; }
.host-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.side {
  padding: 1.05rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #eef3fa;
  height: fit-content;
  position: sticky;
  top: 0.75rem;
}
.side h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-d);
  font-size: 1.3rem;
}

.danmaku-panel {
  margin: 0 0 1rem;
  padding: 0.75rem 0.7rem 0.85rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 143, 184, 0.28);
}
.danmaku-h {
  margin: 0 0 0.5rem !important;
  font-size: 1.15rem !important;
  color: #ffb3d0;
}
.danmaku-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}
.danmaku-feed li {
  font-size: 0.98rem;
  line-height: 1.45;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #eef3fa;
  word-break: break-word;
}
.danmaku-feed .dm-at {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #061018;
  background: linear-gradient(145deg, #ff8fb8, #9ec8ff);
  vertical-align: 0.05em;
}

.danmaku-stage {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}
.danmaku-float {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  background: rgba(8, 16, 28, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  animation-name: danmaku-fly;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes danmaku-fly {
  from { transform: translateX(0); opacity: 0.95; }
  to { transform: translateX(calc(-100vw - 100%)); opacity: 0.85; }
}

@media (max-width: 560px) {
  .danmaku-feed li { font-size: 1.02rem; }
  .danmaku-float { font-size: 1.08rem; }
  .side { position: static; }
}

.stats {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.stats li {
  display: grid;
  grid-template-columns: 2.6rem 1fr 1.6rem;
  gap: 0.45rem;
  align-items: center;
  font-weight: 700;
}
.stats .luck-row {
  grid-template-columns: 2.6rem 1fr;
  padding-top: 0.2rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}
.stats .lab { font-size: 0.95rem; color: #9aa8bc; }
.stats .bar {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.stats .bar i {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8fb8, #5b9dff);
  transition: width 0.25s ease;
}
.stats li:nth-child(2) .bar i { background: linear-gradient(90deg, #5ec4b2, #3a9e8e); }
.stats li:nth-child(3) .bar i { background: linear-gradient(90deg, #f0c36a, #c9922a); }
.luck-num { color: #f0c36a; font-size: 1.2rem; justify-self: end; }

.stats.resources { margin-top: 0.15rem; }
.stats.resources .bar.fame i { background: linear-gradient(90deg, #ff7eb3, #ff4d8d); }
.stats.resources .bar.exist i { background: linear-gradient(90deg, #7ad7ff, #3aa0ff); }
.stats.resources .bar.alert i { background: linear-gradient(90deg, #ffb347, #ff5e5e); }

.encounter-box {
  border-color: rgba(255, 126, 179, 0.35);
  background: linear-gradient(160deg, rgba(40, 18, 36, 0.92), rgba(18, 24, 40, 0.92));
}
.enc-meta {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: #c9d6e8;
}
.enc-bars {
  margin: 0 0 0.65rem;
}
.enc-bars > div {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: #ffb3d0;
  font-weight: 700;
}
.enc-bars .bar.enc {
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.enc-bars .bar.enc i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff8fb8, #a78bfa);
  transition: width 0.3s ease;
}

.flags-h {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #9ec8ff;
}
.flags {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.flags li {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}
.flags.items li { background: rgba(240, 195, 106, 0.18); color: #ffe6a8; }
.flags .empty { opacity: 0.5; font-weight: 500; }

.rules .t {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: #ffb3d0;
}
.rules ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #9aa8bc;
  font-size: 0.95rem;
}
.rules li { margin-bottom: 0.3rem; }

.fx-banner {
  position: fixed;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: min(90vw, 400px);
  padding: 1.1rem 1.5rem;
  border-radius: 18px;
  background: rgba(8, 16, 28, 0.94);
  border: 2px solid #5b9dff;
  text-align: center;
  pointer-events: none;
  animation: rise 0.3s ease;
}
.fx-kicker { margin: 0; font-size: 0.95rem; color: #9aa8bc; }
.fx-title {
  margin: 0.2rem 0 0;
  font-family: var(--font-d);
  font-size: 1.85rem;
  color: #ffb3d0;
}

.btn { font-size: 1.05rem; }
.lede { font-size: 1.05rem; line-height: 1.7; }
.setup-points { font-size: 1.02rem; line-height: 1.55; }

@media (max-width: 560px) {
  .btn { font-size: 1.08rem; padding: 0.85rem 1.25rem; }
  .fx-title { font-size: 1.7rem; }
}
