:root {
  --ink: #503b2d;
  --muted: #836b59;
  --paper: #fffaf0;
  --cream: #fff4d9;
  --pink: #f7b6b2;
  --red: #e8665d;
  --yellow: #f8cf60;
  --green: #9ecf9a;
  --blue: #9dd7dc;
  --purple: #c6b6dd;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 6%, #fff9e8 0 4%, transparent 4.2%),
    radial-gradient(circle at 89% 12%, #fbe6bc 0 5%, transparent 5.2%),
    linear-gradient(160deg, #fff5dc 0%, #fae9c7 100%);
}

.app-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 26px 16px;
}

.sun {
  position: fixed;
  width: 180px;
  height: 180px;
  border: 18px dotted rgba(232, 102, 93, .18);
  border-radius: 50%;
  pointer-events: none;
}

.sun-left { left: -88px; bottom: -80px; }
.sun-right { top: -90px; right: -75px; }

.stamp-card {
  position: relative;
  width: min(100%, 510px);
  overflow: hidden;
  border: 3px solid #d8b98e;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 14px 0 rgba(171, 125, 74, .14), 0 24px 50px rgba(107, 76, 44, .18);
}

.top-decoration {
  display: flex;
  justify-content: space-between;
  padding: 12px 31px 0;
  color: #e6b76a;
  font-size: 23px;
  letter-spacing: 7px;
}

.hero { padding: 7px 24px 10px; text-align: center; }

.event-label {
  display: inline-block;
  margin: 3px 0 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: #fbe6bb;
  color: #885839;
  font-size: 12px;
  font-weight: bold;
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3 { font-family: "Arial Rounded MT Bold", "Malgun Gothic", sans-serif; font-weight: 700; }

h1 {
  color: #765134;
  font-size: clamp(34px, 9vw, 45px);
  line-height: 1.05;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #f8dfb0;
}

.intro { margin-top: 11px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.journey {
  position: relative;
  margin: 7px 16px 17px;
  padding: 17px 14px 15px;
  border: 2px dashed #dcbd89;
  border-radius: 23px;
  background: linear-gradient(155deg, #fffdfa, #fff4da);
}

.journey-heading { display: flex; align-items: center; gap: 7px; }
.journey-heading h2 { flex: 1; color: #755137; font-size: 21px; }
.journey-heading strong { color: #d45f55; font-family: "Arial Rounded MT Bold", "Malgun Gothic", sans-serif; font-size: 18px; font-weight: 700; }

.map {
  position: relative;
  height: 65px;
  margin: 3px 1px -2px;
  overflow: hidden;
  border-radius: 17px;
  background: linear-gradient(105deg, #ccebee 0%, #e8f6dc 52%, #ffe4bb 100%);
}

.map::before {
  position: absolute;
  top: 36px;
  left: 9%;
  width: 76%;
  height: 19px;
  border-top: 3px dashed rgba(178, 109, 77, .6);
  border-radius: 50%;
  content: "";
  transform: rotate(-2deg);
}

.map-cloud { position: absolute; color: rgba(255, 255, 255, .9); font-size: 29px; }
.cloud-one { top: 2px; left: 7%; }
.cloud-two { right: 29%; bottom: -6px; }
.cloud-three { top: 1px; right: 7%; font-size: 23px; }
.route-dot { position: absolute; top: 29px; width: 12px; height: 12px; border: 2px solid #fff8e9; border-radius: 50%; background: #e66d5f; box-shadow: 0 1px 0 rgba(102, 55, 35, .2); }
.dot-one { left: 10%; top: 31px; }
.dot-two { left: 25%; top: 38px; background: #e9b446; }
.dot-three { left: 40%; top: 42px; background: #75b974; }
.dot-four { left: 55%; top: 37px; background: #7fc8cd; }
.dot-five { left: 70%; top: 29px; background: #9a76ca; }
.dot-six { right: 9%; top: 32px; background: #e982a3; }
.travel-mark { position: absolute; right: 2%; bottom: 2px; color: #bb754d; font-size: 19px; transform: rotate(13deg); }

.stamp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }

.reset-stamps {
  display: block;
  margin: 12px auto 0;
  padding: 5px 10px;
  border: 1px dashed #cda978;
  border-radius: 999px;
  background: rgba(255, 250, 240, .72);
  color: #8d6b51;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.reset-stamps:hover:not(:disabled) { background: #fff7e7; color: #765134; }
.reset-stamps:focus-visible { outline: 3px solid rgba(232, 102, 93, .35); outline-offset: 2px; }
.reset-stamps:disabled { opacity: .42; cursor: not-allowed; }

.stamp-slot {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--slot-color) 65%, white);
  border-radius: 18px;
  background: color-mix(in srgb, var(--slot-color) 6%, white);
  text-align: center;
}

.stamp-slot.just-earned {
  z-index: 6;
  overflow: visible;
}

.stamp-slot::before {
  position: absolute;
  inset: 6px;
  border: 1px dashed color-mix(in srgb, var(--slot-color) 22%, transparent);
  border-radius: 14px;
  content: "";
}

.stamp-slot::after {
  position: absolute;
  z-index: 4;
  top: calc(var(--seal-y, 50%) - 200px);
  left: calc(var(--seal-x, 50%) + 4px);
  width: 142px;
  height: 213px;
  background: url("assets/wooden-hand-stamp.png") center / contain no-repeat;
  filter: drop-shadow(0 7px 4px rgba(69, 35, 19, .28));
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -260px) rotate(-8deg);
  transform-origin: 50% 94%;
}

.yut { --slot-color: #d94742; --seal-x: 50%; --seal-y: 51%; }
.tuho { --slot-color: #dd7b24; --seal-x: 51%; --seal-y: 50%; }
.jegi { --slot-color: #2f9066; --seal-x: 51%; --seal-y: 49%; }
.ddakji { --slot-color: #277cab; --seal-x: 52%; --seal-y: 49%; }
.gangwon { --slot-color: #7855b5; --seal-x: 51%; --seal-y: 50%; }
.jeolla { --slot-color: #c94378; --seal-x: 51%; --seal-y: 49%; }

.traditional-background {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--slot-color);
  object-fit: fill;
  opacity: .2;
  filter: saturate(.52);
}

.seal {
  position: absolute;
  z-index: 2;
  top: var(--seal-y, 50%);
  left: calc(var(--seal-x, 50%) + 4px);
  display: grid;
  width: clamp(78px, 58%, 92px);
  aspect-ratio: 1;
  height: auto;
  place-items: center;
  border: 7px double currentColor;
  border-radius: 45% 55% 47% 53% / 54% 44% 56% 46%;
  background: rgba(255, 250, 240, .99);
  color: var(--slot-color);
  font-family: "Arial Rounded MT Bold", "Malgun Gothic", sans-serif;
  font-size: clamp(20px, 5.4vw, 23px);
  font-weight: 900;
  letter-spacing: -1.4px;
  white-space: nowrap;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--slot-color) 35%, transparent), 0 3px 7px rgba(84, 43, 25, .2);
  text-shadow: .45px 0 0 currentColor, -.45px 0 0 currentColor;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-15deg) scale(1.8);
}

.seal::before,
.seal::after {
  position: absolute;
  width: 16px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 6px -4px 0 -1px currentColor, 13px -1px 0 -1px currentColor;
  content: "";
  opacity: .22;
  pointer-events: none;
}

.seal::before { top: 12px; left: 13px; }
.seal::after { right: 13px; bottom: 12px; transform: scaleX(-1); }

.impact {
  position: absolute;
  z-index: 1;
  top: var(--seal-y, 50%);
  left: calc(var(--seal-x, 50%) + 4px);
  width: 108px;
  height: 108px;
  background: color-mix(in srgb, var(--slot-color) 48%, transparent);
  clip-path: polygon(50% 0%, 61% 22%, 84% 10%, 78% 34%, 100% 50%, 78% 61%, 90% 84%, 64% 79%, 50% 100%, 39% 78%, 13% 90%, 22% 64%, 0% 50%, 22% 39%, 10% 13%, 37% 22%);
  color: transparent;
  font-size: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.15) rotate(-20deg);
}

.stamp-slot.is-earned .traditional-background {
  opacity: .2;
  filter: saturate(.52);
  transform: none;
}
.stamp-slot.is-earned .seal { opacity: 1; transform: translate(-50%, -50%) rotate(-15deg) scale(1); transition: transform .42s cubic-bezier(.17, .89, .32, 1.26), opacity .2s; }
.stamp-slot.just-earned::after { animation: stamp-handle-press .98s cubic-bezier(.16, .88, .3, 1.16) both; }
.stamp-slot.just-earned .seal { animation: stamp-ink-reveal .98s cubic-bezier(.17, .89, .32, 1.26) both; }
.stamp-slot.just-earned .impact { animation: ink-splash .68s ease-out .46s both; }

@keyframes stamp-handle-press {
  0% { opacity: 0; transform: translate(-50%, -260px) rotate(-8deg); }
  14% { opacity: 1; }
  54% { opacity: 1; transform: translate(-50%, 0) rotate(-4deg); }
  65% { opacity: 1; transform: translate(-50%, -18px) rotate(-6deg); }
  100% { opacity: 0; transform: translate(-50%, -245px) rotate(-8deg); }
}

@keyframes stamp-ink-reveal {
  0%, 48% { opacity: 0; transform: translate(-50%, -50%) rotate(-15deg) scale(.68); }
  59% { opacity: 1; transform: translate(-50%, -50%) rotate(-15deg) scale(1.14); }
  76% { opacity: 1; transform: translate(-50%, -50%) rotate(-15deg) scale(.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-15deg) scale(1); }
}

@keyframes art-reveal {
  0% { opacity: .08; transform: scale(.68) rotate(-7deg); filter: grayscale(1) saturate(.2); }
  58% { opacity: 1; transform: scale(1.12) rotate(2deg); filter: drop-shadow(0 5px 4px rgba(111, 76, 41, .18)) saturate(1.15); }
  100% { opacity: 1; transform: scale(1.05); filter: drop-shadow(0 3px 2px rgba(111, 76, 41, .16)) saturate(1.08); }
}

@keyframes ink-splash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.15) rotate(-20deg); }
  38% { opacity: .55; transform: translate(-50%, -50%) scale(1.04) rotate(9deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.24) rotate(15deg); }
}

@media (prefers-reduced-motion: reduce) {
  .stamp-slot.just-earned .seal, .stamp-slot.just-earned .impact, .stamp-slot.just-earned::after, .completion, .completion-dialog, .firework { animation: none; transition: none; }
  .stamp-slot.just-earned::after, .stamp-slot.just-earned .impact { opacity: 0; }
}

.completion {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: rgba(78, 53, 42, .46);
  backdrop-filter: blur(2px);
  animation: completion-fade-in .28s ease-out both;
}

.completion[hidden] { display: none; }

.completion-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 365px);
  padding: 30px 22px 22px;
  overflow: hidden;
  border: 3px solid #ef9858;
  border-radius: 28px;
  background: linear-gradient(135deg, #fff8d9, #ffe0a2);
  text-align: center;
  box-shadow: 0 16px 0 rgba(87, 48, 31, .18), 0 22px 50px rgba(52, 31, 23, .32);
  animation: completion-pop .58s cubic-bezier(.17, .89, .32, 1.26) .06s both;
}

.completion-dialog::before {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(206, 119, 72, .5);
  border-radius: 21px;
  content: "";
  pointer-events: none;
}

.completion-stars { position: relative; display: block; margin-bottom: 1px; color: #db8759; letter-spacing: 10px; }
.completion h2 { position: relative; color: #c8564f; font-size: 30px; }.completion p { position: relative; margin-top: 4px; color: #77523d; font-size: 16px; font-weight: bold; line-height: 1.55; }
.completion-ribbon { position: relative; display: inline-block; margin-top: 11px; padding: 4px 14px; border-radius: 4px; background: #dc725e; color: white; font-size: 12px; font-weight: bold; }

.completion-close {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  background: #c8564f;
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #a84943;
}

.completion-close:hover { background: #b94843; }
.completion-close:active { transform: translateY(2px); box-shadow: 0 1px 0 #a84943; }
.completion-close:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.fireworks { position: absolute; inset: 0; pointer-events: none; }

.firework {
  position: absolute;
  width: 126px;
  height: 126px;
  opacity: 0;
  filter: drop-shadow(0 0 7px currentColor);
  transform: translate(-50%, -50%) scale(.12);
  animation: firework-burst 1.7s cubic-bezier(.2, .7, .35, 1) both;
}

.firework::before {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(from -2deg, currentColor 0 5deg, transparent 5deg 25deg);
  content: "";
  -webkit-mask: radial-gradient(circle, transparent 0 18%, #000 19% 55%, transparent 56%);
  mask: radial-gradient(circle, transparent 0 18%, #000 19% 55%, transparent 56%);
}

.firework::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8de;
  content: "✦";
  font-size: 31px;
  font-weight: 900;
  text-shadow: 0 0 9px currentColor, 0 0 16px currentColor;
}

.firework-one { top: 17%; left: 16%; color: #ff766b; animation-delay: .08s; }
.firework-two { top: 25%; left: 84%; color: #ffd35f; animation-delay: .25s; }
.firework-three { top: 54%; left: 10%; color: #65d0d6; animation-delay: .42s; }
.firework-four { top: 58%; left: 90%; color: #a782e8; animation-delay: .16s; }
.firework-five { top: 79%; left: 50%; color: #7fc768; animation-delay: .58s; }

body.completion-open { overflow: hidden; }

@keyframes completion-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes completion-pop { from { opacity: 0; transform: translateY(18px) scale(.72); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes firework-burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.08) rotate(-12deg); } 14% { opacity: 1; } 64% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.28) rotate(16deg); } }

footer { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 54px; background: #f2d6a4; color: #78543b; font-size: 12px; font-weight: bold; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: 24px; width: min(calc(100% - 32px), 420px); padding: 13px 16px; border-radius: 16px; background: rgba(73, 54, 43, .94); color: white; font-size: 14px; text-align: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .16); transform: translateX(-50%); }

@media (max-width: 370px) {
  .app-shell { padding: 12px 9px; }
  .stamp-card { border-radius: 23px; }
  .hero { padding-inline: 13px; }
  .journey { margin-inline: 10px; padding-inline: 10px; }
  .stamp-grid { gap: 7px; }
  .stamp-slot { min-height: 106px; }
  .completion { margin-inline: 10px; }
}
