/* Hangout — neon-noir UI over a pixel-art office. One look: deep night blacks, cyan neon, a hot pink accent,
   clipped-corner panels, Chakra Petch for words and Silkscreen for little pixel labels. */
:root {
  --bg: #07070d; --panel: #0e1019ee; --panel2: #151826; --line: #262b40; --text: #e6ebff; --dim: #8b93b3;
  --neon: #36e2ff; --pink: #ff3fa4; --amber: #ffb000; --good: #3cff8f; --bad: #ff4f6d;
  --cut: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  --cut-s: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 "Chakra Petch", system-ui, sans-serif; }
body.in-office { overflow: hidden; overscroll-behavior: none; }
a { color: var(--neon); }
input, textarea, select { font: inherit; color: var(--text); background: #0a0c14; border: 1px solid var(--line); padding: 9px 11px; width: 100%; outline: none; border-radius: 0; clip-path: var(--cut-s); }
input:focus, textarea:focus, select:focus { border-color: var(--neon); box-shadow: inset 0 0 0 1px var(--neon); }
textarea { resize: vertical; }
label { display: grid; gap: 4px; margin: 10px 0; color: var(--dim); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
h3, h4 { margin: 18px 0 8px; letter-spacing: .06em; text-transform: uppercase; }
h4 { font-size: 13px; color: var(--neon); }
.hint { color: var(--dim); font-size: 14px; margin: 6px 0; }
.bad { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.grow { flex: 1; }
kbd { font: 10px "Silkscreen", monospace; border: 1px solid var(--line); padding: 2px 5px; color: var(--dim); }

.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 14px "Chakra Petch", sans-serif; letter-spacing: .04em; text-transform: uppercase;
  background: var(--neon); color: #04131a; border: 0; padding: 9px 14px; cursor: pointer; text-decoration: none; clip-path: var(--cut-s); white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: #1a1e2e; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--neon); }
.btn.danger { background: #2a0f1a; color: #ff9ab0; box-shadow: inset 0 0 0 1px #5a1a2c; }
.btn.big { font-size: 18px; padding: 14px 22px; }
.btn.google { background: #fff; color: #222; font-size: 16px; padding: 12px 18px; }
.btn.google .g { font: 700 18px sans-serif; color: #4285f4; }
i.badge { font-style: normal; font: 10px "Silkscreen", monospace; background: var(--pink); color: #fff; padding: 1px 5px; border-radius: 8px; margin-left: 4px; }
i.badge[hidden] { display: none; }

/* ---------------------------------------------------------------- lobby pages */
.page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden; }
.hero { position: fixed; inset: 0; background: url(/art/title.webp) center / cover no-repeat; filter: saturate(1.15); }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(7,7,13,.25), rgba(7,7,13,.92) 70%), repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); }
.page main.card { position: relative; width: min(560px, 100%); background: var(--panel); padding: 28px; clip-path: var(--cut); box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(6px); }
.page main.card::before { content: ""; position: absolute; left: 0; top: 0; width: 60%; height: 2px; background: linear-gradient(90deg, var(--neon), var(--pink), transparent); }
.page footer { position: relative; margin-top: 18px; color: var(--dim); font-size: 12px; letter-spacing: .05em; }
.logo { font: 400 44px/1 "Silkscreen", monospace; margin: 0 0 12px; color: var(--text); text-shadow: 0 0 18px rgba(54,226,255,.55); letter-spacing: .04em; }
.logo span { color: var(--neon); }
.lead { font-size: 17px; color: #c8cfee; }
.wsname { font: 700 30px "Chakra Petch"; margin: 4px 0 16px; color: var(--neon); }
.who { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--panel2); clip-path: var(--cut-s); flex-wrap: wrap; }
.who > div { flex: 1; display: grid; min-width: 120px; }
.who small { color: var(--dim); }
.pic { display: inline-grid; place-items: center; background: #0a0c14; border-radius: 50%; overflow: hidden; }
.pic canvas { image-rendering: pixelated; display: block; }
.wslist { display: grid; gap: 8px; }
.ws { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel2); color: var(--text); text-decoration: none; clip-path: var(--cut-s); box-shadow: inset 3px 0 0 var(--neon); }
.ws:hover { background: #1c2134; }
.ws small { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.ws .arrow { margin-left: auto; color: var(--neon); }
.row input { flex: 1; width: auto; min-width: 160px; }

/* ---------------------------------------------------------------- the office */
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; image-rendering: pixelated; }
#loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); font: 12px "Silkscreen", monospace; color: var(--neon); z-index: 5; }
.spin { width: 34px; height: 34px; border: 3px solid #1b2033; border-top-color: var(--neon); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hud { position: relative; display: inline-flex; align-items: center; gap: 6px; background: var(--panel); color: var(--text); border: 0; padding: 9px 12px; font: 600 13px "Chakra Petch"; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; clip-path: var(--cut-s); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; }
.hud:hover, .hud.on { box-shadow: inset 0 0 0 1px var(--neon); color: var(--neon); }
.hud .badge { position: absolute; top: 2px; right: 2px; }
#top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; display: flex; gap: 8px; align-items: center; z-index: 3; }
#top .title { background: var(--panel); padding: 8px 14px; clip-path: var(--cut-s); display: grid; line-height: 1.15; }
#top .title b { font-size: 15px; letter-spacing: .04em; }
.status { font: 9px "Silkscreen", monospace; color: var(--dim); }
.status:empty { display: none; }
.status.bad { color: var(--amber); }
#tools { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 10px; display: flex; gap: 6px; z-index: 3; flex-wrap: wrap; justify-content: flex-end; }
#zoom { position: fixed; right: 10px; bottom: 16px; display: grid; gap: 6px; z-index: 3; }
#zoom .hud { width: 38px; justify-content: center; font-size: 18px; }
#help { position: fixed; left: 12px; bottom: 12px; font: 9px "Silkscreen", monospace; color: var(--dim); background: rgba(7,7,13,.6); padding: 5px 8px; z-index: 2; pointer-events: none; }

/* The "next to it" card. */
#near { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3; background: var(--panel); clip-path: var(--cut); box-shadow: inset 0 0 0 1px var(--neon), 0 0 24px rgba(54,226,255,.25); padding: 10px 12px; min-width: 300px; max-width: calc(100vw - 120px); animation: rise .18s ease-out; }
#near[hidden] { display: none; }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }
.cardrow { display: flex; align-items: center; gap: 10px; }
.cardrow .ico { font-size: 22px; }
.cardtext { display: grid; flex: 1; min-width: 0; }
.cardtext b, .cardtext small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardtext small { color: var(--dim); }
.btn.go { background: var(--good); color: #04160b; }

/* Build palette. */
#palette { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(860px, calc(100vw - 80px)); z-index: 4; background: var(--panel); clip-path: var(--cut); box-shadow: inset 0 0 0 1px var(--amber); padding: 10px; }
#palette[hidden] { display: none; }
.ptools { display: flex; gap: 6px; flex-wrap: wrap; }
.ptool, .pitem { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; background: var(--panel2); color: var(--text); border: 0; padding: 6px 10px; cursor: pointer; font: 600 11px "Chakra Petch"; text-transform: uppercase; clip-path: var(--cut-s); }
.ptool { flex-direction: row; font-size: 13px; gap: 6px; }
.ptool.on, .pitem.on { box-shadow: inset 0 0 0 1px var(--amber); color: var(--amber); }
.ptool.done { margin-left: auto; background: var(--amber); color: #1a1000; }
.items { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
.pitem { flex: 0 0 auto; width: 82px; }
.pitem img { height: 44px; max-width: 70px; object-fit: contain; image-rendering: pixelated; }
.pitem .ph { height: 44px; }
.pitem span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 76px; }
.selbar { display: flex; gap: 10px; align-items: center; padding: 8px 2px 0; color: var(--dim); }
.selbar b { color: var(--amber); }

/* Chat. */
#chat { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 4; background: var(--panel); box-shadow: -1px 0 0 var(--line), -20px 0 40px rgba(0,0,0,.4); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .2s ease; }
#chat.open { transform: none; }
#chat header { display: flex; align-items: center; gap: 6px; padding: max(10px, env(safe-area-inset-top)) 10px 8px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--dim); font: 600 13px "Chakra Petch"; text-transform: uppercase; padding: 6px 8px; cursor: pointer; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.tabs button.on { color: var(--neon); box-shadow: inset 0 -2px 0 var(--neon); }
button.x { background: none; border: 0; color: var(--dim); font-size: 16px; cursor: pointer; padding: 4px 8px; }
button.x:hover { color: var(--text); }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.msg { max-width: 88%; align-self: flex-start; }
.msg .who { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; padding: 0; background: none; clip-path: none; }
.msg .who small { color: var(--dim); font-size: 11px; }
.msg p { margin: 2px 0; background: var(--panel2); padding: 7px 10px; clip-path: var(--cut-s); word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; }
.msg.mine .who { justify-content: flex-end; }
.msg.mine p { background: #10313a; }
.compose { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.compose[hidden] { display: none; }
.compose textarea { min-height: 40px; max-height: 120px; }
.retention { color: var(--dim); font-size: 11px; padding: 0 12px max(8px, env(safe-area-inset-bottom)); }
.dmhead { display: flex; gap: 10px; align-items: center; position: sticky; top: -10px; background: var(--panel); padding: 4px 0; }
.people h4 { margin: 8px 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px; }
.person.away { opacity: .55; }
.person .pname { flex: 1; display: grid; min-width: 0; }
.person small { color: var(--dim); font-size: 12px; }
.person .btn { padding: 6px 8px; }

/* Panels. */
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(4,4,9,.6); backdrop-filter: blur(2px); }
.modal .panel { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); clip-path: var(--cut); box-shadow: inset 0 0 0 1px var(--line); padding: 0 18px 18px; position: relative; }
.modal .panel.wide { width: min(760px, 100%); }
.modal .panel::before { content: ""; position: sticky; display: block; top: 0; height: 2px; margin: 0 -18px; background: linear-gradient(90deg, var(--neon), var(--pink) 60%, transparent); }
.modal header { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 2px; background: var(--panel); z-index: 1; }
.modal header h3 { margin: 14px 0 10px; }
.modal section { border-top: 1px solid var(--line); padding: 4px 0 10px; }
.modal section:first-child { border-top: 0; }
.invite input { font-family: ui-monospace, monospace; font-size: 13px; }
.member, .roomrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.member img, .member .pic { width: 32px; height: 32px; border-radius: 50%; }
.member > div { flex: 1; display: grid; min-width: 140px; }
.member small, .roomrow small { color: var(--dim); }
.roomrow b { flex: 1; }
.role { font: 9px "Silkscreen", monospace; color: var(--amber); }
.lock { color: var(--amber); }

.events { display: grid; gap: 10px; max-height: 50vh; overflow: auto; }
.day h4 { margin: 4px 0; }
.event { display: grid; grid-template-columns: 80px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel2); clip-path: var(--cut-s); box-shadow: inset 3px 0 0 var(--neon); }
.event.past { opacity: .45; }
.event .time { font: 11px "Silkscreen", monospace; color: var(--neon); }
.event small { color: var(--dim); }
.addrow { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.addrow input, .addrow textarea { flex: 1 1 180px; width: auto; }
.addrow select { width: auto; }
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; max-height: 50vh; overflow: auto; padding: 8px; }
.note { position: relative; color: #1b1b24; padding: 12px 12px 8px; box-shadow: 0 6px 14px rgba(0,0,0,.35); min-height: 90px; }
.note p { margin: 0 0 8px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.note a { color: #00557a; }
.note small { font-size: 11px; opacity: .7; }
.note .x { position: absolute; top: 0; right: 0; color: #1b1b24; }
.swatches { display: flex; gap: 4px; }
.sw { width: 24px; height: 24px; border: 2px solid transparent; cursor: pointer; border-radius: 50%; padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--neon); }

.boardmodal .panel { width: min(1100px, 100%); }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-bottom: 8px; }
.tools select { width: auto; }
.tool.on { box-shadow: inset 0 0 0 1px var(--neon); }
.boardwrap { border: 1px solid var(--line); background: #000; }
canvas.board { width: 100%; display: block; aspect-ratio: 1000 / 600; touch-action: none; cursor: crosshair; }

.floors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.floor { height: 64px; border: 0; cursor: pointer; background-size: 128px; image-rendering: pixelated; display: flex; align-items: flex-end; padding: 0; clip-path: var(--cut-s); }
.floor span { width: 100%; background: rgba(7,7,13,.75); font: 600 11px "Chakra Petch"; color: var(--text); padding: 3px; text-transform: uppercase; }
.floor.on { box-shadow: inset 0 0 0 2px var(--amber); }
.resize { margin: 10px 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; align-items: center; text-align: center; }
.row.small .btn { font-size: 11px; padding: 6px 8px; }

.profile { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.profile .left { display: grid; align-content: start; }
canvas.preview { width: 192px; height: 192px; image-rendering: pixelated; background: radial-gradient(circle at 50% 60%, #1a2033, #0a0c14); clip-path: var(--cut); }
.lookrow { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.lookrow b { font-size: 12px; color: var(--dim); text-transform: uppercase; }
.opts { display: flex; gap: 4px; flex-wrap: wrap; }
.opt { min-width: 26px; height: 26px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font: 600 11px "Chakra Petch"; padding: 0 6px; }
.opt.on { box-shadow: 0 0 0 2px var(--neon); }

#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 20; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast { background: var(--panel); padding: 9px 14px; clip-path: var(--cut-s); box-shadow: inset 0 0 0 1px var(--neon); font-size: 14px; animation: rise2 .2s ease-out; max-width: 90vw; }
.toast.bad { box-shadow: inset 0 0 0 1px var(--bad); color: #ffc2cd; }
.toast.out { opacity: 0; transition: opacity .5s; }
@keyframes rise2 { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 640px) {
  .hud span { display: none; }
  #help { display: none; }
  #near { min-width: 0; width: calc(100vw - 70px); left: 10px; transform: none; animation: none; }
  #palette { width: calc(100vw - 16px); left: 8px; transform: none; }
  .profile { grid-template-columns: 1fr; justify-items: center; }
  .lookrow { grid-template-columns: 70px 1fr; }
  .event { grid-template-columns: 60px 1fr auto; }
  .event small { display: none; }
}
