* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1d2433;
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  color: #f2f4f8;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  background: rgba(15, 19, 28, 0.78);
  backdrop-filter: blur(4px);
  z-index: 2;
}
.logo { font-weight: 800; letter-spacing: -0.02em; }
.place { font-weight: 700; color: #ffd36b; }
.count { font-size: 13px; opacity: 0.7; }
.nav { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav button, .my-addr {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #2c3650;
  color: #fff;
  font-size: 14px;
}
.nav button:hover, .my-addr:hover { background: #3a4768; }
.visit { display: flex; gap: 4px; }
.visit input {
  width: 76px;
  padding: 6px 8px;
  border: 2px solid #3a4560;
  border-radius: 8px;
  background: #0f131c;
  color: inherit;
  font-size: 14px;
}
.my-addr { background: #3b5bd9; font-weight: 700; }
.my-addr:empty { display: none; }

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  /* 휴대폰: 길게 누르기를 게임이 직접 처리하도록, 브라우저의 확대·스크롤·글자 선택·길게 누르기 메뉴를 막아요 */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 채팅 ---------- */
.chatlog {
  position: fixed;
  left: 12px;
  bottom: 64px;
  width: min(320px, calc(100vw - 24px));
  max-height: 30vh;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 19, 28, 0.55);
  font-size: 13px;
  line-height: 1.5;
  z-index: 1;
}
.chatlog:empty { display: none; }
.chatlog .sys { color: #9aa6c2; }
.chatlog .who { font-weight: 700; margin-right: 6px; }
.chatlog .say { color: #f2f4f8; }

.chatbar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  width: min(520px, calc(100vw - 24px));
  z-index: 2;
}
.chatbar input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid #3a4560;
  border-radius: 10px;
  background: #0f131c;
  color: inherit;
  font-size: 16px; /* 16px 미만이면 아이폰에서 입력할 때 화면이 확대돼요 */
  outline: none;
}
.chatbar input:focus { border-color: #6aa0ff; }
.chatbar button {
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #4a7dff;
  color: #fff;
  font-weight: 700;
}

/* ---------- 입장 화면 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 13, 20, 0.85);
  z-index: 10;
}
.overlay.hidden { display: none; }
/* ❓ 게임 안내 */
.guide-card { max-width: 420px; width: calc(100vw - 32px); text-align: center; }
.guide-emoji { font-size: 52px; line-height: 1.1; margin-top: 4px; }
.guide-card h2 { margin: 6px 0 10px; font-size: 20px; }
.guide-body { text-align: left; margin: 0 0 12px; padding-left: 20px; line-height: 1.6; font-size: 15px; }
.guide-body li { margin: 4px 0; }
.guide-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.guide-dots span { width: 8px; height: 8px; border-radius: 50%; background: #495057; }
.guide-dots span.on { background: #74c0fc; }
.guide-row { display: flex; gap: 8px; justify-content: space-between; }
.guide-row .primary { flex: 1; }
.helpb { background: #5c7cfa; }
.newsb { background: #12b886; position: relative; }
.newsb .dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ff6b6b; border: 2px solid #fff; }
.newsb .dot.hidden { display: none; }
/* 📢 업데이트 소식 */
.news-card { max-width: 480px; width: calc(100vw - 32px); max-height: calc(100vh - 60px); overflow: auto; }
.news-ver { margin-top: 12px; }
.news-ver h3 { margin: 0 0 6px; font-size: 16px; }
.news-ver h3 small { color: #adb5bd; font-weight: 400; }
.news-ver ul { list-style: none; padding: 0; margin: 0; }
.news-ver li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.06); line-height: 1.45; font-size: 14px; }
.news-tag { flex: none; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.news-tag.t-new { background: #4c6ef5; color: #fff; }
.news-tag.t-up { background: #12b886; color: #fff; }
.news-tag.t-fix { background: #fab005; color: #2b2100; }
.start-news-line { text-align: center; font-size: 12px; color: #adb5bd; margin: 10px 0 0; }
.start-news-line a { color: #74c0fc; }
.questb { background: #e8590c; position: relative; }
.questb .dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ff6b6b; border: 2px solid #fff; }
.questb .dot.hidden { display: none; }
/* 🧭 첫 퀘스트 안내판 */
.quest-tracker {
  position: fixed; left: 12px; top: 120px; z-index: 4; width: 250px; max-width: calc(100vw - 24px);
  padding: 10px 12px; border-radius: 12px; background: rgba(30, 26, 42, 0.9); color: #f1f3f5; font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.quest-tracker.hidden { display: none; }
.qt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; color: #ffd43b; }
.qt-head button { background: none; border: 0; color: #adb5bd; font-size: 16px; cursor: pointer; padding: 0 4px; }
.qt-step { font-weight: 800; font-size: 14px; }
.qt-hint { color: #ced4da; margin-top: 3px; line-height: 1.4; }
/* ❤️ 좋아요 · 📣 자랑하기 */
.home-actions { position: fixed; right: 12px; top: 120px; z-index: 4; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.home-actions.hidden { display: none; }
.like-btn, .show-btn { border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 14px; cursor: pointer; color: #fff; background: rgba(30,26,42,0.88); }
.like-btn.on { background: #e64980; }
.like-btn.owner { cursor: default; }
.show-btn { background: #7048e8; }
.show-btn.hidden { display: none; }
.bgm-chip { border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 13px; cursor: pointer; color: #fff; background: #0c8599; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgm-chip.off { background: rgba(30,26,42,0.88); color: #adb5bd; }
.bgm-chip.hidden { display: none; }
.bgm-pop { position: fixed; right: 12px; top: 240px; z-index: 6; width: 250px; padding: 12px; border-radius: 12px; background: #232c40; color: #f1f3f5; box-shadow: 0 8px 30px rgba(0,0,0,0.45); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.bgm-pop.hidden { display: none; }
.bgm-pop small { color: #adb5bd; }
.bgm-vol { display: flex; align-items: center; gap: 8px; }
.bgm-vol input { flex: 1; }
.bgm-chk { display: flex; gap: 6px; align-items: flex-start; line-height: 1.35; }
.bgm-pop-row { display: flex; gap: 6px; }
.bgm-pop-row button { flex: 1; width: auto; padding: 8px; }
.bgm-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.05); margin-bottom: 6px; }
.bgm-row.on { outline: 2px solid #3bc9db; }
.bgm-main { flex: 1; display: flex; flex-direction: column; }
.bgm-main small { color: #adb5bd; }
.bgm-row button { width: auto; flex: none; padding: 8px 14px; }
@media (max-width: 640px) { .bgm-pop { top: auto; bottom: 200px; } }
/* 👀 자랑 링크 손님 */
.show-banner {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 5; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px 10px 16px; border-radius: 999px; background: rgba(30,26,42,0.92); color: #fff; font-weight: 700; white-space: nowrap;
  max-width: calc(100vw - 24px);
}
.show-banner.hidden { display: none; }
.show-banner span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* 📜 할 일 */
.quests-card { max-width: 460px; width: calc(100vw - 32px); max-height: calc(100vh - 60px); overflow: auto; }
.quests-body { margin-top: 10px; }
.q-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.05); margin-bottom: 6px; }
.q-row .q-main { flex: 1; min-width: 0; }
.q-row .q-label { font-weight: 700; }
.q-row .q-sub { font-size: 12px; color: #adb5bd; margin-top: 2px; }
.q-row .q-gold { font-weight: 800; color: #ffd43b; white-space: nowrap; }
.q-row.done { opacity: 0.6; }
.q-row.now { outline: 2px solid #ffd43b; }
.q-bar { height: 6px; border-radius: 3px; background: #343a40; margin-top: 5px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: #51cf66; }
.q-streak { padding: 10px; border-radius: 10px; background: rgba(255,212,59,0.12); margin-bottom: 10px; font-weight: 700; }
.dex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dex-cell { text-align: center; padding: 10px 4px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.dex-cell .e { font-size: 30px; }
.dex-cell.no { opacity: 0.45; }
.dex-cell .n { font-size: 12px; color: #adb5bd; }
.q-row button { white-space: nowrap; }
.tophomes-list { padding-left: 0; list-style: none; margin: 8px 0 0; }
.tophomes-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.05); margin-bottom: 6px; }
.tophomes-list .rk { font-size: 20px; width: 28px; text-align: center; }
.tophomes-list .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tophomes-list button, .show-banner button, .q-row button { width: auto; flex: none; padding: 8px 14px; }
.tophomes-list .lk { white-space: nowrap; }
.tophomes-list .lk { color: #f783ac; font-weight: 800; }
.card {
  width: min(380px, 100%);
  padding: 24px;
  border-radius: 16px;
  background: #232c40;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.card h1 { margin: 0; font-size: 26px; }
.card h1 small { font-size: 14px; opacity: 0.6; font-weight: 400; }
.card .sub { margin: 6px 0 18px; opacity: 0.75; font-size: 14px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; opacity: 0.8; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #3a4560;
  border-radius: 10px;
  background: #0f131c;
  color: inherit;
  font-size: 16px;
}
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 30px; height: 30px;
  border: 3px solid transparent;
  border-radius: 50%;
  outline: 1px solid rgba(255, 255, 255, 0.25);
}
.swatches button[aria-pressed="true"] { border-color: #fff; }
.primary {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: #4a7dff;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}

/* ---------- 알림 ---------- */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(15, 19, 28, 0.9);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 20;
}
.toast.show { opacity: 1; }

/* ---------- 3단계: 꾸미기 ---------- */
.start-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px;
  border-radius: 12px;
  background: #1a2132;
}
.start-preview canvas { width: 96px; height: 100px; image-rendering: pixelated; }
.secondary {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #3a4768;
  color: #fff;
  font-weight: 700;
}
.edit-btn {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #e64980;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.card.editor {
  width: min(760px, 100%);
  display: flex;
  gap: 16px;
  padding: 16px;
}
.editor-left { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#editor-preview {
  width: 200px;
  height: 300px;
  border-radius: 12px;
  background: linear-gradient(#2c3a58, #1a2132);
  image-rendering: pixelated;
}
.editor-preview-btns { display: flex; gap: 6px; }
.editor-preview-btns button {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #2c3650;
  color: #fff;
  font-size: 13px;
}
.editor-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tabs button {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #2c3650;
  color: #c9d2e6;
  font-size: 14px;
}
.tabs button[aria-selected="true"] { background: #4a7dff; color: #fff; font-weight: 700; }
.editor-options { flex: 1; overflow-y: auto; max-height: 300px; padding-right: 4px; }
.opt-group { margin-bottom: 12px; }
.opt-title { font-size: 13px; opacity: 0.8; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  padding: 6px 12px;
  border: 2px solid #3a4560;
  border-radius: 999px;
  background: #1a2132;
  color: #e6ebf5;
  font-size: 14px;
}
.chips button[aria-pressed="true"] { border-color: #ffd36b; color: #ffd36b; font-weight: 700; }
.editor-actions { display: flex; gap: 8px; margin-top: 12px; }
.editor-actions .primary { margin: 0; flex: 1; }

@media (max-width: 640px) {
  .card.editor { flex-direction: column; max-height: calc(100vh - 32px); overflow-y: auto; }
  #editor-preview { width: 140px; height: 210px; }
  .editor-options { max-height: none; }
}

/* ---------- 4단계: 가구 배치 ---------- */
.hidden { display: none !important; }
.edit-btn.build { background: #f08c00; }
.edit-btn.guest { background: #2f9e44; }
.buildbar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(23, 29, 43, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.build-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.build-hint { font-size: 12px; opacity: 0.7; }
.build-actions { display: flex; gap: 8px; justify-content: flex-end; }
.build-actions .primary { width: auto; margin: 0; padding: 10px 22px; }
body.building .chatbar, body.building .chatlog { display: none; }

/* ---------- 4단계: 방명록 ---------- */
.card.guestbook { width: min(560px, 100%); display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 32px); }
.gb-head { display: flex; justify-content: space-between; align-items: center; }
.gb-head h2 { margin: 0; font-size: 20px; }
.gb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  overflow-y: auto;
  min-height: 120px;
  max-height: 50vh;
  padding: 4px;
}
.gb-empty { grid-column: 1 / -1; opacity: 0.7; font-size: 14px; text-align: center; padding: 24px 0; }
.postit {
  position: relative;
  padding: 12px 12px 10px;
  border-radius: 4px;
  color: #2b2b2b;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 96px;
}
.postit:nth-child(odd) { transform: rotate(-1.2deg); }
.postit:nth-child(even) { transform: rotate(1deg); }
.postit .pi-text { font-size: 15px; line-height: 1.4; word-break: break-all; flex: 1; }
.postit .pi-meta { font-size: 11px; opacity: 0.7; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.postit .pi-del {
  border: 0;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: #2b2b2b;
}
.gb-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gb-form input {
  flex: 1;
  min-width: 160px;
  padding: 10px 12px;
  border: 2px solid #3a4560;
  border-radius: 10px;
  background: #0f131c;
  color: inherit;
  font-size: 16px;
}
.gb-form .primary { width: auto; margin: 0; padding: 10px 18px; }

/* ---------- 아이콘·로고 ---------- */
.logo { display: inline-flex; align-items: center; gap: 6px; }
.logo img, .brand img { border-radius: 22%; }
.brand { display: flex; align-items: center; gap: 12px; }

/* ---------- 캐릭터 카드 ---------- */
.profile-card {
  position: fixed;
  z-index: 4;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(23, 29, 43, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  max-width: calc(100vw - 24px);
}
.profile-card canvas { width: 80px; height: 110px; image-rendering: pixelated; border-radius: 10px; background: #2c3a58; }
.pc-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-body strong { font-size: 16px; }
.pc-addr { font-size: 13px; opacity: 0.75; }
.pc-actions { display: flex; gap: 6px; }
.pc-actions .primary { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }
.pc-actions .secondary { padding: 8px 12px; font-size: 14px; }
.pc-actions .primary:disabled { background: #3a4560; cursor: default; }

/* ---------- 가구 메뉴 ---------- */
.furn-menu {
  position: fixed;
  z-index: 4;
  padding: 6px;
  border-radius: 12px;
  background: rgba(23, 29, 43, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.furn-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f2f4f8;
  font-size: 15px;
  text-align: left;
}
.furn-menu button:hover { background: #2c3650; }

/* ---------- 초대·안전장치 ---------- */
.invite-note {
  margin: -8px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #2f3f6b;
  color: #dbe4ff;
  font-size: 14px;
}
.edit-btn.lock { background: #5c677d; }
.edit-btn.lock.on { background: #c92a2a; }
.pc-small { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-small button {
  padding: 4px 10px;
  border: 1px solid #3a4560;
  border-radius: 999px;
  background: transparent;
  color: #c9d2e6;
  font-size: 12px;
}
.pc-small button:hover { background: #2c3650; }
#pc-report, .pc-reason { border-color: #a6474a; color: #ffc9c9; }
#pc-kick { border-color: #f08c00; color: #ffd8a8; }

/* ---------- 시장 · 크리스마스 에디션 ---------- */
.nav button.market { background: #2b8a3e; }
.nav button.market:hover { background: #37b24d; }
.gold {
  border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer;
  background: #f0b429; color: #3d2a00; font-weight: 800; font-size: 14px; font: inherit; font-weight: 800;
}
.gold:hover { background: #ffc94d; }
body.festive { background: radial-gradient(ellipse at top, #24304f, #121a2c 70%); }
.card.shop { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.shop-sub { margin: 6px 0 0; font-size: 13px; opacity: 0.75; }
.shop-gold { margin: 10px 0 0; font-weight: 800; font-size: 16px; color: #ffd43b; }
.shop-hint { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff3bf; color: #5c4400; font-size: 13px; }
.shop-hint.hidden { display: none; }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.shop-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px; border-radius: 12px; background: #fff8f0; border: 2px solid #f1d3b0;
}
.shop-card canvas { width: 120px; height: 112px; background: linear-gradient(#eaf3ff, #fdfdff); border-radius: 8px; }
.shop-name { font-weight: 800; font-size: 14px; color: #3b2a1a; }
.shop-meta { font-size: 13px; color: #7a5a3a; }
.shop-buy {
  margin-top: 4px; width: 100%; border: 0; border-radius: 8px; padding: 7px 0; cursor: pointer;
  background: #c92a2a; color: #fff; font: inherit; font-weight: 800;
}
.shop-buy:hover:not(:disabled) { background: #e03131; }
.shop-buy:disabled { background: #ced4da; color: #6c757d; cursor: default; }
#build-items button.shop-item { background: #2b8a3e; color: #fff; }
#build-items button.shop-item[aria-pressed="true"] { outline: 3px solid #ffd43b; }

/* ---------- 광산 · 낚시터 ---------- */
.stamina {
  padding: 6px 10px; border-radius: 8px; background: #2b3a55; color: #b2f2bb; font-weight: 800; font-size: 14px; white-space: nowrap;
}
.stamina.empty { color: #ff8787; }
/* 누워 쉬는 동안: 체력 +1까지 남은 시간 */
.sleep-badge {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 4;
  padding: 8px 14px; border-radius: 999px; background: rgba(30, 26, 42, 0.85); color: #e7f5ff;
  font-weight: 700; font-size: 14px; white-space: nowrap; pointer-events: none;
}
.places-menu { position: fixed; z-index: 6; }
.reel {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 4;
  border: 0; border-radius: 999px; padding: 14px 26px; cursor: pointer;
  background: #2b3a55; color: #dbe4ff; font: inherit; font-size: 16px; font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.reel.hidden { display: none; }
.reel.bite { background: #f59f00; color: #1e1a2a; animation: reel-shake 0.15s infinite alternate; }
@keyframes reel-shake { from { transform: translateX(-50%) rotate(-2deg) scale(1.06); } to { transform: translateX(-50%) rotate(2deg) scale(1.06); } }

/* ---------- 상인 모모 · 사고팔기 ---------- */
.shop-tabs { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.shop-tabs button {
  flex: 1; min-width: 150px; border: 0; border-radius: 10px; padding: 10px 12px; cursor: pointer;
  background: #2c3650; color: #c5cee0; font: inherit; font-weight: 800;
}
.shop-tabs button[aria-selected="true"] { background: #f1d3b0; color: #3b2a1a; }
.shop-emoji { width: 120px; height: 112px; display: grid; place-items: center; font-size: 56px; border-radius: 8px; background: linear-gradient(#fff4e6, #fffaf3); }
.shop-sell-row { display: flex; gap: 6px; width: 100%; }
.shop-sell-row .shop-buy { background: #2b8a3e; }
.shop-sell-row .shop-buy:hover:not(:disabled) { background: #37b24d; }
.shop-sellall {
  margin-top: 12px; width: 100%; border: 0; border-radius: 10px; padding: 12px; cursor: pointer;
  background: #f59f00; color: #1e1a2a; font: inherit; font-weight: 800; font-size: 15px;
}
.shop-sellall:disabled { background: #495057; color: #adb5bd; cursor: default; }
.shop-empty { grid-column: 1 / -1; text-align: center; opacity: 0.75; padding: 28px 0; font-size: 14px; }

/* ---------- 뿅망치 ---------- */
.pc-actions .bonk { background: #fa5252; }
.pc-actions .bonk:hover { background: #ff6b6b; }

/* ---------- 낚싯대 ---------- */
.shop-emoji.gold { background: linear-gradient(#fff3bf, #ffe066); }
.shop-desc { text-align: center; font-size: 12px; line-height: 1.4; min-height: 34px; }

/* ---------- 낚시 줄다리기 ---------- */
.fishgame {
  position: fixed; right: 24px; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 16px; border-radius: 18px; background: rgba(23, 29, 43, 0.95);
  border: 3px solid #a5723f; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  user-select: none; touch-action: none; cursor: pointer;
}
.fg-title { font-weight: 800; color: #ffe8a3; text-align: center; }
.fg-title small { display: block; font-weight: 400; font-size: 11px; color: #c5cee0; }
.fg-hint { font-size: 11px; color: #adb5bd; text-align: center; line-height: 1.4; }
.fishgame.win { border-color: #51cf66; }
.fishgame.lose { border-color: #ff6b6b; opacity: 0.7; }
@media (max-width: 600px) { .fishgame { right: 8px; padding: 10px; } }

.fishgame.holding { border-color: #8ce99a; box-shadow: 0 0 0 4px rgba(140, 233, 154, 0.35), 0 16px 40px rgba(0, 0, 0, 0.5); }

/* ---------- 가방 ---------- */
.edit-btn.bag { background: #8d5a2f; }
.card.bag { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.bag-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bag-stats span { padding: 6px 12px; border-radius: 999px; background: #2c3650; font-weight: 800; }
.bag-sec { margin: 16px 0 6px; font-size: 14px; color: #ffe8a3; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bag-sec small { color: #adb5bd; font-weight: 400; font-size: 12px; }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.bag-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px 8px; border-radius: 12px; background: #fff8f0; border: 2px solid #f1d3b0; color: #3b2a1a;
}
.bag-slot .ic { font-size: 30px; line-height: 1.1; }
.bag-slot canvas { width: 72px; height: 66px; }
.bag-slot .nm { font-size: 12px; font-weight: 800; text-align: center; }
.bag-slot .sub { font-size: 11px; color: #7a5a3a; text-align: center; }
.bag-slot .cnt {
  position: absolute; top: 4px; right: 6px; min-width: 22px; padding: 1px 6px; border-radius: 999px;
  background: #3b2a1a; color: #fff; font-size: 12px; font-weight: 800; text-align: center;
}
.bag-slot.using { border-color: #f59f00; box-shadow: 0 0 0 2px rgba(245, 159, 0, 0.35); }
.bag-empty { opacity: 0.7; font-size: 13px; margin: 4px 0; }
.bag-tip { margin: 14px 0 0; font-size: 12px; opacity: 0.6; text-align: center; }

/* 휴대폰: 캐릭터 카드 버튼 글자가 두 줄로 쪼개지지 않게 */
.pc-actions { flex-wrap: wrap; }
.pc-actions button { white-space: nowrap; }
@media (max-width: 600px) {
  .pc-actions .primary, .pc-actions .secondary { padding: 8px 10px; font-size: 13px; }
}

/* ---------- 휴대폰 화면 정리: ☰ 메뉴 + 접히는 채팅 기록 ---------- */
.menu-panel { display: contents; } /* PC: 상자 없이 버튼들이 원래 자리에 그대로 */
.menu-btn, .chatlog-toggle { display: none; }

@media (max-width: 640px) {
  .topbar { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; }
  .logo { font-size: 0; }               /* 글자는 숨기고 아이콘만 */
  .logo img { margin: 0; }
  .place { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
  .count { font-size: 12px; white-space: nowrap; }
  .stamina, .gold { padding: 5px 8px; font-size: 13px; white-space: nowrap; }
  .menu-btn {
    display: block; border: 0; border-radius: 8px; padding: 5px 11px; cursor: pointer;
    background: #2c3650; color: #fff; font-size: 18px; line-height: 1.2;
  }
  body.menu-open .menu-btn { background: #4a5a80; }
  /* 접힌 메뉴: ☰을 누르면 위에서 내려오는 패널 */
  .menu-panel {
    display: none;
    position: fixed; top: 46px; left: 8px; right: 8px; z-index: 6;
    padding: 12px; border-radius: 14px; background: rgba(23, 29, 43, 0.97);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    flex-direction: column; gap: 8px;
  }
  body.menu-open .menu-panel { display: flex; }
  .menu-panel .nav { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .menu-panel .nav .visit { grid-column: 1 / -1; display: flex; gap: 8px; }
  .menu-panel .nav .visit input { flex: 1; min-width: 0; width: auto; padding: 10px; font-size: 16px; }
  .menu-panel .nav .visit button { width: auto; flex: none; padding: 10px 16px; }
  .menu-panel button { width: 100%; padding: 10px; font-size: 14px; }
  .menu-panel .edit-btn.hidden { display: none !important; }

  /* 채팅 기록: 평소엔 최근 2줄만 작게, 💬을 누르면 펼쳐져요 */
  .chatlog-toggle {
    display: block; flex: none; border: 0; border-radius: 10px; padding: 0 12px; cursor: pointer;
    background: #2c3650; font-size: 18px;
  }
  body.chat-open .chatlog-toggle { background: #4a5a80; }
  .chatlog { left: 8px; bottom: 62px; width: calc(100vw - 16px); max-height: 3.1em; overflow: hidden; font-size: 12px; padding: 4px 8px; background: rgba(15, 19, 28, 0.45); pointer-events: none; }
  body.chat-open .chatlog { max-height: 45vh; overflow-y: auto; background: rgba(15, 19, 28, 0.85); pointer-events: auto; }
}

/* ---------- 로그인 ---------- */
.login-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.login-buttons { display: flex; flex-direction: column; gap: 8px; }
.login-buttons a {
  display: block; padding: 12px; border-radius: 10px; text-align: center; font-weight: 800; text-decoration: none;
}
.login-buttons .kakao { background: #fee500; color: #191919; }
.login-buttons .naver { background: #03c75a; color: #fff; }
.login-buttons .google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.login-buttons .none { opacity: 0.7; font-size: 13px; text-align: center; }
.dev-login { display: flex; gap: 6px; }
.dev-login input { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid #3a4560; background: #1b2233; color: #fff; }
.watch-btn { width: 100%; }
.login-small { margin: 4px 0 0; font-size: 11px; opacity: 0.6; text-align: center; }
.login-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: #3b1f24; color: #ffc9c9; font-size: 13px; }
.login-who { margin: 8px 0 0; font-size: 13px; opacity: 0.8; }
.logout-link { display: block; margin-top: 10px; text-align: center; font-size: 12px; color: #9aa6c2; }
.login-top { border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; background: #fee500; color: #191919; font: inherit; font-weight: 800; white-space: nowrap; }

/* ---------- GM ---------- */
.edit-btn.gmb { background: #c92a2a; }
.pc-gm { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #c92a2a; }
.pc-gm-title { width: 100%; font-size: 12px; font-weight: 800; color: #ff8787; }
.pc-gm button { border: 0; border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer; background: #2c3650; color: #f2f4f8; white-space: nowrap; }
.pc-gm button.danger { background: #5c1f24; color: #ffc9c9; }
.pc-gm button.confirm { background: #e03131; color: #fff; }
.card.gm-panel { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.gm-body { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.gm-item { padding: 10px 12px; border-radius: 10px; background: #1b2233; font-size: 13px; line-height: 1.5; }
.gm-item b { color: #ffd36b; }
.gm-item .ev { margin: 6px 0; padding: 6px 8px; border-radius: 6px; background: #121826; color: #c5cee0; font-size: 12px; }
.gm-item .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gm-item .acts button { border: 0; border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; background: #2c3650; color: #f2f4f8; }
.gm-empty { opacity: 0.7; text-align: center; padding: 20px 0; }
.gm-body textarea { width: 100%; min-height: 70px; padding: 10px; border-radius: 8px; border: 1px solid #3a4560; background: #1b2233; color: #fff; font: inherit; box-sizing: border-box; }
.card.gm-warn { width: min(380px, calc(100vw - 32px)); border: 2px solid #f59f00; text-align: center; }
.card.gm-warn h2 { margin: 0 0 8px; color: #ffd43b; }
.announce {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 7;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px;
  background: #f59f00; color: #1e1a2a; font-weight: 800; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); text-align: center;
}
body.guest .chatbar input { opacity: 0.6; }
.profile-card { max-width: min(470px, calc(100vw - 24px)); }
.login-small a { color: #9ec5ff; }

/* ---------- 계정 삭제 ---------- */
.link-btn { display: block; margin: 6px auto 0; border: 0; background: none; color: #ff8787; font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.link-btn.inline { display: inline; margin: 0; }
.card.delete-acc { width: min(420px, calc(100vw - 32px)); border: 2px solid #c92a2a; }
.card.delete-acc h2 { margin: 0 0 8px; color: #ff8787; }
.card.delete-acc ul { margin: 6px 0; padding-left: 1.2em; font-size: 14px; line-height: 1.7; }
.del-small { font-size: 12px; opacity: 0.75; line-height: 1.6; }
.del-small a { color: #9ec5ff; }
.del-actions { display: flex; gap: 8px; margin-top: 12px; }
.del-actions button { flex: 1; }
.danger-btn { border: 0; border-radius: 10px; padding: 12px; background: #e03131; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.danger-btn:disabled { background: #5c3a3a; color: #b8a3a3; cursor: default; }

/* ---------- 옷 가게 · 옷장 ---------- */
.shop-card canvas.wear-pic { width: 72px; height: 99px; image-rendering: pixelated; cursor: pointer; background: linear-gradient(#e7f5ff, #fdfdff); }
.shop-card.wear-card.trying { border-color: #4dabf7; box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.35); }
.shop-desc { text-align: center; line-height: 1.35; }
.shop-buy.wearing { background: #2b8a3e; }
.shop-buy.wearing:hover:not(:disabled) { background: #37b24d; }
.wear-top { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.wear-preview { width: 90px; height: 120px; image-rendering: pixelated; flex: none; cursor: pointer; border-radius: 10px; background: linear-gradient(#dbe4ff, #f8f9ff); }
.wear-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wear-cap { font-weight: 800; font-size: 14px; }
.wear-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.wear-reset { align-self: flex-start; padding: 5px 10px; font-size: 13px; }
.chips button.locked { opacity: 0.6; border-style: dashed; }
.chips button.owned::after { content: ' ✨'; }
.editor-note { margin: 0 0 8px; padding: 7px 10px; border-radius: 8px; background: #fff3bf; color: #5c4400; font-size: 13px; }
.editor-note.hidden { display: none; }
button.bag-slot { font: inherit; cursor: pointer; }
.bag-slot.clickable:hover { border-color: #74c0fc; }
.bag-slot canvas[width="72"][height="96"] { width: 54px; height: 72px; image-rendering: pixelated; }
@media (max-width: 640px) {
  .wear-top { gap: 10px; }
  .wear-preview { width: 72px; height: 96px; }
  .shop-tabs button { font-size: 12px; padding-left: 6px; padding-right: 6px; }
  .shop-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shop-card { padding: 8px 6px; }
  .shop-name { font-size: 13px; }
  .shop-desc { font-size: 11px; }
  .shop-buy { font-size: 13px; }
  .wear-cats { gap: 4px; }
  .wear-cats button { padding: 4px 8px; font-size: 12px; }
  .wear-cap { font-size: 13px; }
}

/* ---------- 가구 배치 분류 · 집 넓히기 ---------- */
.build-cats { margin-bottom: 6px; }
.build-cats button { font-size: 13px; padding: 4px 10px; }
.build-count { font-size: 12px; opacity: 0.8; margin-right: auto; align-self: center; }
.gold-btn { border: 0; border-radius: 10px; padding: 8px 12px; background: #f0b429; color: #3d2a00; font: inherit; font-weight: 800; cursor: pointer; }
.gold-btn:disabled { background: #868e96; color: #dee2e6; cursor: default; }
.gold-btn.hidden { display: none; }

/* ---------- 포스트잇 (방명록 · 가게) ---------- */
.gb-designs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.gb-design { border: 2px solid transparent; border-top-width: 5px; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.gb-design[aria-pressed="true"] { outline: 3px solid #ffd43b; }
.gb-design:disabled { opacity: 0.5; cursor: default; }
.gb-sec { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; color: #ffe8a3; display: flex; justify-content: space-between; gap: 8px; }
.gb-sec small { color: #adb5bd; font-weight: 400; font-size: 12px; }
.postit.unpinned { opacity: 0.8; filter: saturate(0.85); }
.pi-del.pin { color: #2b8a3e; font-weight: 800; }
.pi-del.trash { color: #c92a2a; }
.post-sample { width: 90px; height: 76px; border-radius: 4px; display: grid; place-items: center; font-size: 26px; box-shadow: 0 3px 8px rgba(0,0,0,0.25); transform: rotate(-3deg); margin: 8px 0; }
#gb-text:disabled { opacity: 0.6; }
.postit .pi-meta { flex-wrap: wrap; row-gap: 4px; }
.postit .pi-del { white-space: nowrap; }
@media (max-width: 640px) {
  .build-actions { flex-wrap: wrap; }
  .build-actions button { white-space: nowrap; }
  .build-count { width: 100%; }
  #build-grow { flex: 1 1 100%; }
  .build-hint { font-size: 12px; }
}

/* ---------- 초대 코드 (비공개 테스트) ---------- */
.invite-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.invite-box.hidden, .closed-note.hidden, .invite-msg.hidden { display: none; }
.invite-title { margin: 0; font-weight: 800; font-size: 16px; }
.invite-sub { margin: 0; font-size: 13px; opacity: 0.8; line-height: 1.5; }
.invite-row { display: flex; gap: 6px; }
.invite-row input { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid #3a4560; background: #1b2233; color: #fff; font: inherit; }
.invite-row .primary { width: auto; margin: 0; padding: 10px 18px; }
.invite-msg { margin: 0; padding: 8px 10px; border-radius: 8px; background: #3b1f24; color: #ffc9c9; font-size: 13px; }
.invite-msg.ok { background: #1f3b26; color: #b2f2bb; }
.closed-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: #2b3a55; color: #dbe4ff; font-size: 13px; line-height: 1.5; }

/* ---------- 친구 · 집 공개 범위 ---------- */
.edit-btn.friends { background: #0c8599; }
.edit-btn.friends.alert { background: #e8590c; animation: friendPulse 1.6s ease-in-out infinite; }
@keyframes friendPulse { 50% { filter: brightness(1.2); } }
.card.friends { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.vis-box { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.vis-title { font-weight: 800; font-size: 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vis-title small { font-weight: 400; color: #adb5bd; font-size: 12px; }
.vis-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vis-options button { display: flex; flex-direction: column; gap: 2px; align-items: center; padding: 8px 6px; border-radius: 10px; border: 2px solid #3a4560; background: #1a2132; color: #e6ebf5; font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; }
.vis-options button small { font-weight: 400; font-size: 11px; color: #adb5bd; text-align: center; }
.vis-options button[aria-checked="true"] { border-color: #ffd36b; color: #ffd36b; background: #2b2a1f; }
.friends-body { display: flex; flex-direction: column; gap: 6px; }
.friend-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: #fff8f0; color: #3b2a1a; }
.fr-name { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-name small { font-weight: 400; font-size: 12px; color: #868e96; margin-left: 4px; }
.fr-name small.on { color: #2b8a3e; }
.fr-btn { border: 0; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; background: #dee2e6; color: #343a40; white-space: nowrap; }
.fr-btn.ok { background: #4a7dff; color: #fff; }
.fr-btn.danger { background: #ffe3e3; color: #c92a2a; }
.fr-btn:disabled { background: #e9ecef; color: #adb5bd; cursor: default; }
.friends-tip { margin: 0; font-size: 12px; color: #adb5bd; text-align: center; }
#pc-friend.friend { background: #0c8599; }
#pc-friend:disabled { background: #495057; color: #ced4da; }
@media (max-width: 640px) {
  .vis-options button { font-size: 13px; }
  .vis-options button small { display: none; }
}

/* ---------- 거래 (1:1 교환) ---------- */
#pc-trade.trade { background: #e8590c; }
#pc-sitnext.sitnext { background: #2b8a3e; }
#pc-trade:disabled { background: #495057; color: #ced4da; }
.card.trade { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.trade-status { margin: 0; padding: 8px 12px; border-radius: 10px; background: #1a2132; font-size: 14px; font-weight: 700; }
.trade-status.ready { background: #2b8a3e; color: #fff; }
.trade-status.changed { background: #e8590c; color: #fff; animation: tradeFlash 0.5s 2; }
@keyframes tradeFlash { 50% { filter: brightness(1.35); } }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trade-side { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.trade-side.ok { border-color: #51cf66; }
.trade-side h3 { margin: 0; font-size: 14px; color: #ffe8a3; display: flex; justify-content: space-between; gap: 6px; }
.ok-badge { color: #8ce99a; font-size: 13px; }
.ok-badge.hidden { display: none; }
.trade-gold { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.trade-gold input { width: 120px; padding: 6px 8px; border: 2px solid #3a4560; border-radius: 8px; background: #0f131c; color: inherit; font: inherit; font-size: 16px; }
.trade-gold small { font-weight: 400; color: #adb5bd; font-size: 12px; }
.trade-gold.view { min-height: 34px; }
.trade-list { display: flex; flex-direction: column; gap: 4px; min-height: 40px; }
.trade-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: #fff8f0; color: #3b2a1a; font-size: 13px; font-weight: 700; }
.trade-row .tr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-row .tr-n { color: #7a5a3a; }
.trade-row button { border: 0; border-radius: 6px; padding: 2px 8px; background: #dee2e6; color: #343a40; font: inherit; cursor: pointer; }
.trade-empty { font-size: 12px; color: #adb5bd; margin: 4px 0; }
.trade-bag { max-height: 260px; overflow: auto; padding: 2px; }
.trade-bag .bag-slot:disabled { opacity: 0.4; cursor: default; }
#trade-ok:disabled { background: #495057; color: #ced4da; }
.trade-tip { margin: 0; font-size: 12px; color: #adb5bd; text-align: center; }
.card.trade.waiting .trade-cols, .card.trade.waiting .trade-bag, .card.trade.waiting .bag-sec, .card.trade.waiting #trade-ok { opacity: 0.45; pointer-events: none; }

.trade-invite {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 11;
  width: min(380px, calc(100vw - 32px)); padding: 12px 14px 10px; border-radius: 14px;
  background: #232c40; border: 2px solid #e8590c; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.trade-invite.hidden { display: none; }
.home-invite { border-color: #7048e8; }
.hi-more { width: 100%; display: flex; gap: 6px; justify-content: flex-end; }
.hi-more button { background: none; border: 0; color: #adb5bd; font-size: 12px; cursor: pointer; padding: 2px 6px; text-decoration: underline; }
.pc-actions .invite, #pc-invite { background: #7048e8; }
.ti-text { flex: 1; min-width: 180px; font-weight: 800; font-size: 14px; }
.ti-actions { display: flex; gap: 6px; }
.ti-bar { flex-basis: 100%; height: 4px; border-radius: 2px; background: #1a2132; overflow: hidden; }
.ti-bar span { display: block; height: 100%; background: #e8590c; width: 100%; }
@media (max-width: 600px) {
  .trade-cols { grid-template-columns: 1fr; }
  .trade-bag { max-height: 200px; }
  .trade-invite { bottom: 96px; }
}

/* ---------- 사냥터 ⚔️ 공격 버튼 ---------- */
.hunt-btn {
  position: fixed; right: 16px; bottom: 84px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 96px; padding: 12px 16px; border: 3px solid #ffd43b; border-radius: 18px; cursor: pointer;
  background: #c92a2a; color: #fff; font: inherit; font-size: 17px; font-weight: 900;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.hunt-btn small { font-size: 11px; font-weight: 700; opacity: 0.85; }
.hunt-btn:active { transform: scale(0.95); }
.hunt-btn.on { background: #f59f00; color: #1e1a2a; animation: huntPulse 0.9s infinite; }
.hunt-btn.hidden { display: none; }
@keyframes huntPulse { 50% { box-shadow: 0 0 0 6px rgba(255, 212, 59, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45); } }
@media (max-width: 600px) {
  .hunt-btn { right: 12px; bottom: 168px; width: 84px; height: 84px; min-width: 0; padding: 0; border-radius: 50%; font-size: 16px; }
}

/* ---------- 우리집 화면에 붙인 포스트잇 ---------- */
.notes { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.note {
  position: absolute; width: 150px; padding: 6px 10px 8px; pointer-events: auto;
  border-top: 8px solid #fab005; border-radius: 3px 3px 6px 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); font-size: 13px; line-height: 1.35;
  transform: rotate(var(--tilt, 0deg)); transition: transform 0.12s, box-shadow 0.12s;
  -webkit-user-select: none; user-select: none;
}
.note.movable { cursor: grab; touch-action: none; }
.note.dragging { cursor: grabbing; transform: rotate(0deg) scale(1.06); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); transition: none; }
.note-head { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; opacity: 0.8; }
.note-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-off { border: 0; background: rgba(0, 0, 0, 0.08); border-radius: 6px; padding: 2px 5px; font-size: 13px; cursor: pointer; line-height: 1; }
.note-off:hover { background: rgba(0, 0, 0, 0.18); }
.note-text { margin-top: 4px; font-weight: 700; word-break: break-all; }
.note-date { margin-top: 4px; font-size: 10px; opacity: 0.6; text-align: right; }
.notes-toggle {
  position: fixed; right: 16px; bottom: 84px; z-index: 4;
  border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  background: rgba(15, 19, 28, 0.85); color: #ffe066; font: inherit; font-size: 13px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.notes-toggle.hidden { display: none; }
@media (max-width: 600px) {
  .note { width: 112px; padding: 5px 8px 6px; font-size: 12px; border-top-width: 6px; }
  .note-date { display: none; }
  .notes-toggle { right: 12px; bottom: 168px; }
}

/* ---------- 포스트잇 붙일 곳 고르기 ---------- */
.place-layer { position: fixed; inset: 0; z-index: 6; background: rgba(10, 13, 20, 0.25); touch-action: none; cursor: crosshair; }
.place-layer.hidden, .place-bar.hidden { display: none; }
.note.ghost { cursor: grab; outline: 3px dashed #ffd43b; outline-offset: 3px; animation: ghostBob 1.2s ease-in-out infinite; }
.note.ghost.dragging { animation: none; cursor: grabbing; transform: scale(1.06); }
@keyframes ghostBob { 50% { transform: translateY(-3px) rotate(-1deg); } }
.place-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 7;
  width: min(460px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 14px;
  background: #232c40; border: 2px solid #ffd43b; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
}
.pb-text { font-weight: 800; font-size: 14px; text-align: center; }
.pb-actions { display: flex; gap: 6px; }
.pb-actions .fr-btn { padding: 10px 14px; font-size: 14px; }

/* ---------- 나가기 ---------- */
.edit-btn.exit { background: #495057; }
.exit-m { display: none; }
@media (max-width: 640px) {
  .exit-pc { display: none; }
  .exit-m { display: block; }
}
.card.exit-dlg { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.card.exit-dlg h2 { margin: 0; font-size: 20px; }
.exit-note { margin: 0; font-size: 13px; opacity: 0.75; }
.exit-dlg .primary { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; }
.exit-dlg .primary small { font-size: 12px; font-weight: 600; opacity: 0.85; }
.exit-dlg .primary.logout { background: #868e96; }
.exit-dlg .secondary { border-radius: 10px; background: #2c3650; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- 휴대폰 조이스틱 ---------- */
.joystick {
  display: none; position: fixed; left: 18px; bottom: 168px; z-index: 4;
  width: 112px; height: 112px; border-radius: 50%;
  background: rgba(15, 19, 28, 0.35); border: 3px solid rgba(255, 255, 255, 0.35);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); pointer-events: none;
}
.joystick.on { background: rgba(15, 19, 28, 0.5); border-color: #ffd43b; }
.joystick.on .joy-knob { background: #ffd43b; }
@media (pointer: coarse) {
  body.can-move .joystick { display: block; }
  body.building .joystick, body.chat-open .joystick { display: none; }
}

/* ---------- GM 🧪 테스트 도구 ---------- */
.gm-test-now { margin: 8px 0; font-size: 13px; color: #c5cee0; }
.gm-test-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.gm-test-row.items select, .gm-test-row.items input { padding: 8px; border: 2px solid #3a4560; border-radius: 8px; background: #0f131c; color: inherit; font: inherit; font-size: 14px; }
.gm-test-row.items select { flex: 1; min-width: 140px; }
.gm-test-row.items input { width: 72px; }
.gm-test-row.items input:disabled { opacity: 0.4; }
.gm-test-btn { flex: 1; min-width: 140px; border: 0; border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #2c3650; color: #fff; font: inherit; font-weight: 800; }
.gm-test-btn.on { background: #2b8a3e; }
.gm-test-btn.ok { background: #4a7dff; flex: 0 0 auto; min-width: 80px; }

/* ---------- 위쪽 바 한 줄 정리 (PC 중간 크기 화면) ----------
   버튼이 많아 두 줄이 되던 것: 이모지가 있는 버튼은 아이콘만 (마우스를 올리면 이름), 긴 집 이름은 … 으로.
   휴대폰(☰ 메뉴)과 아주 넓은 화면에서는 글자를 그대로 보여 줘요. */
@media (min-width: 641px) and (max-width: 1599px) {
  .topbar .lbl { display: none; }
  .topbar { gap: 8px; }
  .place { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav { gap: 4px; }
  .nav button, .my-addr, .edit-btn { padding-left: 9px; padding-right: 9px; }
}
@media (min-width: 641px) and (max-width: 1365px) {
  .logo { font-size: 0; }   /* 글자는 숨기고 아이콘만 */
  .logo img { margin: 0; }
  .place { max-width: 160px; }
}
/* 휴대폰 ☰ 메뉴가 열려 있을 땐 화면 위 버튼들이 메뉴를 가리지 않게 숨겨요 */
body.menu-open .joystick, body.menu-open .hunt-btn, body.menu-open .notes-toggle { display: none !important; }

/* ---------- 장소 옮길 때 화면 전환 ---------- */
.fade { position: fixed; inset: 0; z-index: 1; background: #0b0e15; opacity: 0; pointer-events: none; transition: opacity 0.35s ease-out; }
.fade.on { opacity: 1; transition-duration: 0.18s; }
.fade.instant { transition: none; }

/* ---------- 귓속말 ---------- */
#chatlog .whisper { color: #fcc2d7; }
#chatlog .whisper .who { color: #f783ac; font-weight: 800; margin-right: 6px; }
#pc-whisper.whisper { background: #d6336c; }

/* ---------- 📮 우편함 ---------- */
.edit-btn.mailb { background: #5f3dc4; }
.edit-btn.mailb.alert { box-shadow: 0 0 0 2px #ffd43b; animation: huntPulse 1.2s infinite; }
.card.mailbox { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.mail-list { display: flex; flex-direction: column; gap: 8px; }
.letter { padding: 10px 12px; border-radius: 10px; background: #fff8f0; color: #3b2a1a; }
.letter.gift { box-shadow: 0 0 0 3px #ffd43b; }
.letter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.letter-head small { color: #8a6a4a; }
.letter-text { margin: 6px 0; white-space: pre-wrap; word-break: break-all; font-size: 14px; }
.letter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.letter-gift { flex: 1; font-weight: 800; font-size: 13px; }
.letter-done { flex: 1; color: #2b8a3e; font-weight: 700; }
.mail-send-in { display: flex; flex-direction: column; gap: 8px; }
.mail-send-in label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.mail-send-in select, .mail-send-in input, .mail-send-in textarea { padding: 8px; border: 2px solid #3a4560; border-radius: 8px; background: #0f131c; color: inherit; font: inherit; font-size: 15px; }
.mail-send-in textarea { resize: vertical; }
.mail-send-in #mail-to { flex: 1; }
.mail-gold input { width: 120px; }
.mail-pick { display: flex; gap: 6px; }
.mail-pick select { flex: 1; min-width: 0; }
.mail-pick input { width: 70px; }
.mail-gifts { display: flex; flex-wrap: wrap; gap: 6px; }
.gift-chip { border: 0; border-radius: 999px; padding: 5px 10px; background: #ffe066; color: #3b2a1a; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }

/* ---------- ⚔️ 결투 ---------- */
#pc-duel.duel { background: #c92a2a; }
#pc-duel:disabled { background: #495057; }
.duel-invite { border-color: #c92a2a; }
.duel-invite .ti-bar span { background: #c92a2a; }
.duel-bar {
  position: fixed; left: 50%; top: 112px; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px;
  background: rgba(35, 44, 64, 0.95); border: 2px solid #c92a2a; font-weight: 800; font-size: 14px; white-space: nowrap;
}
.duel-bar.hidden { display: none; }
.duel-bar b { color: #ff8787; }

/* 홈 화면 앱 설치 */
.install-btn { margin: 4px auto 6px; display: block; background: #edf2ff; color: #364fc7; border: 1px solid #bac8ff; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.install-btn.hidden, .install-guide.hidden { display: none; }
.install-guide { margin: 0 0 8px; font-size: 12.5px; color: #495057; background: #f8f9fa; border-radius: 10px; padding: 8px 10px; line-height: 1.5; }

/* 🎨 우리집 꾸미기 */
.decor-btn { background: #7048e8; color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 700; cursor: pointer; }
.decor-card { width: min(560px, 94vw); max-height: 86vh; overflow: auto; }
.decor-tabs { margin: 6px 0 10px; }
.decor-tabs button[aria-selected="true"] { background: #7048e8; color: #fff; }
.decor-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.decor-list.hidden, .decor-motto.hidden { display: none; }
.decor-opt { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border: 2px solid #dee2e6; border-radius: 12px; background: #fff; cursor: pointer; text-align: center; color: #343a40; }
.decor-opt[aria-pressed="true"] { border-color: #7048e8; box-shadow: 0 0 0 2px rgba(112,72,232,0.25); }
.decor-opt:disabled { opacity: 0.55; cursor: not-allowed; }
.decor-swatch { height: 54px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.85); font-size: 18px; text-shadow: 0 1px 2px rgba(0,0,0,0.35); border: 1px solid rgba(0,0,0,0.08); }
.decor-swatch.big { height: 110px; margin: 6px 6px 2px; align-self: stretch; width: auto; font-size: 30px; }
.decor-name { font-weight: 700; font-size: 13px; }
.decor-meta { font-size: 11.5px; color: #868e96; }
.decor-motto input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid #ced4da; font-size: 15px; }
.decor-motto-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* 🎤 콘서트장 응원 버튼 */
.cheer-bar { position: fixed; right: 16px; bottom: 84px; z-index: 4; display: flex; gap: 10px; }
.cheer-bar.hidden { display: none; }
.cheer-bar button {
  width: 74px; height: 74px; border-radius: 50%; border: 3px solid #e599f7; cursor: pointer;
  background: #5f3dc4; color: #fff; font: inherit; font-size: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.cheer-bar button small { font-size: 11px; font-weight: 800; }
.cheer-bar button:active { transform: scale(0.94); }
body.menu-open .cheer-bar { display: none !important; }
@media (max-width: 600px) { .cheer-bar { right: 12px; bottom: 168px; } .cheer-bar button { width: 64px; height: 64px; font-size: 22px; } }
.decor-motto-row button { white-space: nowrap; padding: 8px 16px; }

/* 📺 유튜브 같이 보기 */
.yt-dlg { width: min(460px, 94vw); }
.yt-dlg h2 { margin: 0 0 6px; }
.yt-dlg input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid #ced4da; font-size: 15px; }
.yt-msg { margin: 8px 0 0; font-size: 13px; color: #ffa8a8; }
.yt-msg.hidden { display: none; }
.yt-note { margin: 10px 0 0; font-size: 12px; opacity: 0.7; }
.yt-panel {
  position: fixed; right: 16px; top: 64px; z-index: 6; width: min(400px, 46vw);
  background: #15151f; border: 2px solid #ff0033; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.yt-panel.hidden, .yt-chip.hidden, .yt-owner.hidden { display: none; }
.yt-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; color: #fff; }
.yt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.yt-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-info span { font-size: 11px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-head button, .yt-actions button { border: 0; border-radius: 8px; background: #343a40; color: #fff; padding: 6px 10px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.yt-frame-box { position: relative; aspect-ratio: 16 / 9; background: #000; }
.yt-frame-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-actions { display: flex; gap: 6px; padding: 6px 8px; justify-content: space-between; }
.yt-owner { display: flex; gap: 6px; }
.yt-chip { position: fixed; right: 16px; top: 64px; z-index: 6; border: 2px solid #ff0033; background: #15151f; color: #fff; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 800; cursor: pointer; }
@media (max-width: 600px) {
  .yt-panel { left: 8px; right: 8px; width: auto; top: 58px; }
  .yt-chip { right: 8px; top: 58px; }
}

/* ⭐ 별 상점 */
.stars-btn { border: 0; border-radius: 10px; padding: 6px 10px; background: #3b3f8a; color: #ffe066; font: inherit; font-weight: 800; cursor: pointer; white-space: nowrap; }
.stars-btn:hover { background: #4c4fa8; }
.stars-btn.hidden { display: none; }
.starshop { width: min(760px, 96vw); max-height: 90vh; overflow: auto; }
.starshop .gb-head { gap: 10px; }
.ss-stars { margin-left: auto; background: #3b3f8a; color: #ffe066; border-radius: 999px; padding: 4px 12px; font-weight: 800; }
#ss-tabs button[aria-selected="true"] { background: #fcc419; color: #3d2a00; }
.ss-rule { font-size: 12.5px; line-height: 1.5; background: rgba(252,196,25,0.12); border: 1px solid rgba(252,196,25,0.4); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.ss-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ss-body.list { display: flex; flex-direction: column; gap: 6px; }
.ss-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 12px; background: #f8f0ff; border: 2px solid #d0bfff; color: #343a40; }
.ss-card canvas { width: 120px; height: 120px; image-rendering: pixelated; }
.ss-card .decor-swatch { align-self: stretch; height: 110px; font-size: 28px; }
.ss-card .shop-desc { font-size: 12px; color: #868e96; text-align: center; min-height: 2.6em; }
.ss-btns { display: flex; gap: 6px; width: 100%; }
.ss-btns button { flex: 1; border: 0; border-radius: 8px; padding: 8px 6px; font: inherit; font-weight: 800; cursor: pointer; }
.ss-buy { background: #5f3dc4; color: #fff; }
.ss-gift { background: #f783ac; color: #fff; }
.ss-btns button:disabled { background: #ced4da; color: #868e96; cursor: default; }
.ss-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.06); font-size: 13.5px; }
.ss-row .d { margin-left: auto; font-weight: 800; }
.ss-row .d.plus { color: #8ce99a; } .ss-row .d.minus { color: #ffa8a8; }
.ss-row small { opacity: 0.7; }
.ss-row button { border: 0; border-radius: 8px; padding: 6px 10px; background: #e03131; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.ss-pack { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.06); }
.ss-pack b { font-size: 18px; color: #ffe066; } .ss-pack button { margin-left: auto; }
.star-gift { width: min(420px, 94vw); }
.star-gift textarea, .star-gift select { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; border: 1px solid #ced4da; font: inherit; }
.sg-item { font-weight: 800; color: #ffe066; }
.ss-charge { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: rgba(252,196,25,0.1); }
.ss-steps { margin: 0; font-size: 13px; line-height: 1.6; }
.ss-code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ss-code-label { font-size: 12px; opacity: 0.75; }
.ss-code { font-size: 22px; letter-spacing: 2px; color: #ffe066; font-family: ui-monospace, Menlo, Consolas, monospace; user-select: all; }
.ss-go { display: block; text-align: center; padding: 12px; border-radius: 12px; background: #fcc419; color: #3d2a00; font-weight: 900; text-decoration: none; }
.nick-locked { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.nick-locked.hidden { display: none; }
.ticket-swatch { background: linear-gradient(135deg, #fff3bf, #ffd8a8); font-size: 54px; color: inherit; text-shadow: none; }
.gm-online-sum { font-size: 12.5px; background: rgba(77,171,247,0.12); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; line-height: 1.6; }
/* 휴대폰: 퀘스트 안내판(왼쪽 위)과 겹치지 않게 좋아요·자랑하기는 오른쪽 아래 (조이스틱은 왼쪽 아래) */
@media (max-width: 640px) {
  .home-actions { top: auto; bottom: 150px; right: 10px; }
  .quest-tracker { width: auto; max-width: calc(100vw - 24px); top: 108px; font-size: 12px; padding: 8px 10px; }
  .qt-step { font-size: 13px; }
}
