body {
  background: #f5e9d4;
  color: #44393f;
}
header,
footer {
  background: #312738;
  color: #ffefd5;
}
main {
  width: min(1140px, 94%);
}
.hero {
  background: #63454e url('assets/lucky-lantern-arcade.webp') center 50% / cover;
  box-shadow: 0 6px 0 #9f7871;
}
.hero-box {
  background: linear-gradient(transparent, rgba(41, 27, 41, 0.94) 42%);
}
h1,
h2,
h3 {
  color: #543843;
}
.cards .ticket {
  border-top: 4px solid #b56756;
}
.primary,
.selected,
.rooms a[aria-current='page'] {
  background: #783f55;
  color: #fff2da;
  border-color: #623548;
}
.selected:hover,
.primary:hover {
  background: #854860;
}
.board,
.field,
.side,
.ticket {
  border-color: #c7a895;
}
.room-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
.field {
  background: #f2dfbc;
}
.overline {
  color: #7e4851;
}
.field .flow-detail {
  color: #5a384b;
}
.room-head {
  margin-bottom: 12px;
}
.room-head p {
  max-width: 74ch;
}
.room-head img {
  filter: drop-shadow(0 4px 3px #78554d30);
}
.actions {
  margin: 8px 0;
}
.board > h2 {
  margin-bottom: 12px;
}
.encounter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #4f3b54;
  color: #fff4d6;
  border-radius: 12px;
  padding: 8px 13px;
  margin-bottom: 14px;
}
.encounter .foe {
  font-size: 26px;
}
.encounter strong {
  display: block;
}
.encounter small {
  color: #f9cf9f;
}
.bead {
  width: 13px;
  height: 13px;
  display: inline-block;
  border-radius: 50%;
  margin: 0 3px;
  border: 1px solid #f9e4ba;
  background: #675367;
}
.bead.lit {
  background: #ffd777;
  box-shadow: 0 0 6px #ffc35c;
}
.dojo {
  height: 78px;
  position: relative;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  background:
    linear-gradient(90deg, #43304630, #43304600, #43304650),
    url('assets/lucky-lantern-arcade.webp') center 50% / cover;
}
.dojo:before {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff0c833;
}
.dojo-michi {
  position: absolute;
  width: 68px;
  height: 68px;
  bottom: 0;
  left: 11%;
  background: url('assets/michi-idle.webp') left bottom/400% 100%;
}
.dojo-foe {
  position: absolute;
  right: 14%;
  bottom: 6px;
  font-size: 43px;
  filter: drop-shadow(0 3px 2px #43334680);
}
.sparks {
  position: absolute;
  left: 46%;
  top: 5px;
  font-size: 43px;
  color: #ffe19a;
  opacity: 0;
}
.dojo + .encounter {
  border-radius: 0 0 10px 10px;
}
.successful .sparks {
  opacity: 1;
}
.bumped .dojo-michi {
  filter: sepia(0.65);
}
@media (prefers-reduced-motion: no-preference) {
  .dojo-foe {
    animation: lantern-hover 1.9s ease-in-out infinite alternate;
  }
  .successful .sparks {
    animation: fox-flash 0.65s ease-out both;
  }
  .bumped .dojo-michi {
    animation: fox-bump 0.42s ease-out;
  }
  @keyframes lantern-hover {
    to {
      transform: translateY(-5px) rotate(4deg);
    }
  }
  @keyframes fox-flash {
    from {
      transform: translate(-100%, 12%) scale(0.6);
    }
    to {
      transform: translate(130%, 0) scale(1.1);
      opacity: 0.15;
    }
  }
  @keyframes fox-bump {
    35% {
      transform: translateX(-14%) rotate(-6deg);
    }
  }
}
.socket-row,
.chips,
.stamp-strip,
.price-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: 9px 0;
}
.socket {
  min-width: 92px;
  text-align: center;
  border: 1.5px dashed #a77d80;
  border-radius: 10px;
  padding: 7px;
  background: #faead0;
}
.socket b,
.socket small {
  display: block;
}
.socket b {
  font-size: 22px;
}
.chip {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 7px;
  background: #f2dcae;
  color: #563c34;
  font-variant-numeric: tabular-nums;
}
.scroll-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.scroll-list button {
  display: grid;
  text-align: left;
  gap: 2px;
  padding: 6px;
}
.scroll-list small {
  font-size: 12px;
}
.scroll-list strong {
  font-size: 16px;
}
.lantern-wheel {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
  margin: 12px 0;
}
.slip {
  border-radius: 4px;
  text-align: center;
  padding: 5px 0;
  background: #86c8ac;
  color: #283e35;
  font-weight: 800;
  font-size: 13px;
}
.slip.archive {
  background: #f2b586;
  color: #4f3228;
}
.slip.picked {
  outline: 3px solid #62344e;
  z-index: 1;
}
.receipt {
  border-color: #84506a;
  background: #f7e4cc;
}
.machine {
  padding: 10px;
  margin: 12px 0;
  border: 1px solid #c5a795;
  border-radius: 11px;
  background: #fbf0dc;
}
.shrine-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
  font-size: 13px;
}
.shrine-legend span {
  border: 1px solid #caad9b;
  border-radius: 6px;
  padding: 4px 7px;
  background: #fff6e6;
}
.duel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.84fr);
  gap: 14px;
  align-items: start;
}
.arena-panel {
  min-width: 0;
}
.fox-board {
  height: clamp(290px, 41vw, 462px);
  position: relative;
  background: radial-gradient(ellipse at center, #795c69, #3b303e);
  border: 3px solid #8a616a;
  border-radius: 14px;
  overflow: hidden;
  touch-action: manipulation;
}
.fox-board canvas,
.fox-grid {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.fox-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  padding: 7px;
}
.fox-grid[hidden],
canvas[hidden] {
  display: none !important;
}
.tile {
  font-size: clamp(9px, 2.2vw, 16px);
  font-weight: bold;
  border: 0;
  border-radius: 3px;
  padding: 0;
  min-width: 0;
  min-height: 0;
  background: #ead0a6;
}
.tile.wall {
  background: #80677c;
}
.tile[data-type='cat'] {
  background: #fff1b8;
}
.tile[data-type='crate'] {
  background: #e5a86b;
  outline: 2px solid #855363;
  outline-offset: -3px;
}
.tile[data-type='shrine'] {
  background: #92c6b1;
}
.play-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 43px);
  grid-template-rows: 38px 38px;
  gap: 2px;
}
.dpad button {
  padding: 0;
  font-size: 19px;
}
.dpad button:first-child {
  grid-column: 2;
}
.dpad button:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}
.dpad button:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}
.dpad button:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}
summary {
  cursor: pointer;
  font-weight: 700;
}
.gift {
  margin: 10px 0;
}
.field-note {
  font-size: 14px;
}
.duel-side details {
  margin: 10px 0;
}
.duel-side .tablewrap th,
.duel-side .tablewrap td {
  padding: 4px;
}
.duel-side .field {
  margin-top: 10px;
}
.map-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.map-tools button {
  font-size: 13px;
  padding: 4px 8px;
}
.board button {
  touch-action: manipulation;
}
.fox-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  font-weight: bold;
}
.duel-side h2 {
  font-size: 25px;
}
.draw-arena,
.hammer {
  animation: unfold 0.24s ease-out;
}
@keyframes unfold {
  from {
    opacity: 0.6;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .draw-arena,
  .hammer {
    animation: none;
  }
}
@media (max-width: 780px) {
  .room-grid,
  .duel-layout {
    grid-template-columns: 1fr;
  }
  .fox-board {
    height: clamp(290px, 76vw, 420px);
  }
  .room-head img {
    width: 65px;
  }
  .scroll-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
