/* Factory floor: pixel-art RPG overview. */
.floor-page { height: auto; min-height: 100vh; background: var(--brand-black); color: var(--brand-white); }
.floor-page .topbar { gap: 16px; flex-wrap: wrap; }
.floor-page .brand-page { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; }
.floor-page .btn { font-family: inherit; }
.floor-page .muted { color: var(--brand-silver); }
.floor-page .small { font-size: 12px; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 420px; }
.floor-page .topbar-actions { flex: none; flex-wrap: wrap; margin-left: auto; }
.chip { font: 12px ui-monospace, Menlo, Consolas, monospace; background: var(--brand-graphite); border: 2px solid #334155; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.chip b { color: var(--brand-teal); }

.floor-main { display: flex; gap: 16px; padding: 16px 20px 0; align-items: flex-start; }
.stage-wrap { flex: 1; min-width: 0; position: relative; }
.stage { position: relative; height: clamp(780px, 92vh, 1080px); image-rendering: pixelated; }
.stations { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-hall, .st-service { grid-column: span 2; }
/* Fewer tiles (#25): customers before a POC is accepted, and everyone but managers (no Intake). */
.stations.poc-only { grid-template-rows: repeat(2, minmax(0, 1fr)); }
.stations.poc-only .st-showroom { grid-column: span 3; }
.stations.no-intake .st-dock { grid-column: span 2; }

.station {
  position: relative; overflow: hidden; border-radius: 2px;
  border: 4px solid #0b0914;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.08), 0 4px 0 #0b0914;
  --tile: #3a3450; --tile2: #332e48;
  background:
    repeating-conic-gradient(var(--tile) 0 25%, var(--tile2) 0 50%) 0 0 / 32px 32px;
}
.station .sign {
  display: flex; justify-content: space-between; align-items: center;
  font: 700 12px ui-monospace, Menlo, Consolas, monospace; text-transform: uppercase; letter-spacing: 1px;
  background: #5e3b1a; color: #ffe8b0; padding: 6px 10px;
  border-bottom: 3px solid #2b1a0b; box-shadow: inset 0 -3px 0 #7a5230;
}
.station .count { background: #2b1a0b; color: #ffd43b; padding: 0 7px; border-radius: 3px; }
.station .blurb { position: absolute; left: 10px; bottom: 6px; max-width: calc(100% - 92px); line-height: 1.3; font: 11px ui-monospace, Menlo, Consolas, monospace; color: rgba(255,255,255,.55); }
.station .prop { position: absolute; right: 8px; bottom: 6px; opacity: .9; pointer-events: none; }

.st-hall      { --tile: #4a3b2a; --tile2: #433526; }
.st-discovery { --tile: #34406a; --tile2: #2f3a60; }
.st-council   { --tile: #4b3566; --tile2: #44305d; }
.st-forge     { --tile: #4a2f2a; --tile2: #422925; }
.st-storage   { --tile: #3b3b44; --tile2: #35353d; }
.st-dock      { --tile: #2c4a44; --tile2: #27423d; }
.st-showroom  { --tile: #2e4a2c; --tile2: #294227; }
.st-repair    { --tile: #503038; --tile2: #482b32; }
.st-intake    { --tile: #3d4a5c; --tile2: #374354; }
.st-issues    { --tile: #5a4a2a; --tile2: #524326; }
.st-review    { --tile: #2a4a5a; --tile2: #264352; }
.st-pipeline  { --tile: #45454f; --tile2: #3e3e47; }
.st-service   { --tile: #2a5a3a; --tile2: #265234; }

.station.active { box-shadow: inset 0 0 0 3px rgba(255,212,59,.5), 0 4px 0 #0b0914, 0 0 24px rgba(255,170,60,.35); }
.st-forge.active { animation: forge-glow 1.2s ease-in-out infinite alternate; }
@keyframes forge-glow {
  from { box-shadow: inset 0 0 0 3px rgba(255,120,40,.5), 0 4px 0 #0b0914, 0 0 10px rgba(255,100,30,.3); }
  to   { box-shadow: inset 0 0 0 3px rgba(255,190,60,.8), 0 4px 0 #0b0914, 0 0 34px rgba(255,140,40,.6); }
}

/* characters */
.sprites { position: absolute; inset: 0; pointer-events: none; }
.sprite {
  position: absolute; left: 0; top: 0; width: 36px; pointer-events: auto;
  transition: transform 1.5s linear, opacity .4s;
  display: flex; flex-direction: column; align-items: center;
}
.sprite.entering, .sprite.leaving { opacity: 0; }
.sprite .body { position: relative; height: 48px; animation: idle 1.6s ease-in-out infinite; animation-delay: inherit; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.sprite .body svg { display: block; }
.sprite.facing-left .body svg { transform: scaleX(-1); }
.sprite.walking .body { animation: walk .3s steps(2) infinite; }
.sprite.working .body { animation: work .45s steps(2) infinite; }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes walk { 0% { transform: translateY(0) rotate(-3deg); } 100% { transform: translateY(-3px) rotate(3deg); } }
@keyframes work { 0% { transform: translateY(0); } 100% { transform: translateY(-4px); } }

.sprite .tag {
  margin-top: 3px; max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 700 10px ui-monospace, Menlo, Consolas, monospace; line-height: 14px;
  background: rgba(11,9,20,.82); color: #f5f0ff; padding: 0 5px; border-radius: 3px;
}
.sprite.project .tag { background: #f5f0ff; color: #1b1b2a; border: 2px solid #0b0914; }
.sprite.project.selected .tag { background: #ffd43b; }
.sprite.project.selected .body { filter: drop-shadow(0 0 0 #ffd43b) drop-shadow(0 0 6px #ffd43b); }
.sprite.project:hover .tag { background: #ffe8a3; }
/* Projects assigned to the signed-in developer. */
.sprite.project.mine .tag { background: var(--brand-teal); border-color: #0b0914; }
.drawer .devs { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.drawer .devs legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.drawer form.edit label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.sprite.npc .tag { background: #5e3b1a; color: #ffe8b0; }
.sprite.person .tag { background: #2b1a0b; color: #ffd43b; font-weight: 400; }
.sprite.person.manager .tag { color: #ffd43b; font-weight: 700; }
.sprite.person.me .tag { outline: 2px solid #ffd43b; }
.sprite.person { z-index: 2; }
/* Visitors standing beside a project show their name above their head so it doesn't cover the project's tag. */
.sprite.person.visiting .tag { position: absolute; top: -16px; margin: 0; }
.sprite.more .tag { background: #0b0914; color: #ffd43b; margin-top: 18px; }

.bubble {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #1b1b2a; border: 2px solid #0b0914; border-radius: 6px;
  font-size: 13px; line-height: 18px; min-width: 22px; text-align: center; padding: 0 3px;
  box-shadow: 0 2px 0 #0b0914;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -3px; border: 3px solid transparent; border-top-color: #0b0914; }
.bubble.pulse { animation: pulse 1s ease-in-out infinite; }
.bubble.hammer { animation: hammer .5s steps(2) infinite; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.15); } }
@keyframes hammer { 0% { transform: translateX(-50%) rotate(-15deg); } 100% { transform: translateX(-50%) rotate(15deg); } }

/* chronicle (event feed) */
.chronicle { margin-top: 10px; min-height: 22px; font: 12px ui-monospace, Menlo, Consolas, monospace; color: #d9d3f0; display: flex; flex-direction: column; gap: 2px; }
.chronicle div:first-child { color: #ffd43b; }

/* drawer */
.drawer {
  width: 360px; flex-shrink: 0; background: var(--brand-white); color: var(--brand-graphite);
  border: 4px solid #0b0914; box-shadow: 0 4px 0 #0b0914; border-radius: 2px;
  padding: 14px 16px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
}
.drawer .muted { color: var(--muted); }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0 0 2px; font-size: 18px; }
.drawer-head > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.portrait { background: #2e4a2c; border: 3px solid #0b0914; padding: 4px; line-height: 0; }
.drawer .close { padding: 2px 8px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; margin: 14px 0; }
.facts dt { color: #6b7385; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.drawer .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.drawer .error { margin: 8px 0; }
.drawer form.edit { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 10px; background: #fff; border: 2px solid #e2e5eb; border-radius: 6px; }
.drawer form.edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.drawer form.edit select { padding: 6px 8px; border: 1px solid #e2e5eb; border-radius: 6px; font: inherit; font-weight: 400; }
.drawer form.edit input[type=checkbox] { padding: 0; }
.drawer form.edit input { padding: 6px 8px; border: 1px solid #e2e5eb; border-radius: 6px; font: inherit; font-weight: 400; }
.drawer form.edit .row { display: flex; justify-content: flex-end; gap: 6px; }

/* ledger */
.ledger { margin: 18px 20px 24px; background: var(--brand-white); color: var(--brand-graphite); border: 4px solid #0b0914; box-shadow: 0 4px 0 #0b0914; padding: 12px 16px; overflow-x: auto; }
.ledger .muted { color: var(--muted); }
.ledger-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ledger h2 { margin: 0 0 8px; font: 700 15px ui-monospace, Menlo, Consolas, monospace; }
.online { font-size: 12px; color: #6b7385; }
.ledger table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger th { text-align: left; font-weight: 600; color: #6b7385; border-bottom: 2px solid #d8d2ea; padding: 6px 8px; white-space: nowrap; }
.ledger td { border-bottom: 1px solid #e6e1f2; padding: 7px 8px; vertical-align: middle; }
.ledger tr[data-id] { cursor: pointer; }
.ledger tr[data-id]:hover, .ledger tr.selected { background: #fff7d6; }
.ledger .err { color: var(--err); }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.badge.starting { background: var(--accent-soft); color: var(--accent-text); }

.modal.welcome p { margin: 0; font-size: 14px; line-height: 1.5; color: #3d4455; }
.modal.wide { width: min(760px, 94vw); }
.modal textarea { font: 12px ui-monospace, Menlo, Consolas, monospace; width: 100%; resize: vertical; }
.modal .muted { color: var(--muted); margin: 0; }

@media (max-width: 1100px) {
  .floor-main { flex-direction: column; align-items: stretch; }
  .drawer { width: 100%; position: static; max-height: none; }
  .stations { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(7, minmax(0, 1fr)); }
  .st-service { grid-column: span 1; }
  .stage { height: 1900px; }
  .stations.poc-only { grid-template-rows: repeat(4, minmax(0, 1fr)); }
  .stations.poc-only .st-showroom { grid-column: span 1; }
  .stage:has(.stations.poc-only) { height: 1100px; }
}
