:root {
  --ink: #fdfbff;
  --muted: #c9c2e6;
  --panel: rgba(36, 28, 64, 0.88);
  --panel-solid: #2a2148;
  --panel-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #f2c744;
  --accent-ink: #2a2148;
  --good: #7fe0a4;
  --bad: #ff8f8f;
  --primary: #6c5bd8;
  --primary-2: #8c7bf0;
  --radius: 14px;
  --font: "Noto Sans", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Sans", "Microsoft YaHei", "PingFang SC",
    "Noto Sans Thai", "Noto Sans Devanagari", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* body pinned to the viewport: after a phone rotation the page can never stay scrolled or wider than the screen */
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; background: #1b1530; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.06em; }
body { position: fixed; inset: 0; }
#game { position: fixed; inset: 0; overflow: hidden; }
#game canvas { display: block; max-width: 100vw; max-height: 100dvh; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 7px 13px; cursor: pointer; white-space: nowrap; transition: background .15s, transform .08s; }
.btn:hover { background: rgba(255,255,255,0.16); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); border-color: transparent; font-weight: 700; box-shadow: 0 3px 0 #3f319c; }
.btn.gold { background: linear-gradient(180deg, #ffd96b, #f0b52e); color: var(--accent-ink); border-color: transparent; font-weight: 700; box-shadow: 0 3px 0 #b98419; }
.btn.danger { color: var(--bad); }
.btn.big { padding: 12px 18px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px; }
input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,0.25); outline: none; font-size: 16px; }
input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(140,123,240,.3); }
select { background: rgba(0,0,0,0.3); border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.error { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }

/* start */
.screen { position: fixed; inset: 0; display: grid; place-items: safe center; z-index: 50; padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.start-bg { position: absolute; inset: 0; background: url(assets/world.webp) center/cover no-repeat; image-rendering: pixelated; filter: saturate(1.1) brightness(.75) blur(1.5px); transform: scale(1.04); }
.start-card { position: relative; width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px 22px; text-align: center; backdrop-filter: blur(8px); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.logo, .brand { font-family: "Jua", var(--font); letter-spacing: .04em; }
.logo { font-size: 40px; margin: 0; color: #fff; text-shadow: 0 3px 0 #3f319c, 0 6px 18px rgba(0,0,0,.4); }
.logo span, .brand span { color: var(--accent); margin: 0 6px; }
.tagline { color: var(--muted); margin: 8px 0 20px; }
.nick-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nick-now { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); }
.nick-now b { font-size: 20px; line-height: 1.3; word-break: keep-all; }
.nick-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.nick-opt { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.nick-opt:hover { background: rgba(255, 255, 255, 0.14); }
.nick-opt.on { background: var(--primary, #6c5bd8); border-color: transparent; color: #fff; }
.nick-opt.more { border-style: dashed; opacity: 0.85; }
.agree { display: flex; align-items: flex-start; gap: 8px; text-align: left; font-size: 13px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.agree input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.agree a, .legal-links a { color: var(--ink); text-decoration: underline; }
.body-pick { display: flex; justify-content: center; gap: 12px; }
.body-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 104px; padding: 10px 6px 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.body-opt img { width: 64px; height: auto; image-rendering: pixelated; }
.body-opt:hover { transform: translateY(-2px); }
.body-opt.on { border-color: var(--accent); background: rgba(242,199,68,.14); color: var(--ink); }
.body-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-btn { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; z-index: 2; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 14px; cursor: pointer; }

/* top bar */
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(27,21,48,.92), rgba(27,21,48,.72)); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { font-size: 20px; white-space: nowrap; }
.place { font-size: 13px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.menu { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu button { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 7px 10px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-size: 14px; }
.menu button:hover { background: var(--panel-2); }
.menu button i { font-style: normal; }
.menu .lang-menu { border: 1px solid var(--line); }
#timerChip { background: #e5534b; border-radius: 999px; padding: 1px 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.chip.points { cursor: pointer; font: inherit; font-size: 13px; color: inherit; display: flex; align-items: center; gap: 4px; }
.chip.points:hover { background: rgba(255,255,255,.16); border-color: var(--accent); }
.chip.points .q { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: rgba(242,199,68,.25); color: var(--accent); font-size: 11px; font-weight: 800; }
.chip.points b { color: var(--accent); }
.vol { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.vol input[type=range] { flex: 1; accent-color: var(--accent); padding: 0; }
.rules { display: flex; flex-direction: column; gap: 8px; }
.rule { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.rule .ic { font-size: 22px; width: 30px; text-align: center; flex: none; }
.rule .tx { flex: 1; min-width: 0; }
.rule .tx b { display: block; }
.rule .pt { font-weight: 800; color: var(--accent); font-size: 17px; white-space: nowrap; }
.pts-head { text-align: center; margin-bottom: 14px; }
.pts-head .big { font-size: 34px; font-weight: 800; color: var(--accent); }
.example { background: rgba(108,91,216,.18); border: 1px solid rgba(140,123,240,.4); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.55; }
.chip.points.pop { animation: pop .4s; }
@keyframes pop { 50% { transform: scale(1.25); } }

/* greet bar */
#greetbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; max-width: calc(100vw - 16px); box-shadow: 0 10px 30px rgba(0,0,0,.35); backdrop-filter: blur(6px); }
.nearby { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding: 0 4px; }
.phrases { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.phrases button { border: 0; border-radius: 12px; padding: 8px 12px; background: #fff; color: #2a2440; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 #b7aee0; }
.phrases button:hover { background: #fff7d6; }
.phrases button:active { transform: translateY(2px); box-shadow: 0 1px 0 #b7aee0; }
.cooldown { opacity: .5; pointer-events: none; }

/* door button: pops in, glows, shines and sparkles so it is impossible to miss */
#doorBtn { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 21; font-size: 17px; padding: 12px 20px 12px 16px;
  display: flex; align-items: center; gap: 9px; overflow: visible; isolation: isolate;
  background: linear-gradient(180deg, #ffe48a, #f5b730); color: #3a2a08; border: 2px solid #fff6cf; border-radius: 999px;
  box-shadow: 0 4px 0 #b98419, 0 0 0 0 rgba(255, 214, 90, .7); animation: bob 1.4s ease-in-out infinite, glow 1.4s ease-out infinite; }
#doorBtn.appear { animation: pop-in .45s cubic-bezier(.2, 1.6, .4, 1), bob 1.4s ease-in-out .45s infinite, glow 1.4s ease-out infinite; }
#doorBtn::before { content: ""; position: absolute; inset: 0; border-radius: inherit; overflow: hidden; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat; animation: shine 2.2s ease-in-out infinite; }
#doorBtn .door-ico { font-size: 22px; animation: wiggle 1.4s ease-in-out infinite; display: inline-block; }
#doorBtn .door-key { font-size: 11px; font-weight: 800; background: rgba(58,42,8,.18); border: 1px solid rgba(58,42,8,.35); border-radius: 6px; padding: 1px 6px; }
#doorBtn .sp { position: absolute; font-style: normal; color: #fff3a6; text-shadow: 0 0 6px #ffd34d; pointer-events: none; animation: twinkle 1.6s ease-in-out infinite; }
#doorBtn .s1 { top: -12px; left: 8px; font-size: 14px; }
#doorBtn .s2 { top: -8px; right: 2px; font-size: 18px; animation-delay: .5s; }
#doorBtn .s3 { bottom: -10px; right: 34px; font-size: 13px; animation-delay: 1s; }
@keyframes bob { 50% { transform: translate(-50%, -5px); } }
@keyframes glow { 0% { box-shadow: 0 4px 0 #b98419, 0 0 0 0 rgba(255, 214, 90, .75); } 100% { box-shadow: 0 4px 0 #b98419, 0 0 0 16px rgba(255, 214, 90, 0); } }
@keyframes pop-in { 0% { transform: translate(-50%, 30px) scale(.4); opacity: 0; } 100% { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes shine { 0%, 40% { background-position: -150% 0; } 100% { background-position: 250% 0; } }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 85% { transform: rotate(10deg); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { #doorBtn, #doorBtn *, #doorBtn::before { animation: none !important; } }
.hint { position: fixed; left: 12px; bottom: 96px; z-index: 15; font-size: 12px; color: #fff; background: rgba(27,21,48,.7); border-radius: 8px; padding: 5px 9px; }

#roomHud { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 19; display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px 8px 14px; max-width: calc(100vw - 16px); }
.room-title { display: flex; flex-direction: column; line-height: 1.25; }
.room-title span { font-size: 12.5px; color: var(--muted); }

/* notifications */
#notifs { position: fixed; right: 12px; top: 64px; z-index: 55; display: flex; flex-direction: column; gap: 8px; width: min(320px, calc(100vw - 24px)); }
.notif { background: var(--panel-solid); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: slidein .25s ease-out; }
.notif .who { font-size: 12.5px; color: var(--muted); }
.notif .say { font-size: 17px; font-weight: 700; margin: 2px 0 8px; }
.notif .acts { display: flex; gap: 5px; flex-wrap: wrap; }
.notif { position: relative; }
.notif.req { border-left-color: var(--good); }
.notif-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.notif-x:hover { background: var(--panel-2); color: inherit; }
.notif.req .say { padding-right: 22px; font-size: 15.5px; }
.notif .acts button.yes { background: var(--good); color: #10301d; }
.menu button.has-badge { position: relative; }
.nbadge { position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-weight: 800; box-shadow: 0 0 0 2px var(--panel-solid); }
.req-box { border: 1px solid var(--good); border-radius: 12px; padding: 10px 12px; }
.invite-link { padding: 9px 11px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; word-break: break-all; user-select: all; margin-bottom: 8px; }
.invite-note { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: rgba(127,224,164,.15); border: 1px solid rgba(127,224,164,.5); font-size: 13.5px; }
.notif .acts button { border: 0; border-radius: 8px; padding: 5px 9px; background: #fff; color: #2a2440; font-size: 12.5px; font-weight: 700; cursor: pointer; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
#toasts { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 56; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(20,16,36,.92); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 14px; animation: fadeup 2.8s forwards; max-width: 90vw; text-align: center; }
.toast.gold { color: var(--accent); font-weight: 700; }
@keyframes fadeup { 0% { opacity: 0; transform: translateY(8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; text-align: center; background: #e5534b; padding: 8px; font-weight: 700; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(10,8,20,.5); padding: 12px; }
.modal-card { width: min(560px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.modal-card.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }
.x { border: 0; background: var(--panel-2); width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
.modal-body { padding: 14px 16px 18px; overflow-y: auto; }
.section { margin-bottom: 16px; }
.section h3 { font-size: 13px; color: var(--muted); margin: 0 0 8px; font-weight: 600; text-transform: none; }

.code-box { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: clamp(22px, 6vw, 30px); letter-spacing: .08em; text-align: center; background: #fff; color: #2a2148; border-radius: 12px; padding: 16px 8px; margin: 12px 0; font-weight: 800; user-select: all; }
.warn { background: rgba(229,83,75,.15); border: 1px solid rgba(229,83,75,.4); color: #ffc9c4; border-radius: 10px; padding: 9px 11px; font-size: 13.5px; }

/* lists */
.list { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.item .grow { flex: 1; min-width: 0; }
.item .sub { font-size: 12.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #777; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.room-bar { height: 6px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; margin-top: 5px; }
.room-bar i { display: block; height: 100%; background: var(--good); }
.room-bar.full i { background: var(--bad); }
.badge { font-size: 11.5px; background: var(--accent); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px; font-weight: 700; }

/* map */
.map-wrap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.map-wrap img { width: 100%; display: block; image-rendering: pixelated; }
.map-pin { position: absolute; transform: translate(-50%, -100%); background: rgba(27,21,48,.85); border: 1px solid var(--line); color: #fff; border-radius: 8px; padding: 2px 6px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.map-pin b { color: var(--good); margin-left: 3px; }
.map-pin:hover { background: var(--primary); }
.map-me, .map-friend { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid #fff; background: #f2c744; box-shadow: 0 0 0 3px rgba(242,199,68,.35); }
.map-friend { background: #7fe0a4; width: 10px; height: 10px; margin: -5px 0 0 -5px; }

/* shop */
/* preview stays at the top of the shop window while the list scrolls (phones: you see what you try on) */
.shop-top { position: sticky; top: -14px; z-index: 3; display: flex; gap: 12px; align-items: center; margin: -14px -16px 12px; padding: 12px 16px; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.shop-top .try-item { display: grid; place-items: center; min-width: 56px; }
.shop-top .try-item img { max-height: 64px; width: auto; }
.shop-top .try-name { font-weight: 800; font-size: 14px; line-height: 1.3; }
.shop-top .try-act { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.shop-top .try-act .btn { white-space: normal; max-width: 150px; font-size: 13px; }
.btn.armed { outline: 2px solid #fff; animation: armedPulse .8s ease-in-out infinite alternate; }
@keyframes armedPulse { from { filter: brightness(1); } to { filter: brightness(1.25); } }
.card.pick { cursor: pointer; font: inherit; color: inherit; }
.card.trying, .sw.trying { outline: 3px solid #fff; outline-offset: 1px; }
.shop-top img { width: 64px; image-rendering: pixelated; background: radial-gradient(circle at 50% 70%, rgba(255,255,255,.18), transparent 70%); border-radius: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 13px; }
.tabs button.on { background: #fff; color: #2a2148; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.card.equipped { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card img { height: 52px; image-rendering: pixelated; }
.card .ico { font-size: 30px; height: 52px; display: grid; place-items: center; }
.card .nm { font-size: 13px; font-weight: 600; }
.card .btn { padding: 4px 10px; font-size: 12.5px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
.sw { aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; cursor: pointer; position: relative; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
.sw.owned::after { content: "✓"; position: absolute; top: 2px; right: 5px; font-size: 11px; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--primary-2); }

/* timer */
.timer-big { font-size: 56px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; margin: 6px 0 12px; }
.seg { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.seg button.on { background: #fff; color: #2a2148; font-weight: 700; }

.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.langs button { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 15px; }
.langs button.on { background: #fff; color: #2a2148; font-weight: 700; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch input { width: auto; transform: scale(1.3); }

/* mobile */
@media (max-width: 1240px) {
  .menu button .lbl { display: none; }
  .menu button { font-size: 17px; padding: 7px 9px; }
  .menu .lang-menu .lang-name { font-size: 13px; }
}
@media (max-width: 860px) {
  .menu .lang-menu .lang-name { display: none; }
  .menu button { padding: 7px 8px; font-size: 18px; }
  .place { display: none; }
  .brand { font-size: 16px; }
  .chip.online { display: none; }
  #greetbar { flex-wrap: wrap; justify-content: center; width: calc(100vw - 16px); border-radius: 14px; }
  .nearby { order: -1; }
  #greetbar select { order: -1; }
  .phrases { width: 100%; }
  #doorBtn { bottom: 200px; max-width: calc(100vw - 32px); white-space: normal; }
  .hint { display: none; }
  #notifs { top: auto; bottom: 250px; right: 8px; }
  #roomHud { top: 56px; gap: 8px; }
  #roomHud > .small { display: none; }
}
@media (max-width: 420px) {
  .brand { display: none; }
}
html[data-lang="th"] body, html[data-lang="th"] button, html[data-lang="th"] input { font-family: "Noto Sans Thai", var(--font); }
html[data-lang="hi"] body, html[data-lang="hi"] button, html[data-lang="hi"] input { font-family: "Noto Sans Devanagari", var(--font); }
.card.body-pick { cursor: pointer; font: inherit; color: inherit; transition: transform .12s; }
.card.body-pick:hover { transform: translateY(-2px); border-color: var(--primary-2); }
.group-h { font-size: 13px; color: var(--ink); margin: 16px 0 8px; font-weight: 700; display: flex; align-items: baseline; gap: 4px; }
.group-h:first-of-type { margin-top: 4px; }
.swatches { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
.swatches .sw { font-size: 10px; }

/* status picker: coloured dot + select */
.status-pick { display: inline-flex; align-items: center; gap: 4px; }
.status-dot { font-size: 13px; line-height: 1; text-shadow: 0 0 6px currentColor; }

/* ---------- zoom buttons ---------- */
.zoom-ctl { position: fixed; right: 10px; bottom: calc(var(--bot-ui, 90px) + 10px); z-index: 18; display: flex; flex-direction: column; gap: 6px; }
.zoom-ctl button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.zoom-ctl button:active { transform: scale(.94); }

/* ---------- phones: every bar stays on one line ---------- */
@media (max-width: 600px), (max-height: 500px) {
  #topbar { gap: 6px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
  .menu { margin-left: 0; flex: 1; justify-content: space-between; min-width: 0; overflow: hidden; }
  .menu button { padding: 6px 4px; font-size: 18px; gap: 0; }
  .menu .lang-menu { border: 0; }
  .chips { flex: none; }
  .chip.points { padding: 4px 9px; font-size: 13px; }
  .chip.points .q { display: none; }

  /* room bar: name · room · count on one line (ellipsis), leave button always visible on the right */
  #roomHud { top: calc(var(--top-ui, 52px) + 6px); left: 8px; right: 8px; transform: none; max-width: none; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 12px; }
  .room-title { flex: 1; min-width: 0; flex-direction: row; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
  #roomName { overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 14px; }
  #roomInfo { flex: none; font-size: 12px; }
  #roomHud .btn { flex: none; padding: 7px 12px; white-space: nowrap; font-size: 13.5px; }
  #roomReport { padding: 7px 9px !important; }

  /* bottom bar: status dot button + one scrolling row of phrases */
  #greetbar { flex-wrap: nowrap; width: calc(100vw - 16px); padding: 6px; gap: 6px; border-radius: 14px; }
  .nearby { display: none; }
  .status-pick { position: relative; flex: none; width: 42px; height: 42px; justify-content: center; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
  .status-dot { font-size: 20px; }
  #statusSel { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .phrases { width: auto; flex: 1; min-width: 0; }
  .phrases button { padding: 9px 11px; font-size: 13.5px; }
  #doorBtn { bottom: calc(var(--bot-ui, 70px) + 14px); }
  #notifs { bottom: calc(var(--bot-ui, 70px) + 70px); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .menu { justify-content: flex-end; gap: 4px; }
  .menu button { padding: 6px 8px; }
  #roomHud { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100vw - 16px)); }
}
@media (max-width: 600px), (max-height: 500px) {
  /* shop tabs: one scrolling row instead of three wrapped rows */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
}
.medal-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.medal-bar > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f2c744, #ff9f43); }
/* the language window must sit above the start screen (it opens from the 🌐 button there) */
body:has(#start:not(.hidden)) #modal { z-index: 60; }
.about { margin-top: 12px; text-align: left; font-size: 13px; line-height: 1.55; color: var(--muted); }
.about summary { text-align: center; cursor: pointer; list-style: none; font-weight: 700; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: " ▾"; }
.about[open] summary::after { content: " ▴"; }
.about p { margin: 8px 0 6px; }
.about ul { margin: 0; padding-left: 18px; }
.about li { margin: 2px 0; }
/* phones: greeting cards are small and slim, reply buttons in one swipeable row (they used to cover the map) */
@media (max-width: 600px), (max-height: 500px) {
  .notif { padding: 7px 10px; border-radius: 10px; }
  .notif .who { font-size: 11.5px; }
  .notif .say { font-size: 14.5px; margin: 1px 0 5px; }
  .notif.greet .small.muted { display: none; }
  .notif.greet .acts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .notif.greet .acts::-webkit-scrollbar { display: none; }
  .notif.greet .acts button { flex: none; padding: 4px 8px; font-size: 12px; }
}
/* café signs: real buttons laid over the map (placed by WorldScene.placeSigns), crisp and the same size at any zoom */
#cafeSigns { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#cafeSigns[hidden] { display: none; }
.cafe-sign { position: absolute; left: 0; top: 0; pointer-events: auto; white-space: nowrap; cursor: pointer;
  padding: 5px 11px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.9); background: var(--c, #3E4C8A); color: #fff;
  font: 400 14px/1.15 "Jua", system-ui, sans-serif; letter-spacing: 0.2px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); will-change: transform; -webkit-tap-highlight-color: transparent; }
.cafe-sign b { font-weight: 400; }
.cafe-sign span { opacity: 0.9; font-size: 12px; }
.cafe-sign.on { background: #E8A21C; animation: signPulse .8s ease-in-out infinite alternate; }
@keyframes signPulse { from { box-shadow: 0 0 0 0 rgba(255, 210, 80, 0.8); } to { box-shadow: 0 0 0 6px rgba(255, 210, 80, 0); } }
@media (max-width: 600px) { .cafe-sign { font-size: 13px; padding: 4px 9px; } .cafe-sign span { font-size: 11px; } }
