:root {
  --ink: #2a2622;
  --soft: #6d655c;
  --paper: rgba(255, 252, 246, 0.86);
  --line: rgba(60, 50, 40, 0.12);
  --mint: #2ec4a6;
  --mango: #ffb627;
  --pink: #ff4fa3;
  --font: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #efe9de; font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; }
#app canvas { display: block; touch-action: none; }

/* 로딩 */
#loading { position: fixed; inset: 0; z-index: 50; background: #f3ede2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; transition: opacity .6s; }
#loading.fade { opacity: 0; pointer-events: none; }
.load-icon { font-size: 34px; animation: bob 1s ease-in-out infinite; }
.load-title { font-size: 26px; font-weight: 700; letter-spacing: 6px; }
.load-sub { color: var(--soft); font-size: 13px; }
.load-dots span { display: inline-block; width: 5px; height: 5px; margin: 6px 3px; border-radius: 50%; background: var(--soft); animation: blink 1.2s infinite; }
.load-dots span:nth-child(2) { animation-delay: .2s; } .load-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes blink { 50% { opacity: .2; } }

/* HUD */
.pill { background: var(--paper); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 4px 18px rgba(60, 40, 20, .1); }
.round { width: 40px; height: 40px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 17px; box-shadow: 0 4px 18px rgba(60, 40, 20, .1); }
.top-left { position: fixed; top: 16px; left: 16px; display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 8px; font-size: 14px; z-index: 5; }
.top-left button { width: 30px; height: 30px; border-radius: 50%; font-size: 15px; }
.top-left button:hover { background: rgba(0, 0, 0, .05); }
.top-left .region-btn { width: auto; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.top-left .region-btn .caret { font-size: 10px; color: var(--soft); margin-left: 2px; }
.regions { display: flex; flex-direction: column; gap: 8px; }
.region { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; background: #fff; }
.region .ic { font-size: 28px; }
.region .txt { flex: 1; min-width: 0; }
.region .txt b { display: block; font-size: 15px; }
.region .txt small { color: var(--soft); font-size: 12px; }
.region .badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.region.on { border-color: var(--ink); background: #fff6df; }
.region.on .badge { background: #e3f6e8; color: #1f8a3d; }
.region.soon { opacity: .6; cursor: default; }
.region.soon .ic { filter: grayscale(.6); }
.region.soon .badge { background: #eee7da; color: var(--soft); }
.top-left .sep { width: 1px; height: 14px; background: var(--line); }
#count { color: var(--soft); font-variant-numeric: tabular-nums; font-size: 14px; }
.top-left #count { width: auto; height: auto; padding: 2px 6px; }
.map-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.map-wrap canvas { display: block; width: 100%; height: auto; cursor: pointer; touch-action: manipulation; }
.people { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 210px; overflow-y: auto; }
.person { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; background: #fff; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .who small { color: var(--soft); font-size: 12px; }
.person.me { background: #eef6ff; border-color: #b9d6f5; }
.person .go { padding: 7px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.people .empty { color: var(--soft); font-size: 13px; text-align: center; padding: 10px 0; }
#net { color: #c9bfae; font-size: 10px; margin-right: -4px; }
#net.on { color: #2fbf4f; }
.av-label.bot .av-name { opacity: .72; }
.av-label.bot .av-name::after { content: ' · 봇'; font-size: 9px; color: var(--soft); }
.top-right { position: fixed; top: 16px; right: 16px; display: flex; gap: 8px; z-index: 5; }
#hint { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 12px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: opacity 1s; pointer-events: none; z-index: 4; white-space: nowrap; }
#me-chip { position: fixed; top: 64px; left: 16px; padding: 6px 12px; font-size: 13px; z-index: 5; }
#squall-banner { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); background: rgba(30, 50, 80, .85); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 13px; z-index: 6; animation: drop .4s; }
@keyframes drop { from { transform: translate(-50%, -12px); opacity: 0; } }

#bottom { position: fixed; bottom: 16px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 5; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: min(520px, calc(100vw - 32px)); }
#quick button { background: var(--paper); border: 1px solid var(--line); backdrop-filter: blur(10px); border-radius: 999px; padding: 8px 12px; font-size: 13px; box-shadow: 0 4px 12px rgba(60, 40, 20, .1); }
#quick button:hover { background: #fff; }
#debug { position: fixed; left: 16px; top: 110px; z-index: 9; background: rgba(0, 0, 0, .65); color: #9ff59f; font: 12px "SF Mono", Menlo, monospace; padding: 6px 10px; border-radius: 8px; }
#actionbar { display: flex; padding: 6px 8px; gap: 2px; max-width: calc(100vw - 32px); overflow-x: auto; }
#actionbar button { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--soft); padding: 4px 10px; border-radius: 14px; min-width: 50px; }
#actionbar button span { font-size: 19px; line-height: 1.3; }
#actionbar button:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
#context-btn { position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%); z-index: 6; background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: pop .3s; white-space: nowrap; }
#context-btn:hover { transform: translateX(-50%) scale(1.04); }
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }

/* 아바타 라벨 */
.av-label { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; transform: translateY(-6px); }
.av-name { font-size: 11px; background: rgba(255, 255, 255, .88); padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.av-label.me .av-name { background: var(--ink); color: #fff; }
.av-bubble { max-width: 180px; font-size: 12px; background: #fff; padding: 6px 10px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); opacity: 0; transform: translateY(4px); transition: .25s; text-align: center; word-break: keep-all; }
.av-bubble.show { opacity: 1; transform: none; }
.av-emoji { font-size: 22px; opacity: 0; height: 0; }
.av-emoji.show { animation: floatup 1.8s ease-out; }
@keyframes floatup { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 15% { opacity: 1; transform: translateY(-4px) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px); } }

/* 모달 */
#modal-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(30, 20, 10, .28); padding: 16px; }
#modal { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #fffdf8; border-radius: 22px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: rise .25s; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
#modal h2 { margin: 0 0 4px; font-size: 19px; }
#modal .sub { color: var(--soft); font-size: 13px; margin: 0 0 16px; }
#modal .thai { color: var(--mint); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.opt { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 10px; text-align: left; background: #fff; transition: .15s; }
.opt:hover { border-color: var(--ink); }
.opt.on { border-color: var(--ink); background: #fff6df; }
.opt b { display: block; font-size: 14px; }
.opt small { color: var(--soft); font-size: 12px; }
.opt .sw { display: inline-block; width: 18px; height: 18px; border-radius: 5px; margin-bottom: 6px; }
.actions { display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.btn { padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #eee7da; }
.btn.primary { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .35; cursor: default; }
.steps { display: flex; gap: 4px; margin-bottom: 14px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: #eee7da; }
.steps i.on { background: var(--mango); }
.cond { display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.cond .cnt { display: flex; align-items: center; gap: 10px; }
.cond button { width: 32px; height: 32px; border-radius: 50%; background: #eee7da; font-size: 16px; }
.spicy { display: flex; gap: 2px; font-size: 16px; min-height: 22px; }

/* 프레스 미니게임 */
.gauge { position: relative; height: 26px; background: #f0e8d8; border-radius: 999px; overflow: hidden; margin: 18px 0 8px; }
.gauge .zone { position: absolute; top: 0; bottom: 0; left: 58%; width: 22%; background: rgba(255, 182, 39, .45); border-left: 2px dashed #e09b12; border-right: 2px dashed #e09b12; }
.gauge .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(90deg, #f6e7c4, #e3a650 60%, #7a3d12); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--soft); }
.toast-preview { font-size: 54px; text-align: center; margin: 8px 0; }

/* 계산 */
.coins { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.coin { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, #e8b93c); font-weight: 700; font-size: 14px; box-shadow: 0 3px 0 #b88a1d; }
.coin.silver { background: radial-gradient(circle at 35% 30%, #fff, #b9c0c7); box-shadow: 0 3px 0 #8a9198; }
.coin.note { border-radius: 8px; width: 78px; background: linear-gradient(135deg, #f3d6e8, #d97bb0); box-shadow: 0 3px 0 #a3507f; }
.paybox { display: flex; justify-content: space-around; text-align: center; background: #faf5ea; border-radius: 14px; padding: 10px; }
.paybox b { font-size: 20px; display: block; }
.receipt { font-family: "SF Mono", Menlo, monospace; background: #fff; border: 1px dashed #c9bfae; padding: 14px 16px; font-size: 12.5px; line-height: 1.7; }
.receipt .c { text-align: center; }
.receipt .r { display: flex; justify-content: space-between; }
.receipt hr { border: 0; border-top: 1px dashed #c9bfae; margin: 6px 0; }

/* 카드 */
.card { border-radius: 18px; padding: 18px; color: #fff; text-align: center; background: linear-gradient(135deg, #ff9a3c, #ff4fa3); }
.card .big { font-size: 22px; font-weight: 800; margin: 6px 0; }
.preview-img { width: 100%; border-radius: 10px; display: block; }

/* 포토 모드 */
#photo-ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.photo-frame { position: absolute; inset: 14px; border: 2px solid rgba(255, 255, 255, .7); border-radius: 18px; }
.photo-panel { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); pointer-events: auto; background: rgba(20, 16, 30, .78); color: #fff; padding: 12px 14px; border-radius: 20px; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 32px)); backdrop-filter: blur(10px); }
.photo-panel .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.photo-panel .lbl { font-size: 11px; opacity: .6; width: 30px; }
.photo-panel button { padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: 13px; color: #fff; }
.photo-panel button.on { background: #fff; color: #222; }
.photo-panel .shutter { width: 56px; height: 56px; border-radius: 50%; background: #fff; color: #ff4fa3; font-size: 30px; padding: 0; box-shadow: 0 0 0 4px rgba(255, 255, 255, .3); }

#eat-ui { position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%); z-index: 7; }
#eat-big { background: var(--mango); color: var(--ink); padding: 14px 26px; border-radius: 999px; font-size: 17px; font-weight: 700; box-shadow: 0 6px 0 #c98a0b, 0 10px 24px rgba(0, 0, 0, .2); }
#eat-big:active { transform: translateY(4px); box-shadow: 0 2px 0 #c98a0b; }

#cold { position: fixed; inset: 0; pointer-events: none; z-index: 3; box-shadow: inset 0 0 120px 40px rgba(200, 240, 255, .75); animation: coldin 2.4s ease-out forwards; }
@keyframes coldin { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

#toasts { position: fixed; top: 120px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 30; pointer-events: none; }
.toast { background: rgba(42, 38, 34, .92); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; animation: toastin .3s, toastout .4s 3.2s forwards; white-space: nowrap; }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastout { to { opacity: 0; transform: translateY(-8px); } }

#invite-pop { position: fixed; bottom: 150px; right: 16px; z-index: 12; background: #fffdf8; border-radius: 16px; padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); font-size: 13px; animation: rise .25s; }
#invite-pop .actions { margin-top: 10px; }

/* 툭툭 이동 연출 */
.tuk-ride { text-align: center; padding: 20px 0; }
.tuk-ride .road { height: 60px; position: relative; overflow: hidden; border-bottom: 3px dashed #c9bfae; }
.tuk-ride .tt { position: absolute; font-size: 44px; bottom: 0; animation: ride 1.8s linear; transform: scaleX(-1); }
@keyframes ride { from { left: -60px; } to { left: 100%; } }
.elev { text-align: center; padding: 18px 0; }
.elev .floor { font-size: 60px; font-weight: 800; font-variant-numeric: tabular-nums; font-family: "SF Mono", Menlo, monospace; color: #7af7ff; background: #120a2a; border-radius: 16px; padding: 10px 0; }

@media (max-width: 560px) {
  #hint { display: none; }
  /* 모바일 상단: 좁은 화면에서도 지역·인원이 다 보이게 */
  .top-left { top: 12px; left: 12px; gap: 6px; padding: 4px 10px 4px 4px; }
  .top-left .region-btn { padding: 0 6px; font-size: 13px; }
  .top-right { top: 12px; right: 12px; gap: 6px; }
  .round { width: 36px; height: 36px; font-size: 15px; }
  #me-chip { top: 54px; left: 12px; font-size: 12px; padding: 5px 10px; }
  #actionbar button { min-width: 44px; padding: 4px 6px; }
  #context-btn { bottom: 140px; font-size: 14px; }
}
