@font-face {
  font-family: "Poiret One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/poiret-one-400.woff2") format("woff2");
}

@font-face {
  font-family: "Josefin Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/josefin-sans-400.woff2") format("woff2");
}

:root {
  --ink: #14110c;
  --cream: #f6edd8;
  --gold: #e4c78a;
  --gold-deep: #b8893e;
  --gold-dim: rgba(228, 199, 138, 0.55);
  --panel: rgba(12, 10, 8, 0.78);
  --line: rgba(228, 199, 138, 0.62);
  --display: "Poiret One", "Century Gothic", Futura, "Trebuchet MS", sans-serif;
  --ui: "Josefin Sans", "Century Gothic", Futura, "Avenir Next", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #07080c;
  color: var(--cream);
  font-family: var(--ui);
}

button, input { font-family: inherit; }

.topbar {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px 12px;
  background: linear-gradient(180deg, rgba(7, 8, 12, 0.82), rgba(7, 8, 12, 0.28) 70%, transparent);
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.brand-rule {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.updated {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.updated.fresh { color: #fff4d8; }

#reload {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(16, 13, 9, 0.72);
  color: var(--cream);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 7px 14px 6px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(228, 199, 138, 0.15);
}

#reload:hover { background: rgba(48, 36, 18, 0.85); color: white; }
#reload:disabled { opacity: 0.6; cursor: progress; }
#reload:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(90, 60, 24, 0.18), transparent 55%),
    #07080c;
}

#stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100vw, calc(100vh * 16 / 9));
  height: auto;
  max-height: 100vh;
  overflow: hidden;
  user-select: none;
}

#stage canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

#sky-sheen {
  position: absolute;
  z-index: 1;
  left: 16%;
  right: 4%;
  top: 5%;
  height: 18%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 206, 140, 0.22), rgba(255, 180, 90, 0.05) 55%, transparent);
  mix-blend-mode: soft-light;
  animation: sheen 9s ease-in-out infinite;
}

@keyframes sheen {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

#rooms, #names, #debug {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#sky-sheen { z-index: 2; }
#rooms { z-index: 5; }
#names { z-index: 7; }
#debug { z-index: 8; }

.pin {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pin.absent { visibility: hidden; }

.room {
  position: absolute;
  border: 1px solid rgba(228, 199, 138, 0.45);
  background: rgba(212, 164, 74, 0.13);
  box-shadow:
    inset 0 0 40px rgba(255, 196, 110, 0.22),
    0 0 24px rgba(212, 160, 70, 0.18);
  animation: roomglow 3.2s ease-in-out infinite;
}

.room.soft {
  background: rgba(212, 164, 74, 0.08);
  border-color: rgba(228, 199, 138, 0.28);
}

@keyframes roomglow {
  0%, 100% { box-shadow: inset 0 0 30px rgba(255, 196, 110, 0.16), 0 0 16px rgba(212, 160, 70, 0.12); }
  50% { box-shadow: inset 0 0 48px rgba(255, 210, 140, 0.28), 0 0 28px rgba(212, 160, 70, 0.22); }
}

.plaque {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 10px 5px;
  min-width: 38%;
  max-width: 92%;
  background: rgba(14, 11, 8, 0.78);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(228, 199, 138, 0.18);
  text-align: center;
}

.plaque-kicker {
  font-family: var(--display);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: clamp(9px, 0.9vw, 12px);
  color: var(--gold);
}

.plaque-topic {
  font-size: clamp(10px, 0.85vw, 13px);
  letter-spacing: 0.04em;
  color: var(--cream);
  line-height: 1.25;
}

.monitor {
  position: absolute;
  width: 5.2%;
  aspect-ratio: 1.15 / 1;
  transform: translate(-50%, -40%);
  border-radius: 45%;
  background: radial-gradient(ellipse at center, rgba(255, 236, 196, 0.98) 0%, rgba(255, 176, 72, 0.55) 38%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
  filter: blur(0.6px);
}

.monitor.on {
  opacity: 0.95;
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

button.actor {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}

.sprite {
  position: absolute;
  left: 0;
  bottom: 0;
  line-height: 0;
}

.sprite img {
  display: block;
  height: 80px;
  width: auto;
  filter: drop-shadow(0 10px 6px rgba(0, 0, 0, 0.45));
  -webkit-user-drag: none;
}

.facing { transform-origin: 50% 100%; }

.bob { transform-origin: 50% 100%; }

.pose { transform-origin: 50% 100%; }

.actor.sitting .pose { transform: translateY(18%); }
.actor.sitting .pose img { clip-path: inset(0 0 40% 0); }
.actor.sitting.couch .pose { transform: translateY(10%); }
.actor.sitting.couch .pose img { clip-path: inset(0 0 46% 0); }

.bob.typing { animation: typebob 1.15s ease-in-out infinite; }
.bob.walking { animation: walkbob 0.36s ease-in-out infinite; }
.bob.gesture { animation: nod 1.7s ease-in-out infinite; }

.occluder {
  position: absolute;
  background-image: url("assets/background.png");
  background-repeat: no-repeat;
  pointer-events: none;
}

.actor.absent { visibility: hidden; }

.prop {
  position: absolute;
  left: 0;
  width: 26px;
  height: 30px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}

.prop svg { width: 100%; height: 100%; display: block; overflow: visible; }
.prop-laptop { width: 36px; height: 24px; }

.steam { animation: steam 1.7s ease-in-out infinite; transform-origin: center; }

.emoji-bubble {
  position: absolute;
  left: 0;
  transform: translate(-50%, -6px);
  min-width: 28px;
  padding: 3px 7px 4px;
  border-radius: 999px;
  background: rgba(14, 11, 8, 0.88);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  z-index: 3;
}

.emoji-bubble.thought {
  border-radius: 14px;
}

.emoji-bubble.thought::after,
.emoji-bubble.speech::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 7px;
  height: 7px;
  margin-left: -4px;
  background: rgba(14, 11, 8, 0.88);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.scenery {
  position: absolute;
  width: 34px;
  height: 40px;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.scenery svg { width: 100%; height: 100%; display: block; overflow: visible; }
.scenery-books { width: 30px; height: 36px; }
.scenery-urn { width: 28px; height: 34px; }

@keyframes typebob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.4%); }
}

@keyframes walkbob {
  0%, 100% { transform: translateY(0) rotate(-1.4deg); }
  50% { transform: translateY(-5%) rotate(1.4deg); }
}

@keyframes nod {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  40% { transform: translateY(1%) rotate(-1.6deg); }
  70% { transform: translateY(0) rotate(1.2deg); }
}

@keyframes steam {
  0%, 100% { opacity: 0.15; transform: translateY(1px); }
  50% { opacity: 0.85; transform: translateY(-2px); }
}

.actor.away { opacity: 0.28; filter: grayscale(0.4); }
.actor.away .nametag { opacity: 0.7; }

.shadow {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 10px;
  transform: translate(-50%, -40%);
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5), transparent 70%);
  pointer-events: none;
}

.nametag {
  position: absolute;
  left: 0;
  top: 3px;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(8px, calc(var(--sw, 1200px) * 0.0105), 14px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f8ecc8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.7);
}

.nametag i {
  display: block;
  width: 10px;
  height: 1px;
  background: var(--gold);
  font-style: normal;
}

.actor:focus-visible .sprite img,
.actor.pinned .sprite img {
  filter: drop-shadow(0 10px 6px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px rgba(228, 199, 138, 0.85));
}

#feed {
  position: fixed;
  z-index: 40;
  top: 62px;
  right: 12px;
  width: clamp(168px, 13vw, 240px);
  max-height: min(68vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 0 0 1px rgba(228, 199, 138, 0.15),
    0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 7px;
  border-bottom: 1px solid rgba(228, 199, 138, 0.28);
}

.feed-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

#feed-toggle {
  appearance: none;
  border: 0;
  background: none;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
}

#feed-toggle:hover { color: white; }
#feed-toggle:focus-visible { outline: 1px solid var(--gold); }

#feed-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 6px;
  overflow: auto;
}

#feed.collapsed #feed-list { display: none; }
#feed.collapsed { max-height: none; }

.feed-item {
  padding: 8px 10px 9px;
  border-bottom: 1px solid rgba(228, 199, 138, 0.14);
}

.feed-item:last-child { border-bottom: 0; }

.feed-time {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 2px;
}

.feed-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--cream);
}

.feed-empty {
  margin: 0;
  padding: 14px 12px;
  font-size: 13px;
  color: var(--gold-dim);
}

#card {
  position: fixed;
  z-index: 50;
  width: min(280px, calc(100vw - 24px));
  padding: 12px 14px 13px;
  background: rgba(14, 11, 8, 0.92);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 0 0 1px rgba(228, 199, 138, 0.16),
    0 18px 40px rgba(0, 0, 0, 0.45);
  color: var(--cream);
  pointer-events: auto;
}

#card::before,
#card::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

#card::before { top: 4px; }
#card::after { bottom: 4px; }

.card-name {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1;
}

.card-role {
  margin: 4px 0 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d9c7a2;
}

.card-status {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 8px 1px;
  border: 1px solid var(--gold-dim);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.card-status.working { color: #f3ddb0; border-color: var(--gold); }
.card-status.meeting { color: #f0d7a4; }
.card-status.handoff { color: #ffe1a8; }
.card-status.away { opacity: 0.7; }

.card-task {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
}

.card-time {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

#debug .block {
  position: absolute;
  border: 1px solid rgba(255, 70, 70, 0.8);
  background: rgba(255, 40, 40, 0.15);
}

#debug .walk {
  position: absolute;
  border: 1px dashed rgba(80, 220, 120, 0.7);
  background: rgba(80, 220, 120, 0.06);
}

#debug .spot {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ffe08a;
  box-shadow: 0 0 0 1px #000;
}

#debug .spot span {
  position: absolute;
  left: 8px;
  top: -4px;
  font-size: 10px;
  color: #ffe08a;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .brand-rule { display: none; }
  .brand h1 { letter-spacing: 0.16em; font-size: 20px; }
  .updated { display: none; }
  #feed {
    top: auto;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 42vh;
  }
  #feed.collapsed { bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .bob.typing,
  .bob.walking,
  .bob.gesture,
  .steam,
  .monitor.on,
  .room,
  #sky-sheen { animation: none; }
}
