* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d2029; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #fff; }
#world { position: fixed; inset: 0; width: 100vw; height: 100dvh; touch-action: none; display: block; }

.pill { position: fixed; background: rgba(20, 22, 30, .78); backdrop-filter: blur(6px); padding: 6px 12px; border-radius: 999px; font-size: 13px; pointer-events: none; }
#zone { left: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); font-weight: 600; }
#hint { right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); opacity: .8; }

#tiles { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 0 10px; pointer-events: none; }
.tile { position: relative; width: 160px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #2b2f3c; box-shadow: 0 4px 18px rgba(0,0,0,.4); border: 2px solid transparent; pointer-events: auto; }
.tile.self { width: 110px; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.self video { transform: scaleX(-1); }
.tile .label { position: absolute; left: 6px; bottom: 6px; font-size: 12px; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 999px; }
.tile .avatar { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; }
.tile.nocam .avatar { display: flex; }
.tile.self.sharing video { transform: none; }
.tile.screen { order: -1; width: min(92vw, 860px); aspect-ratio: 16 / 9; cursor: zoom-in; }
.tile.screen video { object-fit: contain; background: #000; }
.tile.expanded { position: fixed; inset: 0; width: 100vw; height: 100dvh; aspect-ratio: auto; border-radius: 0; border: 0; z-index: 30; cursor: zoom-out; }
@media (max-width: 600px) { .tile.screen { width: 92vw; } }
.tile.nocam video { visibility: hidden; }
@media (max-width: 600px) { .tile { width: 112px; } .tile.self { width: 76px; } }

#controls { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.ctl { width: 52px; height: 52px; border-radius: 50%; border: 0; font-size: 22px; cursor: pointer; background: #e7484f; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ctl.on { background: #f2f3f7; }
.ctl.sharing { background: #4f7cff; }
.ctl[hidden] { display: none; }

#join { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 17, 24, .82); backdrop-filter: blur(4px); padding: 16px; z-index: 10; }
.card { background: #262a36; border-radius: 18px; padding: 22px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.sub { margin: 0 0 14px; color: #aab0c0; font-size: 14px; }
.preview { position: relative; aspect-ratio: 4 / 3; background: #161922; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#camStatus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; font-size: 14px; color: #aab0c0; }
#nameInput, #passInput { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #3a3f4e; background: #1b1e28; color: #fff; font-size: 16px; margin-bottom: 12px; }
#colors { display: flex; gap: 8px; margin-bottom: 16px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.sel { border-color: #fff; }
#enterBtn { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: #4f7cff; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }

#banner { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #262a36; padding: 16px 20px; border-radius: 12px; z-index: 20; text-align: center; cursor: pointer; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
