@font-face { font-family: 'Pull Pixel'; src: url(/fonts/pull-pixel.woff) format('woff'); font-display: block; }
@font-face { font-family: 'Adv Display'; src: url(/fonts/adv-display.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'Adv UI'; src: url(/fonts/adv-ui.woff) format('woff'); font-display: swap; }

:root {
  --ink: #2a2238; --navy: #26244a; --navy2: #1b1830; --cream: #fff8ee; --orange: #ff5c1b; --orange2: #e04812;
  --yellow: #ffd84a; --red: #e8434f; --line: #3a3560;
  --fd: 'Adv Display', system-ui, sans-serif; --fu: 'Adv UI', system-ui, sans-serif; --px: 'Pull Pixel', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--navy2); color: var(--ink); font-family: var(--fu); overflow: hidden; }
button { font: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.nav { position: fixed; inset: 0 0 auto 0; height: 64px; z-index: 10; display: flex; align-items: center; gap: 22px; padding: 0 22px;
  background: var(--navy); border-bottom: 3px solid var(--orange); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--fd); font-size: 22px; letter-spacing: .5px;
  text-shadow: 0 2px 0 var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--orange); border: 2px solid var(--ink); box-shadow: inset 0 -4px 0 var(--orange2), 0 2px 0 var(--ink); position: relative; }
.brand-mark::after { content: ''; position: absolute; left: 7px; top: 7px; width: 12px; height: 9px; background: var(--cream); border: 2px solid var(--ink); border-radius: 2px; }
.links { display: flex; gap: 6px; }
.links a { color: #e9e6ff; text-decoration: none; font-family: var(--fd); font-size: 16px; padding: 8px 14px; border-radius: 10px; }
.links a:hover { background: rgba(255,255,255,.08); }
.links a.on { background: var(--orange); color: #fff; border: 2px solid var(--cream); box-shadow: 0 2px 0 var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.count { font-family: var(--px); font-size: 14px; color: #cfcaf2; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--navy2); }
.btn { border: 2px solid var(--ink); border-radius: 10px; padding: 9px 16px; font-family: var(--fd); font-size: 15px; box-shadow: 0 3px 0 var(--ink); transition: transform .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:disabled { background: #7a3a44; color: #f2c9cd; cursor: default; animation: blink 0.7s steps(2) infinite; }
@keyframes blink { 50% { background: var(--red); } }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 67px 0 0 0; }
#office { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.hud-tl { position: absolute; left: 16px; top: 16px; display: flex; gap: 8px; align-items: center; }
.room-pill { display: flex; align-items: center; gap: 8px; background: var(--cream); border: 2px solid var(--ink); border-radius: 10px; padding: 7px 12px;
  font-family: var(--fd); font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.room-pill i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.preview-pill { font-family: var(--px); font-size: 13px; color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; box-shadow: 0 3px 0 var(--ink); }
body.alarm .stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px rgba(232,67,79,.55); animation: pulse .7s steps(2) infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 40px rgba(232,67,79,.2); } }

/* ---------- agent card ---------- */
.card { position: absolute; right: 16px; top: 16px; width: 270px; background: var(--cream); border: 2px solid var(--ink); border-radius: 14px; padding: 14px; box-shadow: 0 4px 0 var(--ink); }
.card .x, .modal .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 22px; color: var(--ink); }
.card-top { display: flex; gap: 12px; align-items: center; }
#card-face { width: 64px; height: 96px; image-rendering: pixelated; background: #a6e070; border: 2px solid var(--ink); border-radius: 10px; padding: 0 8px; box-sizing: content-box; }
.card-name { font-family: var(--fd); font-size: 20px; }
.card-role { font-family: var(--px); font-size: 13px; color: #6a6185; margin-top: 4px; }
.card-rows { margin: 12px 0 0; display: grid; gap: 6px; }
.card-rows div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px dashed #d8cdb8; padding-top: 6px; }
.card-rows dt { font-family: var(--px); font-size: 13px; color: #6a6185; }
.card-rows dd { margin: 0; font-family: var(--fu); font-size: 14px; font-weight: 600; text-align: right; }

/* ---------- minimap ---------- */
.minimap { position: absolute; right: 16px; bottom: 16px; background: var(--navy); border: 2px solid var(--ink); border-radius: 12px; padding: 8px; box-shadow: 0 4px 0 var(--ink); }
#mini { display: block; width: 224px; image-rendering: pixelated; border-radius: 6px; }
.mini-label { font-family: var(--px); font-size: 11px; color: #a9a3d0; margin-top: 6px; text-align: center; }

/* ---------- dialog ---------- */
.dialog { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(780px, calc(100% - 32px)); background: var(--cream); border: 3px solid var(--ink); border-radius: 16px;
  padding: 18px 26px 22px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
.dlg-name { position: absolute; top: -16px; left: 22px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 3px 10px; font-family: var(--px); font-size: 14px; }
.dialog p { margin: 4px 0 0; font-family: var(--px); font-size: 19px; line-height: 1.6; min-height: 2.2em; }
.dlg-next { position: absolute; right: 18px; bottom: 10px; color: var(--orange); animation: bob .8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* ---------- modal ---------- */
.modal { position: absolute; inset: 0; background: rgba(15,12,30,.6); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal[hidden], .card[hidden], .dialog[hidden], .minimap[hidden] { display: none; }
.modal-box { position: relative; width: min(560px, 100%); background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; padding: 24px 26px; box-shadow: 0 6px 0 var(--ink); }
.modal-box h2 { margin: 0 0 14px; font-family: var(--fd); font-size: 26px; }
.rooms-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rooms-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; }
.rooms-list strong { font-family: var(--fd); font-weight: normal; margin-right: 6px; }
.sw { flex: 0 0 18px; height: 18px; border: 2px solid var(--ink); border-radius: 5px; margin-top: 1px; }
.keys { margin: 16px 0 0; font-size: 14px; line-height: 1.8; color: #4a4262; }
kbd { font-family: var(--px); background: #fff; border: 2px solid var(--ink); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font-size: 13px; }

@media (max-width: 760px) {
  .links, .count { display: none; }
  .nav { gap: 10px; padding: 0 12px; }
  .brand { font-size: 17px; }
  .minimap { display: none; }
  .card { left: 16px; right: 16px; width: auto; top: auto; bottom: 16px; }
}

/* ---------- v2: visitors, hiring, chat ---------- */
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-orange { background: var(--orange); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
#me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; }
#me-face { width: 22px; height: 33px; image-rendering: pixelated; }
.faint { color: #8a82a6; }
.legend { display: flex; gap: 10px; background: var(--cream); border: 2px solid var(--ink); border-radius: 10px; padding: 7px 12px; box-shadow: 0 3px 0 var(--ink); font-family: var(--px); font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 9px; border-radius: 3px; border: 2px solid var(--ink); }
.lg-agent { background: #2F3D66; } .lg-visitor { background: #FFF8EE; } .lg-me { background: #FFD84A; }
.hint-hire { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 14px; font-family: var(--px); font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.hint-hire[hidden], .preview-pill[hidden] { display: none; }
.card-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-links a { text-decoration: none; }

.chat { position: absolute; left: 16px; bottom: 16px; width: 330px; margin: 0; }
.chat ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chat li { background: rgba(27,24,48,.82); color: #fff; border-radius: 8px; padding: 5px 9px; font-family: var(--px); font-size: 14px; line-height: 1.35; transition: opacity 1s; width: fit-content; max-width: 100%; }
.chat li b { color: var(--yellow); font-weight: normal; }
.chat li.sys { color: #b9b3dc; } .chat li.old { opacity: .45; }
.chat input { width: 100%; background: var(--cream); border: 2px solid var(--ink); border-radius: 10px; padding: 9px 12px; font-family: var(--px); font-size: 15px; box-shadow: 0 3px 0 var(--ink); outline: none; }

.modal-box.wide { width: min(900px, 100%); max-height: calc(100vh - 110px); overflow: auto; }
.modal-box .sub { margin: -6px 0 16px; color: #5c5478; font-size: 15px; line-height: 1.45; }
.maker { display: grid; grid-template-columns: 230px 1fr; gap: 22px; }
.maker-left { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stagebox { width: 210px; height: 230px; border: 2px solid var(--ink); border-radius: 14px; background: #a6e070 radial-gradient(#8fcf5f 1px, transparent 1.5px) 0 0 / 12px 12px; display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); }
.stagebox canvas { width: 128px; height: 192px; image-rendering: pixelated; }
.turn { display: flex; align-items: center; gap: 12px; font-family: var(--px); }
.round { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; font-size: 20px; line-height: 1; box-shadow: 0 2px 0 var(--ink); }
.lbl { display: block; font-family: var(--fd); font-size: 14px; margin: 12px 0 6px; }
.input { width: 100%; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 9px 12px; font-family: var(--fu); font-size: 15px; outline: none; resize: vertical; }
.input:focus { border-color: var(--orange); }
.look-ed { margin-top: 6px; display: grid; gap: 8px; }
.look-ed.compact { width: 100%; gap: 6px; }
.lk { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; }
.look-ed.compact .lk { grid-template-columns: 1fr; gap: 3px; }
.lk-l { font-family: var(--px); font-size: 13px; color: #6a6185; }
.lk-o { display: flex; flex-wrap: wrap; gap: 5px; }
.swc { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--ink); padding: 0; }
.look-ed.compact .swc { width: 18px; height: 18px; border-radius: 5px; }
.swt { border: 2px solid var(--ink); border-radius: 8px; background: #fff; padding: 2px 8px; font-family: var(--px); font-size: 13px; }
.swc.on, .swt.on { outline: 3px solid var(--orange); outline-offset: 1px; }
.swt.on { background: var(--yellow); }
.modal-foot { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.modal-foot .btn-orange { margin-left: auto; font-size: 17px; padding: 11px 22px; }
.err { font-family: var(--px); font-size: 14px; color: #6a6185; }
.err.bad, #who-err { color: #c22f3a; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.row4 .lbl { font-size: 12px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick button { border: 2px solid var(--ink); border-radius: 9px; background: #fff; padding: 6px 12px; font-family: var(--fd); font-size: 14px; box-shadow: 0 2px 0 var(--ink); }
.pick button.on { background: var(--orange); color: #fff; }
#f-agentpct { margin-top: 8px; }
.hint { font-size: 13px; color: #6a6185; margin-top: 6px; line-height: 1.45; }
.notice { margin-top: 14px; background: #fff3cf; border: 2px dashed #d99a12; border-radius: 10px; padding: 9px 12px; font-size: 13px; }
.f-imgrow { display: flex; gap: 12px; align-items: center; }
.f-imgbtn { flex: 0 0 64px; height: 64px; border: 2px dashed var(--ink); border-radius: 12px; background: #fff; font-size: 26px; overflow: hidden; padding: 0; }
.f-imgbtn img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  .maker { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; }
  .legend, #me-btn span, .chat { display: none; }
  #hire-btn, #meeting-btn { padding: 7px 10px; font-size: 13px; }
}

/* ---------- guided tour ---------- */
.tour { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 16px 22px 18px; box-shadow: 0 5px 0 var(--ink); z-index: 15; }
.tour[hidden] { display: none; }
.tour-top { display: flex; justify-content: space-between; align-items: center; }
.tour-step { font-family: var(--px); font-size: 13px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 8px; }
.tour-skip { border: 0; background: none; font-family: var(--px); font-size: 13px; color: #6a6185; text-decoration: underline; }
.tour h3 { margin: 10px 0 4px; font-family: var(--fd); font-size: 24px; font-weight: normal; }
.tour p { margin: 0; font-size: 16px; line-height: 1.5; color: #3a3352; }
.tour p b { color: var(--ink); }
.tour-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.tour-dots { display: flex; gap: 5px; margin-right: auto; margin-left: 6px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.tour-dots i.on { background: var(--orange); }
#tour-back[disabled] { opacity: .4; cursor: default; }
body.touring .hud-tl, body.touring .chat, body.touring .minimap, body.touring .card, body.touring .hint-hire { display: none; }

/* ---------- links ---------- */
.x-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--navy2); border: 2px solid var(--line); color: #fff; }
.x-link:hover { border-color: var(--orange); }
.ca-pill { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 10px; font-family: var(--px); font-size: 15px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 14px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.ca-pill b { font-family: var(--fd); font-weight: normal; font-size: 15px; }
.ca-pill i { font-style: normal; font-size: 12px; background: var(--ink); color: var(--yellow); border-radius: 6px; padding: 2px 6px; }
.burn-toast { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: #fff; border: 2px solid var(--orange); border-radius: 12px; padding: 10px 16px; font-family: var(--px); font-size: 15px; box-shadow: 0 3px 0 #000; z-index: 6; }
.burn-toast[hidden] { display: none; }
.burn-toast b { color: var(--orange); font-weight: normal; }
.burn-toast a { color: var(--yellow); margin-left: 8px; }
.card-log { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; max-height: 150px; overflow: auto; }
.card-log li { font-size: 12.5px; line-height: 1.35; border-top: 1px dashed #d8cdb8; padding-top: 5px; }
.card-log a { color: var(--orange2); }
@media (max-width: 1100px) { .ca-pill { position: static; transform: none; } }
.ca-pill[hidden] { display: none; }

.hud-tl .count { background: var(--cream); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); padding: 7px 12px; }
@media (max-width: 760px) { .hud-tl .count { display: none; } }
