* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1636; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; color: #1d1830; }
canvas#view { position: fixed; inset: 0; touch-action: none; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.coin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a6, #f0c419 45%, #b8860b); box-shadow: inset 0 0 0 1.5px #a07a0a; vertical-align: -2px; margin-right: 5px; }

/* HUD */
#topbar { position: fixed; top: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: center; pointer-events: none; }
#topbar > * { pointer-events: auto; }
#roomname { background: rgba(20, 16, 40, .75); color: #fff; padding: 7px 14px; border-radius: 10px; font-weight: 700; backdrop-filter: blur(6px); }
.zoom { margin-left: auto; display: flex; gap: 4px; }
.zoom button { width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(20, 16, 40, .75); color: #fff; font-size: 16px; }
#coins { background: #fff; padding: 5px 6px 5px 12px; border-radius: 10px; display: flex; align-items: center; font-size: 15px; box-shadow: 0 3px 0 #c9bfe6; }
#coins b { min-width: 34px; }
#btn-buy { margin-left: 8px; width: 26px; height: 26px; border-radius: 7px; border: 0; background: #3fbf6f; color: #fff; font-weight: 800; }

#bottombar { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(20, 16, 40, .82); padding: 6px; border-radius: 14px; backdrop-filter: blur(6px); max-width: calc(100vw - 16px); }
#bottombar > button { border: 0; background: rgba(255, 255, 255, .08); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 18px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
#bottombar > button span { font-size: 10.5px; opacity: .85; margin-top: 2px; }
#bottombar > button:hover { background: rgba(255, 255, 255, .18); }
#chat { display: flex; gap: 4px; }
#chatin { width: 260px; border: 0; border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; }
#chat button { border: 0; border-radius: 10px; background: #5b8def; color: #fff; padding: 0 12px; font-size: 16px; }
#chatlog { position: fixed; left: 10px; bottom: 84px; width: 300px; max-height: 160px; overflow-y: auto; color: #fff; font-size: 12.5px; text-shadow: 0 1px 2px #000; pointer-events: none; display: flex; flex-direction: column; gap: 2px; opacity: .9; }
#chatlog:empty { display: none; }

#furnipanel { position: fixed; right: 12px; bottom: 84px; background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
#furnipanel .fp b { display: block; margin-bottom: 6px; }
#placehint { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 12px; padding: 7px 8px 7px 14px; display: flex; gap: 8px; align-items: center; font-size: 13.5px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }

/* buttons */
.btn { border: 0; background: #5b8def; color: #fff; border-radius: 10px; padding: 9px 16px; font-weight: 700; box-shadow: 0 3px 0 #3c66b8; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #3c66b8; }
.btn.ghost { background: #eceaf5; color: #2d2550; box-shadow: 0 3px 0 #cfcae3; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 13px 24px; font-size: 17px; background: #3fbf6f; box-shadow: 0 4px 0 #2a8f50; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .price .coin { width: 13px; height: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }

/* windows */
#windows .win { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: 440px; max-width: calc(100vw - 16px); max-height: calc(100vh - 160px); display: flex; flex-direction: column; background: #f7f6fc; border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); overflow: hidden; z-index: 5; }
#windows .win.wide { width: 780px; }
.win-head { background: linear-gradient(#6c5ce7, #5446c9); color: #fff; padding: 9px 12px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; cursor: move; user-select: none; }
.win-head .x { border: 0; background: rgba(255, 255, 255, .18); color: #fff; width: 26px; height: 26px; border-radius: 7px; font-size: 18px; line-height: 1; }
.win-body { padding: 14px; overflow-y: auto; }
.note { color: #5b557a; font-size: 13.5px; margin: 0 0 12px; }
h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #6b6590; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { border: 0; background: #eceaf5; border-radius: 10px; padding: 8px 14px; font-weight: 700; color: #4a4370; }
.tab.on { background: #6c5ce7; color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.card { background: #fff; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; box-shadow: 0 2px 0 #e3e0f0; }
.card b { font-size: 13px; }
.card small { font-size: 11.5px; color: #7a7499; min-height: 14px; }
.card.rare { background: linear-gradient(#fff8dc, #fff); box-shadow: 0 2px 0 #f0d77a, inset 0 0 0 1.5px #f0c419; }
.card.click { cursor: pointer; }
.card.click:hover { box-shadow: 0 0 0 2px #6c5ce7; }
.card .btn { margin-top: 4px; }
.pack .pile { font-size: 40px; }
.clothes { display: flex; gap: 14px; }
.tryon { width: 170px; flex: none; background: linear-gradient(#e6e2fa, #fff); border-radius: 12px; display: flex; flex-direction: column; align-items: center; padding: 10px; align-self: flex-start; position: sticky; top: 0; }
.tryon small { font-size: 12px; color: #6b6590; text-align: center; }
.clothes .grid { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 0; background: #eceaf5; border-radius: 8px; padding: 5px 9px; font-size: 12.5px; color: #3a3360; }
.chip.on { background: #6c5ce7; color: #fff; }
.chip.more { background: #fff3c4; color: #7a5c00; }
.chip.sp { display: flex; flex-direction: column; align-items: center; padding: 4px 6px 5px; }
.chip.sp small { font-size: 11px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid rgba(0, 0, 0, .15); }
.sw.on { outline: 3px solid #6c5ce7; outline-offset: 1px; }
.sw.custom { position: relative; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; cursor: pointer; }
.sw.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

.editor { display: flex; gap: 16px; }
.stage { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; background: linear-gradient(#cfe7ff, #f2e9ff); border-radius: 14px; padding: 10px; align-self: flex-start; }
.preview { width: 200px; height: 230px; }
.controls { flex: 1; min-width: 0; }
.controls input:not([type=color]) { width: 100%; border: 2px solid #e0dcf0; border-radius: 9px; padding: 8px 10px; font-size: 14px; }

.nav .room-card { display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; gap: 10px; }
.nav .room-card small { display: block; color: #7a7499; font-size: 12px; }
.rc-right { display: flex; gap: 6px; align-items: center; }
.users { font-size: 12.5px; color: #5b557a; }
.profile { display: flex; gap: 14px; align-items: center; }
.profile small { display: block; color: #7a7499; margin: 2px 0 10px; }

/* creator */
#creator { position: fixed; inset: 0; display: flex; background: radial-gradient(circle at 30% 20%, #4b3d8f, #1b1636 70%); padding: 12px; overflow-y: auto; z-index: 10; }
.creator-card { margin: auto; background: #f7f6fc; border-radius: 20px; padding: 22px; width: 820px; max-width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.logo { font-size: 30px; font-weight: 900; color: #5446c9; }
.sub { margin: 2px 0 14px; color: #6b6590; }
.creator-card .row { margin-top: 16px; flex-wrap: nowrap; }
.creator-card .name { flex: 1; border: 2px solid #e0dcf0; border-radius: 12px; padding: 12px 14px; font-size: 16px; }

#toasts { position: fixed; top: 60px; right: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 20; }
.toast { background: #1d1830; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateX(20px); }

@media (max-width: 760px) {
  #bottombar > button span { display: none; }
  #bottombar { gap: 3px; padding: 4px; }
  #bottombar > button { padding: 6px 7px; }
  #chatin { width: 90px; }
  #bottombar { overflow-x: auto; justify-content: flex-start; }
  #chatlog { display: none; }
  .editor, .clothes { flex-direction: column; }
  .stage, .tryon { align-self: center; }
  #roomname { font-size: 13px; }
}
