:root {
  --ink: #fbf1d8;
  --muted: #c1b8d5;
  --bg: #100d20;
  --panel: #211b36;
  --wall: #513b7a;
  --wallhi: #8e68bc;
  --pink: #fa5a9d;
  --cyan: #55ead4;
  --gold: #ffe36b;
  --line: #725b91;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 0, #4b2865 0, transparent 55%), var(--bg);
  color: var(--ink);
  font:
    16px/1.45 "Courier New",
    monospace;
  image-rendering: pixelated;
}
body:after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(0deg, #0000 0 3px, #0005 4px);
  opacity: 0.2;
}
button,
a {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px max(16px, calc((100vw - 1080px) / 2));
  border-bottom: 3px solid #5c426f;
  background: #100d20d9;
}
.brand {
  color: var(--gold);
  font-weight: bold;
  letter-spacing: 0.08em;
}
.top a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.85rem;
}
.wrap {
  max-width: 1080px;
  margin: 20px auto;
  padding: 0 16px;
}
.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  background: linear-gradient(145deg, #28203d, #171429);
  border: 2px solid var(--line);
  box-shadow: 5px 5px 0 #090714;
  border-radius: 8px;
  padding: 15px;
}
.tag {
  color: var(--cyan);
  font-size: 0.73rem;
  letter-spacing: 0.13em;
  font-weight: bold;
}
.hero h1 {
  color: var(--gold);
  font-size: clamp(1.6rem, 4vw, 2.55rem);
  line-height: 1.03;
  margin: 0.35rem 0 0.6rem;
  text-shadow: 3px 3px #8e427f;
}
.hero p {
  margin: 0.4rem 0;
  color: #e0d8ec;
}
.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.roles span {
  padding: 5px 8px;
  border: 1px solid #6b548b;
  background: #33274b;
  border-radius: 3px;
  font-size: 0.73rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat {
  text-align: center;
  background: #100d20;
  padding: 8px 3px;
  border: 1px solid #43355f;
  border-radius: 4px;
}
.stat b {
  display: block;
  color: var(--gold);
  font-size: 1rem;
}
.stat small {
  font-size: 0.61rem;
  color: var(--muted);
}
#message {
  min-height: 35px;
  margin: 9px 0 0;
  color: #f8e6b3;
  font-size: 0.76rem;
}
.boardlayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
}
.board {
  padding: 12px;
}
.boardhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 2px 9px;
  font-size: 0.82rem;
}
.boardhead strong {
  color: var(--cyan);
}
#gate {
  color: var(--pink);
  font-size: 0.7rem;
  text-align: right;
}
.banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin-bottom: 9px;
  background: linear-gradient(90deg, #56316f, #244f65);
  border: 1px solid #e8c466;
  border-radius: 4px;
}
.banner b {
  display: block;
  color: var(--gold);
  font-size: 0.72rem;
}
.banner small {
  display: block;
  color: #f3eafa;
  font-size: 0.67rem;
}
.banner .scene {
  margin-left: auto;
  white-space: nowrap;
  font-size: 1.15rem;
}
#maze {
  position: relative;
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  gap: 2px;
  width: min(100%, 680px);
  aspect-ratio: 17/11;
  margin: auto;
  padding: 5px;
  background: #080917;
  border: 3px solid #9a72be;
  box-shadow: 0 0 18px #b34ffc66;
  overflow: hidden;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: #1b1930;
  border-radius: 2px;
}
.cell.wall {
  background: linear-gradient(135deg, #73549b, #402f65);
  border: 1px solid #a57bcc;
  box-shadow: inset 0 0 0 2px #574077;
}
.cell.wall:after {
  content: "+";
  font-weight: bold;
  color: #d6b2ee;
  font-size: clamp(6px, 0.85vw, 10px);
  opacity: 0.7;
}
.pickup {
  font-size: clamp(10px, 1.65vw, 17px);
  filter: drop-shadow(0 0 5px #ffe36b);
  z-index: 1;
  animation: blink 0.7s infinite alternate;
}
.shielditem {
  font-size: clamp(9px, 1.3vw, 14px);
  filter: drop-shadow(0 0 6px #55ead4);
  z-index: 1;
  animation: blink 0.55s infinite alternate;
}
@keyframes blink {
  to {
    transform: scale(0.76);
    filter: brightness(1.5);
  }
}
.actors {
  position: absolute;
  inset: 5px;
  pointer-events: none;
}
.actor {
  position: absolute;
  width: 5%;
  height: 7%;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  font-size: clamp(12px, 2vw, 21px);
  filter: drop-shadow(0 2px 2px #000);
}
.player {
  border-radius: 45%;
  background: #ffe36b33;
  outline: 2px solid var(--gold);
  animation: float 0.35s infinite alternate;
}
.entity {
  border-radius: 50%;
  background: #f84c8c35;
  outline: 2px solid #ff73ad;
  animation: entity 0.8s infinite alternate;
}
.entity.e1 {
  background: #a861ed44;
  outline-color: #c08bff;
}
.entity.e2 {
  background: #f45a6b44;
  outline-color: #ff8587;
}
.entity.e3 {
  background: #41bfca44;
  outline-color: #75f1ee;
}
@keyframes float {
  to {
    transform: translate(-50%, -50%) scale(1.12);
  }
}
@keyframes entity {
  to {
    transform: translate(-50%, -50%) scale(0.86);
    filter: drop-shadow(0 0 7px #fa5a9d);
  }
}
.player.safe {
  outline: 3px solid var(--cyan);
  box-shadow: 0 0 16px var(--cyan);
}
.door {
  border-radius: 3px;
  background: #b33e5555;
  outline: 1px solid #ff8293;
}
.door.open {
  background: #42eab888;
  outline: 2px solid #7dffe8;
  box-shadow: 0 0 12px #54ffe5;
  animation: blink 0.5s infinite alternate;
}
.toast {
  height: 23px;
  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: 9px;
}
.buttons button,
.action {
  padding: 8px 11px;
  background: #463362;
  border: 1px solid #9b79b8;
  border-radius: 3px;
  font-weight: bold;
  font-size: 0.75rem;
  box-shadow: 2px 2px #080717;
}
.buttons button:hover,
.action:hover {
  background: #674a88;
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}
.pad button {
  height: 37px;
  background: #302444;
  border: 1px solid #8970a7;
  border-radius: 3px;
  font-size: 1.1rem;
  touch-action: manipulation;
}
.pad button:nth-child(1) {
  grid-column: 2;
}
.pad button:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}
.pad button:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}
.pad button:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}
.side .panel {
  margin-bottom: 10px;
}
.side h2 {
  font-size: 0.83rem;
  color: var(--cyan);
  margin: 0 0 8px;
}
.side ul {
  padding-left: 16px;
  margin: 5px 0;
  color: #ddd5ec;
  font-size: 0.72rem;
}
.side li {
  margin: 5px 0;
}
.legend {
  display: grid;
  gap: 7px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  color: #e1d9eb;
}
.legend i {
  font-style: normal;
  font-size: 1rem;
}
.note {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 10px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #090716dd;
}
.overlay[hidden] {
  display: none;
}
.dialog {
  width: min(500px, 100%);
  padding: 23px;
  background: #211a36;
  border: 3px solid #b58bd4;
  box-shadow: 7px 7px #080615;
  text-align: center;
}
.dialog h2 {
  color: var(--gold);
  font-size: 1.45rem;
  text-shadow: 2px 2px #9f477d;
}
.dialog p {
  color: #e5ddee;
  font-size: 0.82rem;
}
.dialog .action {
  margin-top: 8px;
  background: #f5ce56;
  color: #241b36;
  border: 0;
  padding: 10px 16px;
}
.scanline {
  color: var(--pink);
}
@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .boardlayout {
    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;
  }
  .banner .scene {
    display: none;
  }
  .actor {
    font-size: 13px;
  }
  .stats small {
    font-size: 0.55rem;
  }
  .top {
    padding: 11px 12px;
  }
  .tag {
    font-size: 0.65rem;
  }
}
.dialog-icon {
  display: none !important;
}
