:root {
  color-scheme: light;
  --ink: #251915;
  --muted: #705f4c;
  --pond: #d8c6a2;
  --pond-deep: #8c6f4d;
  --leaf: #487e66;
  --leaf-dark: #24473f;
  --flower: #ae372d;
  --sun: #e0b04f;
  --line: #5b4632;
  --used: #ae372d;
  --panel: rgba(255, 248, 226, 0.88);
  --shadow: rgba(49, 33, 22, 0.24);
  --control-size: 56px;
  --name-field-height: 42px;
  --main-control-size: 70px;
  --modal-control-size: 60px;
  --control-stack-gap: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 18%, rgba(224, 176, 79, 0.32), transparent 23rem),
    linear-gradient(135deg, #e4d2ac 0%, #9fc9c8 42%, #b43b32 135%);
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #f6cf66;
  outline-offset: 3px;
}

.place-name,
.next-round,
.icon-button,
.mode-button,
.close-button,
.save-button,
.mode9-unlock-action {
  display: inline-grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  border-style: solid;
  border-color: transparent;
  border-image-source: url("./assets/asset-001.png");
  border-image-slice: 34 fill;
  border-image-width: 12px;
  border-image-repeat: stretch;
  background: none;
  line-height: 1;
  text-align: center;
}

.shell {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
  padding: 0;
}

.stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}

.stage[aria-busy="true"]::after {
  content: "";
  position: absolute;
  z-index: 100;
  inset: 0;
  background: #d8c59b;
  pointer-events: auto;
}

.topbar,
.controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  position: absolute;
  z-index: 5;
  width: auto;
  top: clamp(10px, 2.4vw, 24px);
  left: clamp(10px, 2.4vw, 28px);
  right: clamp(10px, 2.4vw, 28px);
  min-height: 92px;
  padding: 0 clamp(4px, 1vw, 10px);
}

.place-name {
  appearance: none;
  position: absolute;
  left: 0;
  top: 22px;
  width: max-content;
  max-width: min(48vw, 380px);
  min-width: clamp(150px, 22vw, 230px);
  min-height: clamp(48px, 7.2vw, 76px);
  padding: 0 clamp(18px, 2.4vw, 28px);
  border-width: 12px 18px;
  border-image-source: url("./assets/asset-001.png");
  border-image-slice: 34 fill;
  border-image-width: 12px;
  border-radius: 6px;
  background: none;
  box-shadow:
    0 4px 0 rgba(42, 30, 21, 0.56),
    0 12px 22px rgba(49, 33, 22, 0.22);
  overflow: hidden;
  color: #11100e;
  font-family:
    "Gungsuh", "궁서", "Batang", "바탕", "Noto Serif KR", "Nanum Myeongjo",
    serif;
  font-size: clamp(1.55rem, 4.9vw, 3.45rem);
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-text-stroke: 0.18px rgba(17, 16, 14, 0.62);
  text-shadow:
    0.35px 0 rgba(17, 16, 14, 0.72),
    -0.25px 0 rgba(17, 16, 14, 0.42),
    0 0.7px rgba(17, 16, 14, 0.54),
    0 0 0.5px rgba(17, 16, 14, 0.62),
    0 2px 0 rgba(255, 248, 226, 0.26);
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  isolation: isolate;
  animation:
    palaceButtonLift 4.2s ease-in-out infinite,
    palaceButtonGlow 4.2s ease-in-out infinite;
}

.place-name.place-gwanghwamun,
.place-name.place-heungnyemun,
.place-name.place-yeongjegyo,
.place-name.place-geunjeongjeon-out,
.place-name.place-geunjeongjeon-in,
.place-name.place-amisan-chimney,
.place-name.place-gyeonghoeru,
.place-name.place-gyeonganmun,
.place-name.place-jibokjae-out,
.place-name.place-jibokjae-in,
.place-name.place-hyangwonjeong,
.place-name.place-zodiac-statues {
  width: clamp(190px, 26vw, 270px);
  aspect-ratio: 549 / 135;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-image-source: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  -webkit-text-stroke: 0;
  text-shadow: none;
  box-shadow: none;
  overflow: visible;
  animation: none;
}

.place-name.place-gwanghwamun {
  background: url("./assets/place-button-gwanghwamun.png") center / 100% 100% no-repeat;
}

.place-name.place-heungnyemun {
  background: url("./assets/place-button-heungnyemun.png") center / 100% 100% no-repeat;
}

.place-name.place-yeongjegyo {
  background: url("./assets/place-button-yeongjegyo.png") center / 100% 100% no-repeat;
}

.place-name.place-geunjeongjeon-out {
  background: url("./assets/place-button-geunjeongjeon-out.png") center / 100% 100% no-repeat;
}

.place-name.place-geunjeongjeon-in {
  background: url("./assets/place-button-geunjeongjeon-in.png") center / 100% 100% no-repeat;
}

.place-name.place-amisan-chimney {
  background: url("./assets/place-button-amisan-chimney.png") center / 100% 100% no-repeat;
}

.place-name.place-gyeonghoeru {
  background: url("./assets/place-button-gyeonghoeru.png") center / 100% 100% no-repeat;
}

.place-name.place-gyeonganmun {
  background: url("./assets/place-button-gyeonganmun.png") center / 100% 100% no-repeat;
}

.place-name.place-jibokjae-out {
  background: url("./assets/place-button-jibokjae-out.png") center / 100% 100% no-repeat;
}

.place-name.place-jibokjae-in {
  background: url("./assets/place-button-jibokjae-in.png") center / 100% 100% no-repeat;
}

.place-name.place-hyangwonjeong {
  background: url("./assets/place-button-hyangwonjeong.png") center / 100% 100% no-repeat;
}

.place-name.place-zodiac-statues {
  background: url("./assets/place-button-zodiac.png") center / 100% 100% no-repeat;
}

.place-name:active,
.place-name.pressing {
  animation-play-state: paused;
  filter: brightness(0.88) saturate(0.94);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.64),
    inset 0 -1px 0 rgba(128, 82, 34, 0.18),
    0 1px 0 rgba(99, 64, 28, 0.3),
    0 8px 18px rgba(49, 33, 22, 0.18);
}

.place-name.place-gwanghwamun:active,
.place-name.place-gwanghwamun.pressing,
.place-name.place-heungnyemun:active,
.place-name.place-heungnyemun.pressing,
.place-name.place-yeongjegyo:active,
.place-name.place-yeongjegyo.pressing,
.place-name.place-geunjeongjeon-out:active,
.place-name.place-geunjeongjeon-out.pressing,
.place-name.place-geunjeongjeon-in:active,
.place-name.place-geunjeongjeon-in.pressing,
.place-name.place-amisan-chimney:active,
.place-name.place-amisan-chimney.pressing,
.place-name.place-gyeonghoeru:active,
.place-name.place-gyeonghoeru.pressing,
.place-name.place-gyeonganmun:active,
.place-name.place-gyeonganmun.pressing,
.place-name.place-jibokjae-out:active,
.place-name.place-jibokjae-out.pressing,
.place-name.place-jibokjae-in:active,
.place-name.place-jibokjae-in.pressing,
.place-name.place-hyangwonjeong:active,
.place-name.place-hyangwonjeong.pressing,
.place-name.place-zodiac-statues:active,
.place-name.place-zodiac-statues.pressing {
  box-shadow: none;
}

.stage.background-view .place-name {
  animation: none;
}

@keyframes palaceButtonLift {
  0%, 68%, 100% { transform: translateY(0); }
  74% { transform: translateY(-4px); }
  81% { transform: translateY(2px); }
  88% { transform: translateY(-2px); }
}

@keyframes palaceButtonGlow {
  0%, 45%, 84%, 100% { filter: brightness(1) saturate(1); }
  58% { filter: brightness(1.28) saturate(1.08); }
  68% { filter: brightness(1.16) saturate(1.04); }
}

.trophy-strip,
.score-stack,
.controls,
.next-round,
.success-overlay,
.modal {
  transition:
    transform 0.34s ease,
    opacity 0.24s ease;
}

.stage.background-view .trophy-strip,
.stage.background-view .score-stack,
.stage.background-view .controls,
.stage.background-view .next-round,
.stage.background-view .success-overlay,
.stage.background-view .modal {
  opacity: 0;
  pointer-events: auto;
}

.stage.background-view .trophy-strip {
  transform: translateX(120vw);
}

.stage.background-view .score-stack,
.stage.background-view .controls,
.stage.background-view .next-round,
.stage.background-view .success-overlay,
.stage.background-view .modal {
  transform: translateX(120vw);
}

.stage.background-view canvas {
  cursor: grab;
}

.stage.background-view.dragging canvas {
  cursor: grabbing;
}

.trophy-strip,
.score-stack {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 2px 8px rgba(255, 248, 226, 0.85), 0 1px 1px rgba(37, 25, 21, 0.34);
}

.trophy-strip {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  min-width: 118px;
  width: max-content;
  max-width: 92vw;
  display: grid;
  place-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  pointer-events: auto;
  touch-action: manipulation;
}

#trophyLineA,
#trophyLineB {
  position: relative;
  width: 100%;
  height: 4.2rem;
  min-height: 4.2rem;
  white-space: nowrap;
}

#trophyLineB {
  min-height: 4.2rem;
}

#trophyLineA:empty,
#trophyLineB:empty {
  display: none;
  min-height: 0;
}

.trophy-layer {
  position: absolute;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.trophy-layer-large {
  top: 0;
  z-index: 1;
  transform: translateX(-50%);
}

.trophy-layer-large .seal-trophy + .seal-trophy {
  margin-left: -1.1rem;
}

.trophy-layer-small {
  top: 1.55rem;
  z-index: 2;
  gap: 3px;
  transform: translateX(-50%);
}

.trophy-layer-myriad {
  top: 0;
  z-index: 3;
  transform: translateX(-50%);
}

.trophy-layer-legacy {
  top: 0;
  z-index: 4;
  transform: translateX(-50%);
}

#trophyLineB .trophy-layer-myriad {
  top: -2.55rem;
}

#trophyLineA .trophy-layer-myriad {
  top: calc(-2.1rem - 4px);
}

#trophyLineA .trophy-layer-legacy {
  top: 0.2rem;
}

.trophy-layer-myriad .ten-thousand-cheonrok-trophy + .ten-thousand-cheonrok-trophy {
  margin-left: -5.3rem;
}

.trophy-layer-legacy .legacy-cheonrok-trophy + .legacy-cheonrok-trophy {
  margin-left: -2.7rem;
}

.trophy-small,
.trophy-big {
  display: inline-block;
  color: initial;
  vertical-align: middle;
}

.trophy-small {
  font-size: 0.95rem;
  line-height: 1;
}

.trophy-big {
  font-size: 1.9rem;
  line-height: 1;
}

.seal-trophy {
  width: 1.55rem;
  height: 1.55rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter:
    drop-shadow(1.6px 0 0 rgba(24, 15, 9, 0.86))
    drop-shadow(-1.6px 0 0 rgba(24, 15, 9, 0.86))
    drop-shadow(0 1.6px 0 rgba(24, 15, 9, 0.86))
    drop-shadow(0 -1.6px 0 rgba(24, 15, 9, 0.78))
    drop-shadow(0 2px 0 rgba(55, 34, 20, 0.88))
    drop-shadow(0 0 4px rgba(255, 248, 226, 0.62));
}

.seal-trophy.trophy-small {
  filter:
    drop-shadow(0.5px 0 0 rgba(24, 15, 9, 0.86))
    drop-shadow(-0.5px 0 0 rgba(24, 15, 9, 0.86))
    drop-shadow(0 0.5px 0 rgba(24, 15, 9, 0.86))
    drop-shadow(0 -0.5px 0 rgba(24, 15, 9, 0.78)) !important;
}

.seal-trophy.trophy-big {
  width: 3.1rem;
  height: 3.1rem;
}

.seal-trophy.trophy-grand {
  width: 4.65rem;
  height: 4.65rem;
}

.legacy-cheonrok-trophy {
  display: inline-block;
  width: 4.65rem;
  height: 4.65rem;
  background: url("./assets/legacy-cheonrok-trophy.png") center / contain no-repeat;
  vertical-align: middle;
  filter: drop-shadow(0 2px 2px rgba(28, 18, 12, 0.72));
}

.ten-thousand-cheonrok-trophy {
  width: 6.975rem;
  height: 6.975rem;
}

.jade-seal {
  background-image: url("./assets/asset-002.png");
}

.gold-seal {
  background-image: url("./assets/asset-003.png");
}

.trophy-strip .jade-seal {
  background-image: var(--jade-trophy-outlined, url("./assets/asset-002.png"));
}

.trophy-strip .gold-seal {
  background-image: var(--gold-trophy-outlined, url("./assets/asset-003.png"));
}

.trophy-strip .legacy-cheonrok-trophy {
  background-image: var(--legacy-trophy-outlined, url("./assets/legacy-cheonrok-trophy.png"));
}

.rainbow-trophy {
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
  display: inline-block;
  color: transparent;
  overflow: visible;
  filter:
    drop-shadow(0 1px 0 rgba(55, 34, 20, 0.9))
    drop-shadow(0 -1px 0 rgba(55, 34, 20, 0.75))
    drop-shadow(1px 0 0 rgba(55, 34, 20, 0.72))
    drop-shadow(-1px 0 0 rgba(55, 34, 20, 0.72))
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.68));
}

.rainbow-trophy::before {
  content: "";
  position: absolute;
  inset: 12% 12% 38%;
  border-radius: 0 0 38% 38%;
  border: 1px solid rgba(80, 48, 22, 0.88);
  background: linear-gradient(90deg, #ff4545 0 14%, #ffb347 14% 28%, #fff05a 28% 42%, #4bd96f 42% 56%, #47c7ff 56% 70%, #6f6bff 70% 84%, #d85cff 84% 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(67, 38, 24, 0.34),
    -0.24em 0.1em 0 -0.1em #ff7a59,
    0.24em 0.1em 0 -0.1em #6f6bff;
}

.rainbow-trophy::after {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 10%;
  height: 38%;
  background: linear-gradient(90deg, #ff4545, #ffb347, #fff05a, #4bd96f, #47c7ff, #6f6bff, #d85cff);
  clip-path: polygon(36% 0, 64% 0, 64% 48%, 100% 48%, 100% 74%, 80% 74%, 88% 100%, 12% 100%, 20% 74%, 0 74%, 0 48%, 36% 48%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -1px 0 rgba(67, 38, 24, 0.42);
}

.rainbow-trophy.trophy-big {
  width: 2.7rem;
  height: 2.7rem;
}

.trophy-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-stack {
  position: absolute;
  right: 0;
  top: 2px;
  min-width: 0;
  max-width: min(178px, 35vw);
  display: grid;
  gap: 2px;
  padding: 7px 0 7px 8px;
  font-weight: 900;
  font-size: clamp(0.76rem, 1.85vw, 1.02rem);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  -webkit-text-stroke: 0.35px rgba(255, 248, 226, 0.7);
}

.score-stack div {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  line-height: 1.05;
  white-space: nowrap;
}

.score-icon {
  flex: 0 0 auto;
  display: inline-block;
  width: 1.45em;
  height: 1.45em;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter:
    drop-shadow(0 1px 0 rgba(55, 34, 20, 0.82))
    drop-shadow(0 0 3px rgba(255, 248, 226, 0.7));
}

.palace-clear-icon {
  width: 1.65em;
  background-image: url("./assets/asset-004.png");
}

.score-gold-seal {
  background-image: url("./assets/asset-003.png");
  background-position: center;
  background-size: contain;
}

.score-stack strong {
  min-width: 72px;
  max-width: 116px;
  text-align: right;
  overflow: hidden;
  text-overflow: clip;
  font-size: 2em;
  line-height: 0.92;
}

.playfield {
  position: absolute;
  inset: 0;
  min-height: 100vh;
  min-height: 100svh;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--pond);
  box-shadow: none;
}

#gameCanvas,
#mascotCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gameCanvas {
  z-index: 0;
  touch-action: none;
}

#mascotCanvas {
  z-index: 30;
  pointer-events: none;
  touch-action: none;
  background: transparent;
}

.stage.modal-open #mascotCanvas {
  visibility: hidden;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(92%, 420px);
  padding: 10px 14px;
  border: 1px solid rgba(16, 37, 31, 0.13);
  border-radius: 8px;
  background: rgba(255, 252, 239, 0.94);
  color: var(--ink);
  box-shadow: 0 14px 36px var(--shadow);
  font-weight: 800;
  text-align: center;
}

.controls {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px;
  pointer-events: auto;
}

.next-round {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(var(--main-control-size) + var(--control-stack-gap) + max(12px, env(safe-area-inset-bottom)));
  width: var(--main-control-size);
  height: var(--main-control-size);
  border: 0;
  border-radius: 50%;
  background: url("./assets/btn-premium-next.png") center / contain no-repeat;
  color: transparent;
  box-shadow: none;
  cursor: pointer;
  transform: translateX(-50%);
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background-color 0.12s ease;
}

.next-round span {
  font-size: 0;
  line-height: 1;
}

.next-round.ready {
  filter: brightness(1.12) saturate(1.08);
  animation: nextPulse 0.9s infinite ease-in-out;
}

.next-round:disabled {
  filter: grayscale(0.62) brightness(0.82);
  opacity: 1;
  cursor: default;
  pointer-events: none;
  animation: none;
}

.next-round:active,
.next-round.pressing {
  transform: translateX(-50%) translateY(4px);
  box-shadow: none;
}

.icon-button {
  width: var(--main-control-size);
  height: var(--main-control-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background-color 0.12s ease;
}

.mode-button {
  position: relative;
  width: var(--main-control-size);
  height: var(--main-control-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background-color 0.12s ease,
    color 0.12s ease;
}

.mode-button.active {
  color: transparent;
  filter:
    brightness(1.42)
    saturate(1.22)
    contrast(1.04)
    drop-shadow(0 0 7px rgba(255, 218, 112, 0.72));
  box-shadow: none;
}

.icon-button span {
  font-size: 0;
  line-height: 1;
  display: block;
  transform: translateY(-0.02em);
}

#resetLevel span {
  font-size: 0;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.rank-button-seal {
  width: 0;
  height: 0;
  background: none;
  filter: none;
}

#resetLevel {
  background-image: url("./assets/btn-premium-reset.png");
}

#rankButton {
  background-image: url("./assets/btn-premium-rank.png");
}

#rankButton:disabled {
  filter: grayscale(0.68) brightness(0.76);
  opacity: 1;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

#mode3 {
  background-image: url("./assets/btn-premium-mode3.png");
}

#mode6 {
  background-image: url("./assets/btn-premium-mode6.png");
}

#mode9 {
  background-image: url("./assets/btn-premium-mode9.png");
}

#mode9.mode-locked {
  background-image: url("./assets/btn-premium-mode9-ad-clean.png");
}

.icon-button.primary {
  filter: brightness(1.04) saturate(1.05);
}

.icon-button:active,
.icon-button.pressing,
.mode-button:active,
.mode-button.pressing {
  filter: brightness(0.84) saturate(0.92);
  box-shadow: none;
}

.icon-button:focus-visible {
  outline: 3px solid rgba(243, 111, 76, 0.45);
  outline-offset: 3px;
}

#rankButton:focus,
#rankButton:focus-visible,
.modal-panel:focus,
.modal-panel:focus-visible,
#playerName:focus,
#playerName:focus-visible {
  outline: none;
}

.success-overlay {
  position: absolute;
  z-index: 22;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.big-trophy {
  font-size: clamp(5rem, 28vw, 11rem);
  transform-origin: center;
  filter: drop-shadow(0 18px 24px rgba(49, 33, 22, 0.28));
  animation: trophyShake 0.62s infinite ease-in-out;
}

.big-trophy.seal-trophy {
  width: clamp(8rem, 42vw, 16rem);
  height: clamp(8rem, 42vw, 16rem);
  background-size: contain;
  filter:
    drop-shadow(3px 0 0 rgba(22, 14, 8, 0.88))
    drop-shadow(-3px 0 0 rgba(22, 14, 8, 0.88))
    drop-shadow(0 3px 0 rgba(22, 14, 8, 0.88))
    drop-shadow(0 -3px 0 rgba(22, 14, 8, 0.78))
    drop-shadow(0 18px 24px rgba(49, 33, 22, 0.34))
    drop-shadow(0 0 10px rgba(255, 248, 226, 0.72));
}

.big-trophy.legacy-cheonrok-trophy {
  width: clamp(8rem, 42vw, 16rem);
  height: clamp(8rem, 42vw, 16rem);
  background-size: contain;
  filter:
    drop-shadow(0 18px 24px rgba(49, 33, 22, 0.34))
    drop-shadow(0 0 10px rgba(255, 248, 226, 0.72));
}

.big-trophy.ten-thousand-cheonrok-trophy {
  width: clamp(12rem, 63vw, 24rem);
  height: clamp(12rem, 63vw, 24rem);
}

.big-trophy.collecting {
  animation: trophyCollect 2.45s cubic-bezier(0.18, 0.86, 0.24, 1) forwards;
}

.modal {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px 18px;
  background: rgba(18, 12, 8, 0.48);
  backdrop-filter: blur(1.5px);
  pointer-events: auto;
  touch-action: manipulation;
}

.modal[hidden],
.success-overlay[hidden] {
  display: none;
}

.rank-modal-stack {
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
}

.modal-panel {
  position: relative;
  pointer-events: none;
  width: min(470px, 94vw, calc((100svh - 104px) * 548 / 892));
  aspect-ratio: 548 / 892;
  height: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background: url("./assets/rank-scroll-premium-v3.png") center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 18px 24px rgba(37, 25, 21, 0.24));
  padding: 0;
}

.modal-panel.rank-scroll-9 {
  background-image: url("./assets/rank-scroll-premium-v3.png");
  background-position: center;
  background-size: 100% 100%;
  width: min(470px, 94vw, calc((100svh - 104px) * 548 / 892));
  transform: none;
}

.modal-panel.rank-scroll-9 .name-row {
  left: 15%;
  right: 15%;
}

.modal-panel.rank-scroll-9 .rank-list {
  left: 15%;
  right: 15%;
}

.modal-panel.rank-scroll-9 .rank-best-row {
  left: 15%;
  right: 15%;
}

.modal-panel.celebrate {
  animation: panelPop 0.45s ease-out;
}

.modal-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: auto;
  clip-path: inset(8% 11% 14% 11%);
}

.modal-panel::after {
  content: none;
}

.modal-panel .close-button,
.modal-panel .name-row,
.modal-panel .rank-best-row,
.modal-panel .rank-list {
  pointer-events: auto;
}

.close-button {
  position: absolute;
  top: 10.5%;
  right: 15%;
  z-index: 3;
  width: var(--modal-control-size);
  height: var(--modal-control-size);
  border: 0;
  border-radius: 50%;
  background: url("./assets/btn-premium-close.png") center / contain no-repeat;
  color: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  touch-action: manipulation;
}

.close-button:hover {
  transform: translateY(-1px) scale(1.05);
}

.close-button:active,
.close-button.pressing {
  transform: translateY(3px) scale(0.96);
  box-shadow: none;
}

.modal-trophy {
  position: absolute;
  top: min(4.1svh, 32px);
  left: 50%;
  width: 5.6rem;
  height: 5.6rem;
  margin: 0;
  transform: translateX(-50%);
  animation: none;
  filter:
    drop-shadow(1.6px 0 0 rgba(24, 15, 9, 0.78))
    drop-shadow(-1.6px 0 0 rgba(24, 15, 9, 0.78))
    drop-shadow(0 1.6px 0 rgba(24, 15, 9, 0.78))
    drop-shadow(0 -1.6px 0 rgba(24, 15, 9, 0.68))
    drop-shadow(0 2px 0 rgba(78, 48, 24, 0.18))
    drop-shadow(0 7px 10px rgba(37, 25, 21, 0.18));
}

.modal-panel .modal-trophy {
  display: none;
}

.modal h2 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 1.4rem;
}

.rank-reset-countdown {
  position: absolute;
  top: 16.8%;
  left: 15%;
  right: 15%;
  height: 24px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) var(--control-size);
  align-items: center;
  padding: 0 11px;
  transform: translateY(5px);
  pointer-events: none;
  z-index: 3;
}

.rank-reset-countdown[hidden] {
  display: none;
}

.rank-reset-countdown img {
  grid-column: 1;
  justify-self: center;
  width: 28px;
  height: 28px;
  object-fit: contain;
  transform: translateX(-5px);
  filter: drop-shadow(0 1px 1px rgba(54, 31, 13, 0.24));
}

.rank-reset-countdown time {
  grid-column: 2;
  justify-self: start;
  margin-left: 3px;
  color: #b3261e;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 238, 199, 0.72);
}

.name-row {
  position: absolute;
  top: 20.9%;
  left: 15%;
  right: 15%;
  height: var(--main-control-size);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) var(--control-size);
  column-gap: 0;
  align-items: stretch;
  margin: 0;
  padding: 0 11px;
  z-index: 2;
}

.name-row::before {
  content: none;
}

.name-row::after {
  content: none;
}

.name-field {
  position: relative;
  top: 2px;
}

.name-field::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(125, 91, 48, 0.68);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 205, 0.62),
    0 1px 2px rgba(59, 39, 22, 0.18);
  pointer-events: none;
  z-index: 0;
}

.name-field::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(150, 111, 58, 0.62);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  pointer-events: none;
  z-index: 0;
}

.name-rank {
  position: relative;
  top: 2px;
  height: var(--control-size);
  display: grid;
  place-items: center;
  align-self: center;
  color: rgba(72, 48, 28, 0.38);
  font-weight: 900;
  font-size: 11px;
  border-radius: 5px 0 0 5px;
  background: transparent;
  transform: none;
  z-index: 1;
}

.name-rank.visible {
  color: rgba(54, 35, 21, 0.9);
  background: rgba(255, 248, 218, 0.12);
  box-shadow: none;
}

.name-field {
  display: grid;
  align-items: stretch;
  align-self: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  z-index: 1;
  height: var(--name-field-height);
  transform: none;
}

.name-field input {
  position: relative;
  z-index: 1;
  width: 100%;
  height: var(--name-field-height);
  border: 0;
  border-radius: 0 5px 5px 0;
  padding: 0 12px 0 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  line-height: var(--name-field-height);
  box-shadow: none;
}

.save-button {
  position: relative;
  top: 2px;
  width: var(--modal-control-size);
  height: var(--modal-control-size);
  align-self: center;
  margin-left: -4px;
  border: 0;
  border-radius: 50%;
  background: url("./assets/btn-premium-save-clean.png") center / contain no-repeat;
  color: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 950;
  overflow: hidden;
}

.save-button:disabled {
  cursor: default;
  pointer-events: none;
  filter: grayscale(0.65) brightness(0.82);
  opacity: 1;
  box-shadow: none;
}

.rank-list {
  position: absolute;
  top: calc(30.5% + 42px);
  left: 15%;
  right: 15%;
  bottom: 14.5%;
  margin: 0;
  padding: 2px 5px 4px;
  list-style: none;
  display: grid;
  gap: 0;
  overflow: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(86, 70, 50, 0.58) rgba(255, 248, 225, 0.14);
}

.rank-best-row {
  position: absolute;
  top: 30.5%;
  left: 15%;
  right: 15%;
  min-height: 40px;
  padding: 4px 11px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 60px 20px;
  gap: 3px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  background-color: rgba(77, 121, 93, 0.1);
  border: 0;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 2px rgba(44, 31, 22, 0.06);
  z-index: 2;
}

.rank-best-row::before {
  content: none;
}

.rank-best-row::after {
  content: none;
}

.modal-panel.rank-scroll-9 .rank-best-row {
  background-color: rgba(224, 176, 79, 0.14);
}

.rank-best-row > * {
  min-width: 0;
  white-space: nowrap;
}

.rank-best-row strong {
  overflow: visible;
  text-overflow: clip;
  font-size: 11px;
}

.rank-best-row em,
.rank-best-row i {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.rank-list::-webkit-scrollbar {
  width: 5px;
}

.rank-list::-webkit-scrollbar-track {
  background: rgba(255, 248, 225, 0.14);
  border-radius: 999px;
}

.rank-list::-webkit-scrollbar-thumb {
  background: rgba(86, 70, 50, 0.58);
  border-radius: 999px;
}

.rank-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 60px 20px;
  gap: 3px;
  align-items: center;
  min-height: 34px;
  font-size: 11px;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.rank-list li > * {
  min-width: 0;
  white-space: nowrap;
}

.rank-list li strong {
  overflow: visible;
  text-overflow: clip;
  font-size: 11px;
}

.rank-list li.mine {
  background: rgba(224, 176, 79, 0.12);
  border-radius: 3px;
}

.rank-list li.my-best {
  background: rgba(77, 121, 93, 0.1);
  border-radius: 3px;
}

.modal-panel.rank-scroll-9 .rank-list li.my-best {
  background: rgba(224, 176, 79, 0.14);
}

.rank-list li.empty {
  color: var(--muted);
  font-weight: 800;
}

.rank-list li.rank-status {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 68px;
  text-align: center;
  color: var(--muted);
}

.rank-list li.rank-status.offline {
  opacity: 0.76;
}

.rank-policy-links {
  position: static;
  z-index: 3;
  display: flex;
  width: max-content;
  max-width: 94vw;
  justify-content: center;
  gap: 9px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 248, 223, 0.58);
  font-size: 9.5px;
  pointer-events: auto;
}

.rank-policy-links a,
.rank-policy-links button {
  display: inline-flex;
  min-width: 44px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 3px 5px;
  background: transparent;
  color: rgba(55, 36, 22, 0.9);
  font: inherit;
  line-height: 1.2;
  text-align: center;
  text-decoration: underline;
  cursor: pointer;
}

.rank-policy-links [hidden] {
  display: none;
}

@media (max-height: 520px) and (orientation: landscape) {
  .rank-list {
    bottom: 14.5%;
  }

  .rank-policy-links {
    width: min(94vw, 360px);
    display: flex;
    gap: 2px 4px;
    padding: 2px 4px;
    border-radius: 8px;
  }

  .rank-policy-links a,
  .rank-policy-links button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    flex: 1;
  }
}

.rank-list span,
.rank-list i,
.rank-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.rank-medal {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 24px;
  height: 24px;
  transform: translateX(-4px);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  color: #25170e;
  filter: drop-shadow(0 1px 1px rgba(54, 31, 13, 0.2));
}

.rank-number {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-4px);
  z-index: 0;
}

.name-rank .rank-medal,
.name-rank .rank-number {
  transform: translateX(-5px);
}

.rank-number::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1px solid rgba(153, 113, 58, 0.72);
  background: rgba(255, 244, 207, 0.12);
  transform: rotate(45deg);
  z-index: -1;
}

.rank-number-2 {
  font-size: 9px;
}

.rank-number-3 {
  font-size: 7px;
  letter-spacing: -0.45px;
}

.rank-number-2::before,
.rank-number-3::before {
  width: 18px;
  height: 18px;
}

.rank-medal-1 { background-image: url("./assets/rank-medal-1.png"); }
.rank-medal-2 { background-image: url("./assets/rank-medal-2.png"); }
.rank-medal-3 { background-image: url("./assets/rank-medal-3.png"); }
.rank-medal-4 { background-image: url("./assets/rank-medal-4.png"); }

.rank-medal b {
  display: block;
  max-width: 15px;
  overflow: hidden;
  color: #24170f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.55px;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 244, 204, 0.72);
}

.rank-list em,
.rank-list i {
  text-align: right;
}

.mode9-unlock-modal {
  z-index: 12;
  background: rgba(27, 18, 12, 0.42);
  backdrop-filter: blur(1.5px);
  place-items: center;
  padding: 0;
}

.mode9-unlock-panel {
  position: relative;
  pointer-events: none;
  width: min(390px, 90vw, calc(86svh * 564 / 880));
  aspect-ratio: 564 / 880;
  height: auto;
  padding: 0;
  border: 0;
  background: url("./assets/mode9-unlock-scroll-v3.png") center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 18px 24px rgba(27, 18, 12, 0.34));
}

.mode9-unlock-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: auto;
  clip-path: inset(9% 16% 14% 11%);
}

.mode9-unlock-panel::after,
.mode9-unlock-rod {
  content: none;
  display: none;
}

.mode9-unlock-panel .mode9-unlock-action {
  pointer-events: auto;
}

.mode9-unlock-eobo {
  display: none;
}

.mode9-unlock-mark {
  display: block;
  position: absolute;
  top: 20%;
  left: 50%;
  width: 41%;
  aspect-ratio: 1;
  height: auto;
  margin-top: 0;
  transform: translateX(calc(-50% + 5px));
  background: url("./assets/btn-premium-mode9.png") center / contain no-repeat;
  filter: drop-shadow(0 8px 10px rgba(45, 24, 10, 0.24));
}

.mode9-unlock-copy {
  position: absolute;
  top: 48.5%;
  left: 16%;
  right: 16%;
  margin: 0;
  padding: 0 2px;
  box-sizing: border-box;
  color: #4b2a15;
  font-size: clamp(12px, 3.2vw, 16px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: center;
  text-wrap: balance;
  word-break: keep-all;
  overflow-wrap: anywhere;
  transform: none;
  text-shadow:
    0 1px 0 rgba(255, 241, 198, 0.82),
    0 2px 4px rgba(45, 24, 10, 0.15);
}

.mode9-unlock-actions {
  display: grid;
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 14.5%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 0;
  transform: translateX(-6px);
}

.mode9-unlock-actions.purchase-disabled {
  left: 23%;
  right: 23%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  transform: translateX(-4px);
}

.mode9-unlock-action {
  position: relative;
  width: 100%;
  height: 88px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto min(66px, 100%);
  background-position-y: top;
  cursor: pointer;
  box-shadow: none;
  touch-action: manipulation;
}

.mode9-unlock-action[hidden] {
  display: none;
}

.mode9-unlock-action:hover {
  transform: translateY(-1px) scale(1.035);
}

.mode9-unlock-action:active,
.mode9-unlock-action.pressing {
  filter: brightness(0.84) saturate(0.92);
  box-shadow: none;
}

.mode9-unlock-action::before {
  content: none;
}

.mode9-unlock-action.watch::before {
  background: none;
}

.mode9-unlock-action.remove::before {
  background: none;
}

.mode9-unlock-action.close::before {
  background: none;
}

.mode9-unlock-action .action-icon {
  display: none;
}

.mode9-unlock-action.watch {
  background-image: url("./assets/btn-premium-watch-ad-clean.png");
  background-position-x: calc(50% - 8px);
}

.mode9-unlock-action.watch[aria-busy="true"] {
  filter: saturate(0.72) brightness(0.94);
}

.mode9-unlock-action.watch[aria-busy="true"] .action-label {
  font-size: clamp(11px, 2.8vw, 14px);
}

.mode9-unlock-action.remove {
  background-image: url("./assets/btn-premium-remove-ads-clean.png");
  background-position-x: calc(50% - 4px);
}

.mode9-unlock-action.close {
  background-image: url("./assets/btn-premium-close.png");
  background-position-x: calc(50% - 7px);
}

.mode9-unlock-action .action-label {
  position: absolute;
  left: 50%;
  top: 70px;
  bottom: auto;
  transform: translateX(-50%);
  color: #4b2a15;
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow:
    -2px 0 0 rgba(255, 241, 198, 0.92),
    2px 0 0 rgba(255, 241, 198, 0.92),
    0 -2px 0 rgba(255, 241, 198, 0.92),
    0 2px 0 rgba(255, 241, 198, 0.92),
    -1px -1px 0 rgba(255, 241, 198, 0.92),
    1px -1px 0 rgba(255, 241, 198, 0.92),
    -1px 1px 0 rgba(255, 241, 198, 0.92),
    1px 1px 0 rgba(255, 241, 198, 0.92),
    0 3px 5px rgba(45, 24, 10, 0.38);
  pointer-events: none;
}

.mode9-unlock-action.watch .action-icon {
  border: 5px solid #f5d994;
  border-radius: 8px;
}

.mode9-unlock-action.watch:disabled,
.mode9-unlock-action.watch:disabled:hover,
.mode9-unlock-action.watch:disabled:active,
.mode9-unlock-action.remove:disabled,
.mode9-unlock-action.remove:disabled:hover,
.mode9-unlock-action.remove:disabled:active {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.58;
  filter: grayscale(0.65) saturate(0.45) brightness(0.82);
  transform: none;
}

.mode9-unlock-action.watch .action-icon::before {
  content: "";
  position: absolute;
  left: 37%;
  top: 25%;
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 20px solid #f5d994;
  filter: drop-shadow(0 1px 0 rgba(33, 19, 11, 0.45));
}

.mode9-unlock-action.remove .action-icon {
  border: 0;
  border-radius: 0;
}

.mode9-unlock-action.remove .action-icon::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 22%;
  height: 56%;
  border: 5px solid #f5d994;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 3px rgba(245, 217, 148, 0.28),
    0 1px 0 rgba(33, 19, 11, 0.45);
}

.mode9-unlock-action.remove .action-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 9px;
  border-radius: 999px;
  background: #f5d994;
  box-shadow: 0 1px 0 rgba(33, 19, 11, 0.45);
  transform: translateY(-50%) rotate(-45deg);
}

.mode9-unlock-action.close .action-icon::before,
.mode9-unlock-action.close .action-icon::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 10px;
  border-radius: 999px;
  background: #f5d994;
  box-shadow: 0 1px 0 rgba(33, 19, 11, 0.45);
}

.mode9-unlock-action.close .action-icon::before {
  transform: translateY(-50%) rotate(45deg);
}

.mode9-unlock-action.close .action-icon::after {
  transform: translateY(-50%) rotate(-45deg);
}

@keyframes trophyShake {
  0%,
  100% {
    transform: rotate(-4deg) scale(1);
  }
  50% {
    transform: rotate(5deg) scale(1.08);
  }
}

@keyframes trophyCollect {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(-5deg) scale(0.72);
  }
  16% {
    opacity: 1;
    transform: translate(0, 0) rotate(4deg) scale(1.08);
  }
  58% {
    opacity: 1;
    transform: translate(0, 0) rotate(-2deg) scale(1);
  }
  90% {
    opacity: 1;
    transform: translate(calc(var(--trophy-dx, 0px) * 0.96), calc(var(--trophy-dy, 0px) * 0.96)) rotate(12deg) scale(0.22);
  }
  100% {
    opacity: 0;
    transform: translate(var(--trophy-dx, 0px), var(--trophy-dy, 0px)) rotate(18deg) scale(0.08);
  }
}

@keyframes panelPop {
  0% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes nextPulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.08);
  }
}

@media (max-width: 680px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .shell {
    height: 100vh;
    height: 100svh;
  }

  .stage {
    width: 100%;
    height: 100vh;
    height: 100svh;
    min-height: 0;
  }

  .topbar {
    left: 8px;
    right: 8px;
    min-height: 86px;
    padding: 0 4px;
  }

  .place-name {
    top: 22px;
    max-width: 44vw;
    min-width: 148px;
    min-height: 48px;
    padding: 0 14px;
    font-size: clamp(1.12rem, 5.6vw, 1.78rem);
  }

  .place-name.place-gwanghwamun,
  .place-name.place-heungnyemun,
  .place-name.place-yeongjegyo,
  .place-name.place-geunjeongjeon-out,
  .place-name.place-geunjeongjeon-in,
  .place-name.place-amisan-chimney,
  .place-name.place-gyeonghoeru,
  .place-name.place-gyeonganmun,
  .place-name.place-jibokjae-out,
  .place-name.place-jibokjae-in,
  .place-name.place-hyangwonjeong,
  .place-name.place-zodiac-statues {
    width: clamp(176px, 44vw, 236px);
    max-width: none;
    min-width: 0;
    min-height: 0;
    padding: 0;
    font-size: 0;
  }

  .trophy-strip {
    min-width: 86px;
    width: max-content;
    max-width: 82vw;
    padding: 7px 8px;
    font-size: 0.86rem;
  }

  .score-stack {
    min-width: 0;
    max-width: 126px;
    padding: 6px 0 6px 4px;
    font-size: 0.66rem;
  }

  .icon-button,
  .mode-button {
    width: var(--main-control-size);
    height: var(--main-control-size);
  }

  .controls {
    gap: 6px;
    padding: 0 8px;
  }

  .next-round {
    width: var(--main-control-size);
    height: var(--main-control-size);
  }

  .score-stack strong {
    min-width: 88px;
    max-width: 96px;
  }
}

@media (max-width: 420px) {
  .topbar {
    min-height: 80px;
  }

  .place-name {
    top: 24px;
    max-width: 46vw;
    min-width: 142px;
    min-height: 44px;
    padding: 0 12px;
    font-size: clamp(1rem, 5.25vw, 1.42rem);
  }

  .place-name.place-gwanghwamun,
  .place-name.place-heungnyemun,
  .place-name.place-yeongjegyo,
  .place-name.place-geunjeongjeon-out,
  .place-name.place-geunjeongjeon-in,
  .place-name.place-amisan-chimney,
  .place-name.place-gyeonghoeru,
  .place-name.place-gyeonganmun,
  .place-name.place-jibokjae-out,
  .place-name.place-jibokjae-in,
  .place-name.place-hyangwonjeong,
  .place-name.place-zodiac-statues {
    width: clamp(176px, 46vw, 224px);
    aspect-ratio: 549 / 135;
    min-width: 0;
    min-height: 0;
    padding: 0;
    font-size: 0;
  }

  .trophy-strip {
    min-width: 76px;
    width: max-content;
    max-width: 84vw;
    padding: 5px 4px;
  }

  .score-stack {
    max-width: 118px;
    font-size: 0.58rem;
  }

  .score-stack div {
    gap: 2px;
  }

  .score-stack strong {
    min-width: 84px;
    max-width: 92px;
  }

  .modal {
    padding: 28px 14px;
  }

  .modal-panel {
    width: min(470px, 94vw, calc((100svh - 104px) * 548 / 892));
    aspect-ratio: 548 / 892;
    height: auto;
    padding: 0;
  }

  .close-button {
    top: 10.5%;
    right: 15%;
    width: var(--modal-control-size);
    height: var(--modal-control-size);
  }

  .rank-list {
    top: calc(33% + 42px);
    bottom: 14.5%;
  }

  .rank-best-row {
    top: 33%;
  }

}

@media (max-width: 680px) and (orientation: portrait) {
  .playfield {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
  }

  canvas {
    height: 100%;
  }

  .controls {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) and (orientation: portrait) {
  .stage {
    gap: 8px;
  }

  .playfield {
    max-height: none;
  }

  .icon-button,
  .mode-button {
    width: var(--main-control-size);
    height: var(--main-control-size);
  }

  .next-round {
    width: var(--main-control-size);
    height: var(--main-control-size);
  }

  .controls {
    gap: 2px;
    padding-inline: 0;
  }

}

@media (pointer: coarse) {
  .trophy-strip {
    filter: none;
  }

  .trophy-strip .seal-trophy,
  .trophy-strip .legacy-cheonrok-trophy {
    filter: none;
  }
}
