/* Clip the mountain illustration to the felt while tile flights can still cross its edge. */
.felt-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.felt-art::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 11%;
  width: 82%;
  aspect-ratio: 3;
  background: url("assets/solo-landscape.webp") center / contain no-repeat;
  opacity: .52;
}

/* Decorative only. RummiMotion owns the moving faces and the resting hit targets. */
.solo-meld-trails {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9299;
  pointer-events: none;
  overflow: hidden;
}
.solo-meld-trails path {
  fill: none;
  stroke: #ffe1a1;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-dasharray: 1;
  filter: drop-shadow(0 0 3px #efb55c);
  animation: solo-tile-trace 360ms cubic-bezier(.23,.76,.31,1) both;
}
@keyframes solo-tile-trace {
  from { stroke-dashoffset: 1; opacity: 0; }
  14% { opacity: .88; }
  70% { stroke-dashoffset: 0; opacity: .8; }
  to { stroke-dashoffset: 0; opacity: 0; }
}

.meld-tiles:has(> .solo-meld-mark) { position: relative; }
.solo-meld-mark {
  position: absolute;
  inset: -3px;
  z-index: 2;
  pointer-events: none;
  border: 2px solid #f8d383;
  border-radius: 7px;
  box-shadow: 0 0 8px #f6c168a6, inset 0 0 4px #fff2a677;
  animation: solo-meld-ink 880ms ease-out both;
}
.solo-meld-mark b, .solo-victory-seal {
  display: grid;
  place-items: center;
  background: #953c2b;
  color: #fff1d3;
  border: 1px solid #f4d597;
  border-radius: 21% 14% 18% 15%;
  box-shadow: inset 0 0 0 2px #943526, inset 0 0 0 3px #eac498;
  font-family: 'Kaiti TC', 'STKaiti', 'DFKai-SB', 'KaiTi', var(--serif);
  font-weight: 700;
}
.solo-meld-mark b {
  position: absolute;
  right: -4px;
  top: -7px;
  width: 1.4em;
  height: 1.4em;
  font-size: clamp(12px, .45 * var(--public-size, 40px), 20px);
  line-height: 1;
  transform: rotate(-7deg);
}
@keyframes solo-meld-ink {
  0%, 18% { opacity: 0; }
  33%, 75% { opacity: 1; }
  100% { opacity: 0; }
}

.solo-call {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
  container-type: size;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
  border-radius: inherit;
  animation: solo-call-duration var(--call-time, 680ms) linear both;
}

.solo-call-print {
  --wash: #204e49;
  --deep: #12352f;
  position: relative;
  /* Leave the newly exposed meld visible beneath the calligraphy. */
  top: max(-76px, -15cqh);
  display: grid;
  justify-items: center;
  align-content: center;
  grid-template-columns: 1.05em 1.56em;
  grid-template-rows: auto auto;
  justify-content: center;
  gap: .05em .16em;
  width: 3.5em;
  height: 1.56em;
  isolation: isolate;
  font: 900 clamp(38px, min(13cqw, 22cqh), 76px)/.95 'Kaiti TC', 'STKaiti', 'BiauKai', 'DFKai-SB', 'KaiTi', var(--serif);
  animation: solo-call-strike 310ms cubic-bezier(.17,.85,.29,1) both;
}
.solo-call.is-player .solo-call-print { --wash: #9b4433; --deep: #632d21; }

.solo-call-print::before,
.solo-call-print::after {
  content: '';
  position: absolute;
  inset: 8% -3% 3%;
  z-index: -1;
  transform: rotate(-3deg);
  pointer-events: none;
  clip-path: polygon(8% 17%, 32% 7%, 18% 12%, 75% 0, 95% 5%, 88% 11%, 100% 9%, 93% 19%, 100% 17%, 96% 29%, 92% 31%, 98% 34%, 94% 49%, 100% 50%, 91% 63%, 99% 62%, 93% 70%, 98% 71%, 87% 79%, 98% 79%, 78% 90%, 85% 89%, 68% 94%, 8% 100%, 15% 93%, 0 94%, 8% 82%, 1% 83%, 7% 71%, 4% 67%, 9% 58%, 0 61%, 4% 50%, 1% 46%, 10% 37%, 3% 39%, 9% 29%, 0 32%, 12% 21%, 3% 23%);
}
.solo-call-print::before {
  background: url("assets/grain.svg"), linear-gradient(165deg, var(--wash) 20%, var(--deep) 90%);
  background-blend-mode: soft-light;
}
.solo-call-print::after {
  inset: 5% -7% -1%;
  background: linear-gradient(177deg, transparent 12%, #edd398 12.5% 13.3%, transparent 14.3% 17.2%, #efcf8b77 17.4% 17.9%, transparent 18.4% 81%, #d6af6b 81.3% 81.9%, transparent 83% 86%, #e8cb92 86.3% 87%, transparent 88%);
}
.solo-call-glyph {
  display: block;
  position: relative;
  grid-area: 1 / 1 / 3 / 2;
  align-self: center;
  color: #fff0c7;
  font-weight: 900;
  text-shadow: 0 2px 0 #593e24, 0 4px 8px #10271d;
  transform: rotate(-5deg);
}
.solo-call-actor, .solo-victory-actor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7em;
  color: #ffedc6;
  text-shadow: 0 1px 2px #342818;
  font: 700 clamp(13px, 3.4cqw, 20px)/1.2 var(--serif);
  letter-spacing: .08em;
}
.solo-call-actor::before, .solo-call-actor::after,
.solo-victory-actor::before, .solo-victory-actor::after {
  content: '';
  width: 1.2em;
  height: 1px;
  background: currentColor;
  opacity: .7;
}
.solo-call-print .solo-call-actor {
  grid-area: 2 / 2;
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(12px, min(3.6cqw, 5cqh), 17px);
}
.solo-call-beats {
  grid-area: 1 / 2;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: .045em;
}
.solo-call-beats i {
  display: block;
  width: .23em;
  height: .30em;
  border: 1px solid #ecd7a3;
  border-radius: 20% 20% 16% 16%;
  background: linear-gradient(115deg,#fff4cf,#e2c382);
  box-shadow: inset 0 -.065em #c09d60, 0 .022em #473522;
}
[data-kind="chow"] .solo-call-beats i { animation: solo-chow-step 260ms calc(var(--beat) * 68ms) ease-out backwards; }
[data-kind="pung"] .solo-call-beats i { --from: -.46em; animation: solo-pung-hit 280ms ease-out both; }
[data-kind="pung"] .solo-call-beats i + i { --from: .46em; }
[data-kind="kong"] .solo-call-beats i { animation: solo-kong-drop 300ms calc(var(--beat) * 42ms) ease-out backwards; }
[data-kind="kong"] .solo-call-glyph { animation: solo-kong-stamp 280ms 160ms ease-out both; }
@keyframes solo-chow-step {
  from { opacity: 0; transform: translate(-.22em,.09em) rotate(-15deg); }
  72% { transform: translate(.025em,-.025em); }
  to { opacity: 1; transform: none; }
}
@keyframes solo-pung-hit {
  from { opacity: .25; transform: translateX(var(--from)); }
  62% { opacity: 1; transform: translateX(0) scaleX(.82); }
  to { transform: none; }
}
@keyframes solo-kong-drop {
  from { opacity: 0; transform: translateY(-.35em); }
  62% { opacity: 1; transform: translateY(.02em) scale(1.08,.90); }
  to { transform: none; }
}
@keyframes solo-kong-stamp {
  0% { transform: rotate(-5deg) scale(1.18); }
  36% { transform: rotate(-5deg) scale(.94, .88); }
  100% { transform: rotate(-5deg); }
}
@keyframes solo-call-strike {
  from { transform: translateY(-.15em) scale(1.36) rotate(-4deg); }
  46% { transform: translateY(.025em) scale(.95) rotate(.5deg); }
  to { transform: none; }
}
@keyframes solo-call-duration {
  0% { opacity: 0; }
  7%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

dialog.solo-victory {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.solo-victory::backdrop { background: #0c221b59; }
.solo-victory-panel {
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 2vh, 20px);
  padding: 4px;
  container-type: size;
  overflow: auto;
  isolation: isolate;
  border-radius: 14px;
  background: radial-gradient(ellipse 59% 52% at center, #102c23 8%, #0d2d25f5 48%, #10362a77 75%, transparent);
  animation: solo-victory-appear 320ms ease-out both;
}
.solo-victory-actor { color: #f1d997; }
.solo-win-reason {
  padding-left: .65em;
  border-left: 1px solid #c7a769;
  white-space: nowrap;
}
#solo-win-confirm {
  position: relative;
  min-height: 44px;
  min-width: 9em;
  margin-top: 2px;
  padding: 8px 20px;
  border: 1px solid #f5df9f;
  border-radius: 5px;
  background: linear-gradient(180deg, #f4dfad, #dbc087);
  box-shadow: inset 0 0 0 2px #b695582b, 0 3px 8px #0d261c99;
  color: #343725;
  font: 700 16px/1.3 var(--serif);
  letter-spacing: .06em;
}
#solo-win-confirm:hover { background: #ffedbb; }
#solo-win-confirm:focus-visible { outline: 2px solid #fff4d8; outline-offset: 3px; }
.solo-victory-print {
  --brush-size: clamp(47px, min(30.5cqw, 48cqh), 182px);
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: baseline;
  gap: .12em;
  padding: .1em .24em;
  font: 900 var(--brush-size)/1 'Kaiti TC', 'STKaiti', 'BiauKai', 'DFKai-SB', 'KaiTi', var(--serif);
  transform: rotate(-4deg);
}
.solo-victory-print::before, .solo-victory-print::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: 52%;
  left: 50%;
  width: min(146%, 94cqw);
  translate: -50% 0;
  height: .31em;
  transform: rotate(-4deg);
  background: linear-gradient(90deg, transparent, #ab773ca8 17%, #c38d52c7 47%, #ad7c3a99 84%, transparent);
  clip-path: polygon(0 61%, 19% 29%, 9% 33%, 37% 11%, 26% 18%, 80% 0, 95% 6%, 79% 24%, 100% 11%, 88% 37%, 99% 26%, 81% 51%, 95% 45%, 63% 77%, 72% 75%, 17% 98%, 25% 84%, 2% 97%, 17% 66%);
}
.solo-victory-print::after {
  top: 65%;
  height: .1em;
  opacity: .64;
  transform: rotate(-6deg);
  background: repeating-linear-gradient(0deg, #d5a660 0 1px, transparent 1px 3px);
}
.solo-victory-print strong {
  white-space: nowrap;
  color: #f5d782;
  font-weight: inherit;
  letter-spacing: -.065em;
  filter: drop-shadow(1px 3px 1px #11271f) drop-shadow(0 3px 14px #1a2619);
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .solo-victory-print strong {
    color: transparent;
    background-image: url("assets/grain.svg"), linear-gradient(112deg, #d89543 1%, #fff1ad 23%, #e6b75f 47%, #ffdf91 64%, #c99348 98%);
    background-size: 84px, cover;
    background-blend-mode: soft-light;
    -webkit-background-clip: text;
    background-clip: text;
  }
}
.solo-victory-seal {
  align-self: flex-end;
  margin-bottom: .08em;
  width: 1.27em;
  height: 1.27em;
  font-size: .32em;
  line-height: 1;
  transform: rotate(9deg);
}
@media (min-aspect-ratio: 3/2) and (max-height: 480px) {
  .solo-victory-panel {
    justify-content: center;
    grid-template-columns: max-content max-content;
    grid-template-rows: auto auto;
    column-gap: clamp(14px, 4vw, 34px);
    row-gap: 8px;
  }
  .solo-victory-print { grid-area: 1 / 1 / 3 / 2; align-self: center; }
  .solo-victory-actor { grid-area: 1 / 2; align-self: end; }
  #solo-win-confirm { grid-area: 2 / 2; align-self: start; }
}
@keyframes solo-victory-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.solo-rackout-panel {
  overflow: visible;
  animation: none;
  gap: clamp(4px, 1vh, 10px);
}
.solo-rackout-banner {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.5cqw, 26px);
  width: min(95%, 720px);
  min-width: 0;
  padding: clamp(8px, 2.8cqh, 24px) clamp(12px, 4.5cqw, 42px);
}
.solo-rackout-banner::before, .solo-rackout-banner::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  animation: solo-rackout-unroll 300ms 220ms ease-out both;
}
.solo-rackout-banner::before {
  inset: 0;
  background: url("assets/grain.svg"), linear-gradient(108deg, #773d2d, #4a3828 25%, #193e32 58%, #304332 85%, #674631);
  background-blend-mode: soft-light;
  clip-path: polygon(0 10%, 9% 7%, 8% 3%, 79% 0, 100% 4%, 97% 24%, 100% 30%, 97% 53%, 100% 83%, 98% 96%, 12% 100%, 0 95%, 3% 72%, 1% 63%, 3% 46%);
}
.solo-rackout-banner::after { inset: 6% 5%; border-block: 1px solid #dec48b9c; }
@keyframes solo-rackout-unroll {
  from { opacity: 0; transform: scaleX(.46); }
  to { opacity: 1; transform: none; }
}
.solo-rackout-banner .solo-victory-print {
  --brush-size: clamp(40px, min(19cqw, 29cqh), 128px);
  flex: none;
  padding: .08em .05em;
  animation: solo-rackout-name 360ms 255ms ease-out both;
}
.solo-rackout-banner .solo-victory-print::before,
.solo-rackout-banner .solo-victory-print::after { display: none; }
.solo-rackout-finishing {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 4px;
  animation: solo-rackout-name 320ms 290ms ease-out both;
}
.solo-rackout-caption { color: #f1dfb2; font: 650 clamp(11px, 2.6cqw, 14px)/1.25 var(--serif); }
.solo-rackout-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 2px;
  max-width: min(50cqw, 390px);
}
.solo-rackout-tile {
  width: clamp(17px, min(6.4cqw, 8.4cqh), 37px);
  aspect-ratio: .75;
  padding: 1px;
  border: 1px solid #dfcba3;
  border-radius: 3px;
  background: #fff8e7;
  box-shadow: 0 2px #a7956e;
}
@keyframes solo-rackout-name {
  from { opacity: 0; translate: 0 3px; }
  to { opacity: 1; translate: 0; }
}
.solo-rackout-perch {
  position: relative;
  align-self: center;
  flex: none;
  width: clamp(35px, min(13cqw, 23cqh), 92px);
  aspect-ratio: 1;
}
.solo-rackout-perch .solo-victory-seal {
  position: absolute;
  inset: auto 16% 0;
  width: auto;
  height: 44%;
  margin: 0;
  transform: rotate(6deg);
  font-size: clamp(10px, min(3.5cqw, 4.8cqh), 21px);
  animation: solo-rackout-stamp 200ms 620ms ease-out both;
}
.solo-rackout-bird {
  display: block;
  position: absolute;
  bottom: 31%;
  left: 0;
  width: 100%;
  aspect-ratio: 1;
  transform-origin: 50% 90%;
  background: url("assets/reactions/birds.png") 66.6667% 100% / 400% 400% no-repeat;
  filter: drop-shadow(0 2px 1px #18332966);
  pointer-events: none;
}
@keyframes solo-rackout-stamp {
  from { opacity: 0; transform: rotate(6deg) scale(1.18); }
  46% { opacity: 1; transform: rotate(6deg) scale(.9); }
  to { opacity: 1; transform: rotate(6deg); }
}
@media (min-aspect-ratio: 3/2) and (max-height: 480px) {
  .solo-rackout-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }
  .solo-rackout-panel .solo-victory-actor, .solo-rackout-panel #solo-win-confirm {
    grid-area: auto;
    align-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .solo-meld-trails { display: none; }
  .solo-call, .solo-call-print, .solo-meld-mark, .solo-victory-panel { animation: none; }
  .solo-call[data-kind] .solo-call-beats i, .solo-call[data-kind] .solo-call-glyph,
  .solo-rackout-banner::before, .solo-rackout-banner::after, .solo-rackout-banner .solo-victory-print,
  .solo-rackout-finishing, .solo-rackout-perch .solo-victory-seal { animation: none; }
}
