* {
  box-sizing: border-box;
}
html,
body {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #19140f;
  color: #fff8e3;
  font:
    600 16px 'Yu Gothic UI',
    Meiryo,
    sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffed95;
  outline-offset: 2px;
}
button:disabled {
  cursor: default;
}
button img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: contain;
}
:root {
  --drawer: 0px;
  --gap: clamp(18px, 4cqw, 60px);
  --hand: clamp(52px, 10.6cqw, 130px);
  --btn: clamp(88px, 19cqw, 170px);
  --paper: min(22cqw, 50cqh, 284px);
  --safe-l: max(5px, env(safe-area-inset-left));
  --safe-r: max(5px, env(safe-area-inset-right));
  --safe-b: env(safe-area-inset-bottom, 0px);
}
body.open {
  --drawer: min(29vw, 310px);
}
#play {
  position: absolute;
  inset: 0 var(--drawer) 0 0;
  container-type: size;
  overflow: hidden;
  isolation: isolate;
  transition: right 0.22s ease;
}
#world,
#cards,
#show {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#world {
  touch-action: none;
}
#cards,
#show {
  pointer-events: none;
}
header,
nav,
footer {
  position: absolute;
  z-index: 5;
}
header {
  top: max(5px, env(safe-area-inset-top));
  left: var(--safe-l);
  text-shadow: 1px 2px 4px #000;
  pointer-events: none;
  display: grid;
  font:
    800 clamp(17px, 3cqw, 35px) Georgia,
    serif;
}
header {
  color: #f8e0a0;
  font-family: 'Palatino Linotype', Palatino, Georgia, serif;
  font-style: italic;
  line-height: 1.12;
}
header #turn::before {
  content: '❧';
  color: #cdaa66;
  margin-right: 0.22em;
}
header #turn::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, #ba964e, #e3ce93 65%, transparent);
}
header small {
  font:
    italic 600 0.56em Georgia,
    serif;
}
nav {
  top: max(4px, env(safe-area-inset-top));
  right: var(--safe-r);
  display: flex;
  align-items: center;
  gap: 3px;
}
nav button,
#close-log {
  min-width: 40px;
  min-height: 40px;
  background: #261f1ce6;
  border: 1px solid #8e7954;
  border-radius: 6px;
}
nav img {
  width: 22px;
  height: 22px;
  margin: auto;
}
#drawer {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 32px;
  height: 44px;
  padding: 0;
  color: #fff1d2;
  font:
    700 22px Georgia,
    serif;
  border: 1px solid #877e56;
  border-radius: 5px 0 0 5px;
  background: #203c32e6;
}
body.open #drawer span {
  display: inline-block;
  transform: rotate(180deg);
}
footer {
  pointer-events: none;
  inset: auto var(--safe-r) max(2px, var(--safe-b)) var(--safe-l);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.amount,
.right {
  display: flex;
  align-items: baseline;
  gap: 0.22em;
}
.right {
  align-items: flex-end;
  gap: 6px;
}
.amount {
  color: #ffdf91;
  text-shadow:
    0 1px 2px #251400,
    0 1px 6px #000;
  white-space: nowrap;
}
.amount {
  --digit: clamp(38px, 14cqh, 75px);
  --unit: clamp(12px, 3.2cqh, 19px);
}
#expense {
  min-width: calc(4 * var(--unit) + 1.12 * var(--digit) + 0.22em);
  justify-content: flex-end;
}
.amount b {
  --digit-ink: clamp(27px, 12.1cqh, 64px);
  display: inline-flex;
  align-items: flex-end;
  position: relative;
  font:
    700 var(--digit) / 1 Georgia,
    serif;
  font-variant-numeric: tabular-nums;
}
.amount b .numeral-art {
  display: block;
  height: var(--digit-ink);
  overflow: visible;
  filter: drop-shadow(0 1px 2px #251400);
}
.amount-value {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.amount small {
  font: 700 var(--unit) / 1 system-ui;
}
.control {
  padding: 0;
  background: transparent;
  border: 0;
  width: var(--btn);
  height: max(44px, calc(var(--btn) * 0.35));
  pointer-events: auto;
}
.control:disabled {
  opacity: 0.38;
  filter: grayscale(0.85);
}
#guide {
  position: absolute;
  left: var(--guide-center, 50%);
  bottom: var(--guide-bottom, 0px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(clamp(100px, 44cqw, 620px), var(--guide-room, 620px));
  font-size: clamp(13px, 3.7cqh, 20px);
  line-height: 1.25;
  color: #fff;
  text-shadow:
    0 1px 3px #000,
    1px 1px 5px #000,
    -1px -1px 3px #000;
  text-align: center;
  background: #0906004d;
  border-radius: 4px;
  padding: 1px 4px;
  pointer-events: none;
}
.card {
  border: 0;
  background-color: transparent;
  border-radius: 5%;
  background-repeat: no-repeat;
  padding: 0;
  aspect-ratio: 809/1106;
  display: block;
  touch-action: none;
}
.plate {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
  object-fit: fill !important;
}
.card.board {
  position: absolute;
  pointer-events: auto;
  transform-origin: 0 0;
}
.card.board.resting .plate {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 136.6667%;
  height: 73.1707%;
  transform: translate(-50%, -50%) rotate(90deg);
}
.card.board[aria-disabled='true'] {
  cursor: default;
}
.hand-card {
  box-shadow: 0 1px 3px #170d05;
}
.employee-attempt,
.attempt-mark {
  position: absolute;
  pointer-events: none;
}
.stamp {
  position: absolute;
  left: 6%;
  top: 50%;
  width: 88%;
  aspect-ratio: 1;
  transform: translateY(-50%);
  background: url(../../assets/employee-stamps.png) left center/200% 100% no-repeat;
}
.stamp.pass {
  background-position: right center;
}
.counter,
.coin {
  position: absolute;
  pointer-events: none;
  color: #ffe5a6;
  text-shadow:
    0 1px 3px #000,
    0 0 4px #000;
  font:
    bold clamp(13px, 3.4cqh, 21px) Georgia,
    serif;
}
.coin {
  height: 19px;
  width: 19px;
}
.counter {
  z-index: 2;
  transform: translate(-50%, -100%);
}
.counter.market {
  width: 72px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transform: translate(-100%, -100%);
}
.counter.draw {
  white-space: nowrap;
  transform: translate(-50%, -50%);
  font-size: clamp(11px, 2.8cqh, 17px);
}
.board[data-zone='deck'] .plate {
  visibility: hidden;
}
.counter.own,
.counter.opponent {
  font-size: clamp(18px, 4.8cqh, 29px);
}
.counter.opponent {
  transform: translate(0, -100%);
}
.counter .unit {
  font: 600 0.73em system-ui;
}
.counter.own .unit,
.counter.opponent .unit {
  margin-right: 3px;
}
#inspect {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#inspect .card {
  position: absolute;
  left: 50%;
  top: var(--focus-y, 42%);
  width: var(--paper);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}
#inspect .control {
  position: absolute;
  right: calc(50% + var(--paper) / 2 + var(--gap));
  top: var(--focus-y, 42%);
  transform: translateY(-50%);
}
#focus {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
}
#focus:has(.decision)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #100c0555;
  pointer-events: none;
}
.decision {
  position: absolute;
  left: 50%;
  top: var(--focus-y, 42%);
  transform: translate(-50%, -50%);
  width: var(--paper);
  aspect-ratio: 809/1106;
  pointer-events: none;
}
.decision .hero,
.decision .target {
  position: absolute;
  width: 100%;
  inset: 0;
  pointer-events: auto;
}
.decision .target {
  transform: translate(13%, 1%) rotate(5deg);
}
.decision:has(.target) .hero {
  transform: translate(-10%, 0) rotate(-3deg);
}
.decision:has(.target) .left {
  margin-right: calc(var(--paper) * 0.15);
}
.decision:has(.target) .right {
  margin-left: calc(var(--paper) * 0.19);
}
#rebid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
#rebid .card {
  pointer-events: none;
}
.board.pending-target {
  z-index: 4;
}
.decision .control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.decision .left {
  right: calc(100% + var(--gap));
}
.decision .right {
  left: calc(100% + var(--gap));
}
.decision.salary {
  --lane: calc(100cqw - 2 * var(--btn) - 2 * var(--gap) - 2 * max(var(--safe-l), var(--safe-r)));
  --face: min(var(--paper), var(--lane));
  width: min(var(--lane), calc(var(--face) + (var(--fund-count, 1) - 1) * 44px));
  height: calc(var(--face) * 1.367);
  aspect-ratio: auto;
}
.salary .notes {
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: none;
}
.salary .note,
.salary .note + .note {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--face);
  height: auto;
  aspect-ratio: 809/1106;
  margin: 0;
  transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 0px)));
}
.notes {
  position: absolute;
  top: 81%;
  left: 78%;
  width: max-content;
  height: 0;
  display: flex;
  justify-content: center;
  direction: rtl;
  pointer-events: none;
  z-index: 3;
}
.note {
  position: relative;
  flex: none;
  width: var(--hand);
  height: calc(var(--hand) * 1.367);
  pointer-events: auto;
}
.note + .note {
  margin-right: calc(0px - var(--hand) + max(44px, var(--hand) * 0.52));
}
.note::after {
  content: '×';
  position: absolute;
  right: 0;
  top: 0;
  background: #211d19e6;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  font: 700 21px/24px system-ui;
}
.hand-layer {
  z-index: 4;
}
.decision:has(.caption) {
  top: max(var(--focus-y, 42%), calc(var(--paper) * 0.6835 + 22px + env(safe-area-inset-top, 0px)));
}
.decision .caption {
  font-size: clamp(13px, 3.25cqh, 18px);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 65cqw;
  text-shadow: 0 1px 6px #000;
  text-align: center;
}
.pending-target {
  outline: 3px solid #ffe59f;
}
.choices {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 8px;
}
.choices button,
.panel-button,
dialog button {
  pointer-events: auto;
  background: #392b20;
  color: #fff3cf;
  border: 1px solid #ceb077;
  border-radius: 5px;
  min-height: 44px;
  padding: 4px 12px;
}
.reveal {
  position: absolute;
  left: 50%;
  top: var(--focus-y, 42%);
  width: var(--paper);
  transform: translate(-50%, -50%);
}
#show {
  z-index: 4;
}
#show .card {
  pointer-events: none;
}
#show .reveal[data-face] {
  pointer-events: auto;
}
.slot-row {
  position: absolute;
  inset: 50% 0 auto;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  gap: 2%;
}
.slot {
  width: 30%;
  aspect-ratio: 64/72;
  display: grid;
  place-items: center;
  background: transparent url(trigger-frame.svg) center/100% 100% no-repeat;
  animation: appear 0.32s both;
}
.slot img {
  width: 75%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}
@keyframes appear {
  0% {
    transform: scale(0.15);
    opacity: 0;
  }
  75% {
    transform: scale(1.13);
  }
  100% {
    transform: scale(1);
  }
}
.challenge-logo {
  position: absolute;
  width: 74cqw;
  left: 50%;
  top: 43%;
  animation: challenge 0.8s forwards;
}
@keyframes challenge {
  0% {
    transform: translate(-50%, -50%) rotate(-25deg) scale(0.15);
    opacity: 0;
  }
  45%,
  70% {
    transform: translate(-50%, -50%) scale(0.75);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.7);
    opacity: 0;
  }
}
#log {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(29vw, 310px);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  background: #1f1b17;
  padding: 6px;
  overflow: auto;
  z-index: 7;
}
body.open #log {
  transform: none;
}
#log ol {
  padding-left: 18px;
  font-size: 14px;
}
#log li {
  margin-block: 0.5em;
}
/* Source coordinates of the outer four portrait frames and central lettering: x=194..1504, y=94..840 of 1672×941. Center this protected rectangle; the curtain is bleed. */
#title {
  --art: min(calc(100vw * 1.273), calc(100dvh * 2.235));
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #44161b;
}
#title::before,
#title::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background-image: url(../../assets/ui/title-2026-curtain-trim.png);
  background-size: 1100% 100%;
  pointer-events: none;
}
#title::before {
  left: 0;
  background-position: left;
}
#title::after {
  right: 0;
  background-position: right;
}
.title-art {
  z-index: 1;
  position: absolute;
  left: calc(50% - var(--art) * 0.0078);
  top: calc(50% + var(--art) * 0.0021);
  width: var(--art);
  aspect-ratio: 1672/941;
  transform: translate(-50%, -50%);
  background: url(../../assets/ui/title-2026-curtain-trim.png) center/100% 100% no-repeat;
}
#start {
  z-index: 2;
  overflow: hidden;
  clip-path: polygon(
    3% 5%,
    24% 5%,
    26% 0%,
    33% 5%,
    70% 5%,
    73% 1%,
    77% 4%,
    95% 5%,
    99% 9%,
    99% 20%,
    97% 35%,
    98% 66%,
    100% 85%,
    99% 93%,
    96% 98%,
    77% 96%,
    73% 99%,
    69% 96%,
    33% 96%,
    29% 100%,
    24% 97%,
    4% 97%,
    0% 92%,
    0% 82%,
    2% 65%,
    2% 34%,
    0% 16%,
    0% 10%
  );
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(140px, 24vw, 310px);
  height: auto;
  aspect-ratio: 498/198;
  background: transparent;
  border: 0;
  padding: 0;
}
#start img {
  position: absolute;
  max-width: none;
  width: 205.62249%;
  height: 386.36364%;
  left: -53.21285%;
  top: -136.36364%;
  object-fit: fill;
}
#loading {
  z-index: 2;
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4%;
  color: white;
  text-shadow: 0 1px 5px #000;
  text-align: center;
}
#title.departing {
  animation: title-leave 0.18s ease-out forwards;
  pointer-events: none;
}
@keyframes title-leave {
  to {
    opacity: 0;
  }
}
.match-result {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: #100b0570;
  color: #ffe3a1;
  text-align: center;
}
.match-result h1 {
  margin: 0;
  text-shadow: 0 2px 6px #000;
  font-size: clamp(30px, 8cqh, 75px);
}
.match-result button {
  width: var(--btn);
  min-height: 44px;
  background: transparent url(../../assets/ui/retry-original-cutout.png) center/contain no-repeat;
  border: 0;
  color: transparent;
}
dialog {
  background: #231c17;
  color: #fff1cf;
  border: 1px solid #bb9d68;
  border-radius: 8px;
}
dialog:modal {
  display: grid;
  gap: 12px;
}
dialog::backdrop {
  background: #0008;
}
dialog a {
  color: #fff3c1;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) and (orientation: portrait) {
  :root {
    --paper: min(43cqw, 35cqh);
    --btn: clamp(50px, 18cqw, 100px);
    --gap: 2cqw;
  }
  #guide {
    bottom: 52px;
    max-width: 86cqw;
  }
  .amount {
    --digit: 26px;
  }
}
@media (orientation: landscape) and (max-height: 699px) {
  #play {
    --focus-y: max(
      calc(var(--paper) * 0.6835 + 5px),
      min(42cqh, calc(var(--hand-start, 100cqh) - var(--paper) * 0.6835 - 3px))
    );
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
