:root{--navy:#101a35;--blue:#43b9e8;--cyan:#8ce5f4;--ink:#1b2944;--muted:#71809b;--paper:#fff;--line:#e8edf5}
*{box-sizing:border-box}body{margin:0;font-family:Nunito,system-ui,sans-serif;color:var(--ink);background:#eef4fb;min-height:100vh}button,input{font:inherit}.hidden{display:none!important}.auth-shell{min-height:100vh;display:grid;grid-template-columns:1fr 1fr;max-width:1240px;margin:auto;background:white;box-shadow:0 24px 80px #14294a18}.brand-panel{position:relative;overflow:hidden;background:linear-gradient(145deg,#111d3c,#183d66);color:white;padding:64px clamp(28px,6vw,82px);display:flex;flex-direction:column;align-items:flex-start;justify-content:center}.brand-mark{width:48px;height:48px;border-radius:16px;background:linear-gradient(135deg,#79e4ef,#39aee6);display:grid;place-items:center;color:#102344;font-size:30px;font-weight:1000;box-shadow:0 10px 30px #42c5e766}.wordmark{font-size:54px;font-weight:1000;letter-spacing:3px;margin-top:18px}.wordmark span{color:#72dff1}.tagline{margin:0;font-size:18px;color:#bdeefa;font-weight:800}.brand-note{max-width:370px;line-height:1.7;color:#d0d9ea;margin-top:24px}.mini-world{position:relative;width:min(100%,440px);height:250px;margin-top:35px;background:linear-gradient(#8adcf0 0 48%,#9bdc9d 48%);border-radius:24px;overflow:hidden;box-shadow:0 22px 55px #07132966}.hill{position:absolute;bottom:-75px;left:-30px;width:520px;height:190px;background:#66bd81;transform:rotate(-9deg);border-radius:50%}.path{position:absolute;bottom:-75px;left:145px;width:150px;height:220px;background:#f3d49b;transform:rotate(38deg);border-radius:50%}.house{position:absolute;bottom:74px;left:160px;width:120px;height:92px;background:#fff0c8;border:5px solid #fff;border-radius:8px;box-shadow:0 8px 0 #d8a66e}.house:before{content:"";position:absolute;top:-45px;left:-10px;border-left:65px solid transparent;border-right:65px solid transparent;border-bottom:48px solid #ef866e}.house i{position:absolute;bottom:0;left:43px;width:27px;height:48px;background:#8c6b58}.house b{position:absolute;top:20px;right:12px;width:24px;height:25px;background:#83d8e7;border:3px solid white}.tree{position:absolute;bottom:95px;width:18px;height:70px;background:#8a5d42}.tree:before{content:"";position:absolute;left:-25px;top:-42px;width:68px;height:68px;background:#37a978;border-radius:50%;box-shadow:inset -8px -8px #268b69}.t1{left:75px}.t2{right:65px;transform:scale(.8)}.cloud{position:absolute;width:72px;height:20px;border-radius:30px;background:#fff;top:35px}.cloud:before{content:"";position:absolute;width:34px;height:34px;background:white;border-radius:50%;left:15px;top:-16px}.c1{left:45px}.c2{right:50px;top:65px;transform:scale(.7)}.tiny-person{position:absolute;z-index:2;bottom:54px;left:310px;width:20px;height:36px}.tiny-person:before{content:"";position:absolute;top:0;left:4px;width:13px;height:13px;background:#f2b58b;border-radius:50%}.tiny-person i{position:absolute;top:13px;left:2px;width:17px;height:20px;background:#f08b63;border-radius:7px}.form-panel{display:grid;place-items:center;padding:42px}.form-wrap{width:min(100%,390px)}.eyebrow{font-size:10px;font-weight:1000;letter-spacing:2px;color:#39a9d7}.form-wrap h1,.lobby-head h1{font-size:34px;line-height:1.1;margin:10px 0 8px;font-weight:1000;letter-spacing:-1px}.muted,.lobby-head p{color:var(--muted);margin:0 0 26px}.tabs{display:flex;gap:8px;padding:5px;background:#f1f5fa;border-radius:12px;margin-bottom:24px}.tab{border:0;background:transparent;color:#71809b;padding:11px;border-radius:9px;flex:1;font-weight:900;cursor:pointer}.tab.active{background:#fff;color:#1b2944;box-shadow:0 2px 8px #1a31521a}label{display:block;font-size:12px;font-weight:900;margin:15px 0;color:#34425d}input{display:block;width:100%;margin-top:7px;border:1px solid #dfe6f0;border-radius:11px;padding:14px 15px;outline:none;color:#1b2944;background:#fbfcfe}input:focus{border-color:#48b9e4;box-shadow:0 0 0 3px #48b9e41c}.primary{width:100%;border:0;border-radius:11px;padding:15px;background:linear-gradient(100deg,#3caee0,#55cce0);color:#092746;font-weight:1000;cursor:pointer;margin-top:12px;box-shadow:0 9px 22px #39b4df40}.primary span{float:right;font-size:19px}.message{min-height:22px;color:#c34e56;font-size:12px;font-weight:800}.fineprint{font-size:11px;color:#9aa5b6;line-height:1.6;margin-top:25px}.game-shell{max-width:1180px;margin:auto;min-height:100vh;background:#f6f9fd;padding:0 28px 24px}.topbar{height:76px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.game-logo{font-size:23px;font-weight:1000;letter-spacing:2px}.game-logo span{display:inline-grid;place-items:center;width:32px;height:32px;background:#42b9e6;border-radius:10px;color:#0f2944;margin-right:7px}.top-actions{display:flex;align-items:center;gap:18px;font-size:13px;font-weight:900}.logout{border:0;background:#eaf4fa;color:#257da7;border-radius:9px;padding:9px 15px;font-weight:900;cursor:pointer}.lobby-head{display:flex;align-items:end;justify-content:space-between;padding:28px 0 18px}.lobby-head h1{font-size:30px}.lobby-head p{margin:0}.online-pill{background:#e6f8ef;color:#268b5b;border-radius:30px;padding:9px 14px;font-size:11px;font-weight:900}.online-pill i{display:inline-block;width:7px;height:7px;background:#36bd79;border-radius:50%;margin-right:6px}.world-frame{position:relative;height:min(62vh,570px);min-height:360px;border-radius:22px;overflow:hidden;background:#b8e9f3;box-shadow:0 16px 45px #193b5a20;border:5px solid white}#worldCanvas{width:100%;height:100%;display:block;touch-action:none}.world-hint,.world-label{position:absolute;background:#102744d9;color:white;border-radius:9px;padding:9px 12px;font-size:11px;font-weight:900;pointer-events:none}.world-hint{bottom:15px;left:15px}.world-label{top:15px;left:15px;letter-spacing:1px}.game-footer{display:flex;justify-content:space-between;align-items:center;padding:18px 4px}.avatar-chip{display:flex;align-items:center;gap:10px}.avatar-mini{width:38px;height:38px;border-radius:13px;background:#d8f4fa;display:grid;place-items:center;color:#1686b5;font-size:25px}.avatar-chip b,.avatar-chip small{display:block}.avatar-chip small{font-size:10px;color:#8592a6}.footer-tip{font-size:12px;color:#8190a6;font-weight:800}@media(max-width:760px){.auth-shell{grid-template-columns:1fr}.brand-panel{padding:28px 26px 20px;min-height:300px}.mini-world{height:145px;margin-top:18px}.brand-note{margin-top:12px;font-size:13px}.wordmark{font-size:40px}.form-panel{padding:35px 25px}.game-shell{padding:0 12px 15px}.world-frame{height:58vh;min-height:330px}.lobby-head{align-items:start;gap:10px;flex-direction:column}.footer-tip{display:none}}

.zuno-panel {
  background: #182640;
  color: #fff;
  padding: 1rem;
  border: 1px solid #475c7e;
  border-radius: 1rem;
}
.zuno-panel h2 { margin: .3rem 0 .7rem; font-size: 1.1rem; }
#admin .zuno-panel { margin: 1rem auto; max-width: 42rem; }
#chatLog { padding: 0; list-style: none; max-height: 9rem; overflow: auto; overflow-wrap: anywhere; }
#chatForm { display: flex; gap: .6rem; }
#chatForm input { min-width: 0; flex: 1; }
#interaction { margin: .4rem 0; }
#worldCanvas { touch-action: none; }
.zuno-panel label { color: #e0ebff; }
@media (max-width: 500px) {
  .top-actions { gap: .45rem; }
  .top-actions .logout { padding-inline: .65rem; }
  #welcome { display: none; }
}

#chatMessage:empty { display: none; }

#game {
  position: fixed;
  inset: 0;
  max-width: none;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #b5e2f1;
}
#game .world-frame {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#worldCanvas { cursor: crosshair; }
#speechLayer { position: absolute; inset: 0; pointer-events: none; }
.speech-bubble {
  position: absolute;
  transform: translate(-50%,-100%);
  width: max-content;
  max-width: min(240px, 45vw);
  padding: .45rem .7rem;
  border: 2px solid #24334c;
  border-radius: .85rem;
  background: #fffdf2;
  color: #202d45;
  font-weight: 800;
  font-size: .86rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 0 #20334c40;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  left: calc(50% - 5px);
  bottom: -6px;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: inherit;
  border-right: 2px solid #24334c;
  border-bottom: 2px solid #24334c;
}
.plaza-header {
  position: absolute;
  inset: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) auto max(.75rem, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  pointer-events: none;
}
.plaza-identity, .plaza-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.plaza-identity {
  padding: .45rem .75rem;
  border-radius: .85rem;
  background: #122844;
  color: #fff;
  box-shadow: 0 3px 0 #12284440;
}
.plaza-mark { color: #6ce1e9; font-size: 1.7rem; font-weight: 1000; line-height: 1; }
.plaza-identity h1 { margin: 0; font-size: 1rem; white-space: nowrap; }
.plaza-identity p { margin: 0; font-size: .72rem; color: #c2e7f2; }
.plaza-actions button { pointer-events: auto; box-shadow: 0 3px 0 #12284436; }
.plaza-chat {
  position: absolute;
  bottom: max(.75rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 35rem);
  pointer-events: none;
}
.plaza-chat form, .plaza-chat details { pointer-events: auto; }
.plaza-chat form {
  align-items: center;
  background: #122844;
  border-radius: .85rem;
  padding: .35rem;
}
.plaza-chat input { margin: 0; padding: .6rem .75rem; font-size: 1rem; }
.plaza-chat details {
  width: fit-content;
  max-width: 100%;
  background: #122844;
  color: white;
  border-radius: .6rem;
  padding: .35rem .65rem;
  margin-bottom: .35rem;
  font-size: .82rem;
}
.plaza-chat details[open] { width: 100%; }
.plaza-chat summary { cursor: pointer; }
.plaza-chat #interaction:not(:empty), .plaza-chat #chatMessage:not(:empty) {
  width: fit-content;
  background: #122844;
  border-radius: .6rem;
  padding: .35rem .65rem;
  color: white;
}
@media (max-width: 440px) {
  .plaza-header { gap: .3rem; }
  .plaza-actions { gap: .25rem; }
  .plaza-actions button { padding: .45rem; font-size: .72rem; }
  .plaza-identity { padding: .35rem .5rem; }
}

#avatarDialog {
  width: min(94vw, 52rem);
  max-width: none;
  max-height: min(94dvh, 48rem);
  padding: 0;
  color: #1b3148;
  background: #faf7ed;
  border: 1px solid #e5decd;
  border-radius: 1.25rem;
  box-shadow: 0 22px 80px #10253e65;
}
#avatarDialog::backdrop { background: #091d3f96; }
#avatarDialog h2 { margin: 0; font-size: 1.4rem; letter-spacing: -.02em; }
.editor-header, .editor-actions { display: flex; align-items: center; gap: .55rem; padding: .85rem 1rem; }
.editor-header { justify-content: space-between; border-bottom: 1px solid #e9e1ce; }
.editor-body { display: grid; grid-template-columns: minmax(12rem,.85fr) minmax(0,1.15fr); gap: 1rem; padding: 1rem; }
.editor-preview {
  position: relative;
  height: 21rem;
  min-width: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: radial-gradient(ellipse at 52% 44%,#f4f1d5 0%,#c6ead8 45%,#78c4b6 100%);
}
#avatarPreview { width: 100%; height: 100%; display: block; }
.editor-rotation { position: absolute; bottom: .6rem; right: .6rem; display: flex; gap: .3rem; }
.editor-rotation button { padding: .35rem .65rem; font-size: 1.15rem; }
#avatarCategories { display: flex; gap: .28rem; flex-wrap: wrap; }
#avatarCategories button {
  border: 1px solid transparent;
  background: #e8eddf;
  color: #385365;
  padding: .48rem .64rem;
  border-radius: .6rem;
  cursor: pointer;
  font-weight: 850;
}
#avatarCategories button[aria-pressed="true"] { color: #fff; background: #263e57; }
#avatarFields { display: grid; grid-template-columns: 1fr; gap: .7rem; padding: .75rem 0 0; margin: 0; max-height: 17rem; overflow: auto; }
#avatarFields fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
#avatarFields legend { padding: 0 0 .27rem; font-size: .76rem; font-weight: 900; }
.editor-choices { display: flex; flex-wrap: wrap; gap: .24rem; }
#avatarFields .editor-choices label { margin: 0; color: #24364c; }
.editor-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; }
.editor-choices span {
  display: flex;
  align-items: center;
  gap: .34rem;
  min-height: 1.9rem;
  padding: .24rem .47rem;
  border: 1px solid #e4dfce;
  background: #fffdfa;
  border-radius: .55rem;
  cursor: pointer;
}
.editor-choices i { width: .85rem; aspect-ratio: 1; border: 1px solid #20364838; border-radius: 50%; }
.editor-choices input:checked + span { border-color: #267461; background: #ddf4e9; box-shadow: inset 0 0 0 1px #267461; }
.editor-choices input:focus-visible + span { outline: 2px solid #1c627f; outline-offset: 2px; }
.editor-actions { border-top: 1px solid #e9e1ce; }
.editor-actions .primary { width: auto; margin: 0 0 0 auto; padding: .66rem .85rem; }
.editor-actions button:disabled { opacity: .45; cursor: default; box-shadow: none; }
#avatarMessage { margin: 0; padding: 0 1rem .7rem; font-size: .85rem; color: #892e47; }
#avatarMessage:empty { display: none; }
@media (max-width: 610px) {
  .editor-body { grid-template-columns: minmax(0,1fr); gap: .65rem; padding: .65rem; }
  .editor-preview { height: min(26dvh, 15rem); }
  #avatarFields { max-height: min(28dvh, 13rem); }
  .editor-header, .editor-actions { padding: .65rem; }
  .editor-actions button { font-size: .75rem; padding: .52rem; }
  .editor-actions .primary { padding: .52rem; }
}
@media (max-width: 430px) {
  #avatarCategories { flex-wrap: nowrap; }
  #avatarCategories button { padding: .42rem .44rem; font-size: .81rem; }
}
#avatarPreview { touch-action: none; cursor: grab; }
#avatarPreview:active { cursor: grabbing; }
.world-connection {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: min(88vw, 24rem);
  padding: 1rem;
  border: 1px solid #49667f;
  border-radius: .9rem;
  background: #122844;
  color: #fff;
  text-align: center;
  box-shadow: 0 6px 20px #18374d45;
}
.world-connection p { margin: 0; font-weight: 800; }
.world-connection button { margin-top: .65rem; }
