/* Pretendard @font-face rules: css/fonts.css (split into an everyday subset + the full font) */
:root {
  --ui-font: Pretendard, 'Apple SD Gothic Neo', 'Segoe UI', 'Malgun Gothic', sans-serif;
  --ink: #242320; --muted: #777169; --paper: #faf7f0; --edge: #ded7ca; --accent: #b7a58b;
  /* HUD chrome: warm, low-contrast smoked glass (memorial-calm); panels stay on warm paper */
  --hud-surface: rgba(46, 38, 32, .58); --hud-solid: rgba(46, 38, 32, .9); --hud-active: rgba(255, 236, 212, .16); --hud-hover: rgba(255, 236, 212, .1);
  --hud-text: #f8f2e9; --hud-muted: #dccfbe; --hud-edge: rgba(255, 240, 220, .2); --hud-blur: blur(14px) saturate(1.05) brightness(.86);
  --gold: #f0cd8e;
  font-family: var(--ui-font); color: var(--ink); font-size: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e7eedf; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.glass { background: var(--hud-surface); border: 1px solid var(--hud-edge); box-shadow: inset 0 1px 0 rgba(255,255,255,.03); backdrop-filter: var(--hud-blur); -webkit-backdrop-filter: var(--hud-blur); color: var(--hud-text); }

/* loading */
#loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; background: #e7eedf; color: #4b4a45; z-index: 50; transition: opacity .6s; font-size: 13px; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-mark { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 2px solid #c9cdbf; border-top-color: #6f7a63; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= HUD =================
   Layout (mobile first):
     .hud-top      top-left place chip (brand · place · online) + top-right round buttons (알림, 메뉴)
     #actionbar    one bottom bar: 우리 아이 card | context actions
     #space-slot   row just above the bar for space-specific controls (spaces append into it)
   Positions for space UIs (all include safe-area insets):
     var(--hud-top)        bottom edge of the top chrome (put top-anchored space UI below this)
     var(--hud-dock-top)   top edge of the bottom bar, measured from the viewport bottom
     var(--hud-stack-top)  top of bar + space slot (use for floating buttons, toasts) */
:root {
  --sa-t: env(safe-area-inset-top, 0px); --sa-r: env(safe-area-inset-right, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px);
  --hud-gap: 14px; --hud-chip-h: 50px; --hud-bar-h: 66px; --hud-space-h: 0px;
}
/* derived positions are declared on body too, so a body-level --hud-space-h (or the slot's measured height on <html>) flows into them */
:root, body {
  --hud-bottom: max(var(--hud-gap), calc(var(--sa-b) + 4px));
  --hud-top: calc(var(--sa-t) + var(--hud-gap) + var(--hud-chip-h));
  --hud-dock-top: calc(var(--hud-bottom) + var(--hud-bar-h));
  --hud-stack-top: calc(var(--hud-dock-top) + var(--hud-space-h));
}
@media (max-width: 600px) { :root { --hud-gap: 10px; --hud-chip-h: 48px; --hud-bar-h: 64px; } }
.chrome { background: var(--hud-surface); border: 1px solid var(--hud-edge); backdrop-filter: var(--hud-blur); -webkit-backdrop-filter: var(--hud-blur); color: var(--hud-text); box-shadow: 0 8px 28px rgba(36, 24, 12, .16), inset 0 1px 0 rgba(255, 244, 228, .08); }
button.chrome:hover { background: var(--hud-solid); }

/* top: place chip + round buttons */
.hud-top { position: fixed; top: calc(var(--sa-t) + var(--hud-gap)); left: calc(var(--sa-l) + var(--hud-gap)); right: calc(var(--sa-r) + var(--hud-gap)); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; z-index: 10; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.place-chip { display: flex; align-items: center; gap: 10px; height: var(--hud-chip-h); padding: 0 14px 0 6px; border-radius: 999px; min-width: 0; text-align: left; }
.place-mark { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(150deg, #f8e4bd, #d8a670); color: #4a3422; flex-shrink: 0; box-shadow: inset 0 -2px 4px rgba(120, 70, 30, .18); }
.place-mark .ico { width: 21px; height: 21px; stroke-width: 2.1; }
.place-text { display: grid; line-height: 1.2; min-width: 0; }
.place-text small { font-size: 10.5px; color: var(--hud-muted); letter-spacing: .02em; }
.place-text b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.place-no { color: var(--gold); font-weight: 600; }
.place-online { display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: rgba(255, 240, 220, .1); font-size: 11.5px; color: var(--hud-muted); white-space: nowrap; flex-shrink: 0; }
.presence-dot { width: 6px; height: 6px; border-radius: 50%; background: #c99b5c; }
[data-connected=true] .presence-dot { background: #9bd19f; box-shadow: 0 0 0 3px rgba(155, 209, 159, .2); }
.place-chip .chev { width: 16px; height: 16px; opacity: .65; margin-left: -4px; transition: transform .2s; }
.place-chip[aria-expanded=true] .chev { transform: rotate(180deg); }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.round { position: relative; width: var(--hud-chip-h); height: var(--hud-chip-h); border-radius: 50%; display: grid; place-items: center; }
.round .ico { width: 22px; height: 22px; }
.bell-dot { position: absolute; top: 12px; right: 13px; width: 8px; height: 8px; border-radius: 50%; background: #f29d7a; box-shadow: 0 0 0 2px rgba(44, 37, 32, .85); display: none; }
#notify[data-unread=true] .bell-dot { display: block; }

/* place switcher (light popover under the chip) */
.place-pop { position: fixed; top: calc(var(--hud-top) + 8px); left: calc(var(--sa-l) + var(--hud-gap)); width: min(370px, calc(100vw - 2 * var(--hud-gap))); max-height: calc(100dvh - var(--hud-top) - var(--hud-dock-top) - 20px); overflow: auto; overscroll-behavior: contain; padding: 6px 8px 8px; border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(40, 28, 16, .26); z-index: 13; display: none; }
.place-pop.open { display: block; animation: rise .2s ease-out; }
.place-pop h3 { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 10px 10px 4px; letter-spacing: .04em; }
.place-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 8px; border-radius: 14px; text-align: left; }
.place-row:hover { background: #f2ebdf; }
.place-row.cur { background: #efe4d1; }
.pr-ico { width: 38px; height: 38px; border-radius: 12px; background: #efe6d8; display: grid; place-items: center; color: #8d6b45; flex-shrink: 0; }
.place-row.cur .pr-ico { background: #3f362d; color: #f3d6a2; }
.pr-ico .ico { width: 20px; height: 20px; }
.pr-text { display: grid; min-width: 0; flex: 1; line-height: 1.35; }
.pr-text b { font-size: 14.5px; font-weight: 600; }
.pr-text b > span:first-child:not(:last-child) { color: #a47a46; }
.pr-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-state { font-size: 11.5px; font-weight: 600; color: #a47a46; white-space: nowrap; }
.pr-state .ico { width: 18px; height: 18px; color: #bcae9a; }

/* bottom: the one action bar */
.actionbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--hud-bottom); height: var(--hud-bar-h); display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 26px; z-index: 10; max-width: calc(100vw - var(--sa-l) - var(--sa-r) - 2 * var(--hud-gap)); }
.pet-card { display: flex; align-items: center; gap: 9px; height: 100%; padding: 0 14px 0 5px; border-radius: 20px; min-width: 0; max-width: 176px; text-align: left; background: rgba(255, 240, 220, .1); color: var(--hud-text); }
.pet-card:hover { background: var(--hud-active); }
.pet-face { width: 42px; height: 42px; border-radius: 50%; background: #e9dbc4 center/cover no-repeat; border: 2px solid var(--gold); display: grid; place-items: center; color: #8d6b45; flex-shrink: 0; }
.pet-face .ico { width: 22px; height: 22px; }
.pet-face.add { background: transparent; border: 1.5px dashed rgba(240, 205, 142, .85); color: var(--gold); }
.pet-card.walking .pet-face { box-shadow: 0 0 0 3px rgba(240, 205, 142, .32); }
.pet-text { display: grid; line-height: 1.25; min-width: 0; }
.pet-text b { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet-text small { font-size: 11px; color: var(--hud-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet-card.walking small, .pet-card.empty b { color: var(--gold); }
.bar-sep { width: 1px; height: 30px; background: var(--hud-edge); margin: 0 6px; flex-shrink: 0; }
.bar-actions { display: flex; gap: 2px; }
.act { width: 66px; height: 54px; border-radius: 19px; display: grid; justify-items: center; align-content: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--hud-text); white-space: nowrap; }
.act .ico { width: 22px; height: 22px; }
.act:hover { background: var(--hud-hover); }
.act.on { color: var(--gold); background: var(--hud-active); }

/* space-specific controls sit in this row just above the bar */
.space-slot { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--hud-dock-top) + 8px); display: flex; justify-content: center; align-items: flex-end; gap: 8px; z-index: 9; max-width: calc(100vw - 2 * var(--hud-gap)); pointer-events: none; }
.space-slot > * { pointer-events: auto; }
.space-slot:empty { display: none; }

/* joystick (touch screens only; keyboard / click-to-walk on desktop) */
.movement { position: fixed; left: calc(var(--sa-l) + 18px); bottom: calc(var(--hud-stack-top) + 20px); width: 92px; height: 92px; z-index: 8; touch-action: none; }
.joystick { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255, 244, 228, .04), rgba(255, 244, 228, .12)); border: 1px solid rgba(255, 244, 228, .28); }
.joystick.dragging { background: radial-gradient(circle, rgba(255, 244, 228, .1), rgba(255, 244, 228, .22)); }
.stick { position: absolute; left: 26px; top: 26px; width: 40px; height: 40px; border-radius: 50%; background: rgba(250, 242, 228, .42); border: 1px solid rgba(255, 246, 232, .7); box-shadow: 0 2px 12px rgba(36, 24, 12, .22), inset 0 1px 1px rgba(255, 255, 255, .25); backdrop-filter: blur(3px); }
@media (hover: hover) and (pointer: fine) { .movement { display: none; } }

/* first-visit notice (afterwards it lives in 알림) */
.notice { position: fixed; top: calc(var(--hud-top) + 10px); left: calc(var(--sa-l) + var(--hud-gap)); width: min(400px, calc(100vw - 2 * var(--hud-gap))); display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 12px; border-radius: 18px; z-index: 11; font-size: 12.5px; line-height: 1.5; background: var(--hud-solid); color: var(--hud-text); border: 1px solid var(--hud-edge); box-shadow: 0 8px 24px rgba(36, 24, 12, .18); }
.notice > .ico { width: 20px; height: 20px; color: var(--gold); }
.notice a { color: var(--gold); text-underline-offset: 3px; white-space: nowrap; display: inline-block; padding: 13px 6px; margin: -13px -6px; } /* 44 px tall tap target, same line box */
.notice p { margin: 0; flex: 1; }
.notice .x { width: 44px; height: 44px; margin: -6px -2px -6px 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 240, 220, .1); flex-shrink: 0; }
.notice .x .ico { width: 15px; height: 15px; stroke-width: 2; }

#toast { position: fixed; left: 50%; bottom: calc(var(--hud-stack-top) + 16px); transform: translate(-50%, 10px); opacity: 0; transition: opacity .25s, transform .25s; background: var(--hud-solid); color: var(--hud-text); padding: 11px 18px; border-radius: 999px; font-size: 13px; z-index: 40; pointer-events: none; box-shadow: 0 8px 24px rgba(36, 24, 12, .2); max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* emote popover (light, anchored above the bar) */

/* light panels */
.panel { position: fixed; top: calc(var(--hud-top) + 10px); right: calc(var(--sa-r) + var(--hud-gap)); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - var(--hud-top) - var(--hud-dock-top) - 22px); overscroll-behavior: contain; overflow: auto; background: var(--paper); color: var(--ink); border-radius: 24px; padding: 24px 22px 22px; z-index: 20; box-shadow: 0 16px 50px rgba(30, 24, 18, .22); display: none; }
.panel.open { display: block; animation: rise .22s ease-out; }
.panel.wide { width: min(700px, calc(100vw - 24px)); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { font-size: 26px; font-weight: 700; margin: 4px 0 0; letter-spacing: -.02em; }
.panel .close { width: 42px; height: 42px; border-radius: 50%; background: #efe7da; color: #4a4239; display: grid; place-items: center; flex-shrink: 0; }
.panel .close:hover { background: #e6dccb; }
.panel .close .ico { width: 20px; height: 20px; stroke-width: 1.8; }
.panel .lead { color: #6b6760; font-size: 14px; line-height: 1.65; margin: 0 0 18px; }
.panel .lead.small { font-size: 12.5px; margin-bottom: 6px; }
.panel label.field { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 8px; }
.panel input[type=text], .panel input[type=date], .panel select, .panel textarea { width: 100%; height: 44px; border-radius: 12px; border: 1px solid #ddd8ce; background: #fff; padding: 0 14px; font-size: 15px; outline: none; }
.panel textarea { height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.panel input:focus, .panel select:focus, .panel textarea:focus { border-color: #a99a80; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border-radius: 14px; font-weight: 600; font-size: 15px; padding: 0 18px; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.primary { background: #3d3b37; color: #f5f1e8; }
.btn.grey { background: #6f6153; color: #fbf6ee; }
.btn.line { border: 1px solid #d8d1c3; background: #fff; color: #3d3b37; }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.halls { display: grid; gap: 12px; }
.hall-card { display: flex; align-items: center; gap: 16px; min-height: 92px; padding: 14px 18px; border-radius: 18px; background: #f1ece3; color: #8b8273; text-align: left; border: 1px solid #e6ddcd; }
.hall-card.open { background: #fff; color: var(--ink); border-color: #ece3d4; }
.hall-card.open:hover { border-color: #d9c7a8; background: #fffcf6; }
.hall-card .hall-ico { width: 48px; height: 48px; border-radius: 14px; background: #efe6d8; color: #8d6b45; display: grid; place-items: center; flex-shrink: 0; }
.hall-card .hall-ico .ico { width: 24px; height: 24px; stroke-width: 1.4; }
.hall-card small { font-size: 11.5px; font-weight: 600; color: #a47a46; }
.hall-card b { display: block; font-size: 18px; font-weight: 650; margin: 1px 0 3px; }
.hall-card span.desc { font-size: 12.5px; color: var(--muted); }
.hall-card .state { margin-left: auto; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: #a47a46; }

.cell-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.cell-grid button { aspect-ratio: 1.2; border-radius: 5px; background: #ece7dd; font-size: 9.5px; color: #6b6458; }
.cell-grid button.taken { background: #b6b0a5; color: #fff; cursor: default; }
.cell-grid button.sel { background: #3d3b37; color: #fff; }
.bank-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.bank-tabs button { padding: 6px 10px; border-radius: 9px; background: #ece7dd; font-size: 12px; }
.bank-tabs button.on { background: #3d3b37; color: #fff; }

.niche-card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.niche-photo { width: 120px; height: 150px; border-radius: 12px; background: #e9e2d4 center/cover; border: 6px solid #fff; box-shadow: 0 6px 16px rgba(60,40,20,.15); display: grid; place-items: center; color: #b2a891; }
.niche-meta h3 { font-size: 24px; margin: 4px 0 2px; }
.niche-meta p { margin: 2px 0; color: #6b6760; font-size: 13px; }
.letter { white-space: pre-wrap; background: #fff; border: 1px solid #ebe5d9; border-radius: 14px; padding: 14px 16px; line-height: 1.75; font-size: 14px; margin-top: 16px; color: #3f3c37; }
.stats { display: flex; gap: 14px; font-size: 12.5px; color: #6b6760; margin-top: 10px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.actions .btn { height: 52px; flex-direction: column; gap: 2px; font-size: 12px; }
.actions .btn .ico { width: 20px; height: 20px; }
.gift-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.gift-row button { aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1px solid #ebe5d9; font-size: 22px; display: grid; place-items: center; }
.gift-row button small { display: block; font-size: 10px; color: #6b6760; }
.photo-drop { display: grid; place-items: center; height: 120px; border: 1.5px dashed #cfc6b5; border-radius: 14px; color: #8b8273; font-size: 13px; cursor: pointer; background: #fff center/contain no-repeat; }
.list { display: grid; gap: 6px; }
.list .item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid #eee7da; border-radius: 12px; font-size: 14px; }
.list .item .rank { width: 24px; font-weight: 700; color: #a28a62; }
.list .item .muted { margin-left: auto; color: #8b8273; font-size: 12px; }
.support-qr { display: grid; place-items: center; width: 180px; height: 180px; margin: 6px auto 10px; background: #fff; border-radius: 16px; border: 1px solid #ebe5d9; color: #9c927f; font-size: 12px; text-align: center; }
.account { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #fff; border-radius: 12px; border: 1px solid #ebe5d9; margin-top: 10px; font-size: 14px; }

/* hug invitation */
.invite { position: fixed; left: 50%; top: calc(var(--hud-top) + 10px); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); padding: 10px 10px 10px 16px; border-radius: 20px; display: none; gap: 8px; align-items: center; z-index: 14; font-size: 13px; background: var(--hud-solid); color: var(--hud-text); border: 1px solid var(--hud-edge); box-shadow: 0 8px 24px rgba(36, 24, 12, .2); }
.invite span { flex: 1; }
.invite.open { display: flex; }
.invite button { padding: 8px 12px; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,.1); font-size: 12px; }
.invite button.yes { background: var(--gold); color: #2b2a26; font-weight: 600; }

/* constellation overlay */
.cst-top { position: fixed; top: 16px; left: 16px; display: flex; align-items: center; gap: 12px; z-index: 15; color: #f2f1ea; }
.cst-top .round { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.cst-top b { display: block; font-size: 17px; }
.cst-top small { font-size: 11px; color: #cfd2cc; }
.cst-caption { position: fixed; top: 74px; left: 16px; font-size: 12px; color: #e6e7e1; z-index: 15; }
.cst-refresh { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; z-index: 15; }
.cst-hint { position: fixed; left: 50%; bottom: 158px; transform: translateX(-50%); font-size: 11.5px; color: #eef0ea; z-index: 15; text-shadow: 0 1px 4px rgba(0,0,0,.6); white-space: nowrap; }
.cst-poses { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 15; }
.cst-poses button, .cst-bottom button { height: 46px; padding: 0 22px; border-radius: 14px; font-size: 14px; }
.cst-bottom { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 15; }
.cst-bottom button { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 0 16px; }
.cst-bottom .ico { width: 18px; height: 18px; }
body.constellation .hud-top, body.constellation .actionbar, body.constellation .space-slot, body.constellation .notice, body.constellation .place-pop, body.constellation .chatbox { display: none; }
.star-tag { position: fixed; transform: translate(-50%, 0); font-size: 12px; color: #eef0ea; pointer-events: auto; cursor: pointer; white-space: nowrap; z-index: 14; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.star-tag::before { content: ''; display: block; width: 1px; height: 8px; background: rgba(255,255,255,.35); margin: 0 auto 2px; }

@media (max-width: 600px) {
  .place-text small { display: none; }
  .place-text b { font-size: 14.5px; }
  .actionbar { left: calc(var(--sa-l) + var(--hud-gap)); right: calc(var(--sa-r) + var(--hud-gap)); transform: none; max-width: none; padding: 5px; gap: 0; }
  .pet-card { flex: 1 1 auto; max-width: 132px; padding-right: 8px; gap: 8px; }
  .bar-sep { margin: 0 3px; }
  .bar-actions { gap: 0; margin-left: auto; }
  .act { width: 52px; font-size: 10.5px; gap: 3px; border-radius: 16px; }
  .panel, .panel.wide, .panel.menu-sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: calc(100dvh - var(--hud-top) - 6px); border-radius: 24px 24px 0 0; padding: 22px 16px calc(18px + var(--sa-b)); box-shadow: 0 -10px 40px rgba(30, 24, 18, .25); }
  .panel.open { animation: sheet .24s ease-out; }
  .panel::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: #ddd3c3; }
  .panel-heading h2 { font-size: 22px; }
  .panel .close { width: 40px; height: 40px; border-radius: 50%; }
  .cell-grid { grid-template-columns: repeat(5, 1fr); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid rgba(231, 201, 121, .7); outline-offset: -2px; }
.pebble-card { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; margin: 6px 0; }
.pebble-nav { width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 1px solid #ebe5d9; font-size: 22px; color: #5d574d; }
.pebble-nav:disabled { opacity: .35; }
.pebble-stone { min-height: 150px; border-radius: 48% 52% 46% 54% / 55% 50% 50% 45%; background: radial-gradient(circle at 35% 30%, #f3f1ec, #cfcbc2 70%, #b9b4aa); display: grid; place-content: center; text-align: center; padding: 22px 26px; box-shadow: inset 0 -8px 16px rgba(0,0,0,.08), 0 8px 18px rgba(60,50,40,.15); }
.pebble-stone p { margin: 0 0 6px; font-size: 16px; line-height: 1.6; color: #3c3933; }
.pebble-stone small { color: #7a746a; font-size: 12px; }
.list a.item, .list button.item { text-decoration: none; color: inherit; text-align: left; width: 100%; }

/* "walking" chip while a clicked walk is under way (stop button) */
.walk-chip { position: fixed; left: 50%; top: calc(var(--hud-top) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--hud-solid); color: var(--hud-text); font-size: 12px; z-index: 12; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.walk-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: walkdot 1s ease-in-out infinite; }
.walk-chip button { padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 12px; }
@keyframes walkdot { 50% { opacity: .35; transform: scale(.7); } }

/* pet look: 3D preview + editor in the memorial panel */
.pet-look { margin-top: 14px; border: 1px solid var(--edge); border-radius: 14px; padding: 12px; background: #fffdf8; }
.pet-look h4 { margin: 0 0 6px; font-size: 14px; }
.pet-look .pet-stage { position: relative; height: 210px; border-radius: 10px; background: radial-gradient(ellipse at 50% 35%, #fffaf0, #ece4d4); overflow: hidden; }
.pet-look .pet-stage canvas { width: 100%; height: 100%; display: block; }
.pet-look .pet-status { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--muted); }
.pet-look .row { margin-top: 10px; gap: 8px; }
.pet-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 10px; }
.pet-edit label { font-size: 11px; color: var(--muted); display: grid; gap: 3px; }
.pet-edit select, .pet-edit input[type=range] { width: 100%; }
.pet-edit .colors { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pet-edit .colors label { text-align: center; }
.pet-edit input[type=color] { width: 100%; height: 30px; border: 1px solid var(--edge); border-radius: 8px; padding: 2px; background: #fff; }
.pet-edit .full { grid-column: 1 / -1; }

/* menu sheet (a panel variant) */
.panel.menu-sheet { width: min(420px, calc(100vw - 24px)); }
.panel.menu-sheet .panel-heading { margin-bottom: 10px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 18px; background: #fff; border: 1px solid #ece4d6; }
.me-avatar { width: 42px; height: 42px; border-radius: 50%; background: #f1e7d7; color: #8d6b45; display: grid; place-items: center; flex-shrink: 0; }
.me-text { flex: 1; min-width: 0; display: grid; line-height: 1.35; }
.me-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 12px; gap: 6px; white-space: nowrap; }
.btn.sm .ico { width: 17px; height: 17px; }
.menu-group { margin-top: 18px; }
.menu-group h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 4px 8px; letter-spacing: .03em; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tile, .set-row { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 12px; border-radius: 14px; background: #fff; border: 1px solid #eee6d8; font-size: 13.5px; font-weight: 500; text-align: left; color: var(--ink); letter-spacing: -.01em; }
.tile span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .ico, .set-row .ico { width: 20px; height: 20px; color: #9a744b; }
.tile:hover, button.set-row:hover { background: #fcf7ef; border-color: #e3d5bf; }
.set-row { width: 100%; margin-bottom: 6px; cursor: pointer; }
.set-row > span { flex: 1; }
.set-row:has(input[type=range]) > span { flex: none; }
.set-row input[type=range] { flex: 1; min-width: 0; accent-color: #b98a55; }
.set-row em { font-style: normal; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.set-row .ico:last-child { width: 16px; height: 16px; color: #bcae9a; }
.mine-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.mine-row .lead { margin: 0; }
.list button.item { cursor: pointer; }
.list .item .ico { width: 18px; height: 18px; color: #9a744b; }

/* space UIs that predate #space-slot: keep them above the bar (remove once they use the slot / --hud-* vars) */
.snow-build, #forest-note-button { bottom: calc(var(--hud-stack-top) + 10px) !important; }

/* ---------- 산책 (space key grove): park controls in #space-slot, menus, 기억의 나무 panel ---------- */
.park-slot { display: flex; gap: 6px; align-items: center; max-width: calc(100vw - 2 * var(--hud-gap)); overflow-x: auto; scrollbar-width: none; padding: 2px; }
.park-slot::-webkit-scrollbar { display: none; }
.park-chip { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 550; white-space: nowrap; flex-shrink: 0; }
.park-chip .ico { width: 18px; height: 18px; }
.park-chip .chev { width: 14px; height: 14px; margin-left: -2px; opacity: .75; }
.park-chip.icon-only { width: 40px; padding: 0; justify-content: center; }
.park-chip.on, .park-chip.active { color: var(--gold); background: var(--hud-solid); box-shadow: inset 0 0 0 1.5px rgba(240, 205, 142, .55); }
.park-menu { position: fixed; z-index: 13; min-width: 210px; max-width: calc(100vw - 16px); max-height: calc(100dvh - var(--hud-top) - var(--hud-stack-top) - 24px); overflow: auto; padding: 6px; border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(40, 28, 16, .26); display: none; }
.park-menu.open { display: block; }
.park-menu .pm-head { margin: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #9a8f7f; }
.park-menu button { display: grid; grid-template-columns: 22px 1fr; align-items: center; column-gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 11px; font-size: 13.5px; color: inherit; }
.park-menu button .ico { width: 18px; height: 18px; color: #9a744b; }
.park-menu button small { grid-column: 2; font-size: 11px; color: #9a8f7f; }
.park-menu button:hover { background: #f3ede2; }
.park-menu button.cur { background: #f6efe1; font-weight: 600; }
.tree-card { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start; }
.tree-card .tp { width: 110px; height: 138px; border-radius: 12px; background: #ece4d2 center/cover; border: 6px solid #fff; box-shadow: 0 6px 16px rgba(60, 40, 20, .15); display: grid; place-items: center; color: #a99470; }
.tree-card .tp .ico { width: 34px; height: 34px; }
.growth { height: 10px; border-radius: 6px; background: #e9e4d8; overflow: hidden; margin: 10px 0 6px; }
.growth i { display: block; height: 100%; background: linear-gradient(90deg, #d2b15a, #a98b3e); border-radius: 6px; }
.tree-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.tree-acts .btn { height: 50px; font-size: 13px; }
.tree-own { display: flex; gap: 8px; margin-top: 10px; }
.tree-own .btn { flex: 1; height: 42px; font-size: 13px; }
.tree-own .btn.danger { color: #a4473a; }
@media (max-width: 600px) {
  .park-slot { gap: 5px; }
  .park-chip { height: 44px; min-width: 44px; padding: 0 11px 0 9px; font-size: 12px; gap: 5px; } /* 44 px: comfortable thumb targets */
  .park-chip .ico { width: 17px; height: 17px; }
  .park-chip.icon-only { width: 44px; }
  .park-chip[data-c=go] span { display: none; }
}
@media (max-width: 480px) {
  .park-chip[data-c=phase] { display: none; } /* time of day lives in the 둘러보기 menu on phones */
  .park-slot { overflow: visible; }
}

/* chat: one line over your head */
.chatbox { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(calc(var(--hud-dock-top) + 10px), calc(var(--kb, 0px) + 10px)); /* --kb: on-screen keyboard (hud.js) */ width: min(520px, calc(100vw - 24px)); display: none; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); box-shadow: 0 14px 40px rgba(40, 28, 16, .24); z-index: 13; }
.chatbox.open { display: flex; animation: rise .18s ease-out; }
.chatbox input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; padding: 8px 0; }
.chatbox button { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.chatbox .send { background: #c99a5b; color: #fff; }
.chatbox .send:hover { background: #b98a4c; }
.chatbox .x { color: var(--muted); }
.chatbox .x:hover { background: #efe7da; }
.chatbox .ico { width: 18px; height: 18px; stroke-width: 2; }
@media (pointer: coarse) { .chatbox button { width: 44px; height: 44px; } .chatbox { padding: 4px 4px 4px 16px; } }
