.playfield {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
}
.frame {
  box-shadow:
    inset 0 1px 1px #b1bfa1,
    inset 0 0 0 4px #57715a,
    inset 0 0 0 5px #8c9a73,
    0 2px 0 #254c38,
    0 5px 0 #193d2c,
    0 8px 0 #153426,
    1px 13px 15px -8px #152c20a6,
    0 17px 30px -12px #254b3655;
}
.board {
  box-shadow:
    0 -1px 2px #0c291b,
    0 1px 1px #a0af8c;
}
.tile {
  background-image: linear-gradient(
    148deg,
    #fff8 0%,
    transparent 49%,
    #715c3312 100%
  );
  box-shadow:
    inset 1px 1px #ffffff72,
    inset -1px -2px #52614324;
}
.center {
  box-shadow:
    inset 1px 2px 12px #5e704736,
    inset 0 0 35px #72856018;
}
.tile .stripe {
  background-image: linear-gradient(#ffffff27, transparent 38%, #0000000c);
}
.deck {
  z-index: 3;
  cursor: pointer;
  transition:
    transform 0.18s,
    filter 0.18s;
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 3px,
    #667f612b 3px 4px
  );
  box-shadow:
    0 1px 0 #e4dbc0,
    1px 2px 0 #817e65,
    1px 3px 0 #f4ecd2,
    2px 4px 0 #9b997f,
    2px 5px 0 #ece5ca,
    3px 6px 0 #7f806b,
    4px 8px 9px #30412845;
}
.deck-chance {
  background-color: #e7ba91;
  color: #8c593c;
}
.deck-chest {
  background-color: #b9caa6;
  color: #566e50;
}
.deck:hover,
.deck:focus-visible {
  filter: brightness(1.055);
  transform: rotate(-12deg) translateY(-3px);
}
.deck-chest:hover,
.deck-chest:focus-visible {
  transform: rotate(11deg) translateY(-3px);
}
#stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  container-type: inline-size;
}
#stage canvas,
.piece-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#stage canvas {
  visibility: hidden;
}
#stage.gpu canvas {
  visibility: visible;
}
#stage.gpu .piece-fallback {
  visibility: hidden;
}
.pawn-render {
  display: block;
  position: absolute;
  height: auto;
  transform: translate(-50%, -76%);
}
.pawn-render[hidden] {
  display: none;
}
.css-die {
  position: absolute;
  width: var(--ds);
  height: var(--ds);
  transform: translate(-50%, -80%);
  z-index: 95;
  perspective: 48cqw;
}
.css-cube,
.cube-side {
  width: 100%;
  height: 100%;
}
.css-cube {
  position: relative;
  transform-style: preserve-3d;
}
.cube-side {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  padding: 13%;
  border-radius: 15%;
  background: linear-gradient(140deg, #fffdf2, #f3e5c3);
  border: 1px solid #b3a98a;
  box-shadow:
    inset 1px 1px 1px #fffaf0,
    inset -1px -1px 2px #ad9a77;
}
.cube-side .pip {
  width: 77%;
  height: 77%;
  border-radius: 50%;
  background: radial-gradient(at 45% 65%, #3b493c, #17261d);
  box-shadow:
    0 1px #fff7df,
    inset 0 1px 1px #111a15;
}
.side-1 .pip {
  background: radial-gradient(at 45% 65%, #b34732, #782d1f);
}
.side-1 {
  transform: translateZ(calc(var(--ds) * 0.495));
}
.side-2 {
  transform: rotateX(90deg) translateZ(calc(var(--ds) * 0.495));
}
.side-3 {
  transform: rotateY(90deg) translateZ(calc(var(--ds) * 0.495));
}
.side-4 {
  transform: rotateY(-90deg) translateZ(calc(var(--ds) * 0.495));
}
.side-5 {
  transform: rotateX(-90deg) translateZ(calc(var(--ds) * 0.495));
}
.side-6 {
  transform: rotateY(180deg) translateZ(calc(var(--ds) * 0.495));
}
.throw-result {
  position: absolute;
  top: 81%;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #9eaf8c;
  border-radius: 20px;
  background: #f5f3dfeb;
  box-shadow: 0 1px 3px #2b473528;
  padding: 0.36cqw 1.45cqw;
  color: #284534;
  font: 700 clamp(10px, 1.95cqw, 17px)/1.1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.step-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 7.9%;
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--pc) 24%, transparent);
  border: 2px solid color-mix(in srgb, var(--pc) 88%, #fff);
  border-radius: 13%;
  box-shadow: 0 0 12px color-mix(in srgb, var(--pc) 48%, transparent);
}
.last-throw {
  margin-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d7e0cb;
  font-size: 12px;
}
.last-throw strong {
  font-weight: 750;
  color: #fff2d5;
  font-size: 15px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.token:has(.miniature-portrait) {
  width: 49px;
  height: 44px;
  border: 0;
  background: radial-gradient(
    ellipse at 50% 77%,
    color-mix(in srgb, var(--pc) 16%, transparent) 0,
    transparent 70%
  );
  border-radius: 0;
}
.miniature-portrait {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.avatar .miniature-portrait {
  width: 91%;
  height: 91%;
}
.profile-card:has(.miniature-portrait) {
  background:
    radial-gradient(ellipse at 23% 65%, #dedec7 0, transparent 58%), #f1f0e2;
  border: 1px solid #d6d9c7;
  border-radius: 9px;
  padding: 10px 16px;
  gap: 20px;
}
.profile-card .token:has(.miniature-portrait) {
  width: 116px;
  height: 105px;
}
.draw-event {
  position: absolute;
  left: 50%;
  top: 49%;
  width: 43%;
  min-height: 27%;
  transform: translate(-50%, -50%) rotate(-2deg);
  transform-origin: center;
  backface-visibility: visible;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.7cqw;
  padding: 2.1cqw 2.4cqw;
  text-align: center;
  color: #713b2b;
  background:
    repeating-linear-gradient(40deg, transparent 0 3px, #9f744509 3px 4px),
    #fff3d9;
  border: 0.35cqw solid #9e5a37;
  outline: 0.43cqw solid #f2e5bd;
  border-radius: 0.65cqw;
  box-shadow:
    1px 3px #c7bba0,
    2px 5px #a49374,
    4px 12px 15px #1a362c55;
  animation: draw-chance 0.65s cubic-bezier(0.18, 0.73, 0.22, 1) both;
}
.draw-event[data-kind="chest"] {
  color: #30543d;
  border-color: #507257;
  animation-name: draw-chest;
}
.draw-event small {
  letter-spacing: 0.13em;
  font: 700 clamp(8px, 1.32cqw, 13px) var(--sans);
}
.draw-event strong {
  font: 700 clamp(15px, 3.35cqw, 30px)/1.03 var(--serif);
}
.draw-event p {
  font: 600 clamp(10px, 1.7cqw, 15px)/1.35 var(--sans);
}
.draw-stamp {
  font-size: 3.2cqw;
}
[hidden].draw-event,
[hidden].throw-result,
[hidden].step-spot {
  display: none;
}
@keyframes draw-chance {
  0% {
    transform: perspective(800px) translate(-114%, -145%) rotate(-15deg)
      rotateY(-165deg) scale(0.3);
  }
  58% {
    transform: perspective(800px) translate(-54%, -58%) rotate(-7deg)
      rotateY(-51deg) scale(1.05);
  }
  100% {
    transform: perspective(800px) translate(-50%, -50%) rotate(-2deg);
  }
}
@keyframes draw-chest {
  0% {
    transform: perspective(800px) translate(16%, 45%) rotate(14deg)
      rotateY(165deg) scale(0.3);
  }
  58% {
    transform: perspective(800px) translate(-46%, -58%) rotate(6deg)
      rotateY(51deg) scale(1.05);
  }
  100% {
    transform: perspective(800px) translate(-50%, -50%) rotate(-2deg);
  }
}
dialog.physical-card {
  background: transparent;
  color: var(--ink);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0 7px 44px;
  width: min(362px, calc(100vw - 32px));
  max-height: none;
  overflow: visible;
  isolation: isolate;
  animation: none;
  perspective: 1000px;
}
.paper-lift,
.paper-tilt,
.paper-sheet {
  position: relative;
  transform-style: preserve-3d;
}
.paper-lift.draw-in {
  animation: lift-from-table 0.64s cubic-bezier(0.16, 0.76, 0.22, 1) both;
}
.paper-tilt {
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.13s ease-out;
}
.paper-sheet {
  transition: transform 0.52s cubic-bezier(0.26, 0.66, 0.22, 1);
  transform: rotateY(0deg);
}
.paper-sheet.flipped {
  transform: rotateY(180deg);
}
.paper-face,
.paper-back {
  border: 1px solid #9a967c;
  border-radius: 12px;
  backface-visibility: hidden;
  box-shadow:
    1px 2px 0 #bfb7a1,
    2px 4px 0 #d8cfb3,
    3px 5px 0 #92896f,
    4px 15px 29px -5px #0c231753;
  background: #fbf5dd;
}
.paper-face {
  position: relative;
  padding: 28px 23px 22px;
  max-height: calc(85dvh - 44px);
  overflow-y: auto;
  background-image: linear-gradient(130deg, #ffffff58, #fff0 46%, #bb985d15);
  transform: translateZ(2px);
  scrollbar-width: thin;
}
.paper-face:before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 7px;
  background: var(--card-ink);
  border-radius: 3px;
}
.paper-face .modal-head {
  padding-right: 22px;
}
.paper-face .modal-head h2 {
  font-size: 27px;
}
.paper-face .deed-plate {
  background: #f1edd7;
  border: 1px solid #c4c6ae;
  border-top: 4px solid var(--card-ink);
  color: var(--ink);
}
.paper-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  transform: rotateY(180deg) translateZ(2px);
  background-color: var(--card-ink);
  color: #fff4d6;
  background-image: repeating-linear-gradient(
    135deg,
    #fff1 0 1px,
    transparent 1px 5px
  );
  outline: 4px double #e1d7b3;
  outline-offset: -12px;
}
.paper-back b {
  font: 800 27px/1 var(--serif);
  letter-spacing: 0.03em;
}
.paper-back span {
  font-size: 13px;
  letter-spacing: 0.05em;
}
.paper-seal {
  border: 3px double #e7dbb6;
  border-radius: 50%;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
}
.card-close {
  position: absolute;
  right: 19px;
  top: 20px;
  z-index: 3;
  background: #fbf4e2;
  border-color: #ada891;
  width: 29px;
  height: 29px;
}
.flip-sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 17px;
  font-size: 13px;
  border: 1px solid #d1d7c7;
  background: #f4f3e8;
  color: var(--ink);
  border-radius: 18px;
  white-space: nowrap;
}
.event-emblem {
  display: grid;
  place-items: center;
  color: var(--card-ink);
  margin: 16px auto 5px;
}
.event-name,
.event-description {
  text-align: center;
}
.event-name {
  font: 700 23px var(--serif);
}
@keyframes lift-from-table {
  0% {
    opacity: 0.1;
    transform: translate3d(var(--draw-x), var(--draw-y), -140px) rotateZ(-16deg)
      rotateY(-145deg) scale(0.2);
  }
  18% {
    opacity: 1;
  }
  70% {
    transform: translate3d(0, -7px, 25px) rotateZ(2deg) rotateY(12deg)
      scale(1.01);
  }
  100% {
    transform: none;
  }
}
@media (max-width: 760px) {
  .token:has(.miniature-portrait) {
    height: 40px;
  }
  .last-throw {
    margin-top: 7px;
  }
  .frame {
    box-shadow:
      inset 0 0 0 2px #58745b,
      0 3px 0 #234832,
      0 5px 0 #193b2b,
      0 9px 14px -6px #2b4b3355;
  }
}
@media (prefers-reduced-motion: reduce) {
  .paper-lift.draw-in,
  .draw-event {
    animation: none;
  }
  .paper-tilt,
  .paper-sheet,
  .deck {
    transition: none;
  }
}

.field-roll {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 71%;
  transform: translateX(-50%);
  width: 23%;
  height: 14%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 0;
  color: #2b4e39;
}
.field-roll[hidden] {
  display: none;
}
.field-roll span {
  font: 700 clamp(10px, 1.7cqw, 15px)/1.1 var(--sans);
  padding: 0.5cqw 1.65cqw;
  border-radius: 18px;
  background: #f8f6e3e8;
  border: 1px solid #9eaf8c;
  box-shadow: 0 1px 2px #27422c25;
}
.field-roll.has-result span {
  opacity: 0;
}
.field-roll:hover span,
.field-roll:focus-visible span {
  opacity: 1;
}
.field-roll:hover span {
  background: #214c38;
  color: #fff4dc;
}
.field-roll:focus-visible {
  border-radius: 6px;
}

.turn-mini {
  position: absolute;
  right: -4px;
  top: 6px;
  width: 76px;
  height: 70px;
  display: grid;
  place-items: center;
  filter: drop-shadow(1px 4px 3px #102a2244);
}
@media (max-width: 1000px) {
  .turn-mini {
    width: 65px;
  }
}
@media (max-width: 760px) {
  .turn-mini {
    height: 64px;
    width: 72px;
    top: 0;
  }
}

.tile.mortgaged {
  background-color: #f0e4c9;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 6px,
    #9c794510 6px 8px
  );
}
.mortgage-tag,
.tile small.mortgage-tag {
  display: inline-block;
  width: fit-content;
  padding: 0.18em 0.42em;
  border-radius: 0.25em;
  background: #59412a;
  color: #fff3d6;
  font-weight: 750;
  white-space: nowrap;
}
.tile small.mortgage-tag {
  position: absolute;
  bottom: .27cqw;
  align-self: center;
  font-size: clamp(5px, 1.05cqw, 12px);
}
.tile.top small.mortgage-tag {
  top: .27cqw;
  bottom: auto;
}
.mortgage-mini {
  width: 45px;
  height: 45px;
  object-fit: contain;
}
.deed-plate .mortgage-tag {
  font: 700 12px/1.2 var(--sans);
  vertical-align: middle;
}
