:root {
  --bg: #fff8ef;
  --panel: rgba(255, 251, 245, 0.94);
  --ink: #4a3428;
  --ink-soft: #8a6f5f;
  --accent: #ff8a65;
  --accent-2: #7ec8a9;
  --pink: #ff9fb2;
  --line: rgba(74, 52, 40, 0.12);
  --shadow: 0 8px 24px rgba(74, 52, 40, 0.18);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: rgba(46, 36, 44, 0.94);
    --ink: #fbeee4;
    --ink-soft: #cdb7a8;
    --line: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe6ff; font-family: 'Gowun Dodum', 'Apple SD Gothic Neo', sans-serif; color: var(--ink); }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.hidden { display: none !important; }
button { font-family: 'Jua', sans-serif; cursor: pointer; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; }

/* HUD */
#hud { position: fixed; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; width: 230px; pointer-events: none; }
#clock-day { font-family: 'Jua'; font-size: 14px; color: var(--ink-soft); }
#clock-time { font-family: 'Jua'; font-size: 28px; line-height: 1.1; }
#money-row { font-size: 14px; margin-top: 2px; }
#money { font-family: 'Jua'; color: #e67e22; font-size: 16px; }
.need { display: grid; grid-template-columns: 22px 46px 1fr; align-items: center; gap: 4px; font-size: 12px; margin: 3px 0; }
.need .bar { height: 9px; background: var(--line); border-radius: 6px; overflow: hidden; }
.need .bar > div { height: 100%; border-radius: 6px; transition: width .3s; }

#minimap-wrap { position: fixed; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#minimap { width: 200px; height: 200px; border-radius: 50%; border: 5px solid #fff; box-shadow: var(--shadow); background: #9fd38a; }
#location-label { background: var(--panel); padding: 4px 12px; border-radius: 12px; font-family: 'Jua'; font-size: 14px; box-shadow: var(--shadow); max-width: 220px; text-align: center; }

#prompt { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 10px 18px; border-radius: 16px; box-shadow: var(--shadow); font-family: 'Jua'; font-size: 17px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
#prompt .key { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 0 7px; margin-right: 6px; }
#prompt .row { display: flex; align-items: center; }
#help-hint { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.35); color: #fff; padding: 6px 14px; border-radius: 12px; font-size: 13px; white-space: nowrap; }

#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 30; }
.toast { background: var(--panel); padding: 8px 16px; border-radius: 14px; box-shadow: var(--shadow); font-family: 'Jua'; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 이름표 & 말풍선 */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-family: 'Jua'; font-size: 13px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); text-align: center; }
.tag small { display: block; font-family: 'Gowun Dodum'; font-size: 11px; opacity: .9; }
.bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; color: #4a3428; padding: 6px 11px; border-radius: 14px; font-size: 13px; max-width: 220px; box-shadow: 0 3px 8px rgba(0,0,0,.2); animation: pop .2s ease-out; text-align: center; }
.bubble::after { content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }

/* 대화창 */
#chat { position: fixed; right: 14px; bottom: 14px; top: 260px; width: min(400px, calc(100vw - 28px)); background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; z-index: 20; }
#chat-head { display: flex; gap: 10px; padding: 12px; align-items: center; border-bottom: 1px solid var(--line); }
#chat-avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; flex-shrink: 0; border: 3px solid #fff; box-shadow: var(--shadow); }
#chat-info { flex: 1; min-width: 0; }
#chat-name { font-family: 'Jua'; font-size: 19px; }
#chat-sub { font-size: 12px; color: var(--ink-soft); }
#chat-affinity { height: 7px; background: var(--line); border-radius: 5px; margin-top: 5px; overflow: hidden; }
#chat-affinity-bar { height: 100%; background: linear-gradient(90deg, #ffb3c1, #ff4f81); width: 30%; transition: width .4s; }
#chat-close { background: none; border: 0; font-size: 20px; color: var(--ink-soft); }
#chat-profile { font-size: 12px; padding: 8px 14px; color: var(--ink-soft); border-bottom: 1px solid var(--line); line-height: 1.55; max-height: 120px; overflow: auto; }
#chat-profile b { color: var(--ink); }
#chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.msg.npc { background: #fff; color: #4a3428; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.msg.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.sys { align-self: center; font-size: 12px; color: var(--ink-soft); background: none; padding: 2px; }
.msg.typing { opacity: .7; }
#chat-foot { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#chat-input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-family: inherit; font-size: 14px; background: #fff; color: #4a3428; }
#chat-send { background: var(--accent); color: #fff; border: 0; border-radius: 14px; padding: 0 14px; font-size: 15px; }
#chat-gift { border: 2px solid var(--line); border-radius: 14px; font-family: inherit; max-width: 84px; background: #fff; color: #4a3428; }

/* 휴대폰 */
#phone, #modal { position: fixed; inset: 0; background: rgba(40, 25, 20, .35); display: grid; place-items: center; z-index: 40; }
#phone-inner, #modal-inner { background: var(--panel); border-radius: 26px; box-shadow: var(--shadow); width: min(860px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
#modal-inner { height: auto; max-height: calc(100vh - 32px); width: min(560px, calc(100vw - 32px)); padding: 20px; overflow: auto; }
#phone-tabs { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#phone-tabs button { border: 0; background: var(--line); color: var(--ink); padding: 8px 14px; border-radius: 12px; font-size: 15px; }
#phone-tabs button.active { background: var(--accent); color: #fff; }
#phone-close { margin-left: auto; }
#phone-body { flex: 1; overflow: auto; padding: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cit { background: rgba(255,255,255,.6); border-radius: 14px; padding: 10px; display: flex; gap: 10px; align-items: center; cursor: pointer; border: 2px solid transparent; }
.cit:hover { border-color: var(--accent); }
.cit .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.cit .nm { font-family: 'Jua'; font-size: 15px; }
.cit .sb { font-size: 12px; color: var(--ink-soft); }
.search { width: 100%; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); font-family: inherit; font-size: 15px; margin-bottom: 10px; background: #fff; color: #4a3428; }
.profile-big { line-height: 1.8; }
.profile-big h3 { font-family: 'Jua'; margin: 0 0 6px; font-size: 22px; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 8px 14px; font-size: 15px; margin: 4px 4px 0 0; }
.btn.ghost { background: var(--line); color: var(--ink); }
.set-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.set-row input[type=text], .set-row input[type=password], .set-row select { padding: 9px 12px; border-radius: 12px; border: 2px solid var(--line); font-family: inherit; font-size: 14px; background: #fff; color: #4a3428; }
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.job { background: rgba(255,255,255,.6); border-radius: 12px; padding: 8px; cursor: pointer; border: 2px solid transparent; font-size: 13px; }
.job:hover { border-color: var(--accent); }
.job b { font-family: 'Jua'; font-size: 15px; display: block; }
#bigmap { width: 100%; max-width: 560px; aspect-ratio: 1; border-radius: 16px; display: block; margin: 0 auto; }

/* 시간 건너뛰기 */
#fade { position: fixed; inset: 0; background: rgba(30, 20, 40, .82); display: grid; place-content: center; gap: 14px; z-index: 50; color: #fff; text-align: center; }
#fade-text { font-family: 'Jua'; font-size: 28px; }
#fade-bar { width: 260px; height: 10px; background: rgba(255,255,255,.2); border-radius: 6px; overflow: hidden; margin: 0 auto; }
#fade-bar > div { height: 100%; width: 0; background: var(--pink); }

/* 로딩 */
#loading { position: fixed; inset: 0; background: #ffe9d6; display: grid; place-content: center; text-align: center; z-index: 60; font-family: 'Jua'; font-size: 20px; color: #4a3428; }
.spinner { animation: wiggle .6s infinite alternate ease-in-out; }
.spinner .cute-roach, .spinner .cute-bear { width: 96px; height: 104px; }
.title-icon .cute-roach, .title-icon .cute-bear { width: 52px; height: 56px; vertical-align: -10px; margin-right: 6px; }
.av .cute-roach, #chat-avatar .cute-roach, .av .cute-bear, #chat-avatar .cute-bear { width: 78%; height: 78%; }
@keyframes wiggle { from { transform: rotate(-12deg) translateX(-8px); } to { transform: rotate(12deg) translateX(8px); } }

/* 시작 화면 */
#start { position: fixed; inset: 0; background: radial-gradient(circle at 30% 20%, #ffe0ec, #ffd8b8 50%, #c9ecff); display: grid; place-items: center; z-index: 70; overflow: auto; padding: 16px; }
#start-card { background: rgba(255, 252, 248, .95); color: #4a3428; border-radius: 30px; box-shadow: 0 20px 50px rgba(120, 60, 40, .25); padding: 26px 30px; width: min(520px, 100%); text-align: center; }
#title { font-family: 'Jua'; font-size: 44px; }
#title small { font-size: 18px; color: #b0806a; display: block; margin-top: -4px; }
.tagline { font-size: 14px; color: #8a6f5f; line-height: 1.6; }
#start-preview { height: 160px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; text-align: left; margin: 10px 0; }
.form label { display: flex; flex-direction: column; font-family: 'Jua'; font-size: 14px; gap: 4px; }
.form input, .form select { padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(74,52,40,.15); font-family: 'Gowun Dodum'; font-size: 15px; background: #fff; color: #4a3428; }
.colors-label { grid-column: 1 / -1; font-family: 'Jua'; font-size: 14px; }
#p-colors { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: pointer; }
.swatch.sel { outline: 3px solid #ff8a65; }
#llm-status { font-size: 13px; margin: 8px 0 12px; padding: 8px; border-radius: 12px; background: #fff3e0; }
#start-btn { background: linear-gradient(135deg, #ff8a65, #ff6f91); color: #fff; border: 0; border-radius: 18px; padding: 14px 26px; font-size: 21px; box-shadow: 0 6px 16px rgba(255, 111, 145, .4); }
#start-btn:hover { transform: translateY(-1px); }

@media (max-width: 700px) {
  #hud { width: 180px; }
  #minimap { width: 130px; height: 130px; }
  #help-hint { display: none; }
  #chat { top: auto; height: 60vh; }
}

/* 멀티플레이 */
.tag.player { color: #e1d4ff; }
.bubble.player { background: #ede4ff; }
.bubble.player::after { border-top-color: #ede4ff; }
#pchat { position: fixed; left: 14px; bottom: 54px; width: min(360px, calc(100vw - 28px)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; z-index: 15; }
#pchat:not(.hidden) { display: flex; }
#pchat-log { max-height: 180px; overflow: hidden; display: flex; flex-direction: column; gap: 3px; }
.pline { background: rgba(30, 20, 40, .55); color: #fff; padding: 4px 10px; border-radius: 10px; font-size: 13px; align-self: flex-start; max-width: 100%; word-break: break-all; animation: pop .2s ease-out; }
.pline.me { background: rgba(255, 111, 145, .7); }
.pline.sys { background: rgba(0, 0, 0, .35); font-size: 12px; opacity: .85; }
#pchat-input { display: none; pointer-events: auto; border: 2px solid var(--accent); border-radius: 12px; padding: 8px 12px; font-family: inherit; font-size: 14px; background: #fff; color: #4a3428; }
#pchat.open #pchat-input { display: block; }
#sleep { position: fixed; inset: 0; background: rgba(20, 15, 45, .78); color: #fff; display: grid; place-content: center; gap: 16px; text-align: center; z-index: 45; font-family: 'Jua'; font-size: 24px; }
#sleep.hidden { display: none; }
#sleep small { font-family: 'Gowun Dodum'; font-size: 15px; opacity: .85; }
#sleep-wake { background: #ffd54f; color: #4a3428; border: 0; border-radius: 14px; padding: 10px 20px; font-size: 18px; margin: 0 auto; }
#start-error { margin: 0 0 10px; padding: 8px; border-radius: 12px; background: #ffe0e0; color: #c62828; font-size: 14px; }

/* 전투 · 인벤토리 */
#charm { font-size: 12px; color: #c2185b; margin-top: 2px; }
#stars { font-size: 20px; color: #ffd600; text-shadow: 0 1px 2px rgba(0,0,0,.5); letter-spacing: 1px; }
.need.hp b { font-family: 'Jua'; }
#hotbar-wrap { position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 12; }
#hotbar-wrap.hidden { display: none; }
#weapon-name { font-family: 'Jua'; font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
#hotbar { display: flex; gap: 4px; }
#hotbar .slot { width: 46px; height: 46px; border-radius: 12px; background: rgba(30, 20, 40, .55); border: 2px solid rgba(255,255,255,.25); position: relative; display: grid; place-items: center; cursor: pointer; }
#hotbar .slot.sel { border-color: #ffd54f; background: rgba(255, 213, 79, .3); transform: translateY(-3px); }
#hotbar .ic { font-size: 24px; }
#hotbar .num { position: absolute; top: 1px; left: 4px; font-size: 10px; color: #fff; opacity: .8; }
#hotbar .cnt { position: absolute; bottom: 1px; right: 4px; font-size: 11px; color: #fff; font-weight: bold; }
#hotbar .gem { position: absolute; top: 1px; right: 4px; font-size: 10px; color: #e040fb; }
#prompt { bottom: 112px; }
#crosshair { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--crosshair, #fff); font-size: 26px; text-shadow: 0 0 3px #000; pointer-events: none; z-index: 11; }
#hurt { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(255, 0, 0, 0); z-index: 9; }
#hurt.on { animation: hurt .5s ease-out; }
@keyframes hurt { from { box-shadow: inset 0 0 140px rgba(255, 0, 0, .75); } to { box-shadow: inset 0 0 140px rgba(255, 0, 0, 0); } }
#death { position: fixed; inset: 0; background: rgba(60, 0, 10, .55); display: grid; place-content: center; text-align: center; color: #fff; font-family: 'Jua'; font-size: 34px; z-index: 44; }
#death.hidden { display: none; }
#death small { font-family: 'Gowun Dodum'; font-size: 16px; }
#course { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: rgba(30, 20, 40, .75); color: #ffd54f; padding: 8px 18px; border-radius: 14px; font-family: 'Jua'; font-size: 18px; z-index: 12; }
#celebrate { position: fixed; top: 30%; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #ffd54f, #ff8a65); color: #4a3428; padding: 18px 30px; border-radius: 24px; text-align: center; font-family: 'Jua'; font-size: 30px; box-shadow: var(--shadow); z-index: 46; animation: pop .3s ease-out; }
#celebrate small { display: block; font-family: 'Gowun Dodum'; font-size: 15px; }
#confirm { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 80; }
#confirm.hidden { display: none; }
#confirm-inner { background: var(--panel); padding: 20px 26px; border-radius: 20px; text-align: center; font-family: 'Jua'; font-size: 18px; box-shadow: var(--shadow); line-height: 1.6; }
#confirm-inner small { font-family: 'Gowun Dodum'; font-size: 13px; color: var(--ink-soft); }
.floatnum { position: absolute; transform: translate(-50%, -100%); font-family: 'Jua'; font-size: 20px; text-shadow: 0 1px 3px #000; animation: floatup .9s ease-out forwards; pointer-events: none; }
@keyframes floatup { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -40px; } }
.hpbar { width: 50px; height: 5px; background: rgba(0,0,0,.4); border-radius: 3px; margin: 2px auto 0; overflow: hidden; }
.hpbar > div { height: 100%; background: #69f0ae; }
.hpbar.enemy > div { background: #ff5252; }
.tag.enemy { color: #ffcdd2; }
#modal-inner.wide { width: min(900px, calc(100vw - 32px)); }
#worldmap { width: min(100%, 62vh); height: auto; aspect-ratio: 1; border-radius: 14px; cursor: grab; display: block; margin: 6px auto; touch-action: none; }
.mh { font-family: 'Jua'; margin: 0 0 8px; font-size: 22px; }
.mh small { font-family: 'Gowun Dodum'; font-size: 13px; color: var(--ink-soft); margin-left: 6px; }
.money-line { font-size: 14px; margin: 4px 0 10px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shop-item { background: rgba(255,255,255,.6); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; }
.shop-item .ic { font-size: 32px; }
.shop-item b { font-family: 'Jua'; font-size: 15px; }
.shop-item small { font-size: 11px; color: var(--ink-soft); min-height: 28px; }
.btn.mini { padding: 5px 10px; font-size: 13px; margin: 0; }
select.mini { padding: 4px; border-radius: 8px; border: 2px solid var(--line); font-family: inherit; font-size: 12px; background: #fff; color: #4a3428; }
.itemlist { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.item { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.55); border-radius: 12px; padding: 8px 10px; }
.item .ic { font-size: 28px; width: 36px; text-align: center; }
.item .info { flex: 1; min-width: 0; }
.item .info b { font-family: 'Jua'; font-size: 15px; display: block; }
.item .info small { font-size: 12px; color: var(--ink-soft); }
.item .acts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge { background: #ffd54f; color: #4a3428; border-radius: 6px; padding: 0 5px; font-size: 11px; }
.eqrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.eq { background: rgba(255,255,255,.55); border-radius: 12px; padding: 6px 8px; font-size: 12px; color: var(--ink-soft); }
.eq b { display: block; font-family: 'Jua'; color: var(--ink); font-size: 13px; }
.skills { font-size: 13px; margin-bottom: 8px; }
.ench { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { background: rgba(255,255,255,.55); border-radius: 10px; padding: 6px 8px; margin-top: 6px; cursor: pointer; border: 2px solid transparent; font-size: 14px; }
.pick.on { border-color: var(--accent); }
.pick small { display: block; font-size: 11px; color: var(--ink-soft); }
.npc-needs { margin-top: 6px; }
@media (max-width: 700px) { #hotbar .slot { width: 32px; height: 32px; } #hotbar .ic { font-size: 18px; } .ench, .eqrow { grid-template-columns: 1fr 1fr; } }
.shop-item, .item, .eq, .pick, .cit { color: #4a3428; }
.shop-item small, .item .info small, .pick small, .eq { color: #7a5f50; }
.eq b { color: #4a3428; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch-big { background: rgba(255,255,255,.6); color: #4a3428; border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 12px; cursor: pointer; border: 2px solid transparent; }
.swatch-big span { display: block; width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 4px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.swatch-big.sel { border-color: var(--accent); }
/* 모달이 열려도 거울 미리보기가 보이도록 반투명 */
#modal:has(#rc-ok) { background: transparent; place-items: center end; padding-right: 20px; }
#modal:has(#rc-ok) #modal-inner { width: min(400px, calc(100vw - 32px)); }
#modal:has(#rc-ok) .swatches { grid-template-columns: repeat(4, 1fr); }

#keys-btn { position: fixed; left: 14px; bottom: 14px; z-index: 13; background: var(--panel); color: var(--ink); border: 0; border-radius: 12px; padding: 7px 12px; font-size: 14px; box-shadow: var(--shadow); }
#keys-btn.hidden { display: none; }
#keys-btn b { background: var(--accent); color: #fff; border-radius: 5px; padding: 0 5px; margin-left: 4px; font-size: 12px; }
#pchat { bottom: 58px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.keygroup { background: rgba(255,255,255,.6); color: #4a3428; border-radius: 14px; padding: 10px 12px; }
.keygroup > b { font-family: 'Jua'; font-size: 16px; display: block; margin-bottom: 6px; }
.keyrow { display: grid; grid-template-columns: 118px 1fr; gap: 8px; align-items: center; font-size: 13px; padding: 3px 0; }
kbd { display: inline-block; background: #fff; color: #4a3428; border: 1px solid #d7ccc8; border-bottom-width: 3px; border-radius: 6px; padding: 1px 7px; font-family: 'Jua'; font-size: 13px; margin-right: 3px; }
.keynote { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
@media (max-width: 700px) { .keys { grid-template-columns: 1fr; } }

/* 무기 획득 배너 & 탄약 */
#loot { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 47; pointer-events: none; --rc: #ffab00; }
#loot.hidden { display: none; }
#loot.show { animation: lootin .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes lootin { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
#loot .lt { font-family: 'Jua'; font-size: 34px; color: #fff; text-shadow: 0 0 12px var(--rc), 0 0 28px var(--rc), 0 2px 4px #000; }
#loot .ls { font-family: 'Jua'; font-size: 20px; color: var(--rc); text-shadow: 0 1px 3px #000; margin-top: 4px; }
#loot .lb { font-size: 15px; color: #fff; text-shadow: 0 1px 3px #000; margin-top: 2px; }
.pline.loot { background: linear-gradient(90deg, rgba(255,171,0,.75), rgba(213,0,249,.6)); font-weight: bold; }
#hotbar .cnt.empty { color: #ff5252; }
#hotbar .tmr { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; }
#hotbar-wrap { bottom: 52px; }

/* ---------- 로비: 로그인 · 캐릭터 선택 · 꾸미기 ---------- */
#start-card { transition: width .2s; }
#start-card.wide { width: min(980px, 100%); }
.view { margin-top: 6px; }
.pw { display: flex; flex-direction: column; gap: 4px; font-family: 'Jua'; font-size: 14px; margin: 10px auto; max-width: 280px; text-align: left; }
.pw input, #dev-name { padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(74,52,40,.15); font-family: 'Gowun Dodum'; font-size: 15px; background: #fff; color: #4a3428; }
#g-btn { display: flex; justify-content: center; min-height: 44px; margin: 14px 0 6px; }
.g-missing { font-size: 13px; color: #8a6f5f; }
#dev-login { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
#dev-login.hidden { display: none; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 10px; text-align: left; }
.who small { color: #8a6f5f; }
.btn.mini { padding: 5px 10px; font-size: 13px; }
#char-list { display: grid; grid-template-columns: 1fr; gap: 10px; max-height: min(56vh, 520px); overflow: auto; padding: 2px; }
.char-card { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 8px 12px 8px 8px; box-shadow: 0 3px 10px rgba(120,60,40,.12); text-align: left; border: 2px solid transparent; }
.char-card:hover { border-color: #ffb199; }
.char-thumb { width: 84px; height: 84px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #fff3f7, #ffe0cc); flex-shrink: 0; }
.char-info { flex: 1; min-width: 0; font-size: 15px; }
.char-info b { font-family: 'Jua'; font-size: 19px; }
.char-info small { color: #8a6f5f; }
.char-meta { font-size: 12.5px; color: #6d5a4e; margin-top: 4px; line-height: 1.5; }
.char-acts { display: flex; flex-direction: column; align-items: flex-end; }
.char-card.new { justify-content: center; cursor: pointer; min-height: 70px; color: #ff6f91; font-family: 'Jua'; font-size: 17px; border: 2px dashed #ffb199; background: rgba(255,255,255,.6); }
.char-card.new .plus { font-size: 34px; }
.creator { display: grid; grid-template-columns: minmax(240px, 1fr) 1.3fr; gap: 14px; text-align: left; }
#create-preview { height: min(52vh, 460px); border-radius: 22px; background: radial-gradient(circle at 50% 35%, #fff, #ffe9f0 60%, #ffd8c2); cursor: grab; overflow: hidden; }
#create-preview canvas { width: 100%; height: 100%; display: block; }
.creator-side { display: flex; flex-direction: column; min-height: 0; max-height: min(52vh, 460px); }
#create-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#create-tabs button { border: 0; background: rgba(74,52,40,.08); color: #4a3428; padding: 7px 12px; border-radius: 12px; font-family: 'Jua'; font-size: 14px; cursor: pointer; }
#create-tabs button.active { background: #ff8a65; color: #fff; }
#create-body { overflow: auto; padding-right: 4px; }
.opt-row { margin-bottom: 12px; }
.opt-label { font-family: 'Jua'; font-size: 14px; margin-bottom: 5px; }
.opt-row input:not([type=range]), .opt-row select { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(74,52,40,.15); font-family: 'Gowun Dodum'; font-size: 15px; background: #fff; color: #4a3428; }
.opt-row input[type=range] { width: 100%; accent-color: #ff8a65; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid rgba(74,52,40,.12); background: #fff; color: #4a3428; border-radius: 12px; padding: 5px 10px; font-family: 'Gowun Dodum'; font-size: 13px; cursor: pointer; }
.chip.sel { border-color: #ff8a65; background: #fff1eb; font-weight: bold; }
.swatch.sw-word { width: auto; padding: 0 8px; border-radius: 12px; display: grid; place-items: center; font-size: 12px; background: #fff; color: #4a3428; height: 28px; }
.hint { font-size: 12px; color: #8a6f5f; }
.create-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; flex-wrap: wrap; }
#create-ok { background: linear-gradient(135deg, #ff8a65, #ff6f91); color: #fff; border: 0; border-radius: 16px; padding: 11px 22px; font-size: 18px; font-family: 'Jua'; box-shadow: 0 6px 16px rgba(255,111,145,.4); cursor: pointer; }
@media (max-width: 720px) {
  .creator { grid-template-columns: 1fr; }
  #create-preview { height: 240px; }
  .creator-side { max-height: none; }
}

.tabs-row { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 8px; }
#start-card .btn.ghost { background: rgba(74,52,40,.1); color: #4a3428; }
#start-card .btn { cursor: pointer; }
.style-body { max-height: 46vh; overflow: auto; padding-right: 4px; }
#modal-inner .chip { background: rgba(255,255,255,.75); }
#modal:has(#st-ok) { background: transparent; place-items: center end; padding-right: 20px; }
#modal:has(#st-ok) #modal-inner { width: min(430px, calc(100vw - 32px)); }

/* 로그인 화면: 뒤에 실제 도시가 보인다 */
#start.live { background: linear-gradient(180deg, rgba(255,224,236,.18), rgba(201,236,255,.12)); }
#start.live #start-card { background: rgba(255, 252, 248, .9); backdrop-filter: blur(6px); }
#tour-cap { position: fixed; left: 18px; bottom: 18px; background: rgba(30,20,30,.55); color: #fff; padding: 10px 14px; border-radius: 14px; font-family: 'Jua'; font-size: 16px; max-width: calc(100vw - 36px); }
#tour-cap b { background: #ff1744; color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; margin-right: 6px; vertical-align: 2px; }
#tour-cap small { display: block; font-family: 'Gowun Dodum'; font-size: 12px; opacity: .85; margin-top: 3px; }
#start:not(.live) #tour-cap { display: none; }
#tour-fade { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 65; }
#tour-fade.go { animation: tourfade 1s ease-out; }
@keyframes tourfade { 0% { opacity: .85; } 100% { opacity: 0; } }

/* ---------- 레벨 · 퀘스트 · 상단 버튼 ---------- */
#lv-row { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
#lv { font-family: 'Jua'; font-size: 15px; color: #ffb300; }
#xp-bar { flex: 1; height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
#xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd54f, #ff8a65); transition: width .4s; }
#xp-txt { font-size: 10px; color: var(--ink-soft); white-space: nowrap; }
#quest-card { font-size: 12px; line-height: 1.55; pointer-events: auto; cursor: pointer; }
#quest-card b { font-family: 'Jua'; font-size: 13px; }
#quest-card .q.done { opacity: .5; text-decoration: line-through; }
#quest-card .qp { float: right; color: var(--ink-soft); }
#topbar { position: fixed; top: 14px; right: 236px; display: flex; gap: 6px; z-index: 14; }
#topbar.hidden { display: none; }
#topbar button { background: var(--panel); color: var(--ink); border: 0; border-radius: 12px; padding: 8px 12px; font-family: 'Jua'; font-size: 14px; box-shadow: var(--shadow); cursor: pointer; }
#topbar #tb-exit { background: #ff8a65; color: #fff; }
@media (max-width: 900px) { #topbar { top: auto; bottom: 120px; right: 14px; flex-direction: column; } }
#hotbar-row { display: flex; align-items: center; gap: 8px; }
#bag-btn { width: 54px; height: 54px; border-radius: 14px; border: 2px solid rgba(255,255,255,.4); background: linear-gradient(135deg, #8d6e63, #5d4037); font-size: 26px; position: relative; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
#bag-btn small { position: absolute; bottom: 2px; right: 4px; font-size: 11px; color: #fff; background: var(--accent); border-radius: 5px; padding: 0 4px; font-family: 'Jua'; }
#flip { position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%); background: rgba(30,20,40,.8); color: #fff; padding: 16px 26px; border-radius: 20px; text-align: center; z-index: 45; font-family: 'Jua'; animation: wobble .5s infinite alternate; }
#flip.hidden { display: none; }
#flip .fl-t { font-size: 26px; }
#flip kbd { display: inline-block; background: #fff; color: #4a3428; border-radius: 6px; padding: 2px 10px; margin: 0 3px; font-size: 18px; }
#flip .fl-bar { margin-top: 8px; height: 10px; border-radius: 6px; background: rgba(255,255,255,.2); overflow: hidden; }
#flip-fill { height: 100%; width: 0; background: #ffd54f; transition: width .1s; }
@keyframes wobble { from { transform: translate(-50%, -50%) rotate(-3deg); } to { transform: translate(-50%, -50%) rotate(3deg); } }
#scope { position: fixed; inset: 0; pointer-events: none; z-index: 10; background: radial-gradient(circle at center, transparent 0, transparent 30vmin, rgba(0,0,0,.92) 30.5vmin); }
#scope::before, #scope::after { content: ''; position: absolute; background: rgba(0,0,0,.85); }
#scope::before { left: 50%; top: calc(50% - 30vmin); width: 2px; height: 60vmin; transform: translateX(-1px); }
#scope::after { top: 50%; left: calc(50% - 30vmin); height: 2px; width: 60vmin; transform: translateY(-1px); }
#scope.hidden { display: none; }
#draw-meter { position: fixed; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); width: 70px; height: 7px; border-radius: 5px; background: rgba(0,0,0,.4); overflow: hidden; z-index: 11; pointer-events: none; }
#draw-meter.hidden { display: none; }
#draw-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffcc80, #ff5722); }
#xp-pops { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); pointer-events: none; z-index: 20; display: flex; flex-direction: column; align-items: center; }
.xp-pop { font-family: 'Jua'; color: #ffd54f; font-size: 17px; text-shadow: 0 1px 3px #000; animation: xpup 1.6s ease-out forwards; }
@keyframes xpup { 0% { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px); } }
#score-pop { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none; z-index: 44; font-family: 'Jua'; font-size: 44px; color: #fff; text-shadow: 0 0 10px #ff1744, 0 2px 4px #000; opacity: 0; }
#score-pop.go { animation: scorepop .9s ease-out; }
@keyframes scorepop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(1); } }
#range-hud { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: rgba(30,20,40,.75); color: #fff; padding: 8px 18px; border-radius: 14px; font-family: 'Jua'; font-size: 18px; z-index: 30; }
#range-hud.hidden { display: none; }
#shutter { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 80; }
#shutter.go { animation: tourfade .35s ease-out; }
.mana-row .bar div { background: linear-gradient(90deg, #5c6bc0, #42a5f5) !important; }
/* ---------- 전체 채팅 개선 ---------- */
#pchat { width: min(420px, calc(100vw - 28px)); }
#pchat-head { display: none; pointer-events: none; font-family: 'Jua'; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; }
#pchat-head small { opacity: .8; font-family: 'Gowun Dodum'; margin-left: 6px; }
#pchat.open #pchat-head { display: block; }
#pchat-log { max-height: 220px; gap: 4px; }
#pchat.open #pchat-log { background: rgba(20, 12, 30, .55); border-radius: 14px; padding: 8px; overflow-y: auto; pointer-events: auto; max-height: 280px; }
.pline { background: rgba(20, 12, 30, .72); font-size: 14px; padding: 5px 11px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.25); line-height: 1.4; }
.pline b { color: #ffd180; margin-right: 4px; }
.pline.me b { color: #fff; }
.pline.old { opacity: .35; transition: opacity 1s; }
#pchat.open .pline.old { opacity: 1; }
#pchat-input { font-size: 15px; padding: 10px 14px; border-width: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }

/* ---------- 이름표: 레벨 · 훈장 ---------- */
.tag .lvb { display: inline-block; background: rgba(255,179,0,.9); color: #3e2723; border-radius: 6px; padding: 0 5px; font-size: 11px; margin-right: 4px; text-shadow: none; vertical-align: 1px; }
.tag .bdgs { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; max-width: 260px; margin: 2px auto 0; }
.tag .bdg { background: rgba(126,87,194,.85); color: #fff; border-radius: 8px; padding: 1px 6px; font-size: 10.5px; font-family: 'Gowun Dodum'; text-shadow: none; }
.tag.mine { opacity: .85; }
/* ---------- 가방 ---------- */
.inv-wrap { display: grid; grid-template-columns: 1fr 230px; gap: 10px; min-height: 260px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 46vh; overflow: auto; align-content: start; padding: 2px; }
.ic-card { position: relative; background: rgba(255,255,255,.7); border-radius: 14px; padding: 8px 4px 6px; text-align: center; cursor: pointer; border: 2px solid transparent; color: #4a3428; }
.ic-card:hover { border-color: #ffb199; }
.ic-card.sel { border-color: var(--accent); background: #fff3ee; }
.ic-card .e { font-size: 28px; display: block; }
.ic-card small { font-size: 10.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-card .n { position: absolute; top: 3px; right: 5px; font-size: 11px; font-weight: bold; }
.ic-card .eqb { position: absolute; top: 3px; left: 4px; font-size: 9px; background: #7ec8a9; color: #fff; border-radius: 5px; padding: 0 3px; }
.ic-card .hb { position: absolute; bottom: 20px; right: 5px; font-size: 10px; background: #ffd54f; border-radius: 5px; padding: 0 4px; }
.inv-detail { background: rgba(255,255,255,.75); border-radius: 16px; padding: 12px; text-align: center; color: #4a3428; display: flex; flex-direction: column; gap: 6px; }
.inv-detail.empty { justify-content: center; color: #8a6f5f; }
.inv-detail .big { font-size: 54px; }
.inv-detail small { font-size: 12px; color: #6d5a4e; }
.inv-detail .acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.hbpick { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; font-size: 12px; align-items: center; }
.hbb { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(0,0,0,.15); background: #fff; cursor: pointer; font-size: 11px; }
.hbb.on { background: #ffd54f; }
.eq { display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
.eq .eqi { font-size: 22px; }
.eq .eqn { font-size: 11px; }
@media (max-width: 720px) { .inv-wrap { grid-template-columns: 1fr; } }
/* ---------- 휴대폰 앱 ---------- */
.xpbig { height: 12px; border-radius: 8px; background: rgba(0,0,0,.1); overflow: hidden; margin: 4px 0 8px; }
.xpbig div { height: 100%; background: linear-gradient(90deg, #ffd54f, #ff8a65); }
.qrow { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed rgba(0,0,0,.1); }
.qrow.done { opacity: .55; }
.qrow .qr { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.gallery-head, .insta-head { font-family: 'Jua'; font-size: 17px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gallery-head small, .insta-head small { font-family: 'Gowun Dodum'; font-size: 12px; color: var(--ink-soft); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gallery .ph { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 16/10; background: #222; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .tagp { position: absolute; bottom: 4px; right: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 8px; padding: 1px 6px; }
.photo-view { text-align: center; }
.photo-view img { max-width: 100%; max-height: 52vh; border-radius: 14px; }
.pv-meta { font-size: 12px; color: var(--ink-soft); margin: 4px 0 8px; }
.feed { display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; }
.post { background: rgba(255,255,255,.85); border-radius: 16px; overflow: hidden; color: #4a3428; }
.post img { width: 100%; display: block; }
.ph-h { padding: 8px 10px; display: flex; align-items: center; gap: 6px; }
.ph-h .av { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); display: grid; place-items: center; }
.ph-h small { color: #8a6f5f; }
.ph-a { padding: 6px 10px 0; }
.like { border: 0; background: none; font-size: 18px; cursor: pointer; }
.like span { font-size: 14px; }
.ph-c { padding: 4px 10px 10px; font-size: 14px; }
.addrow { display: flex; gap: 6px; margin-top: 8px; }
.addrow input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(0,0,0,.12); font-family: inherit; font-size: 14px; background: #fff; color: #4a3428; }
.mynum { font-size: 15px; background: #ffd54f; color: #4a3428; border-radius: 8px; padding: 2px 8px; margin-left: 6px; }
.smslog { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; padding: 8px; background: rgba(255,255,255,.4); border-radius: 14px; }
.sm { align-self: flex-start; background: #fff; color: #4a3428; padding: 7px 12px; border-radius: 14px 14px 14px 4px; max-width: 75%; font-size: 14px; }
.sm.me { align-self: flex-end; background: #ffd54f; border-radius: 14px 14px 4px 14px; }
.sm small { display: block; font-size: 10px; color: #8a6f5f; text-align: right; }
.thread { cursor: pointer; }
.fbtext { font-size: 14px; white-space: pre-wrap; margin-top: 4px; }
.fbdone { opacity: .55; }
#phone-body textarea { width: 100%; box-sizing: border-box; border-radius: 12px; border: 2px solid rgba(0,0,0,.12); padding: 10px; font-family: inherit; font-size: 14px; background: #fff; color: #4a3428; margin-bottom: 8px; }
#phone-tabs { max-height: 92px; overflow-y: auto; }
#phone-tabs button { padding: 7px 11px; font-size: 14px; }
kbd { background: #fff; color: #4a3428; border-radius: 5px; padding: 0 6px; border: 1px solid rgba(0,0,0,.2); font-family: 'Jua'; }
.carcols { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.cc { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.cc.sel { outline: 2px solid var(--accent); }

#jail-hud { position: fixed; top: 130px; left: 50%; transform: translateX(-50%); background: rgba(38,50,56,.92); color: #fff; padding: 10px 22px; border-radius: 16px; font-family: 'Jua'; font-size: 22px; z-index: 31; box-shadow: 0 6px 18px rgba(0,0,0,.35); border: 3px solid #90a4ae; }
#jail-hud b { color: #ffd54f; font-size: 26px; }

#tv-remote { position: fixed; bottom: 130px; left: 50%; transform: translateX(-50%); background: rgba(33,33,33,.9); color: #fff; padding: 12px 18px; border-radius: 20px; z-index: 30; text-align: center; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
#tv-remote .tvr-ch { font-family: 'Jua'; font-size: 20px; margin-bottom: 8px; }
#tv-remote .tvr-btns { display: flex; gap: 6px; justify-content: center; margin-bottom: 4px; }
#tv-remote button { background: #424242; color: #fff; border: 0; border-radius: 12px; padding: 8px 14px; font-family: 'Jua'; font-size: 15px; cursor: pointer; }
#tv-remote button:hover { background: #ff8a65; }
#tv-remote small { opacity: .7; font-size: 11px; }

#clock-card { pointer-events: auto; }
.lvb2 { background: #ffb300; color: #3e2723; border-radius: 6px; padding: 0 5px; font-size: 11px; }
.bdgline { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.bdg2 { background: rgba(126,87,194,.85); color: #fff; border-radius: 8px; padding: 1px 6px; font-size: 11px; }
.badge-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin: 8px 0; }
.bp { background: rgba(255,255,255,.6); color: #4a3428; border-radius: 12px; padding: 8px 10px; cursor: pointer; border: 2px solid transparent; font-size: 14px; }
.bp.on { border-color: #7e57c2; background: #ede7f6; }

/* ---------- 아이폰 (GTA5처럼 오른쪽 아래) ---------- */
#phone { position: fixed; inset: auto 22px 18px auto; background: none; display: block; z-index: 42; }
#phone.hidden { display: none; }
#phone:not(.hidden) #iphone { animation: phoneup .28s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes phoneup { from { transform: translateY(110%) rotate(4deg); } to { transform: none; } }
#iphone { position: relative; width: 340px; height: min(700px, calc(100vh - 36px)); background: #111; border-radius: 52px; padding: 12px; box-sizing: border-box; box-shadow: 0 0 0 2px #444, 0 0 0 5px #222, 0 24px 60px rgba(0,0,0,.55); display: flex; flex-direction: column; }
#iphone .island { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 110px; height: 30px; background: #000; border-radius: 20px; z-index: 3; }
.ph-status { position: absolute; top: 22px; left: 36px; right: 34px; display: flex; justify-content: space-between; color: #fff; font: 600 14px -apple-system, 'Apple SD Gothic Neo', sans-serif; z-index: 2; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
#phone-screen { flex: 1; border-radius: 42px; overflow: hidden; position: relative; background: linear-gradient(160deg, #ff9a8b 0%, #ff6a88 35%, #8e7dff 70%, #4facfe 100%); }
#phone-home { position: absolute; inset: 0; padding: 64px 16px 18px; display: flex; flex-direction: column; color: #fff; }
#phone-home.hidden, #phone-app.hidden { display: none; }
#ph-clock { text-align: center; margin-bottom: 18px; text-shadow: 0 2px 8px rgba(0,0,0,.25); }
#ph-clock b { display: block; font: 300 54px -apple-system, sans-serif; letter-spacing: -1px; }
#ph-clock small { font-size: 13px; opacity: .9; }
#ph-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; align-content: start; flex: 1; overflow-y: auto; }
#ph-dock { display: flex; justify-content: space-around; background: rgba(255,255,255,.28); backdrop-filter: blur(14px); border-radius: 28px; padding: 10px 6px; margin-top: 8px; }
#ph-dock .an { display: none; }
.app { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: #fff; }
.app .ai { position: relative; width: 56px; height: 56px; border-radius: 15px; display: grid; place-items: center; font-size: 28px; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.app .ai i { position: absolute; top: -5px; right: -5px; background: #ff3b30; color: #fff; font: 700 11px sans-serif; border-radius: 10px; min-width: 18px; height: 18px; display: grid; place-items: center; font-style: normal; }
.app .an { font: 500 11px -apple-system, 'Apple SD Gothic Neo', sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.app:active .ai { transform: scale(.92); }
#phone-app { position: absolute; inset: 0; background: #f2f2f7; color: #1c1c1e; display: flex; flex-direction: column; padding-top: 56px; }
.app-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 8px; border-bottom: 1px solid rgba(0,0,0,.08); background: rgba(242,242,247,.95); }
.app-bar b { font: 600 17px -apple-system, 'Apple SD Gothic Neo', sans-serif; }
.app-bar button { background: none; border: 0; color: #007aff; font-size: 16px; cursor: pointer; padding: 4px; }
#phone-body { flex: 1; overflow-y: auto; padding: 12px; font-size: 14px; }
#phone-body .profile-big { background: #fff; border-radius: 14px; padding: 12px; color: #1c1c1e; box-shadow: none; }
#phone-body .profile-big h3 { margin: 0 0 6px; font-size: 17px; }
#phone-body .item { background: #fff; color: #1c1c1e; border-radius: 12px; }
#phone-body .itemlist { max-height: none; }
#phone-body .btn { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
#phone-body .gallery { grid-template-columns: repeat(3, 1fr); gap: 3px; }
#phone-body .gallery .ph { border-radius: 4px; aspect-ratio: 1; }
#phone-body .feed { max-width: none; }
#phone-body canvas { width: 100%; height: auto; border-radius: 12px; }
#phone-body .addrow input { min-width: 0; }
#phone-body .smslog { max-height: 360px; background: #fff; }
#phone-body .sm { background: #e9e9eb; color: #000; }
#phone-body .sm.me { background: #007aff; color: #fff; }
#phone-body .sm.me small { color: rgba(255,255,255,.8); }
#homebar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 120px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.85); cursor: pointer; z-index: 4; }
#phone-app ~ #homebar, #phone-app:not(.hidden) + #homebar { background: #1c1c1e; }
@media (max-width: 720px) { #phone { inset: auto 8px 8px auto; } #iphone { width: min(340px, calc(100vw - 16px)); } }
/* 튄더 */
.td-card { position: relative; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.15); touch-action: none; user-select: none; transition: transform .25s; }
.td-card .td-img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: radial-gradient(circle at 50% 40%, #fff3f7, #ffd1dc); }
.td-card .td-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; }
.td-card .td-info b { font-size: 22px; }
.td-card .td-info small { display: block; opacity: .9; }
.td-card .stamp { position: absolute; top: 24px; font: 800 30px sans-serif; padding: 2px 10px; border: 4px solid; border-radius: 10px; opacity: 0; transform: rotate(-15deg); }
.td-card .stamp.like { left: 18px; color: #4cd964; border-color: #4cd964; }
.td-card .stamp.nope { right: 18px; color: #ff3b30; border-color: #ff3b30; transform: rotate(15deg); }
.td-btns { display: flex; justify-content: center; gap: 22px; margin: 12px 0; }
.td-btns button { width: 60px; height: 60px; border-radius: 50%; border: 0; background: #fff; font-size: 28px; box-shadow: 0 4px 12px rgba(0,0,0,.15); cursor: pointer; }
.td-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.td-tabs button { flex: 1; border: 0; border-radius: 10px; padding: 8px; background: #e5e5ea; cursor: pointer; font-weight: 600; }
.td-tabs button.on { background: linear-gradient(135deg, #ff6a3d, #ff2d6f); color: #fff; }
.td-match { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 14px; padding: 8px; margin-bottom: 6px; cursor: pointer; }
.td-match img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #ffe0e8; }
.td-match .unread { background: #ff2d6f; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: auto; }
.td-contact { background: #fff7e6; border: 1px solid #ffd180; border-radius: 12px; padding: 8px; color: #4a3428; }
#phone-body .gallery .ph.on { outline: 3px solid #ff2d6f; }

/* 접속 중인 유저 칩 (상단, flex-wrap) */
#online-bar { position: fixed; top: 62px; left: 258px; right: 236px; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; z-index: 13; pointer-events: none; }
#online-bar.hidden { display: none; }
#online-bar .oc { pointer-events: auto; background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap; cursor: pointer; }
#online-bar .oc b { color: #7e57c2; margin-right: 4px; font-size: 11px; }
#online-bar .oc i { color: #e53935; font-style: normal; }
#online-bar .oc.me { background: #fff3c4; color: #4e342e; cursor: default; }
#online-bar .oc.cnt { background: #5c6bc0; color: #fff; cursor: default; }
@media (max-width: 900px) { #online-bar { top: 14px; left: 14px; right: 150px; } }

/* 동물 포획 타이밍 막대 */
#cap-meter { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); width: min(420px, 90vw); background: rgba(38,50,56,.92); color: #fff; border-radius: 16px; padding: 10px 16px 12px; z-index: 31; font-family: 'Jua'; text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
#cap-meter .cm-t { font-size: 18px; margin-bottom: 8px; }
#cap-meter .cm-bar { position: relative; height: 22px; background: #546e7a; border-radius: 11px; overflow: hidden; }
#cap-meter .cm-zone { position: absolute; top: 0; bottom: 0; background: #66bb6a; box-shadow: 0 0 12px #a5d6a7 inset; }
#cap-meter .cm-needle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: #ffd54f; border-radius: 3px; box-shadow: 0 0 8px #ffd54f; }
#cap-meter .cm-needle.in { background: #ffffff; box-shadow: 0 0 12px #fff; }
#cap-meter .cm-s { font-size: 13px; opacity: .85; margin-top: 6px; }

#safe-badge { position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); background: rgba(27,94,32,.85); color: #fff; padding: 5px 14px; border-radius: 999px; font-family: 'Jua'; font-size: 14px; z-index: 12; pointer-events: none; box-shadow: 0 0 14px rgba(105,240,174,.6); }

.guest-btn { display: block; margin: 12px auto 0; padding: 10px 18px; font-size: 16px; }
.guest-btn small { display: block; font-size: 11px; opacity: .75; margin-top: 2px; }

/* 젤리 모드(기본)는 곰돌이 아이콘, 바퀴 모드는 바퀴벌레 아이콘 */
body:not(.bug-mode) .cute-roach { display: none !important; }
body.bug-mode .cute-bear { display: none !important; }

#map-hint { pointer-events: auto; cursor: pointer; background: var(--panel); color: var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; box-shadow: var(--shadow); }
#map-hint kbd { font-size: 11px; }

/* 전체 채팅: 익명 */
#pchat-anon { pointer-events: auto; margin-left: 8px; border: 0; border-radius: 10px; padding: 2px 8px; font-family: inherit; font-size: 12px; background: rgba(255,255,255,.25); color: #fff; cursor: pointer; }
#pchat.anon #pchat-anon { background: #37474f; }
#pchat.anon #pchat-input { border-color: #37474f; background: #eceff1; }
.pline.anon { background: rgba(55, 71, 79, .8); }
.pline.anon b { color: #b0bec5; }

/* 인스타: 팔로우 · 댓글 · 프로필 */
.ig-tabs button { padding: 7px 4px; font-size: 13px; }
.ig-tabs button.on { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.ig-name, .ig-c b, .ig-link { cursor: pointer; }
.ig-follow { margin-left: auto; border: 0; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; background: #0095f6; color: #fff; cursor: pointer; }
.ig-follow.on { background: #e5e5ea; color: #262626; }
.ph-a .like + .like { margin-left: 4px; }
.ig-cmts { padding: 0 10px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.ig-c { word-break: break-all; }
.ig-c small { color: #8a6f5f; font-size: 11px; }
.ig-x { border: 0; background: none; color: #8a6f5f; cursor: pointer; font-size: 11px; padding: 0 2px; }
.ig-more { border: 0; background: none; color: #8a6f5f; cursor: pointer; padding: 0; text-align: left; font-size: 13px; }
.ig-cadd { padding: 0 10px 10px; }
.ig-cadd input { padding: 6px 10px; font-size: 13px; }
.ig-ph { display: flex; align-items: center; gap: 12px; }
.ig-big { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.ig-stats { display: flex; justify-content: space-around; text-align: center; margin: 12px 0 4px; }
.ig-stats b { display: block; font-size: 17px; }
.ig-stats small { color: #8a6f5f; }
.ig-acts { display: flex; gap: 6px; margin-top: 8px; }
.ig-acts .ig-follow { margin-left: 0; flex: 1; padding: 7px; }
.ig-acts .btn { flex: 1; }

/* 설정: 조준점 색 */
.xh-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xh-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.xh-sw.on { outline: 3px solid var(--accent); outline-offset: 1px; }
.xh-row input[type=color] { width: 34px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.xh-prev { width: 44px; height: 44px; border-radius: 10px; background: #6d8a5a; display: grid; place-items: center; font-size: 26px; text-shadow: 0 0 3px #000; margin-left: auto; }

/* 스코프 배율 표시 */
#scope-zoom { position: absolute; left: 50%; top: calc(50% + 32vmin); transform: translateX(-50%); color: #fff; font-family: 'Jua'; font-size: 16px; text-shadow: 0 1px 3px #000; background: rgba(0,0,0,.45); padding: 3px 12px; border-radius: 10px; }

/* 이모트 휠 */
#emote-wheel { position: fixed; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; border-radius: 50%; background: radial-gradient(circle, rgba(30,20,40,.25) 0 64px, rgba(30,20,40,.72) 65px 178px, transparent 179px); z-index: 30; pointer-events: none; }
#emote-wheel.hidden { display: none; }
.ew-item { position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; display: grid; place-items: center; align-content: center; color: #fff; font-family: 'Jua'; font-size: 12px; text-align: center; background: rgba(255,255,255,.08); transition: transform .08s, background .08s; }
.ew-item span { font-size: 30px; line-height: 1; }
.ew-item i { font-style: normal; font-size: 13px; margin-top: 2px; }
.ew-item.on { background: linear-gradient(135deg, #ff6f91, #ffb347); transform: scale(1.18); box-shadow: 0 0 18px rgba(255,111,145,.8); }
.ew-item .music { position: absolute; top: 4px; right: 6px; font-size: 12px; }
#ew-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: #fff; font-family: 'Jua'; width: 120px; }
#ew-center b { display: block; font-size: 16px; }
#ew-center small { font-family: 'Gowun Dodum'; font-size: 11px; opacity: .8; }
#ew-cursor { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #000; }
/* 이모트 노래: 유튜브 공식 플레이어 (보이게, 200px 이상) */
#emote-song { position: fixed; right: 14px; bottom: 96px; z-index: 16; background: #111; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
#emote-song.hidden { display: none; }
#es-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; color: #fff; font-family: 'Jua'; font-size: 13px; }
#es-head button { border: 0; background: rgba(255,255,255,.15); color: #fff; border-radius: 8px; cursor: pointer; padding: 1px 7px; }
#es-box, #es-box iframe { width: 356px; height: 200px; display: block; border: 0; }
#emote-song.tall #es-box, #emote-song.tall #es-box iframe { width: 200px; height: 356px; } /* 쇼츠는 세로로 */
#emote-song.tall { width: 200px; }
#emote-song.tall #es-title { font-size: 11px; }
@media (max-width: 700px) { #emote-song { right: 8px; bottom: 140px; } }

/* 상점 목록 */
.sd-group h4 { margin: 12px 0 6px; font-family: 'Jua'; font-size: 15px; }
.sd-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
