* { box-sizing: border-box; }
body {
  margin: 0;
  background: #1a130c;
  color: #e8d9b8;
  font-family: Georgia, 'Times New Roman', serif;
}

.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: #2b2116;
  border: 2px solid #6b5330;
  border-radius: 6px;
  padding: 32px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
}
.login-card h1 { margin: 0; font-size: 22px; color: #e8c877; }
.login-sub { margin: 0 0 8px; color: #a8916a; font-size: 13px; font-style: italic; }
.login-card input {
  background: #1a130c; border: 1px solid #6b5330; color: #e8d9b8;
  padding: 10px; border-radius: 4px; font-size: 14px;
}
.login-card button {
  background: #6b5330; border: none; color: #f5e9c8; padding: 10px;
  border-radius: 4px; cursor: pointer; font-weight: bold; letter-spacing: 0.5px;
}
.login-card button:hover { background: #7d6339; }
.login-error { color: #d97b6c; font-size: 12px; margin: 0; }

.hud {
  display: flex; gap: 24px; align-items: center;
  background: #120d08; border-bottom: 2px solid #6b5330;
  padding: 10px 18px; font-size: 13px;
}
.hud-title { color: #e8c877; font-weight: bold; letter-spacing: 1px; }
.hud b { color: #e8c877; }
.logout-btn {
  background: transparent; border: 1px solid #6b5330; color: #a8916a;
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
}

.town-wrap { position: relative; width: 100%; line-height: 0; }
.town-img { width: 100%; display: block; }

.tag {
  position: absolute; transform: translate(-50%, -100%);
  background: rgba(20, 14, 8, 0.85); border: 1px solid #8a6d3f;
  border-radius: 4px; padding: 6px 10px; min-width: 120px;
  font-size: 12px; text-align: center; pointer-events: none;
}
.tag-name { color: #e8c877; font-weight: bold; font-size: 13px; }
.tag-status { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 2px; color: #d8c8a0; }
.tag-sub { color: #8a916a; font-size: 10px; margin-top: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #6a6a5a; flex-shrink: 0; }
.dot.online { background: #7dcf7d; box-shadow: 0 0 5px #7dcf7d; }
.dot.offline { background: #6a5a4a; }

.missions {
  background: #120d08; border-top: 2px solid #6b5330; padding: 14px 20px;
}
.missions-title { color: #e8c877; font-weight: bold; margin-bottom: 8px; font-size: 14px; }
.missions ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.missions li { font-size: 13px; color: #d8c8a0; }
.missions li.done { color: #7dcf7d; }
.missions li .note { color: #8a916a; font-size: 11px; }

.tag.clickable { pointer-events: auto; cursor: pointer; transition: transform 0.15s; }
.tag.clickable:hover { transform: translate(-50%, -100%) scale(1.05); border-color: #e8c877; }

/* Pixel-art walk-cycle sprite: brogen_walk.png is a 4-frame horizontal strip
   (120x165 per frame, side-facing walk cycle cropped from the cleaner
   flat-background reference sheet). Frame-stepping uses exact pixel offsets
   (not percentages) so each step lands precisely on a frame boundary --
   percentage based background-position math doesn't divide evenly across
   steps() and produces torn/glitchy frames. Position/movement is handled
   separately in JS (waypoint walking along the actual path), not by this
   animation. */
.town-sprite {
  position: absolute; width: 21px; height: 29px;
  background-image: url('/static/assets/brogen_walk.png?v=4');
  background-size: 84px 29px;
  image-rendering: pixelated;
  cursor: pointer;
  animation: spriteStepTown 1.4s steps(4) infinite;
  transition-property: left, top;
  transition-timing-function: linear;
}
@keyframes spriteStepTown { from { background-position-x: 0; } to { background-position-x: -84px; } }

.house-sprite {
  width: 68px; height: 94px;
  background-image: url('/static/assets/brogen_walk.png?v=4');
  background-size: 272px 94px;
  image-rendering: pixelated;
  position: absolute;
  animation: spriteStepHouse 1.1s steps(4) infinite;
  transition-property: left, top;
  transition-timing-function: linear;
}
@keyframes spriteStepHouse { from { background-position-x: 0; } to { background-position-x: -272px; } }

.house-view {
  position: fixed; inset: 0; z-index: 60; display: flex;
  background: #0a0705;
  animation: houseZoomIn 0.35s ease-out;
}
@keyframes houseZoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.house-panel {
  width: 460px; flex-shrink: 0; background: rgba(15, 11, 6, 0.95);
  border-right: 2px solid #6b5330; padding: 20px; overflow-y: auto;
  font-size: 14px;
}
.house-back {
  background: none; border: 1px solid #6b5330; color: #d8c8a0;
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-bottom: 14px;
}
.house-panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.house-portrait { width: 64px; height: auto; image-rendering: pixelated; border: 1px solid #6b5330; border-radius: 4px; }
.house-name { color: #e8c877; font-weight: bold; font-size: 20px; }
.house-role { color: #a8916a; font-size: 13px; }
.house-stats { font-size: 13px; color: #d8c8a0; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #3a2e1c; }
.house-stats b { color: #e8c877; }
.house-section-title { color: #e8c877; font-size: 13px; font-weight: bold; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.modal-row.clickable { cursor: pointer; padding: 4px; margin: -4px; border-radius: 4px; transition: background 0.1s; }
.modal-row.clickable:hover { background: rgba(232,200,119,0.1); }
.house-scene { flex: 1; position: relative; overflow: hidden; }
.house-bg { width: 100%; height: 100%; object-fit: cover; display: block; }

.modal-list { font-size: 12px; color: #d8c8a0; display: flex; flex-direction: column; gap: 6px; }
.modal-row { display: flex; justify-content: space-between; gap: 10px; }
.modal-row .rationale { color: #8a916a; font-size: 11px; flex-basis: 100%; }
.modal-totals { margin-top: 8px; font-size: 12px; color: #d8c8a0; display: flex; gap: 16px; }
.modal-totals b { color: #e8c877; }

.stock-search { display: flex; gap: 8px; margin-bottom: 8px; }
.stock-search input {
  flex: 1; background: #120d08; border: 1px solid #6b5330; color: #e8d9b8;
  padding: 8px; border-radius: 4px; font-size: 13px;
}
.stock-search button {
  background: #6b5330; border: none; color: #f5e9c8; padding: 8px 14px;
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
.stock-quote { font-size: 13px; color: #d8c8a0; margin-bottom: 8px; }
.stock-quote b { color: #e8c877; }
.chart-wrap { position: relative; height: 240px; }
.stock-error { color: #d97b6c; font-size: 12px; margin-top: 6px; }
