:root {
  --ink: #1a1423;
  --muted: #6b5f78;
  --panel: rgba(255, 255, 255, 0.94);
  --accent: #ff4d6d;
  --neon: #7b2cbf;
  --city: #ff922b;
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  background: #1a1028;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 20% 0%, rgba(255, 77, 109, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 15%, rgba(123, 44, 191, 0.4), transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(255, 146, 43, 0.2), transparent 50%),
    linear-gradient(165deg, #241536, #140c22 55%, #1c1230);
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: #f8f0ff;
}
.back { color: #e0b0ff; text-decoration: none; font-weight: 700; }
.brand { display: flex; gap: 0.7rem; align-items: center; flex: 1; }
.mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff4d6d, #7b2cbf);
  color: #fff;
  font-family: var(--font-d);
  font-size: 1.35rem;
}
.brand h1 { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }
.brand p { margin: 0; font-size: 0.85rem; opacity: 0.72; }

main { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1.2rem 3rem; }

.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 1.3rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  max-width: 480px;
}
.panel h2 { margin: 0 0 1rem; font-family: var(--font-d); font-size: 1.8rem; }
.field { display: grid; gap: 0.4rem; }
.field > span { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1;
  border: 1px solid #d8cce8;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
}
.name-list { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.35rem; }
.name-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  background: #f3eefc;
  border-radius: 10px;
  font-weight: 700;
}
.name-list button {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.8rem 0 0; }

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 14px;
  padding: 0.7rem 1.2rem;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(145deg, #ff6b85, #ff4d6d);
  color: #fff;
}
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid #d8cce8;
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #f8f0ff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn.wide { width: 100%; }

.layout { display: grid; gap: 1rem; }
@media (min-width: 980px) {
  .layout { grid-template-columns: 1fr 300px; align-items: start; }
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.status > span, #phaseEl {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8f0ff;
  font-weight: 600;
}
.status strong { color: #fff; }

.actor-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.7rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.28), rgba(123, 44, 191, 0.22));
  border: 1px solid rgba(255, 209, 102, 0.4);
}
.actor-banner[hidden] { display: none !important; }
.actor-icon {
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.18);
}
.actor-who {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-d);
}
.actor-who strong { color: #ffd166; }
.actor-skill {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: rgba(248, 240, 255, 0.9);
}

.step-guide {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.step-guide li {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  color: rgba(248, 240, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
}
.step-guide li.is-done {
  color: rgba(248, 240, 255, 0.75);
  text-decoration: line-through;
  opacity: 0.7;
}
.step-guide li.is-active {
  color: #1a1423;
  background: linear-gradient(145deg, #ffd166, #ff922b);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.35);
  text-decoration: none;
  opacity: 1;
}

.resolve-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.35);
  color: #f8f0ff;
}
.resolve-box[hidden] { display: none !important; }
.rb-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: #ffd166;
}
.resolve-box ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tokyo-board {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .tokyo-board { grid-template-columns: 1fr 1fr; }
}
.tokyo-spot {
  border-radius: 18px;
  padding: 0.85rem 1rem;
  background: linear-gradient(160deg, rgba(255, 146, 43, 0.35), rgba(255, 77, 109, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.18);
  min-height: 5.5rem;
}
.tokyo-spot.bay {
  background: linear-gradient(160deg, rgba(77, 171, 247, 0.35), rgba(123, 44, 191, 0.25));
}
.spot-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-d);
  color: #ffe8a3;
  font-size: 1.15rem;
}
.spot-body {
  min-height: 2.4rem;
  display: flex;
  align-items: center;
}
.spot-body .empty {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 700;
}
.spot-body .occ {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mh) 55%, #fff);
  color: #1a1423;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.dice-panel {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8f0ff;
}
.dice-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.dice-head h2 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.35rem;
}
.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 0.4rem;
  min-height: 3.6rem;
}
.dice-empty {
  margin: 0;
  color: rgba(248, 240, 255, 0.65);
  font-weight: 700;
}
.die {
  width: 3.6rem;
  height: 3.9rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(145deg, #fff7e8, #ffd43b);
  color: #1a1423;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 0.2rem;
  transition: transform 0.12s, box-shadow 0.12s;
}
.die .die-face { font-size: 1.35rem; line-height: 1; }
.die .die-hint {
  font-size: 0.58rem;
  font-weight: 800;
  opacity: 0.7;
}
.die:hover:not(:disabled) { transform: translateY(-2px); }
.die:disabled { cursor: default; opacity: 0.95; }
.die.locked {
  box-shadow: 0 0 0 3px #ff4d6d;
  background: linear-gradient(145deg, #ffe0e6, #ff8fa3);
  animation: lock-pop 0.25s ease;
}
@keyframes lock-pop {
  from { transform: scale(1.12); }
  to { transform: scale(1); }
}
.die.face-energy { background: linear-gradient(145deg, #e7f5ff, #74c0fc); }
.die.face-smash { background: linear-gradient(145deg, #fff0e0, #ff922b); }
.die.face-heal { background: linear-gradient(145deg, #ebfbee, #69db7c); }
.btn.wide-act { min-width: 12rem; font-size: 1.15rem; padding: 0.85rem 1.4rem; }
.anim-hint {
  margin: 0;
  width: 100%;
  text-align: center;
  color: rgba(248, 240, 255, 0.85);
  font-weight: 800;
}
.dice-legend {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(248, 240, 255, 0.65);
}

.msg {
  text-align: center;
  font-family: var(--font-d);
  font-size: 1.4rem;
  color: #ff8fa3;
  margin: 0.85rem 0 0.15rem;
  min-height: 1.5em;
}
.submsg {
  text-align: center;
  color: rgba(248, 240, 255, 0.72);
  font-size: 0.92rem;
  font-weight: 700;
  min-height: 1.2em;
  margin: 0 0 0.55rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  min-height: 3rem;
}

.shop-h {
  margin: 1rem 0 0.5rem;
  font-family: var(--font-d);
  font-size: 1.25rem;
  color: #f8f0ff;
}
.shop {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.power-card {
  text-align: left;
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  border: 1px solid #d8cce8;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  display: grid;
  gap: 0.2rem;
  transition: transform 0.12s, box-shadow 0.12s;
}
.power-card:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(80, 40, 120, 0.18);
}
.power-card:disabled { opacity: 0.55; cursor: not-allowed; }
.power-card.keep { border-left: 4px solid #7b2cbf; }
.power-card.discard { border-left: 4px solid #ff4d6d; }
.pc-cost { font-weight: 900; color: #5c7cfa; font-size: 0.95rem; }
.pc-type { font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.power-card strong { font-size: 1rem; }
.power-card p { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.shop-empty { color: rgba(248, 240, 255, 0.7); margin: 0; }

.side {
  background: var(--panel);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0.6rem;
}
.side h2 { margin: 0; font-family: var(--font-d); font-size: 1.35rem; }
.log-h { margin-top: 0.85rem !important; }

.monsters { display: grid; gap: 0.55rem; margin-top: 0.55rem; }
.monster-card {
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
  background: #f6f1fc;
  border-left: 4px solid var(--mh, #999);
}
.monster-card.is-turn {
  box-shadow: inset 0 0 0 2px rgba(255, 77, 109, 0.45);
}
.monster-card.is-dead { opacity: 0.45; filter: grayscale(0.6); }
.monster-card.in-tokyo {
  background: linear-gradient(135deg, #fff4e0, #f6f1fc);
}
.monster-card header {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}
.mic {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: color-mix(in srgb, var(--mh) 40%, #fff);
}
.monster-card h3 { margin: 0; font-size: 1.05rem; }
.mon-name { margin: 0; font-size: 0.78rem; color: var(--muted); }
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.st {
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  background: #fff;
}
.st.vp { color: #e67700; }
.st.hp { color: #c2255c; }
.st.en { color: #1c7ed6; }

.skill-box {
  margin-top: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--mh) 22%, #fff);
  border: 1px solid color-mix(in srgb, var(--mh) 45%, #ccc);
}
.skill-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #5a3d7a;
  text-transform: uppercase;
}
.skill-text {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}
.keep-label {
  margin: 0.45rem 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}
.keep-list { display: grid; gap: 0.3rem; }
.keep-chip {
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background: #fff;
  border-left: 3px solid #7b2cbf;
  font-size: 0.78rem;
}
.keep-chip strong { display: block; color: #5b2b8a; }
.keep-chip span { color: var(--muted); line-height: 1.3; }
.no-keep {
  margin: 0;
  font-size: 0.75rem;
  color: #aaa;
}

.monster-card.flash-dmg {
  animation: flash-dmg 0.65s ease;
}
.monster-card.flash-heal {
  animation: flash-heal 0.65s ease;
}
.monster-card.flash-vp {
  animation: flash-vp 0.65s ease;
}
@keyframes flash-dmg {
  0%, 100% { filter: none; }
  30% { filter: brightness(1.15); box-shadow: inset 0 0 0 3px #ff4d6d; }
}
@keyframes flash-heal {
  30% { box-shadow: inset 0 0 0 3px #40c057; }
}
@keyframes flash-vp {
  30% { box-shadow: inset 0 0 0 3px #fab005; }
}

.log {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0;
  max-height: 10rem;
  overflow: auto;
}
.log li {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.2rem 0;
  border-bottom: 1px solid #eee;
}

.rules { border-top: 1px solid #e8e0f5; padding-top: 0.6rem; margin-top: 0.5rem; }
.rules .t { margin: 0 0 0.3rem; font-weight: 700; }
.rules ul {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.84rem;
  color: var(--muted);
}

/* 掷骰遮罩 */
.dice-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgba(12, 6, 24, 0.7);
  backdrop-filter: blur(3px);
  padding: 1rem;
}
.dice-overlay[hidden] { display: none !important; }
.dice-card {
  min-width: min(92vw, 420px);
  padding: 1.25rem 1.4rem 1.4rem;
  border-radius: 22px;
  background: linear-gradient(160deg, #3a2060, #1c1230);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.dice-caption {
  margin: 0 0 0.85rem;
  font-family: var(--font-d);
  font-size: 1.3rem;
  color: #ff8fa3;
}
.dice-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}
.dice-unit .dice-face {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: #1a1423;
  background: linear-gradient(145deg, #fff7e0, #ffd166);
  border: 2px solid rgba(255, 255, 255, 0.7);
}
.dice-face.is-spinning { animation: dice-spin 0.09s linear infinite; }
.dice-face.is-settled { animation: dice-land 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.dice-face.was-locked { outline: 2px solid #ff4d6d; }
.dice-face.face-energy { background: linear-gradient(145deg, #e7f5ff, #74c0fc); }
.dice-face.face-smash { background: linear-gradient(145deg, #fff0e0, #ff922b); }
.dice-face.face-heal { background: linear-gradient(145deg, #ebfbee, #69db7c); }
.dice-result {
  margin: 0.85rem 0 0;
  min-height: 1.3em;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}
@keyframes dice-spin {
  0% { transform: rotate(-10deg) scale(0.94); }
  50% { transform: rotate(10deg) scale(1.06); }
  100% { transform: rotate(-10deg) scale(0.94); }
}
@keyframes dice-land {
  from { transform: scale(1.4) rotate(-14deg); }
  to { transform: scale(1) rotate(0); }
}

/* 战斗横幅 */
.fx-banner {
  position: fixed;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  z-index: 120;
  max-width: min(92vw, 440px);
  padding: 1rem 1.25rem;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(48, 18, 58, 0.97), rgba(20, 10, 36, 0.97));
  border: 1px solid rgba(255, 77, 109, 0.65);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  color: #fff;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.fx-banner.is-on { animation: fx-in 0.28s ease forwards; }
.fx-banner.is-out { animation: fx-out 0.22s ease forwards; }
.fx-banner[hidden] { display: none !important; }
.fx-banner.tone-fire { border-color: #ff922b; }
.fx-banner.tone-card { border-color: #b197fc; }
.fx-banner.tone-enter { border-color: #ffd166; }
.fx-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ffd166;
}
.fx-title {
  margin: 0.25rem 0 0;
  font-family: var(--font-d);
  font-size: 1.35rem;
}
.fx-detail {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: rgba(248, 240, 255, 0.9);
  line-height: 1.4;
}
@keyframes fx-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes fx-out {
  to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

.float-layer {
  position: fixed;
  inset: 0;
  z-index: 115;
  pointer-events: none;
  overflow: hidden;
}
.float-pop {
  position: fixed;
  transform: translate(-50%, 0);
  font-weight: 900;
  font-size: 1.35rem;
  font-family: var(--font-d);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  animation: float-up 1.05s ease forwards;
  white-space: nowrap;
}
.float-pop.pop-dmg { color: #ff6b6b; }
.float-pop.pop-heal { color: #51cf66; }
.float-pop.pop-vp { color: #fcc419; }
.float-pop.pop-en { color: #4dabf7; }
.float-pop.pop-block { color: #e599f7; font-size: 1.1rem; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}

[hidden] { display: none !important; }
