/* 미금역 마을 — 시제품의 초록·크림 톤 그대로. 게임 화면이 주인공, 나머지는 가장자리에 작게. */
:root {
  --bg: #faf8f1; --surface: #fffdf7; --ink: #0c2a22; --muted: #3a4843; --line: #c6d7ca; --chip: #eef3ec;
  --green: #26775f; --green-ink: #fff; --clay: #de9167; --red: #c0392b; --amber: #b7791f; --blue: #2f6fb3;
  --hud: rgba(255,253,247,.97); --hud-ink: #0c2a22; --hud-line: rgba(12,42,34,.28);
  --display: "Jua", "Noto Sans KR", system-ui, sans-serif;
  --body: "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f1412; --surface: #000; --ink: #e8f0ea; --muted: #a7b8af; --line: #2e3d36; --chip: #18211d;
    --green: #5cc29f; --green-ink: #0f1714; --clay: #e8a27f; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0f1412; --surface: #000; --ink: #e8f0ea; --muted: #a7b8af; --line: #2e3d36; --chip: #18211d; --green: #5cc29f; --green-ink: #0f1714; --clay: #e8a27f; color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--clay); outline-offset: 2px; }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; }
kbd { font: 600 12px var(--body); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--ink); }

.stage { position: fixed; inset: 0; background: #cfe3dc; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; }
.stage canvas.gl { display: block; width: 100%; height: 100%; }
.hud { position: absolute; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; z-index: 5; }
.hud.tl { left: max(12px, env(safe-area-inset-left)); top: 12px; max-width: 46%; }
.hud.tr { right: max(12px, env(safe-area-inset-right)); top: 12px; justify-content: flex-end; max-width: 54%; }
.hud.bl { left: max(12px, env(safe-area-inset-left)); bottom: 10px; flex-direction: column; align-items: flex-start; gap: 6px; width: min(380px, 40vw); }
.hud.bc { left: 50%; transform: translateX(-50%); bottom: 78px; justify-content: center; width: max-content; max-width: calc(100% - 24px); }
.hud.br { right: max(12px, env(safe-area-inset-right)); bottom: 12px; }
.pill { font: 700 14px var(--body); background: var(--hud); color: var(--hud-ink); border-radius: 999px; padding: 5px 12px; border: 1px solid var(--hud-line); white-space: nowrap; }
.conn[data-state="online"] { color: #1d6b4f; }
.conn[data-state="online"]::before { content: "● "; color: #2fb67c; }
.conn[data-state="reconnecting"], .conn[data-state="connecting"] { color: var(--amber); }
.conn[data-state="reconnecting"]::before, .conn[data-state="connecting"]::before { content: "● "; color: #e0a526; }
.conn[data-state="offline"], .conn[data-state="auth"] { color: var(--red); }
.sig[data-s="walk"] { background: #e3f7ea; color: #13663b; border-color: #8fd3a8; }
.sig[data-s="stop"] { background: #fdeaea; color: #9b2222; border-color: #eba3a3; }
.hud button, .seg button, .touchBtns button { font: 700 14px var(--body); border-radius: 10px; border: 1px solid var(--hud-line); background: var(--hud); color: var(--hud-ink); padding: 6px 11px; min-height: 36px; }
.hud button:hover, .touchBtns button:hover { background: #fff; border-color: rgba(23,62,53,.4); }
.hud button.icon { min-width: 36px; padding: 6px 8px; font-size: 16px; }
.hud button[aria-pressed="true"], .touchBtns button[aria-pressed="true"] { background: #dff3e8; border-color: var(--green); color: #14563f; }
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--hud-line); }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--hud-line); }
.seg button:last-child { border-right: 0; }

/* 행동 버튼: 그 자리의 핵심이라 크게 */
.act { font: 700 16px var(--body) !important; background: #26775f !important; color: #fff !important; border-color: #26775f !important; padding: 10px 20px !important; border-radius: 14px !important; box-shadow: 0 6px 18px rgba(23,62,53,.28); min-height: 46px !important; }
.act.alt { background: var(--hud) !important; color: var(--hud-ink) !important; border-color: var(--hud-line) !important; }
.act.alt:hover { background: #fff !important; }
.act[disabled] { opacity: .75; cursor: default; }
.act kbd { margin-left: 6px; background: rgba(255,255,255,.2); color: inherit; border-color: rgba(255,255,255,.5); }
.act.alt kbd { background: transparent; color: var(--muted); border-color: var(--hud-line); }

.toast { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); background: rgba(10,36,29,.97); color: #ffffff; border-radius: 12px; padding: 8px 16px; font: 700 15px var(--body); max-width: calc(100% - 32px); text-align: center; z-index: 8; animation: pop .25s ease-out; }
.toast[data-kind="err"] { background: rgba(150,40,40,.95); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.notices { position: absolute; left: 50%; transform: translateX(-50%); top: 100px; display: grid; gap: 8px; z-index: 9; width: min(440px, calc(100% - 24px)); }
.notice { font-weight: 600; background: var(--hud); color: var(--hud-ink); border: 2px solid #e9b65a; border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: pop2 .3s ease-out; }
@keyframes pop2 { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notice .msg { flex: 1; font-weight: 500; }
.notice button { border-radius: 10px; border: 1px solid var(--hud-line); background: #fff; color: var(--hud-ink); padding: 7px 12px; min-height: 38px; }
.notice button.go { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.notice .x { border: 0; background: transparent; font-size: 16px; min-height: 0; padding: 4px; }
.musicChip { position: absolute; right: 12px; top: 58px; z-index: 6; background: var(--hud); color: var(--hud-ink); border: 1px solid var(--hud-line); border-radius: 999px; padding: 3px 4px 3px 12px; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.musicChip button { border: 1px solid var(--hud-line); background: #fff; color: var(--hud-ink); border-radius: 999px; padding: 3px 10px; }

.chatlog { display: grid; gap: 3px; max-height: 30vh; overflow: hidden; align-content: end; width: 100%; pointer-events: none; }
.chatlog .ln { background: rgba(10,36,29,.9); color: #fff; border-radius: 10px; padding: 3px 10px; font-size: 14px; font-weight: 500; width: fit-content; max-width: 100%; overflow-wrap: anywhere; transition: opacity .6s; }
.chatlog .ln b { color: #ffe39a; font-weight: 700; margin-right: 6px; }
.chatlog .ln.me b { color: #b8f3d6; }
.chatlog .ln.sys { background: rgba(60,60,60,.7); }
.chatlog .ln.old { opacity: .35; }
.chat { display: flex; gap: 6px; width: 100%; }
.chat input { flex: 1; font-size: 16px; border-radius: 10px; border: 1px solid var(--hud-line); padding: 7px 10px; background: rgba(255,253,247,.97); color: #173e35; min-width: 0; }
.chat .send { font: 600 14px var(--body); border-radius: 10px; border: 1px solid var(--green); background: var(--green); color: #fff; padding: 0 12px; min-height: 38px; }
.osm { font-size: 11px; color: #26332e; background: rgba(255,253,247,.9); padding: 1px 8px; border-radius: 6px; }

/* 패널 (닫기는 오른쪽 위 ✕ 하나) */
.panel { position: absolute; z-index: 10; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 40px rgba(0,0,0,.25); padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel h2 { font-size: 20px; }
.panel .x { border: 0; background: transparent; color: var(--muted); font-size: 18px; width: 36px; height: 36px; border-radius: 10px; }
.panel .x:hover { background: var(--chip); color: var(--ink); }
.panel.side { right: 12px; top: 60px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 150px); overflow: auto; }
.panel.card { left: 50%; top: 50%; transform: translate(-50%, -60%); width: min(340px, calc(100% - 24px)); }
.panel.help { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 24px)); }
.panel .sub { color: var(--muted); margin: 0; font-size: 14px; }
.panel .work { margin: 0; background: var(--chip); border-radius: 10px; padding: 6px 10px; }
.panel .work:empty { display: none; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.panel button, .login button { border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); padding: 8px 12px; min-height: 40px; font-weight: 500; }
.panel button:hover, .login button:hover { border-color: var(--green); }
.panel .x, .panel .x:hover { border: 0; }
button.primary { background: var(--green) !important; color: var(--green-ink) !important; border-color: var(--green) !important; font-weight: 700 !important; }
button:disabled { opacity: .6; cursor: progress; }
.login .hint { color: var(--green); }
button.big { min-height: 48px; font-size: 16px; padding: 10px 18px; width: 100%; }
.fld { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.fld input, .row input { font-size: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); color: var(--ink); width: 100%; min-height: 40px; }
.cnt { float: right; font-weight: 400; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 40px; }
.chips button[aria-pressed="true"] { background: #dff3e8; border-color: var(--green); color: #14563f; box-shadow: 0 0 0 1px var(--green) inset; font-weight: 700; }
.chips.two button { flex: 1; }
.chips[data-kind="status"] button[data-v="focus"][aria-pressed="true"] { background: #e7e3fb; border-color: #6a5acd; color: #3d2f9e; box-shadow: 0 0 0 1px #6a5acd inset; }
.chips[data-kind="status"] button[data-v="away"][aria-pressed="true"] { background: #f1f1f1; border-color: #888; color: #444; box-shadow: 0 0 0 1px #888 inset; }
.chips[data-kind="status"] button[data-v="meeting"][aria-pressed="true"] { background: #fdeee0; border-color: #d07a2e; color: #8a4510; box-shadow: 0 0 0 1px #d07a2e inset; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.swatches button { height: 34px; min-height: 34px; border-radius: 10px; padding: 0; border: 2px solid transparent; }
.swatches button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
details .sum { font-weight: 400; color: var(--muted); font-size: 13px; }
.meBody { display: flex; gap: 10px; align-items: center; }
.meBody canvas { width: 110px; height: 121px; border-radius: 12px; background: #e8f1ec; flex: none; }
.meInfo .nick { font: 400 22px var(--display); margin: 0; }
.soon { color: var(--muted); font-size: 12px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.people li button { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; background: var(--surface); }
.people li button:hover { background: var(--chip); }
.people .nm { font-weight: 700; }
.people .wk { color: var(--muted); font-size: 12px; grid-column: 2 / 4; margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .st { font-size: 13px; color: var(--muted); font-weight: 500; }
.empty { color: var(--muted); font-size: 13px; margin: 0; }
.keys { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.keys li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.keys li span { color: var(--muted); margin-left: auto; }

/* 덮는 화면 (로그인 · 다른 탭) */
.screen { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(15,30,25,.55); z-index: 20; padding: 16px; overflow: auto; }
.screen .box { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 22px; width: min(520px, 100%); display: grid; gap: 12px; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.screen.login { background: linear-gradient(160deg, #cfe3dc, #f3e3c3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .screen.login { background: linear-gradient(160deg, #10221c, #2a2418); } }
.login h1 { font-size: clamp(30px, 6vw, 40px); }
.lead { margin: 0; color: var(--muted); }
.login hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.login #step1 { display: grid; gap: 10px; }
.signup { display: grid; grid-template-columns: 1fr 160px; gap: 14px; align-items: start; }
.signup .fields { display: grid; gap: 8px; }
.signup canvas { width: 160px; height: 192px; border-radius: 14px; background: #e8f1ec; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }
.small { font-size: 12px !important; }
.err { color: var(--red); margin: 0; font-weight: 500; }
#step2 { display: grid; gap: 12px; }
.tip { position: fixed; z-index: 30; background: #173e35; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; max-width: 240px; }

/* 폰 */
.joy, .touchBtns { display: none; }
@media (max-width: 760px), (pointer: coarse) {
  .hud.tl { max-width: calc(100% - 24px); }
  .hud.tr { top: 50px; max-width: calc(100% - 24px); }
  .hud.tr #meBtn { font-size: 0; } .hud.tr #meBtn::before { content: "👤"; font-size: 16px; }
  .desk { display: none !important; }
  .hud.bl { bottom: 150px; width: min(300px, 70vw); }
  .hud.bl .chat { display: none; }
  .hud.bl.typing .chat { display: flex; }
  .hud.bc { bottom: 156px; }
  .chatlog { max-height: 22vh; }
  .joy { display: block; position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%; background: rgba(255,253,247,.35); border: 2px solid rgba(255,253,247,.8); z-index: 6; touch-action: none; }
  .knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,253,247,.95); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
  .touchBtns { display: grid; grid-template-columns: repeat(2, auto); gap: 8px; position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); z-index: 6; }
  .touchBtns button { min-height: 52px; min-width: 64px; font-size: 15px; font-weight: 700; border-radius: 16px; }
  .notices { top: 150px; }
  .musicChip { top: 96px; }
  .panel.side { top: 92px; max-height: calc(100% - 270px); }
  .signup { grid-template-columns: 1fr; }
  .signup canvas { width: 120px; height: 144px; justify-self: center; order: -1; }
}
.login .row button { flex: 1; white-space: nowrap; }
.login .osm { justify-self: start; }
/* 점검 뒤 고침: HUD 위 초록 버튼은 어두운 화면에서도 같은 진한 초록 (흰 글자 대비) */
.notice button.go, .chat .send { background: #26775f; border-color: #26775f; color: #fff; }
#ageChips { flex-wrap: nowrap; }
#ageChips button { flex: 1; white-space: nowrap; padding: 8px 6px; }
.fld .cnt { float: none; margin-left: 6px; }
/* 누르는 것: 뽈롱 — 누를 때 살짝 들어갔다가 놓으면 통통 튀며 돌아온다 */
button { transition: transform .16s cubic-bezier(.34,1.56,.64,1), background-color .15s, border-color .15s; }
button:not(:disabled):active { transform: scale(.9); }
button.boing { animation: boing .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes boing { 0% { transform: scale(.9); } 45% { transform: scale(1.08); } 70% { transform: scale(.97); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { button, button.boing { transition: none; animation: none; } }
/* 화면 가운데 위 말풍선 (친구 신청 등) — 부드럽게 떴다가 사라진다 */
.bubble { justify-self: center; position: relative; background: #fff; color: var(--hud-ink); border: 2px solid #26775f; border-radius: 18px; padding: 9px 16px; font: 700 15px var(--body); box-shadow: 0 10px 28px rgba(12,42,34,.25); text-align: center; max-width: 100%;
  animation: bubbleIn .45s cubic-bezier(.34,1.56,.64,1) both; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: #fff; border-right: 2px solid #26775f; border-bottom: 2px solid #26775f; transform: translateX(-50%) rotate(45deg); }
.bubble.out { animation: bubbleOut .5s ease-in forwards; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(-14px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes bubbleOut { to { opacity: 0; transform: translateY(-10px) scale(.95); } }
/* 알림함 */
.hud button.mail { position: relative; }
.mail .badge, #mailN { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; border-radius: 10px; background: #d93025; color: #fff; font: 800 11px/19px var(--body); padding: 0 5px; box-shadow: 0 0 0 2px #fff; }
#mailBtn svg { width: 20px; height: 20px; display: block; color: var(--hud-ink); }
#mailBtn[data-new="1"] { animation: boing .5s cubic-bezier(.34,1.56,.64,1); }
ul.mail { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
ul.mail li { border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; display: grid; gap: 6px; background: var(--bg); }
ul.mail li[data-read="0"] { border-color: #26775f; box-shadow: 0 0 0 1px #26775f inset; }
ul.mail .t { font-weight: 700; } ul.mail .w { color: var(--muted); font-size: 12px; }
ul.mail .row { display: flex; gap: 6px; flex-wrap: wrap; }
/* 계절 · 시간 표시 */
.hud .pill.sky { cursor: pointer; min-height: 0; padding: 5px 12px; border-radius: 999px; font: 700 14px var(--body); }
/* 친구 · 동호회 목록 */
.social { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 60px; z-index: 5; width: 236px; max-height: calc(100% - 230px); overflow: auto; background: var(--hud); color: var(--hud-ink); border: 1px solid var(--hud-line); border-radius: 14px; box-shadow: 0 6px 18px rgba(12,42,34,.14); }
.social .sh { display: flex; width: 100%; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--hud-ink); font: 800 14px var(--body); padding: 8px 10px; text-align: left; min-height: 38px; cursor: pointer; }
.social .sh .car { margin-left: auto; transition: transform .2s; }
.social .sh[aria-expanded="false"] .car { transform: rotate(-90deg); }
.social .sh.sub { font-size: 13px; padding: 6px 10px; border-top: 1px solid var(--hud-line); }
.social .sh .n { color: var(--muted); font-weight: 700; }
.social ul { list-style: none; margin: 0; padding: 0 6px 6px; display: grid; gap: 2px; }
.social li button { display: flex; width: 100%; gap: 7px; align-items: center; border: 0; background: transparent; color: var(--hud-ink); border-radius: 9px; padding: 5px 6px; font: 600 13px var(--body); text-align: left; min-height: 32px; cursor: pointer; }
.social li button:hover { background: rgba(38,119,95,.1); }
.social .dot { width: 9px; height: 9px; border-radius: 50%; background: #b8c2bd; flex: none; }
.social .dot.on { background: #2fb67c; box-shadow: 0 0 0 2px rgba(47,182,124,.25); }
.social .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social .wh { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.social li.off .nm { color: var(--muted); }
.social .empty { padding: 2px 12px 8px; font-size: 12px; }
.social .acts { display: flex; gap: 6px; padding: 0 10px 8px; flex-wrap: wrap; }
.social .acts button, .social form button { font: 700 12px var(--body); border-radius: 9px; border: 1px solid var(--hud-line); background: #fff; color: var(--hud-ink); padding: 5px 9px; min-height: 30px; }
.social form { display: flex; gap: 6px; padding: 0 10px 10px; }
.social form input { flex: 1; min-width: 0; font-size: 14px; border: 1px solid var(--hud-line); border-radius: 9px; padding: 5px 8px; background: #fff; color: var(--hud-ink); }
.social .hint { padding: 0 12px 8px; font-size: 12px; color: var(--muted); margin: 0; }
/* 운전 중 길 안내 */
.navBar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 6; display: flex; gap: 8px; align-items: center; background: var(--hud); border: 1px solid var(--hud-line); border-radius: 14px; padding: 5px 6px 5px 12px; box-shadow: 0 6px 18px rgba(12,42,34,.18); max-width: calc(100% - 24px); }
.navBar .navInfo { font: 700 14px var(--body); color: var(--hud-ink); white-space: nowrap; }
.navBar .seg button { font: 700 13px var(--body); padding: 6px 9px; min-height: 36px; background: var(--hud); color: var(--hud-ink); }
.navBar .seg button[aria-pressed="true"] { background: #1e78ff; color: #fff; }
.navBar .icon { min-width: 36px; min-height: 36px; border-radius: 10px; border: 1px solid var(--hud-line); background: #fff; color: var(--hud-ink); font: 800 15px var(--body); }
.navBar .seg button { white-space: nowrap; }
.pill.curb { background: #fff4d6; color: #7a4b00; border-color: #e9b65a; }
.pill.curb[data-over="1"] { background: #fdeaea; color: #9b2222; border-color: #eba3a3; }
@media (max-width: 760px), (pointer: coarse) {
  .navBar { bottom: 212px; flex-wrap: wrap; justify-content: center; padding: 5px; }
  .navBar .navInfo { width: 100%; text-align: center; font-size: 13px; }
  .navBar .seg .t { display: none; }
  .social { top: 140px; width: 178px; max-height: calc(100% - 380px); }
  .navBar .seg button { min-width: 44px; font-size: 17px; }
}
@media (max-width: 760px), (pointer: coarse) {
  .toast { top: 150px; }   /* 폰: 위쪽 두 줄 단추(빠른 이동 · 소리·사람·내 정보) 아래 */
  .notices { top: 150px; }
}

/* 마을 돈 · 속도 */
.pill.money { background: #fff6dc; color: #6b4a00; border-color: #e9c46a; }
.pill.money[data-neg="1"] { background: #fdeaea; color: #9b2222; border-color: #eba3a3; }
.pill.speed { background: #1f2a33; color: #e8f4ff; border-color: #1f2a33; font-variant-numeric: tabular-nums; }
.keys li.h { font-weight: 700; margin-top: 6px; color: var(--green); }

/* 머리 위 말하기 창: 화면 좌표는 매 프레임 app.js 가 옮긴다 */
.headChat { position: absolute; z-index: 12; transform: translate(-50%, -100%); width: min(340px, calc(100vw - 32px)); background: rgba(255,253,247,.98); color: #173e35;
  border: 2px solid var(--green); border-radius: 14px; padding: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.22); display: grid; gap: 6px; }
.headChat::after { content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: var(--green); border-bottom: 0; }
.headChat .line { display: flex; gap: 6px; }
.headChat input { flex: 1; min-width: 0; font-size: 16px; border-radius: 10px; border: 1px solid rgba(23,62,53,.25); padding: 7px 10px; background: #fff; color: #173e35; }
.headChat .send { font: 600 14px var(--body); border-radius: 10px; border: 1px solid #26775f; background: #26775f; color: #fff; padding: 0 12px; min-height: 38px; }
.headChat .to { display: flex; gap: 4px; flex-wrap: wrap; }
.headChat .to:empty { display: none; }
.headChat .to button { font: 500 12px var(--body); border-radius: 999px; border: 1px solid rgba(23,62,53,.25); background: #fff; color: #173e35; padding: 3px 10px; min-height: 30px; }
.headChat .to button[aria-pressed="true"] { background: #26775f; color: #fff; border-color: #26775f; }
.headChat .hint { margin: 0; font-size: 12px; color: #4c665c; }
.headChat .hint:empty { display: none; }
.headChat[data-mode="whisper"] { border-color: #7b5cc4; }
.headChat[data-mode="whisper"]::after { border-top-color: #7b5cc4; }
.headChat[data-mode="door"] { border-color: #e9b65a; }
.headChat[data-mode="door"]::after { border-top-color: #e9b65a; }
.chatlog .ln.whisper { background: rgba(92,64,160,.88); }
.chatlog .ln.door { background: rgba(140,96,20,.88); }

/* 범칙금 고지서 */
.ticket { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; width: min(340px, calc(100vw - 32px)); background: #fffdf7; color: #2b2b2b;
  border: 3px solid #c0392b; border-radius: 16px; padding: 18px 18px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); text-align: center; animation: pop2 .3s ease-out; }
.ticket .badge { margin: 0; font-weight: 700; color: #c0392b; letter-spacing: .02em; }
.ticket h2 { margin: 4px 0 10px; font: 400 26px var(--title); }
.ticket .what { margin: 0 0 6px; font-weight: 500; }
.ticket .amt { margin: 0 0 4px; font: 700 28px var(--body); color: #c0392b; font-variant-numeric: tabular-nums; }
.ticket[data-warn="1"] { border-color: #e9b65a; }
.ticket[data-warn="1"] .badge, .ticket[data-warn="1"] .amt { color: #8a5a00; }
.ticket .sub { margin: 0 0 12px; color: #5b5b5b; font-size: 13px; }

/* 폰: 빠른 이동은 그림만 (글자는 길게 누르면 뜨는 설명으로) · 위 왼쪽은 한 줄씩 */
@media (max-width: 520px) {
  .seg .t { display: none; }
  .seg button { min-width: 40px; padding: 6px 8px; }
  .hud.tl { max-width: calc(100% - 226px); }
  .hud.tl .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hud.tr { max-width: 200px; }
}
