* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background-color: #123e35;
  background-image: radial-gradient(#ffffff16 1px, transparent 1px);
  background-size: 16px 16px;
  color: #fff4d7;
  font-family: 'Malgun Gothic', sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
#deck:focus-visible {
  outline: 3px solid #f0a449;
  outline-offset: 3px;
}
.layout {
  max-width: 1370px;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(170px, 235px) minmax(300px, 510px) minmax(
      170px,
      235px
    );
  justify-content: space-between;
  gap: 24px;
  padding: clamp(18px, 4vw, 60px);
  align-items: start;
}
.panel,
.center form,
#waiting {
  background: #fff7df;
  color: #283f34;
  border: 1px solid #132e24;
  box-shadow: 0 5px 0 #06271f;
  border-radius: 20px;
}
.panel {
  padding: 19px;
}
.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin: 0;
}
.panel i {
  background: #388f60;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.panel b {
  margin-left: auto;
  background: #e0eacb;
  border-radius: 18px;
  padding: 2px 9px;
}
.panel small {
  display: block;
  color: #526354;
  line-height: 1.5;
  font-size: 12px;
}
.panel ul,
.panel ol {
  padding: 0;
  list-style: none;
}
.online ul {
  max-height: 38vh;
  overflow: auto;
}
.online li {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
  padding: 4px 0;
}
.online img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.star {
  color: #be801e;
}
.ranks ol {
  counter-reset: rank;
}
.ranks li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #e4dcc6;
  padding: 6px 0;
  color: #918e80;
}
.ranks li:before {
  content: counter(rank);
  display: grid;
  place-items: center;
  background: #ece5d2;
  border-radius: 50%;
  width: 23px;
  height: 23px;
  font: bold 12px Georgia;
}
.ranks li:first-child:before {
  background: #f3cc73;
  color: #644719;
}
.center {
  text-align: center;
}
.center h1 {
  margin: 12px 0 26px;
  font-size: clamp(48px, 6.2vw, 85px);
  letter-spacing: -0.09em;
  line-height: 1.2;
  text-shadow: 3px 4px #072b22;
}
.center h1 span {
  font: 24px Georgia;
  color: #ffcd6b;
  vertical-align: top;
  margin-left: 4px;
}
.center form,
#waiting {
  padding: clamp(20px, 3vw, 38px);
}
label,
.selector-title {
  display: block;
  text-align: left;
  font-size: 15px;
  font-weight: bold;
}
input {
  display: block;
  width: 100%;
  border: 1px solid #c1b99f;
  background: #fffdf6;
  padding: 13px 15px;
  margin: 8px 0 24px;
  border-radius: 10px;
  color: #183c2f;
}
.selector-title {
  margin: 0 0 12px;
}
.picker {
  display: flex;
  align-items: center;
  gap: 5px;
}
.arrow {
  flex: none;
  background: #fffaf0;
  border: 1px solid #c8bda0;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  line-height: 24px;
  font-size: 28px;
  color: #244b39;
}
#deck {
  position: relative;
  flex: 1;
  min-width: 0;
  height: clamp(170px, 19vw, 228px);
  overflow: hidden;
  touch-action: pan-y;
}
.card {
  position: absolute;
  height: 96%;
  width: 72%;
  left: 14%;
  top: 2%;
  object-fit: cover;
  background: #f9eed7;
  border: 3px solid #b5a98c;
  border-radius: 20px;
  transition:
    transform 0.25s,
    opacity 0.25s;
  opacity: 0;
  transform: scale(0.68);
  pointer-events: none;
}
.card.left,
.card.right {
  opacity: 0.75;
  z-index: 1;
}
.card.left {
  transform: translateX(-40%) rotate(-9deg) scale(0.8);
}
.card.right {
  transform: translateX(40%) rotate(9deg) scale(0.8);
}
.card.active {
  opacity: 1;
  transform: scale(1);
  z-index: 2;
  border-color: #5f5138;
}
.caption {
  font-size: 18px;
  font-weight: 800;
  margin-top: 12px;
}
.dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 9px 0 23px;
}
.dots i {
  width: 6px;
  height: 6px;
  background: #c7bea8;
  border-radius: 6px;
}
.dots .on {
  width: 16px;
  background: #285741;
}
.primary,
#leave {
  width: 100%;
  border: 1px solid #162e23;
  border-radius: 12px;
  padding: 14px;
  background: #ffcb67;
  color: #282e22;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 3px #453e29;
}
.primary span {
  float: right;
}
.primary:disabled {
  opacity: 0.6;
}
#my-cat {
  width: 180px;
  border-radius: 20px;
}
#my-name {
  display: block;
  font-size: 22px;
  margin-top: 10px;
}
#error {
  color: #ffdd9f;
}
.panel small:empty,
#error:empty {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 15px;
  }
  .panel {
    padding: 12px;
    border-radius: 14px;
  }
  .online {
    grid-column: 1;
    grid-row: 2;
  }
  .ranks {
    grid-column: 1;
    grid-row: 3;
  }
  .ranks ol {
    display: flex;
    gap: 4px;
    justify-content: space-between;
    margin: 9px 0;
  }
  .ranks li {
    flex-direction: column;
    gap: 1px;
    border: none;
    padding: 0;
  }
  .ranks li:before {
    width: 19px;
    height: 19px;
  }
  .panel h2 {
    font-size: 14px;
  }
  .center {
    grid-column: 1/-1;
    grid-row: 1;
    width: min(100%, 470px);
    margin: auto;
  }
  .center h1 {
    margin: 10px 0 16px;
  }
  #deck {
    height: 200px;
  }
  .online ul {
    max-height: 82px;
    margin: 8px 0;
  }
  .panel small {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}
#waiting {
  padding: clamp(12px, 2vw, 24px);
}
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 14px;
}
.table-head h2 {
  font-size: 21px;
  margin: 0;
}
.table-head span {
  color: #864318;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.table-wrap {
  position: relative;
  isolation: isolate;
  border: 6px solid #805a39;
  border-radius: 17px;
  background: #866345;
  box-shadow: 0 3px #513d2c;
  overflow: hidden;
}
#board {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  aspect-ratio: 1;
}
.tile {
  margin: 2px;
  border: 0;
  border-radius: 9px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
}
.seat {
  background: #f1ddac;
  color: #847151;
  font-size: 12px;
}
.food {
  background: #e1be82;
  gap: 1px;
}
.food img {
  width: 30%;
  max-width: 38px;
}
.food:enabled {
  box-shadow: inset 0 0 0 2px #ba842f;
}
.food[aria-pressed='true'] {
  box-shadow: inset 0 0 0 4px #42705a;
}
.food:disabled {
  opacity: 1;
  cursor: default;
}
#pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.piece {
  --travel: 0.42s;
  position: absolute;
  display: grid;
  justify-items: center;
  align-content: center;
  width: 32%;
  height: 32%;
  transform: translate(-50%, -50%);
  transition:
    left var(--travel) ease,
    top var(--travel) ease,
    transform 0.35s;
}
.piece img {
  border-radius: 50%;
  border: 2px solid #a5845f;
  grid-row: 2;
}
.piece {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.portrait-mount {
  position: relative;
  isolation: isolate;
  display: block;
  height: 68%;
  max-height: 96px;
  aspect-ratio: 1;
}
.portrait-mount img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.piece.mine .portrait-mount::before {
  content: '';
  position: absolute;
  inset: -5px;
  z-index: -1;
  pointer-events: none;
  border-radius: 46% 54% 46% 54% / 54% 46% 54% 46%;
  background: conic-gradient(
    from -30deg,
    #39765c,
    #b6d89a 14%,
    #457e61 29%,
    #20573e 47%,
    #90b581 65%,
    #316f51 82%,
    #86b180
  );
  box-shadow:
    inset 0 0 0 1px #31513b,
    inset 0 0 0 2px #d1d49a,
    0 2px 3px #4c3c2344;
}
.piece.mine .portrait-mount::after {
  content: '';
  position: absolute;
  inset: -2px;
  pointer-events: none;
  border: 1px solid #e6d49f;
  border-radius: 50%;
}
@keyframes arrive {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
#result-wait {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: #20362955;
}
#result-wait strong {
  background: #fff7df;
  color: #244938;
  border: 2px solid #89704a;
  border-radius: 16px;
  padding: 16px 30px;
  font-size: 24px;
  box-shadow: 0 4px 12px #18352a30;
}
.badge {
  color: #fff;
  background: #655d4a;
  border-radius: 12px;
  font-size: clamp(9px, 1vw, 12px);
  padding: 1px 7px;
  line-height: 1.25;
}
.badge.green {
  background: #35644b;
}
.piece-name {
  max-width: 96%;
  font-size: clamp(10px, 1vw, 13px);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.piece.crowded {
  transform: translate(-50%, -50%) scale(0.53);
}
#hint {
  min-height: 2.6em;
  display: grid;
  place-content: center;
  margin: 0.6em 0;
  font-size: 14px;
}
#waiting #leave {
  margin-top: 12px;
  font-size: 13px;
  padding: 6px;
  background: none;
  border: 0;
  box-shadow: none;
  color: #535b48;
}
#result {
  position: absolute;
  inset: 8%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff6ddfa;
  border: 2px solid #81592c;
  border-radius: 18px;
  padding: 5%;
  box-shadow: 0 4px 20px #59331d55;
}
#result h2 {
  margin: 0;
  font-size: 22px;
}
#scores {
  margin: 0.5em 0;
  padding: 0;
  list-style: none;
}
#scores li {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 4px;
  border-bottom: 1px solid #d9cbad;
  font-size: 14px;
}
.ranks li {
  overflow-wrap: anywhere;
}
@media (max-width: 800px) {
  .ranks:has(small[hidden]) ol {
    flex-direction: column;
  }
  .ranks:has(small[hidden]) li {
    flex-direction: row;
    gap: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .piece {
    transition: none;
  }
}
.food {
  position: relative;
}
.food:enabled[aria-pressed='true'] {
  box-shadow:
    inset 0 0 0 5px #175842,
    inset 0 0 0 8px #fff4b8;
}
.food[aria-pressed='true']::after {
  content: attr(data-chosen);
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #175842;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 800;
}
.piece.happy::after,
.piece.dust::after {
  position: absolute;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px #55332655);
}
.piece.happy::after {
  content: '💕';
  top: 1%;
  right: 12%;
  font-size: clamp(32px, 4vw, 48px);
  animation:
    arrive var(--travel) step-end both,
    sweet 0.7s ease-in-out var(--travel) infinite alternate;
}
.piece.scuffle img {
  animation: rumble 0.16s linear var(--travel) infinite alternate;
}
.piece.dust::after {
  content: '';
  inset: 5% 0 8%;
  background: url('/assets/fight-cloud.webp') center/contain no-repeat;
  animation:
    arrive var(--travel) step-end both,
    puff 0.26s ease-in-out var(--travel) infinite alternate;
}
@keyframes sweet {
  to {
    transform: translateY(-6px) rotate(10deg);
  }
}
@keyframes rumble {
  from {
    transform: translateX(-3px) rotate(-6deg);
  }
  to {
    transform: translateX(3px) rotate(6deg);
  }
}
@keyframes puff {
  to {
    transform: translate(3px, -3px) rotate(9deg);
  }
}
#results-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  box-sizing: border-box;
  padding: clamp(18px, 5vw, 32px);
  border: 3px solid #8a643b;
  border-radius: 24px;
  background: #fff7df;
  color: #294234;
  box-shadow: 0 12px 60px #142e2266;
}
#results-dialog::backdrop {
  background: #142e22a6;
}
#results-dialog h2 {
  margin: 0 36px 18px;
  text-align: center;
  font-size: clamp(26px, 5vw, 36px);
}
.cross {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 44px;
  height: 44px;
  font-size: 30px;
  color: #456450;
  border: 0;
  background: transparent;
}
#standings {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 7px;
}
#standings li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: clamp(6px, 2vw, 14px);
  align-items: center;
  padding: 9px;
  border-radius: 12px;
  background: #f4ebd6;
  text-align: left;
  font-size: clamp(17px, 3vw, 22px);
}
#standings img {
  width: clamp(38px, 9vw, 54px);
  aspect-ratio: 1;
  border-radius: 50%;
}
#standings .player {
  overflow-wrap: anywhere;
}
#standings .rank {
  font-size: 0.8em;
}
#standings li.winner {
  background: #ffe29b;
  color: #714015;
  box-shadow: inset 0 0 0 2px #c19032;
  font-weight: 900;
}
@media (prefers-reduced-motion: reduce) {
  .piece.happy::after,
  .piece.dust::after,
  .piece.scuffle img {
    animation: none;
  }
}
#deck .card {
  background-color: var(--portrait-color, #fff0cc);
  object-fit: contain;
  padding: 5%;
}
#palette {
  min-width: 0;
  text-align: left;
  border: 0;
  margin: 0 0 22px;
  padding: 0;
}
#palette legend {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 7px;
}
#swatches {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
}
#swatches button {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid #655d4955;
  border-radius: 50%;
  padding: 0;
}
#swatches button[aria-pressed='true'] {
  box-shadow: inset 0 0 0 2px white;
  outline: 2px solid #284536;
}
#swatches button[aria-pressed='true']::after {
  content: '✓';
  font-weight: 900;
  color: #223e30;
}
@media (max-width: 420px) {
  #swatches {
    grid-template-columns: repeat(5, 32px);
    gap: 8px;
  }
}

#ready[aria-pressed='true'] {
  background: #146742;
  border-color: #073f2a;
  color: white;
  box-shadow:
    inset 0 2px 0 #79cc9e,
    0 3px #073d29;
}
.portrait-mount .badge,
.portrait-mount .piece-name {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 3px #0005;
}
.portrait-mount .badge {
  top: -2%;
  border: 1px solid #fff9;
}
.portrait-mount .piece-name {
  bottom: -2%;
  max-width: 125%;
  border-radius: 8px;
  background: #26392ff0;
  color: #fff9e6;
  padding: 1px 6px;
}
.piece.mine .portrait-mount::before {
  inset: -7px;
  background: conic-gradient(
    from -45deg,
    #d6ff84,
    #1ecb72 23%,
    #007341 45%,
    #bbff77 68%,
    #019657 89%,
    #d6ff84
  );
  box-shadow:
    inset 0 0 0 2px #205639,
    0 0 0 2px #fff4a7,
    0 2px 6px #063d2790;
}
.piece.mine .portrait-mount::after {
  inset: -3px;
  border: 2px solid #fff6ae;
}
#reactions {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1vw, 9px);
  margin-top: 16px;
}
.reaction-button {
  flex: 0 1 56px;
  min-width: 0;
  border: 1px solid #c5ae82;
  border-radius: 12px;
  background: #fffdf3;
  color: #374836;
  padding: 4px 1px;
  line-height: 1.15;
}
.reaction-button span,
.reaction-button small {
  display: block;
}
.reaction-button span {
  font-size: 24px;
}
.reaction-button small {
  font-size: 11px;
  margin-top: 3px;
}
.reaction-button[aria-pressed='true'] {
  background: #ffdf86;
  border-color: #996a24;
}
.reaction-button:disabled {
  opacity: 0.48;
}
.reaction-bubble {
  position: absolute;
  z-index: 3;
  left: -16%;
  top: -16%;
  display: grid;
  place-items: center;
  background: #fffcf2;
  border: 2px solid #574932;
  border-radius: 50% 50% 14% 50%;
  width: clamp(39px, 4.6vw, 56px);
  aspect-ratio: 1;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1;
  box-shadow: 0 2px 4px #30281e40;
}
.language-bar {
  max-width: 1370px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  padding: 12px clamp(15px, 4vw, 60px) 0;
}
.language-bar label {
  font-size: 14px;
}
.language-bar select {
  border: 1px solid #d1bf95;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff7df;
  color: #244633;
  font:
    600 14px 'Malgun Gothic',
    sans-serif;
}
html:not([lang='ko']) .center h1 {
  letter-spacing: -0.045em;
  font-size: clamp(34px, 4.5vw, 64px);
}
html:not([lang='ko']) .reaction-button small {
  overflow-wrap: anywhere;
}
#music {
  margin-right: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #d1bf95;
  background: #fff7df;
  color: #3f5647;
  cursor: pointer;
}
#music[aria-pressed='true'] {
  background: #245b47;
  color: #fff7df;
  border-color: #245b47;
}
#music[aria-pressed='true'] .silent,
#music[aria-pressed='false'] .waves {
  display: none;
}
.treat {
  display: grid;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
}
.treat-packets {
  position: relative;
  width: clamp(62px, 16vw, 100px);
  height: clamp(40px, 10vw, 62px);
}
.treat-packet {
  position: absolute;
  display: grid;
  place-items: center;
  width: 83%;
  height: 47%;
  font-size: clamp(13px, 3vw, 20px);
  line-height: 1;
  border: 1px solid var(--packet-edge);
  border-inline: 4px double var(--packet-edge);
  border-radius: 3px;
  background: linear-gradient(
    var(--packet-light),
    var(--packet-color) 37%,
    #fff1ba 39% 71%,
    var(--packet-color) 73%
  );
  box-shadow: 0 2px 2px #6c411e40;
}
.treat-packet-back {
  top: 16%;
  left: 2%;
  transform: rotate(-22deg);
  --packet-edge: #91562a;
  --packet-light: #ffde8e;
  --packet-color: #eea347;
}
.treat-packet-front {
  bottom: 13%;
  right: 2%;
  transform: rotate(12deg);
  --packet-edge: #98391e;
  --packet-light: #ffb8a0;
  --packet-color: #e45e40;
}
.treat-value {
  display: flex;
  align-items: center;
  gap: 1px;
  color: #51371c;
  font: bold 12px/1 system-ui;
}
.treat-value img {
  width: 14px;
  height: 14px;
}
.food[aria-pressed='true'] .treat {
  transform: translateY(-7%);
}
