:root {
  --bg: #111020;
  --panel: #211d38;
  --purple: #704b9a;
  --lilac: #bd8bf0;
  --cyan: #62efda;
  --gold: #ffe36d;
  --pink: #ff639f;
  --ink: #fff5e3;
  --muted: #c7bdd9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at top, #432461, transparent 58%), var(--bg);
  color: var(--ink);
  font:
    15px/1.45 "Courier New",
    monospace;
}
body:after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #0005 4px);
  opacity: 0.22;
}
.top {
  display: flex;
  justify-content: space-between;
  padding: 13px max(16px, calc((100vw - 1100px) / 2));
  border-bottom: 3px solid #684b82;
  background: #100d20dd;
}
.top b {
  color: var(--gold);
  letter-spacing: 0.08em;
}
.top a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.85rem;
}
.wrap {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 15px;
}
.intro {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 13px;
  margin-bottom: 13px;
}
.panel {
  background: linear-gradient(145deg, #292341, #19172d);
  border: 2px solid #765894;
  box-shadow: 5px 5px #080713;
  border-radius: 7px;
  padding: 15px;
}
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  font-weight: bold;
  color: var(--cyan);
}
h1 {
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.03;
  color: var(--gold);
  margin: 0.3rem 0 0.55rem;
  text-shadow: 3px 3px #9d468a;
}
p {
  margin: 0.4rem 0;
  color: #e3dced;
}
.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.roles span {
  border: 1px solid #775e91;
  background: #342847;
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 0.7rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat {
  background: #100e1e;
  border: 1px solid #4b3a66;
  border-radius: 4px;
  text-align: center;
  padding: 8px 2px;
}
.stat b {
  display: block;
  color: var(--gold);
  font-size: 1rem;
}
.stat small {
  font-size: 0.6rem;
  color: var(--muted);
}
#message {
  font-size: 0.72rem;
  color: #ffedb4;
  min-height: 32px;
  margin-top: 9px;
}
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 225px;
  gap: 13px;
  align-items: start;
}
.board {
  padding: 12px;
}
.boardhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 2px 8px;
  font-size: 0.8rem;
}
.boardhead strong {
  color: var(--cyan);
}
#gate {
  font-size: 0.68rem;
  color: var(--pink);
  text-align: right;
}
.scene {
  position: relative;
  width: 100%;
  height: clamp(260px, 43vw, 390px);
  overflow: hidden;
  border: 3px solid #ab80d3;
  background: linear-gradient(#332b58 0 53%, #1b3045 53% 55%, #19182f 55%);
  box-shadow: 0 0 17px #b252ff55;
  touch-action: none;
}
.scene:before {
  content: "✦　　·　✦　　　　　·　　　✦　　·　　✦";
  position: absolute;
  top: 9%;
  left: 4%;
  width: 95%;
  color: #f7dd7b;
  letter-spacing: 0.6em;
  opacity: 0.8;
  font-size: 12px;
}
.moon {
  position: absolute;
  right: 9%;
  top: 12%;
  font-size: 34px;
  filter: drop-shadow(0 0 9px #ffe36d);
}
.city {
  position: absolute;
  bottom: 45%;
  left: 0;
  width: 100%;
  height: 33%;
  opacity: 0.65;
  background: linear-gradient(
    90deg,
    transparent 0 4%,
    #302c50 4% 13%,
    transparent 13% 16%,
    #443761 16% 27%,
    transparent 27% 31%,
    #3c3157 31% 42%,
    transparent 42% 47%,
    #4b3864 47% 57%,
    transparent 57% 60%,
    #342d52 60% 73%,
    transparent 73% 77%,
    #48345f 77% 91%,
    transparent 91%
  );
}
.floorline {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 16%;
  background: linear-gradient(#513b68 0 12%, #201a32 12%);
  border-top: 3px solid #bb8ae5;
}
.plat {
  position: absolute;
  height: 15px;
  background: linear-gradient(#b887df 0 4px, #523b73 4px);
  border: 1px solid #d6b4f2;
  box-shadow: 0 3px #100c1c;
  border-radius: 2px;
}
.bridge {
  height: 12px;
  background: linear-gradient(#65f0d7 0 4px, #246e73 4px);
  border: 1px solid #b0fff0;
  box-shadow: 0 0 12px #62efda;
  animation: blink 0.6s infinite alternate;
}
@keyframes blink {
  to {
    filter: brightness(1.55);
  }
}
.player {
  position: absolute;
  width: 28px;
  height: 37px;
  display: grid;
  place-items: center;
  font-size: 25px;
  z-index: 3;
  filter: drop-shadow(0 2px 1px #000);
  transition:
    left 0.09s linear,
    bottom 0.09s linear;
}
.player:after {
  content: "";
  position: absolute;
  width: 23px;
  height: 4px;
  background: #0b081599;
  border-radius: 50%;
  bottom: -3px;
  z-index: -1;
}
.item {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 30px;
  font-size: 22px;
  z-index: 2;
  filter: drop-shadow(0 0 6px #ffe36d);
  animation: float 0.7s infinite alternate;
}
@keyframes float {
  to {
    transform: translateY(-4px);
  }
}
.entity {
  position: absolute;
  z-index: 2;
  font-size: 24px;
  filter: drop-shadow(0 0 7px #ff4f9a);
  animation: haunt 1s infinite alternate;
}
@keyframes haunt {
  to {
    transform: translateY(-8px) scale(1.1);
  }
}
.entity.e1 {
  filter: drop-shadow(0 0 8px #c18aff);
}
.entity.e2 {
  filter: drop-shadow(0 0 8px #ff639f);
}
.entity.e3 {
  filter: drop-shadow(0 0 8px #5ce7df);
}
.toast {
  min-height: 21px;
  text-align: center;
  color: var(--gold);
  font-size: 0.72rem;
  padding-top: 4px;
}
.buttons {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.buttons button,
.action {
  background: #453362;
  border: 1px solid #ab82cf;
  border-radius: 3px;
  color: #fff5e3;
  padding: 8px 11px;
  font: bold 0.75rem "Courier New";
  box-shadow: 2px 2px #090714;
}
.buttons button:hover {
  background: #654883;
}
.touch {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
}
.touch button {
  width: 47px;
  height: 38px;
  background: #302344;
  border: 1px solid #8767a3;
  color: #fff;
  border-radius: 3px;
  font-size: 1.1rem;
  touch-action: manipulation;
}
.side .panel {
  margin-bottom: 10px;
}
.side h2 {
  font-size: 0.83rem;
  color: var(--cyan);
  margin: 0 0 8px;
}
.side ul {
  margin: 5px 0;
  padding-left: 17px;
  font-size: 0.7rem;
  color: #e2daeb;
}
.side li {
  margin: 6px 0;
}
.legend {
  display: grid;
  gap: 7px;
}
.legend span {
  font-size: 0.68rem;
  color: #e6deee;
}
.note {
  font-size: 0.64rem;
  color: var(--muted);
  margin-top: 9px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 15px;
  background: #090716dd;
}
.overlay[hidden] {
  display: none;
}
.dialog {
  width: min(500px, 100%);
  padding: 22px;
  background: #211b37;
  border: 3px solid #b98dde;
  box-shadow: 7px 7px #080713;
  text-align: center;
}
.dialog h2 {
  color: var(--gold);
  font-size: 1.4rem;
  text-shadow: 2px 2px #9b4887;
}
.dialog p {
  font-size: 0.8rem;
}
.dialog .action {
  background: #f5d15c;
  color: #251b39;
  padding: 10px 16px;
  border: 0;
  margin-top: 7px;
}
.note2 {
  font-size: 0.65rem;
  color: var(--muted);
}
@media (max-width: 800px) {
  .intro {
    grid-template-columns: 1fr;
  }
  .game {
    grid-template-columns: 1fr;
  }
  .side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .side .panel {
    margin: 0;
  }
}
@media (max-width: 520px) {
  .wrap {
    padding: 0 9px;
    margin: 12px auto;
  }
  .panel {
    padding: 10px;
  }
  .side {
    grid-template-columns: 1fr;
  }
  .top {
    padding: 11px 12px;
  }
  .scene {
    height: 280px;
  }
}
.dialog-icon {
  display: none !important;
}
