/* IEUMAPPS TOWN — 스타일. 월드 = 배경 그림 픽셀(1448×1086), 화면 폭에 꽉 차게 고정(세로는 위부터 잘림). */
:root {
  --sky: #cfefff;
  --sky-2: #e9f8ff;
  --grass: #bfe8a3;
  --grass-2: #a9dd8a;
  --road: #f3e2bf;
  --road-edge: #e0c99a;
  --ink: #223344;
  --muted: #5d6b7a;
  --paper: #fffdf7;
  --brand: #1db389;
  --brand-2: #6c5ce7;
  --accent: #ff8a3d;
  --shadow: 0 10px 30px rgba(20, 40, 60, .12);
  --radius: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --char-size: 150px;
  --hero-ring: #ffffff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--sky-2); color: var(--ink); font-family: var(--font); }
body { -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ── 헤더 ── */
.site-header {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 20px;
  padding: 12px clamp(16px, 4vw, 40px); background: rgba(255, 253, 247, .97);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(34, 51, 68, .08);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-weight: 900; letter-spacing: .06em; font-size: 15px; color: var(--brand); }
.brand-town { font-weight: 900; font-size: 22px; letter-spacing: .12em; color: var(--ink); }
.brand-tagline { margin: 0; color: var(--muted); font-size: 14px; }
.site-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu { position: relative; }
.menu > summary {
  list-style: none; cursor: pointer; padding: 9px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; font-size: 12px; }
.menu[open] > summary { background: var(--brand-2); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; margin: 0; padding: 8px; list-style: none;
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid rgba(34, 51, 68, .08);
}
.menu-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14px; }
.menu-list a:hover, .menu-list a:focus-visible { background: #f0f4ff; }
.menu-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #999); flex: none; }
.btn-ghost { display: inline-block; text-decoration: none; white-space: nowrap; padding: 9px 14px; border-radius: 999px; border: 1.5px solid rgba(34, 51, 68, .18); background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-ghost[aria-pressed="true"] { background: #eef1f6; }
.btn-mini { padding: 4px 9px; font-size: 12px; margin-left: 4px; }

/* ── 마을 뷰포트 ── */
.town-section { padding: 0; }
/* 가로는 꽉 채우고, 높이는 화면에서 헤더를 뺀 만큼(그림이 그보다 낮으면 그림 높이) — 넘치는 세로는 잘린다 */
.viewport {
  position: relative; width: 100%;
  height: min(calc(100vh - var(--header-h, 66px)), calc(100vw * 1086 / 1448));
  height: min(calc(100svh - var(--header-h, 66px)), calc(100vw * 1086 / 1448));
  overflow: hidden; touch-action: manipulation; outline: none; background: #3f9ff2; cursor: default;
}
.viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--brand-2); }
.world { position: absolute; left: 0; top: 0; width: 1448px; height: 1086px; transform-origin: 0 0; background-size: 100% 100%; background-repeat: no-repeat; }
.world-bg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; user-select: none; }
.ground { position: absolute; inset: 0; width: 100%; height: 100%; }
.objects { position: absolute; inset: 0; }

.sky { display: none; }
.cloud { position: absolute; top: 6%; width: 140px; height: 48px; background: #fff; border-radius: 48px; opacity: .85; filter: drop-shadow(0 6px 10px rgba(50, 90, 120, .08)); }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 62px; height: 62px; left: 22px; top: -30px; }
.cloud::after { width: 44px; height: 44px; left: 70px; top: -18px; }
.cloud.c1 { left: 8%; animation: drift 70s linear infinite; }
.cloud.c2 { left: 45%; top: 12%; transform: scale(.7); animation: drift 95s linear infinite -30s; }
.cloud.c3 { left: 75%; top: 3%; transform: scale(.85); animation: drift 80s linear infinite -60s; }
@keyframes drift { from { translate: -200px 0; } to { translate: 110vw 0; } }

.hud { position: absolute; left: 0; right: 0; top: 12px; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.hint { margin: 0; background: rgba(34, 51, 68, .78); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; max-width: 100%; text-align: center; }
.noscript { position: absolute; inset: auto 16px 60px; text-align: center; background: #fff; padding: 12px; border-radius: 12px; }

/* 월드 안 공통: z-index 는 바닥 y 로 정한다 */
.obj { position: absolute; left: 0; top: 0; transform: translate(var(--x), var(--y)) scale(var(--d, 1)); z-index: var(--z, 1); }

/* ── 건물 ── */
.building {
  display: block; width: var(--w); height: var(--h); margin-left: calc(var(--w) / -2); margin-top: calc(var(--h) * -1);
  text-decoration: none; color: var(--ink); cursor: pointer; outline: none; transform-origin: 50% 100%;
  /* 마을 안에는 따로 떨어진 레이어(will-change·transform 애니메이션·transition·opacity 애니메이션)를 만들지 않는다 —
     레이어가 많으면 폰 브라우저가 손가락 확대 때 일부(또는 배경 전체)를 늦게·끝내 못 그린다(2026-10-11 실기기 확인). README 참고 */
}
.building svg { width: 100%; height: 100%; overflow: visible; }
.building:hover, .building:focus-visible, .building.is-near { transform: translate(var(--x), var(--y)) scale(var(--d, 1)) translateY(-4px) scale(1.03); }
.building:focus-visible .b-body { stroke: var(--brand-2); stroke-width: 4; }
.sign {
  /* 아래 끝을 건물 꼭대기에서 40px 아래에 두고(예전 위치), 원근으로 줄어든 만큼 되돌려 앞뒤 건물 간판을 같은 크기로 — 위로 자란다 */
  position: absolute; left: 50%; bottom: calc(100% - 40px); transform: translateX(-50%) scale(calc(1 / var(--d, 1))); transform-origin: 50% 100%;
  display: flex; align-items: center; gap: calc(8px * var(--ui, 1)); width: max-content; max-width: none;
  padding: calc(5px * var(--ui, 1)) calc(14px * var(--ui, 1)) calc(5px * var(--ui, 1)) calc(6px * var(--ui, 1)); white-space: nowrap;
  background: var(--paper); border: 3px solid var(--c); border-radius: 999px; font-weight: 800; font-size: calc(20px * var(--ui, 1)); letter-spacing: -.01em;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}
.sign img, .sign .emoji-icon { width: calc(34px * var(--ui, 1)); height: calc(34px * var(--ui, 1)); border-radius: 10px; flex: none; }
.sign .emoji-icon { display: grid; place-items: center; font-size: calc(24px * var(--ui, 1)); background: #fff3; }
.sign small { font-weight: 600; color: var(--muted); font-size: 12px; margin-left: 2px; }
.building .door-mat { position: absolute; left: 50%; bottom: -26px; width: 86px; height: 22px; margin-left: -43px; border-radius: 50%; background: rgba(255, 255, 255, .0); transition: background .2s; }
.building.is-near .door-mat { background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 6px rgba(255, 255, 255, .25); }

/* ── 장식 ── */
.decor { pointer-events: none; transform-origin: 50% 100%; }
.signpost { transform-origin: 50% 100%; }
.decor svg { overflow: visible; display: block; }
.tree { transform-origin: 50% 100%; }
.sway .tree-top { transform-origin: 50% 100%; animation: sway 4.5s ease-in-out infinite; }
@keyframes sway { 0%, 100% { rotate: -1.6deg; } 50% { rotate: 1.6deg; } }
.pond .ripple { animation: ripple 5s ease-in-out infinite; transform-origin: center; }
@keyframes ripple { 0%, 100% { opacity: .5; scale: 1; } 50% { opacity: .9; scale: 1.06; } }

.signpost { pointer-events: none; }
.signpost .post-text { font: 800 17px/1.05 var(--font); fill: var(--ink); letter-spacing: .06em; }

/* ── 캐릭터 ── */
.char {
  width: var(--char-size); height: var(--char-size);
  margin-left: calc(var(--char-size) / -2); margin-top: calc(var(--char-size) * -1 * var(--feet, .9));
  transform-origin: 50% calc(100% * var(--feet, .9));
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
}
.char .char-shadow {
  position: absolute; z-index: 0; left: 50%; top: calc(var(--char-size) * var(--feet, .9)); width: 60%; height: 16px; margin-left: -30%; margin-top: -9px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 50, 30, .3), rgba(20, 50, 30, 0));
}
.char .char-sprite {
  position: absolute; inset: 0; z-index: 1; transform-origin: 50% calc(100% * var(--feet, .9));
  background-repeat: no-repeat; background-size: 100% 100%; background-position: 50% 90%; /* 그림은 정사각(360) — 발 높이(90%) 기준으로 커지고 움직인다 */
}
.char[data-dir="right"] .char-sprite { transform: scaleX(-1); }
.char.is-moving .char-sprite { animation: walk .5s ease-in-out infinite; }
.char:not(.is-moving) .char-sprite { animation: breathe 2.6s ease-in-out infinite; }
.char.pose-win .char-sprite, .char.pose-tease .char-sprite { animation: pop .55s ease-out 1; }
@media (hover: hover) and (pointer: fine) { .char:hover .char-sprite { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .9)); } }
.char:focus-visible .char-sprite { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .9)); }
.char.is-hero::after {
  content: ""; position: absolute; z-index: 0; left: 50%; top: calc(var(--char-size) * var(--feet, .9)); width: 74%; height: 22px; margin-left: -37%; margin-top: -12px;
  border-radius: 50%; border: 3px solid var(--hero-ring); opacity: .9; box-shadow: 0 0 0 3px rgba(108, 92, 231, .35);
}
.char.is-guide { cursor: pointer; }
.char .char-name {
  position: absolute; z-index: 2; left: 50%; top: calc(var(--char-size) * var(--feet, .9) + 12px); transform: translateX(-50%) scale(calc(1 / var(--d, 1))); transform-origin: 50% 0;
  font-size: calc(12px * var(--ui, 1)); font-weight: 800; background: rgba(255, 253, 247, .9); padding: calc(2px * var(--ui, 1)) calc(8px * var(--ui, 1)); border-radius: 999px; white-space: nowrap; color: var(--ink);
}
.char.is-hero .char-name { background: var(--brand-2); color: #fff; }

/* 걷기·숨쉬기·반가움 — 그림(배경)의 위치·크기만 바꾼다. transform 계열로 움직이면 캐릭터마다 레이어가 생긴다 */
@keyframes walk { 0%, 100% { background-position: 50% 90%; } 50% { background-position: 50% calc(90% - 7px); } }
@keyframes breathe { 0%, 100% { background-size: 100% 100%; } 50% { background-size: 101.5% 103%; } }
@keyframes pop { 0% { background-size: 96% 96%; } 40% { background-size: 106% 106%; } 100% { background-size: 100% 100%; } }

/* 눈 깜빡임 — idle 그림의 눈 위에 피부색 덮개 + 감은 눈 선 (130ms) */
.eyelid { position: absolute; display: none; border-bottom: 2.5px solid #2b2a3f; border-radius: 40% 40% 50% 50% / 30% 30% 60% 60%; box-sizing: border-box; pointer-events: none; }
.char-sprite.eyes-open-idle.is-blinking .eyelid { display: block; }

/* 말풍선 */
.bubble {
  position: absolute; left: 50%; bottom: calc(100% - 10px);
  transform: translate(-50%, 0) scale(calc(1 / var(--d, 1))); transform-origin: 50% 100%; width: max-content; max-width: calc(260px * var(--ui, 1));
  background: var(--paper); color: var(--ink); border: 2.5px solid var(--c, var(--ink)); border-radius: 16px; padding: calc(10px * var(--ui, 1)) calc(12px * var(--ui, 1));
  font-size: calc(14px * var(--ui, 1)); line-height: 1.45; box-shadow: var(--shadow); pointer-events: auto; z-index: 5;
  animation: bubble-in .22s ease-out;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -12px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--c, var(--ink)); border-bottom: 0; }
.bubble b { display: flex; align-items: center; gap: calc(6px * var(--ui, 1)); margin-bottom: 2px; }
.bubble b img, .bubble b .emoji-icon { width: calc(20px * var(--ui, 1)); height: calc(20px * var(--ui, 1)); border-radius: 5px; flex: none; }
.bubble strong { font-weight: 800; }
.bubble .bubble-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.bubble .bubble-actions a, .bubble .bubble-actions button {
  display: inline-block; padding: calc(6px * var(--ui, 1)) calc(10px * var(--ui, 1)); border-radius: 999px; background: var(--c, var(--ink)); color: #fff; text-decoration: none; font-weight: 700; font-size: calc(13px * var(--ui, 1)); border: 0; cursor: pointer;
}
.bubble .bubble-actions a.secondary, .bubble .bubble-actions button.secondary { background: #eef1f6; color: var(--ink); }
.bubble.is-small { font-size: calc(13px * var(--ui, 1)); padding: calc(6px * var(--ui, 1)) calc(10px * var(--ui, 1)); }
.bubble.is-clickable { cursor: pointer; }
@keyframes bubble-in { from { margin-bottom: -6px; } to { margin-bottom: 0; } }
.meet-mark { position: absolute; left: 50%; top: -6px; margin-left: -.5em; font-size: 26px; animation: float-up 1.4s ease-out forwards; pointer-events: none; }
@keyframes float-up { from { top: 4px; } to { top: -32px; } }

/* 길 위의 목표 표시 */
.target-mark { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid rgba(108, 92, 231, .8); pointer-events: none; animation: target-pulse 1s ease-out infinite; z-index: 0; }
@keyframes target-pulse { from { box-shadow: 0 0 0 0 rgba(108, 92, 231, .7); } to { box-shadow: 0 0 0 14px rgba(108, 92, 231, 0); } }

/* ── 전체 앱 보기 팝업 ── */
.apps-dialog { border: 0; padding: 0; border-radius: 24px; width: min(94vw, 1040px); max-height: min(88vh, 900px); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.apps-dialog::backdrop { background: rgba(20, 30, 50, .55); }
.apps-dialog-inner { padding: clamp(18px, 4vw, 30px); }
.apps-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.apps-dialog-head h2 { margin: 0; font-size: clamp(22px, 3vw, 28px); letter-spacing: -.02em; }
.apps-dialog-head form { margin: 0; }
.dialog-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #eef1f6; color: var(--ink); font-size: 18px; font-weight: 800; cursor: pointer; }
.dialog-x:hover { background: #e0e5ee; }
.apps-dialog-foot { display: flex; justify-content: center; margin: 20px 0 0; }

/* ── 앱 목록 카드 ── */
.about-section { max-width: 1100px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px); }
.about-section h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 6px; letter-spacing: -.02em; }
.section-lead { margin: 0 0 20px; color: var(--muted); }
.app-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.app-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); border-top: 5px solid var(--c); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.app-card-link { display: flex; gap: 12px; text-decoration: none; align-items: flex-start; }
.app-card-icon { width: 56px; height: 56px; flex: none; border-radius: 14px; overflow: hidden; background: #f3f5f9; display: grid; place-items: center; }
.app-card-icon img { width: 56px; height: 56px; }
.app-card-icon .emoji-icon { font-size: 30px; }
.app-card-name { display: block; font-weight: 800; font-size: 18px; }
.app-card-name small { font-weight: 600; color: var(--muted); font-size: 12px; margin-left: 4px; }
.app-card-tagline { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 2px; }
.app-card-char { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.app-card-char:empty { display: none; }
.app-card-links { display: flex; gap: 8px; flex-wrap: wrap; }
.app-card-links a { font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: #eef1f6; text-decoration: none; }
.app-card-links a:first-child { background: var(--c); color: #fff; }
.about-section p { line-height: 1.7; max-width: 760px; }
.about-motto { font-weight: 800; color: var(--brand-2); }

/* ── 푸터 ── */
.site-footer { background: var(--ink); color: #dfe7ee; padding: 28px clamp(16px, 4vw, 40px) 40px; display: grid; gap: 14px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.footer-nav a:hover { text-decoration: underline; }
.copyright { margin: 0; font-size: 12px; color: #9fb0bf; }
.footer-docs { margin: 0; font-size: 13px; line-height: 1.9; color: #c5d1dc; }
.footer-docs a { color: #fff; text-decoration: none; }
.footer-docs a:hover { text-decoration: underline; }
.footer-docs .docs-label { display: inline-block; min-width: 7.5em; color: #9fb0bf; font-weight: 700; }
.biz-info { margin: 0; font-size: 12px; line-height: 1.7; color: #9fb0bf; }

/* ── 캐릭터 선택 ── */
.picker { border: 0; border-radius: 24px; padding: 0; max-width: min(92vw, 760px); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); background: var(--paper); }
.picker::backdrop { background: rgba(20, 30, 50, .55); }
.picker-form { padding: clamp(18px, 4vw, 30px); }
.picker h2 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 26px); }
.picker-lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 12px; border-radius: 18px; border: 2.5px solid transparent; background: #fff; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06); transition: transform .15s, border-color .15s;
}
.pick:hover, .pick:focus-visible { transform: translateY(-3px); border-color: var(--c, #4A90E2); outline: none; }
.pick[aria-pressed="true"] { border-color: var(--c, #4A90E2); background: #f6f8ff; }
.pick > img { width: 96px; height: 96px; }
.pick .pick-app img, .pick .pick-app .emoji-icon { width: 18px; height: 18px; font-size: 14px; }
.pick .pick-name { font-weight: 800; font-size: 16px; }
.pick .pick-app { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ── 모션 줄이기: 걷기·숨쉬기·구름·나무 전부 정지 ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .char .char-sprite, .cloud, .sway .tree-top, .pond .ripple, .target-mark, .bubble, .building { animation: none !important; transition: none !important; }
}
html.reduce-motion .char .char-sprite, html.reduce-motion .cloud, html.reduce-motion .sway .tree-top, html.reduce-motion .pond .ripple,
html.reduce-motion .target-mark, html.reduce-motion .bubble, html.reduce-motion .building { animation: none !important; transition: none !important; }

/* ── 반응형 ── */
@media (max-width: 900px) {
  .site-header { grid-template-columns: auto 1fr; }
  .brand-tagline { display: none; }
  .site-nav { justify-self: end; }
}
@media (max-width: 700px) {
  .site-header { grid-template-columns: 1fr; padding-top: 8px; padding-bottom: 8px; gap: 8px; }
  .site-nav { justify-self: stretch; justify-content: flex-start; gap: 6px; }
  .menu > summary, .site-nav .btn-ghost { padding: 6px 10px; font-size: 12.5px; }
  .site-nav .btn-ghost { border-width: 1px; }
}
@media (max-width: 640px) {
  :root { --char-size: 150px; }
  .brand-town { font-size: 18px; }
  .btn-ghost { padding: 8px 10px; font-size: 13px; }
  .hint { font-size: 12px; }
  .sign { font-size: 18px; }
  .app-cards { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
  .building, .char { -webkit-tap-highlight-color: transparent; }
}
